aboutsummaryrefslogtreecommitdiff
path: root/src/nix-env/main.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-03-08 16:03:58 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-03-08 16:03:58 +0000
commit6dca5c9099b92b6a93071197aa606a31ccd83a37 (patch)
tree3db3e546862c232c79dd4b8fb4a7cd5bc9036c43 /src/nix-env/main.cc
parent9088dee9e265db8176b61e53ac43a916fdd34a3d (diff)
* 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!
Diffstat (limited to 'src/nix-env/main.cc')
-rw-r--r--src/nix-env/main.cc76
1 files changed, 41 insertions, 35 deletions
diff --git a/src/nix-env/main.cc b/src/nix-env/main.cc
index 8648e4f0f..1266c5011 100644
--- a/src/nix-env/main.cc
+++ b/src/nix-env/main.cc
@@ -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 (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 (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();
+ }
+ string column = (string) "" + ch + " " + version;
+ if (diff == cvGreater) column = colorString(column);
+ columns.push_back(column);
}
- string column = (string) "" + ch + " " + version;
- if (diff == cvGreater) column = colorString(column);
- columns.push_back(column);
- }
- if (printSystem) columns.push_back(i->system);
+ if (printSystem) columns.push_back(i->system);
- if (printDrvPath) columns.push_back(
- i->queryDrvPath(globals.state) == ""
- ? "-" : i->queryDrvPath(globals.state));
+ 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);