diff --git a/bin/xbps-pkgdb/main.c b/bin/xbps-pkgdb/main.c index 1869defdf6..dbae941cf8 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(); }