diff options
author | jbj <devnull@localhost> | 2002-02-01 15:19:44 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2002-02-01 15:19:44 +0000 |
commit | ff7a19b2bd00ef66ee702136f2365fae8f713966 (patch) | |
tree | 6e6226ad92732d5051e24d2bf3fad5ba73739bc5 /build | |
parent | d52d65e9f2d9087b9db306315c217d52e085a77f (diff) | |
download | librpm-tizen-ff7a19b2bd00ef66ee702136f2365fae8f713966.tar.gz librpm-tizen-ff7a19b2bd00ef66ee702136f2365fae8f713966.tar.bz2 librpm-tizen-ff7a19b2bd00ef66ee702136f2365fae8f713966.zip |
- permit args to be hidden within %%__find_{requires,provides}.
- a couple more perl.{prov,req} fiddles.
CVS patchset: 5289
CVS date: 2002/02/01 15:19:44
Diffstat (limited to 'build')
-rw-r--r-- | build/files.c | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/build/files.c b/build/files.c index 433f3bbb9..d832d8fdf 100644 --- a/build/files.c +++ b/build/files.c @@ -2402,11 +2402,14 @@ static int generateDepends(Spec spec, Package pkg, TFI_t cpioList, int multiLib) int writeBytes; StringBuf readBuf; DepMsg_t *dm; - char *myargv[4]; + char ** myargv; int failnonzero = 0; int rc = 0; + int ac; int i; + myargv = xcalloc(5, sizeof(*myargv)); + if (!(fi && fi->fc > 0)) return 0; @@ -2452,16 +2455,33 @@ static int generateDepends(Spec spec, Package pkg, TFI_t cpioList, int multiLib) /*@notreached@*/ /*@switchbreak@*/ break; } - /* Get the script name to run */ - /*@-nullderef@*/ /* FIX: double indirection. @*/ - myargv[0] = (dm->argv[0] ? rpmExpand(dm->argv[0], NULL) : NULL); - /*@=nullderef@*/ + /* Get the script name (and possible args) to run */ + if (dm->argv[0] != NULL) { + const char ** av; + char * s; - if (!(myargv[0] && *myargv[0] != '%')) { - myargv[0] = _free(myargv[0]); - continue; + /*@-nullderef@*/ /* FIX: double indirection. @*/ + s = rpmExpand(dm->argv[0], NULL); + /*@=nullderef@*/ + if (!(s != NULL && *s != '%' && *s != '\0')) { + s = _free(s); + continue; + } + + if (!(i = poptParseArgvString(s, &ac, (const char ***)&av)) + && ac > 0 && av != NULL) + { + myargv = xrealloc(myargv, (ac + 5) * sizeof(*myargv)); + for (i = 0; i < ac; i++) + myargv[i] = xstrdup(av[i]); + } + av = _free(av); + s = _free(s); } + if (myargv[0] == NULL) + continue; + rpmMessage(RPMMESS_NORMAL, _("Finding %s: (using %s)...\n"), dm->msg, myargv[0]); @@ -2474,16 +2494,19 @@ static int generateDepends(Spec spec, Package pkg, TFI_t cpioList, int multiLib) /* Expand rest of script arguments (if any) */ for (i = 1; i < 4; i++) { + if (dm->argv[i] == NULL) + break; /*@-nullderef@*/ /* FIX: double indirection. @*/ - myargv[i] = dm->argv[i] ? rpmExpand(dm->argv[i], NULL) : NULL; + myargv[ac++] = rpmExpand(dm->argv[i], NULL); /*@=nullderef@*/ } + myargv[ac] = NULL; readBuf = getOutputFrom(NULL, myargv, getStringBuf(writeBuf), writeBytes, failnonzero); /* Free expanded args */ - for (i = 0; i < 4; i++) + for (i = 0; i < ac; i++) myargv[i] = _free(myargv[i]); if (readBuf == NULL) { @@ -2508,6 +2531,7 @@ static int generateDepends(Spec spec, Package pkg, TFI_t cpioList, int multiLib) } writeBuf = freeStringBuf(writeBuf); + myargv = _free(myargv); return rc; } |