* Added a command to list installed packages.

This commit is contained in:
Eelco Dolstra 2003-03-21 15:58:40 +00:00
parent 2e59698b78
commit 800d8e950f
2 changed files with 23 additions and 3 deletions

View File

@ -237,7 +237,7 @@ void installPkg(string pkgref)
string cmd; string cmd;
string builder; string builder;
if (!queryDB("refs", pkgref, pkgfile)) if (!queryDB(dbRefs, pkgref, pkgfile))
throw Error("unknown package " + pkgref); throw Error("unknown package " + pkgref);
cerr << "installing package " + pkgref + " from " + pkgfile + "\n"; cerr << "installing package " + pkgref + " from " + pkgfile + "\n";
@ -272,7 +272,7 @@ void installPkg(string pkgref)
string file; string file;
if (!queryDB("refs", it->ref, file)) if (!queryDB(dbRefs, it->ref, file))
throw Error("unknown file " + it->ref); throw Error("unknown file " + it->ref);
if (makeRef(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) void run(int argc, char * * argv)
{ {
UsageError argcError("wrong number of arguments"); UsageError argcError("wrong number of arguments");
@ -464,6 +481,9 @@ void run(int argc, char * * argv)
} else if (cmd == "reginst") { } else if (cmd == "reginst") {
if (argc != 2) throw argcError; if (argc != 2) throw argcError;
registerInstalledPkg(argv[0], argv[1]); registerInstalledPkg(argv[0], argv[1]);
} else if (cmd == "listinst") {
if (argc != 0) throw argcError;
listInstalledPkgs();
} else } else
throw UsageError("unknown command: " + string(cmd)); throw UsageError("unknown command: " + string(cmd));
} }

View File

@ -2,7 +2,7 @@
export PATH=$pkgconfig/bin:$gnet/bin:/bin:/usr/bin 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 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` top=`pwd`
tar xvfj $src tar xvfj $src