summaryrefslogtreecommitdiff
path: root/build/parsePrep.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-04-04 16:23:56 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-04-04 16:23:56 +0300
commit0787a058f11fade66fad8d78186ae2b533e20f45 (patch)
treeed19ec1e69349fc59dcdb336d380791fe5ac6f48 /build/parsePrep.c
parentc9bc7c32e0f260312f74b448c859c3acb9aab0b7 (diff)
downloadlibrpm-tizen-0787a058f11fade66fad8d78186ae2b533e20f45.tar.gz
librpm-tizen-0787a058f11fade66fad8d78186ae2b533e20f45.tar.bz2
librpm-tizen-0787a058f11fade66fad8d78186ae2b533e20f45.zip
We only ever deal with local, regular files in doUntar()
Diffstat (limited to 'build/parsePrep.c')
-rw-r--r--build/parsePrep.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/build/parsePrep.c b/build/parsePrep.c
index afbeca4ee..2644ec303 100644
--- a/build/parsePrep.c
+++ b/build/parsePrep.c
@@ -144,13 +144,11 @@ static char *doPatch(rpmSpec spec, int c, int strip, const char *db,
*/
static char *doUntar(rpmSpec spec, int c, int quietly)
{
- const char *fn;
- char *urlfn;
+ char *fn;
char *buf = NULL;
char *tar, *taropts;
struct Source *sp;
rpmCompressedMagic compressed = COMPRESSED_NOT;
- int urltype;
for (sp = spec->sources; sp != NULL; sp = sp->next) {
if ((sp->flags & RPMBUILD_ISSOURCE) && (sp->num == c)) {
@@ -162,7 +160,7 @@ static char *doUntar(rpmSpec spec, int c, int quietly)
return NULL;
}
- urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
+ fn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
/* FIX: shrug */
taropts = ((rpmIsVerbose() && !quietly) ? "-xvvf" : "-xf");
@@ -175,9 +173,9 @@ static char *doUntar(rpmSpec spec, int c, int quietly)
if (sp->flags & RPMTAG_NOSOURCE && autofetchnosource) {
struct stat st;
int rc;
- if (lstat(urlfn, &st) != 0 && errno == ENOENT &&
+ if (lstat(fn, &st) != 0 && errno == ENOENT &&
urlIsUrl(sp->fullSource) != URL_IS_UNKNOWN) {
- if ((rc = urlGetFile(sp->fullSource, urlfn)) != 0) {
+ if ((rc = urlGetFile(sp->fullSource, fn)) != 0) {
rpmlog(RPMLOG_ERR,
_("Couldn't download nosource %s: %s\n"),
sp->fullSource, ftpStrerror(rc));
@@ -188,25 +186,9 @@ static char *doUntar(rpmSpec spec, int c, int quietly)
#endif
/* XXX On non-build parse's, file cannot be stat'd or read */
- if (!spec->force && (rpmFileIsCompressed(urlfn, &compressed) || checkOwners(urlfn))) {
- urlfn = _free(urlfn);
- return NULL;
- }
-
- fn = NULL;
- urltype = urlPath(urlfn, &fn);
- switch (urltype) {
- case URL_IS_HTTPS: /* XXX WRONG WRONG WRONG */
- case URL_IS_HTTP: /* XXX WRONG WRONG WRONG */
- case URL_IS_FTP: /* XXX WRONG WRONG WRONG */
- case URL_IS_HKP: /* XXX WRONG WRONG WRONG */
- case URL_IS_PATH:
- case URL_IS_UNKNOWN:
- break;
- case URL_IS_DASH:
- urlfn = _free(urlfn);
+ if (!spec->force && (rpmFileIsCompressed(fn, &compressed) || checkOwners(fn))) {
+ fn = _free(fn);
return NULL;
- break;
}
tar = rpmGetPath("%{__tar}", NULL);
@@ -252,7 +234,7 @@ static char *doUntar(rpmSpec spec, int c, int quietly)
rasprintf(&buf, "%s %s %s", tar, taropts, fn);
}
- urlfn = _free(urlfn);
+ fn = _free(fn);
tar = _free(tar);
return buf;
}