From 1487d0128f62f5f4991afdc56b523160e05e3a73 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 18 Apr 2009 16:45:10 +0200 Subject: [PATCH] xbps-pkgdb: added 'getpkgrevision' target. --HG-- extra : convert_revision : 48de400ba82c93d5f11e822d2b29cee90fdfbf8f --- bin/xbps-pkgdb/main.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/bin/xbps-pkgdb/main.c b/bin/xbps-pkgdb/main.c index 1869defdf66..dbae941cf88 100644 --- a/bin/xbps-pkgdb/main.c +++ b/bin/xbps-pkgdb/main.c @@ -52,11 +52,12 @@ usage(void) printf("usage: xbps-pkgdb [options] [action] [args]\n" "\n" " Available actions:\n" - " getpkgname, getpkgversion, register, sanitize-plist\n" - " unregister, version\n" + " getpkgname, getpkgrevision, getpkgversion, register\n" + " sanitize-plist, unregister, version\n" "\n" " Action arguments:\n" " getpkgname\t\t\n" + " getpkgrevision\t\n" " getpkgversion\t\n" " register\t\t \n" " sanitize-plist\t\n" @@ -71,6 +72,7 @@ usage(void) "\n" " Examples:\n" " $ xbps-pkgdb getpkgname foo-2.0\n" + " $ xbps-pkgdb getpkgrevision foo-2.0_1\n" " $ xbps-pkgdb getpkgversion foo-2.0\n" " $ xbps-pkgdb register pkgname 2.0 \"A short description\"\n" " $ xbps-pkgdb sanitize-plist /blah/foo.plist\n" @@ -222,6 +224,17 @@ main(int argc, char **argv) printf("%s\n", pkgname); free(pkgname); + } else if (strcasecmp(argv[0], "getpkgrevision") == 0) { + /* Returns the revision of a pkg string */ + if (argc != 2) + usage(); + + version = xbps_get_pkg_revision(argv[1]); + if (version == NULL) + exit(EXIT_SUCCESS); + + printf("%s\n", version); + } else { usage(); }