about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-03-21T15·58+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-03-21T15·58+0000
commit800d8e950f13b9cb9099c5d1270a4385d5ae55da (patch)
treee611495f25371ee809168736e335e821dcc29414
parent2e59698b78d3fcba6908d8478c15943834d9635f (diff)
* Added a command to list installed packages.
-rw-r--r--src/nix.cc24
-rwxr-xr-xtest/build/pan-build.sh2
2 files changed, 23 insertions, 3 deletions
diff --git a/src/nix.cc b/src/nix.cc
index 9f4733f5e202..cc81260e32b7 100644
--- a/src/nix.cc
+++ b/src/nix.cc
@@ -237,7 +237,7 @@ void installPkg(string pkgref)
     string cmd;
     string builder;
 
-    if (!queryDB("refs", pkgref, pkgfile))
+    if (!queryDB(dbRefs, pkgref, pkgfile))
         throw Error("unknown package " + pkgref);
 
     cerr << "installing package " + pkgref + " from " + pkgfile + "\n";
@@ -272,7 +272,7 @@ void installPkg(string pkgref)
 
         string file;
 
-        if (!queryDB("refs", it->ref, file))
+        if (!queryDB(dbRefs, it->ref, file))
             throw Error("unknown file " + it->ref);
 
         if (makeRef(file) != it->ref)
@@ -437,6 +437,23 @@ void verifyDB()
 }
 
 
+void listInstalledPkgs()
+{
+    DBPairs instPkgs;
+
+    enumDB(dbInstPkgs, instPkgs);
+
+    for (DBPairs::iterator it = instPkgs.begin();
+         it != instPkgs.end(); it++)
+    {
+        string descr;
+        if (!queryDB(dbRefs, it->first, descr))
+            descr = "descriptor missing";
+        cout << it->first << " " << descr << endl;
+    }
+}
+
+
 void run(int argc, char * * argv)
 {
     UsageError argcError("wrong number of arguments");
@@ -464,6 +481,9 @@ void run(int argc, char * * argv)
     } else if (cmd == "reginst") {
         if (argc != 2) throw argcError;
         registerInstalledPkg(argv[0], argv[1]);
+    } else if (cmd == "listinst") {
+        if (argc != 0) throw argcError;
+        listInstalledPkgs();
     } else
         throw UsageError("unknown command: " + string(cmd));
 }
diff --git a/test/build/pan-build.sh b/test/build/pan-build.sh
index a29255881cdc..907215f37fa0 100755
--- a/test/build/pan-build.sh
+++ b/test/build/pan-build.sh
@@ -2,7 +2,7 @@
 
 export PATH=$pkgconfig/bin:$gnet/bin:/bin:/usr/bin
 export PKG_CONFIG_PATH=$glib/lib/pkgconfig:$atk/lib/pkgconfig:$pango/lib/pkgconfig:$gtk/lib/pkgconfig
-export LD_LIBRARY_PATH=$gnet/lib:$atk/lib:$pango/lib:$gtk/lib:$gnet/lib
+export LD_LIBRARY_PATH=$glib/lib:$atk/lib:$pango/lib:$gtk/lib:$gnet/lib
 
 top=`pwd`
 tar xvfj $src