X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=zpm-script.c;h=a91f2ac3195974c030a0fc5b28c9645e319feaf6;hb=f85b2f817faa5e86169b4cd80539da4b7f603066;hp=438cf50099a8e99d243e29dcb107dd95ad8ec9df;hpb=33ef8ea6e32e935fa8bf62b62710b216a1ce9b40;p=zpackage diff --git a/zpm-script.c b/zpm-script.c index 438cf50..a91f2ac 100644 --- a/zpm-script.c +++ b/zpm-script.c @@ -119,6 +119,12 @@ int run(char *program, char **args, char *output, int *status) { #define SOFT 1 #define HARD 2 +static int list_scripts(void *ud, const char *pkg, const char *stage, + const char *hash) { + printf("%s %s %.8s\n", pkg, stage, hash); + return 0; +} + int main(int ac, char **av){ struct zpm zpm; int rv; @@ -133,7 +139,7 @@ int main(int ac, char **av){ char *pkgid; char *rootdir = 0; - char *db = "/var/lib/zpm/zpm.db"; + char *db = "/var/lib/zpm/local.db"; char *script = "/var/tmp/zpm-script"; char *output = "/var/tmp/zpm-script.out"; char *phase = 0; @@ -202,7 +208,7 @@ int main(int ac, char **av){ /* first non option arg is always a package id */ pkgstr = av[argn]; - pkgid = zpm_findpkg(&zpm, pkgstr); + pkgid = zpm_findpkg(&zpm, pkgstr, NULL); if (!pkgid) { fprintf(stderr, "no package for %s\n", pkgstr); @@ -248,7 +254,9 @@ int main(int ac, char **av){ fail = HARD; } } else if (mode == LIST) { - if (!zpm_script_hash(&zpm, pkgid, phase, hash)) { + if (!phase) { + zpm_foreach_script(&zpm, pkgid, phase, 0, list_scripts); + } else if (!zpm_script_hash(&zpm, pkgid, phase, hash)) { fail = SOFT; } else if (scriptishash) { printf("%s\n", hash);