diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-04-04 16:03:59 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-04-04 16:03:59 +0300 |
commit | bde22653bc7ef058933af9e814d9644fcf28abb2 (patch) | |
tree | 8ba6bc49d84f67a52f01797d646e3fdb8962fb51 /build.c | |
parent | 3c1126b2a550e2d9f51f46e0948ab5925fe07089 (diff) | |
download | librpm-tizen-bde22653bc7ef058933af9e814d9644fcf28abb2.tar.gz librpm-tizen-bde22653bc7ef058933af9e814d9644fcf28abb2.tar.bz2 librpm-tizen-bde22653bc7ef058933af9e814d9644fcf28abb2.zip |
Get rid of the horrid zcmd hackery in build
- rpmExpand() with %uncompress macro etc simplifies things a lot
Diffstat (limited to 'build.c')
-rw-r--r-- | build.c | 16 |
1 files changed, 4 insertions, 12 deletions
@@ -105,18 +105,12 @@ static char * getTarSpec(const char *arg) char *specBase; char *tmpSpecFile; const char **try; - char *tar; char tarbuf[BUFSIZ]; - int gotspec = 0; - rpmCompressedMagic res = COMPRESSED_OTHER; - - /* FIX: static zcmds heartburn */ - static const char *zcmds[] = { "cat", "gunzip", "bunzip2", "cat" }; + int gotspec = 0, res; static const char *tryspec[] = { "Specfile", "\\*.spec", NULL }; specDir = rpmGetPath("%{_specdir}", NULL); tmpSpecFile = rpmGetPath("%{_specdir}/", "rpm-spec.XXXXXX", NULL); - tar = rpmGetPath("%{__tar}", NULL); #if defined(HAVE_MKSTEMP) (void) close(mkstemp(tmpSpecFile)); @@ -124,14 +118,13 @@ static char * getTarSpec(const char *arg) (void) mktemp(tmpSpecFile); #endif - (void) rpmFileIsCompressed(arg, &res); - for (try = tryspec; *try != NULL; try++) { FILE *fp; char *cmd; - rasprintf(&cmd, "%s < '%s' | %s xOvf - --wildcards %s 2>&1 > '%s'", - zcmds[res & 0x3], arg, tar, *try, tmpSpecFile); + cmd = rpmExpand("%{uncompress: ", arg, "} | ", + "%{__tar} xOvf - --wildcards ", *try, + " 2>&1 > ", tmpSpecFile, NULL); if (!(fp = popen(cmd, "r"))) { rpmlog(RPMLOG_ERR, _("Failed to open tar pipe: %m\n")); @@ -169,7 +162,6 @@ exit: (void) unlink(tmpSpecFile); free(tmpSpecFile); free(specDir); - free(tar); return specFile; } |