diff options
author | jbj <devnull@localhost> | 2000-11-02 17:57:25 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2000-11-02 17:57:25 +0000 |
commit | 62c5a919309223a72c05bbcd2e26559bce67def1 (patch) | |
tree | cf2a4bb2d3bce545f7f0351db4ef59d9533ba228 /build | |
parent | 5f541ebafd9a1ef35d01f5f169a15533f0396d1c (diff) | |
download | librpm-tizen-62c5a919309223a72c05bbcd2e26559bce67def1.tar.gz librpm-tizen-62c5a919309223a72c05bbcd2e26559bce67def1.tar.bz2 librpm-tizen-62c5a919309223a72c05bbcd2e26559bce67def1.zip |
- add support for unzip rodrigob@conectiva.com.br>
CVS patchset: 4243
CVS date: 2000/11/02 17:57:25
Diffstat (limited to 'build')
-rw-r--r-- | build/parsePrep.c | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/build/parsePrep.c b/build/parsePrep.c index 11553e741..da99e357b 100644 --- a/build/parsePrep.c +++ b/build/parsePrep.c @@ -61,7 +61,7 @@ static int checkOwners(const char *urlfn) static char buf[BUFSIZ]; char args[BUFSIZ]; struct Source *sp; - int compressed = 0; + rpmCompressedMagic compressed = COMPRESSED_NOT; int urltype; for (sp = spec->sources; sp != NULL; sp = sp->next) { @@ -149,8 +149,9 @@ static int checkOwners(const char *urlfn) const char *fn, *urlfn; static char buf[BUFSIZ]; char *taropts; + char *t = NULL; struct Source *sp; - int compressed = 0; + rpmCompressedMagic compressed = COMPRESSED_NOT; int urltype; for (sp = spec->sources; sp != NULL; sp = sp->next) { @@ -205,21 +206,42 @@ static int checkOwners(const char *urlfn) /*@notreached@*/ break; } - if (compressed) { - const char *zipper = rpmGetPath( - (compressed == COMPRESSED_BZIP2 ? "%{_bzip2bin}" : "%{_gzipbin}"), - NULL); - sprintf(buf, - "%s -dc %s | tar %s -\n" + if (compressed != COMPRESSED_NOT) { + const char *zipper; + int needtar = 1; + + switch (compressed) { + case COMPRESSED_NOT: /* XXX can't happen */ + case COMPRESSED_OTHER: + t = "%{_gzipbin} -dc"; + break; + case COMPRESSED_BZIP2: + t = "%{_bzip2bin} -dc"; + break; + case COMPRESSED_ZIP: + t = "%{_unzipbin}"; + needtar = 0; + break; + } + zipper = rpmGetPath(t, NULL); + buf[0] = '\0'; + t = stpcpy(buf, zipper); + xfree(zipper); + *t++ = ' '; + t = stpcpy(t, fn); + if (needtar) + t = stpcpy( stpcpy( stpcpy(t, " | tar "), taropts), " -"); + t = stpcpy(t, + "\n" "STATUS=$?\n" "if [ $STATUS -ne 0 ]; then\n" " exit $STATUS\n" - "fi", - zipper, - fn, taropts); - xfree(zipper); + "fi"); } else { - sprintf(buf, "tar %s %s", taropts, fn); + buf[0] = '\0'; + t = stpcpy( stpcpy(buf, "tar "), taropts); + *t++ = ' '; + t = stpcpy(t, fn); } xfree(urlfn); |