mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
* When obtaining derivations from Nix expressions, ignore all
expressions that cause an assertion failure (like `assert system == "i686-linux"'). This allows all-packages.nix in Nixpkgs to be used on all platforms, even if some Nix expressions don't work on all platforms. Not sure if this is a good idea; it's a bit hacky. In particular, due to laziness some derivations might appear in `nix-env -qa' but disappear in `nix-env -qas' or `nix-env -i'. Commit 5000!
This commit is contained in:
parent
9088dee9e2
commit
6dca5c9099
3 changed files with 98 additions and 70 deletions
|
@ -762,47 +762,53 @@ static void opQuery(Globals & globals,
|
|||
for (vector<DrvInfo>::iterator i = elems2.begin();
|
||||
i != elems2.end(); ++i)
|
||||
{
|
||||
Strings columns;
|
||||
try {
|
||||
|
||||
Strings columns;
|
||||
|
||||
if (printStatus) {
|
||||
Substitutes subs = querySubstitutes(noTxn, i->queryOutPath(globals.state));
|
||||
columns.push_back(
|
||||
(string) (installed.find(i->queryOutPath(globals.state))
|
||||
!= installed.end() ? "I" : "-")
|
||||
+ (isValidPath(i->queryOutPath(globals.state)) ? "P" : "-")
|
||||
+ (subs.size() > 0 ? "S" : "-"));
|
||||
}
|
||||
|
||||
if (printName) columns.push_back(i->name);
|
||||
|
||||
if (compareVersions) {
|
||||
/* Compare this element against the versions of the same
|
||||
named packages in either the set of available elements,
|
||||
or the set of installed elements. !!! This is O(N *
|
||||
M), should be O(N * lg M). */
|
||||
string version;
|
||||
VersionDiff diff = compareVersionAgainstSet(*i, otherElems, version);
|
||||
char ch;
|
||||
switch (diff) {
|
||||
case cvLess: ch = '>'; break;
|
||||
case cvEqual: ch = '='; break;
|
||||
case cvGreater: ch = '<'; break;
|
||||
case cvUnavail: ch = '-'; break;
|
||||
default: abort();
|
||||
if (printStatus) {
|
||||
Substitutes subs = querySubstitutes(noTxn, i->queryOutPath(globals.state));
|
||||
columns.push_back(
|
||||
(string) (installed.find(i->queryOutPath(globals.state))
|
||||
!= installed.end() ? "I" : "-")
|
||||
+ (isValidPath(i->queryOutPath(globals.state)) ? "P" : "-")
|
||||
+ (subs.size() > 0 ? "S" : "-"));
|
||||
}
|
||||
string column = (string) "" + ch + " " + version;
|
||||
if (diff == cvGreater) column = colorString(column);
|
||||
columns.push_back(column);
|
||||
}
|
||||
|
||||
if (printSystem) columns.push_back(i->system);
|
||||
if (printName) columns.push_back(i->name);
|
||||
|
||||
if (printDrvPath) columns.push_back(
|
||||
i->queryDrvPath(globals.state) == ""
|
||||
? "-" : i->queryDrvPath(globals.state));
|
||||
if (compareVersions) {
|
||||
/* Compare this element against the versions of the
|
||||
same named packages in either the set of available
|
||||
elements, or the set of installed elements. !!!
|
||||
This is O(N * M), should be O(N * lg M). */
|
||||
string version;
|
||||
VersionDiff diff = compareVersionAgainstSet(*i, otherElems, version);
|
||||
char ch;
|
||||
switch (diff) {
|
||||
case cvLess: ch = '>'; break;
|
||||
case cvEqual: ch = '='; break;
|
||||
case cvGreater: ch = '<'; break;
|
||||
case cvUnavail: ch = '-'; break;
|
||||
default: abort();
|
||||
}
|
||||
string column = (string) "" + ch + " " + version;
|
||||
if (diff == cvGreater) column = colorString(column);
|
||||
columns.push_back(column);
|
||||
}
|
||||
|
||||
if (printSystem) columns.push_back(i->system);
|
||||
|
||||
if (printDrvPath) columns.push_back(
|
||||
i->queryDrvPath(globals.state) == ""
|
||||
? "-" : i->queryDrvPath(globals.state));
|
||||
|
||||
if (printOutPath) columns.push_back(i->queryOutPath(globals.state));
|
||||
table.push_back(columns);
|
||||
if (printOutPath) columns.push_back(i->queryOutPath(globals.state));
|
||||
|
||||
table.push_back(columns);
|
||||
}
|
||||
catch (AssertionError & e) {
|
||||
}
|
||||
}
|
||||
|
||||
printTable(table);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue