summaryrefslogtreecommitdiff
path: root/build.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-04-04 16:03:59 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-04-04 16:03:59 +0300
commitbde22653bc7ef058933af9e814d9644fcf28abb2 (patch)
tree8ba6bc49d84f67a52f01797d646e3fdb8962fb51 /build.c
parent3c1126b2a550e2d9f51f46e0948ab5925fe07089 (diff)
downloadlibrpm-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.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/build.c b/build.c
index e1bbb07e4..2899f5835 100644
--- a/build.c
+++ b/build.c
@@ -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;
}