summaryrefslogtreecommitdiff
path: root/build.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>1999-01-05 23:13:56 +0000
committerjbj <devnull@localhost>1999-01-05 23:13:56 +0000
commit8af5b5af8757e9385ea90770997b45f4f82c06db (patch)
treed6f50fbd74db96d5038a46d89223ab38bb7d5e9b /build.c
parentc7c985480ab320547dbdb977a0e8682c24710393 (diff)
downloadrpm-8af5b5af8757e9385ea90770997b45f4f82c06db.tar.gz
rpm-8af5b5af8757e9385ea90770997b45f4f82c06db.tar.bz2
rpm-8af5b5af8757e9385ea90770997b45f4f82c06db.zip
Expand path macros with rpmGetPath(path, ...).
CVS patchset: 2652 CVS date: 1999/01/05 23:13:56
Diffstat (limited to 'build.c')
-rw-r--r--build.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/build.c b/build.c
index 39604f009..201aca8e2 100644
--- a/build.c
+++ b/build.c
@@ -19,9 +19,6 @@ static int buildForTarget(char *arg, int buildAmount, char *passPhrase,
char * specfile;
int res = 0;
struct stat statbuf;
- char * specDir;
- char * tmpSpecFile;
- char * cmd;
char * s;
int count, fd;
char buf[BUFSIZ];
@@ -30,13 +27,15 @@ static int buildForTarget(char *arg, int buildAmount, char *passPhrase,
rpmSetTables(RPM_MACHTABLE_BUILDARCH, RPM_MACHTABLE_BUILDOS);
if (fromTarball) {
- specDir = alloca(BUFSIZ);
- strcpy(specDir, "%{_specdir}");
- /* XXX can't use spec->macros yet */
- expandMacros(NULL, &globalMacroContext, specDir, BUFSIZ);
+ const char *specDir;
+ const char * tmpSpecFile;
+ char * cmd;
+ char tfn[64];
- tmpSpecFile = alloca(BUFSIZ);
- sprintf(tmpSpecFile, "%s/rpm-spec-file-%d", specDir, (int) getpid());
+ specDir = rpmGetPath("%{_specdir}", NULL);
+
+ sprintf(tfn, "rpm-spec-file-%d", (int) getpid());
+ tmpSpecFile = rpmGetPath("%{_specdir}", tfn, NULL);
cmd = alloca(strlen(arg) + 50 + strlen(tmpSpecFile));
sprintf(cmd, "gunzip < %s | tar xOvf - Specfile 2>&1 > %s", arg,
@@ -103,6 +102,8 @@ static int buildForTarget(char *arg, int buildAmount, char *passPhrase,
*cmd = '\0';
addMacro(&globalMacroContext, "_sourcedir", NULL, buf, RMIL_TARBALL);
+ xfree(specDir);
+ xfree(tmpSpecFile);
} else if (arg[0] == '/') {
specfile = arg;
} else {