summaryrefslogtreecommitdiff
path: root/lib/install.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>1999-01-03 03:13:50 +0000
committerjbj <devnull@localhost>1999-01-03 03:13:50 +0000
commit854d1760c0e45659897e0eba6b400e3bb8652e03 (patch)
treec6b70cbe2496c854fa1fd24fa26c9e926e8acc3d /lib/install.c
parente8d006c635bc39cb9190f240b03bbb30399dbdc4 (diff)
downloadlibrpm-tizen-854d1760c0e45659897e0eba6b400e3bb8652e03.tar.gz
librpm-tizen-854d1760c0e45659897e0eba6b400e3bb8652e03.tar.bz2
librpm-tizen-854d1760c0e45659897e0eba6b400e3bb8652e03.zip
Expand SPECDIR/SOURCEDIR using macros.
CVS patchset: 2641 CVS date: 1999/01/03 03:13:50
Diffstat (limited to 'lib/install.c')
-rw-r--r--lib/install.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/lib/install.c b/lib/install.c
index 77e8a6750..44235d3b6 100644
--- a/lib/install.c
+++ b/lib/install.c
@@ -9,6 +9,7 @@
#include "md5.h"
#include "misc.h"
#include "rpmdb.h"
+#include "rpmmacro.h"
struct callbackInfo {
unsigned long archiveSize;
@@ -274,7 +275,7 @@ int installBinaryPackage(char * rootdir, rpmdb db, FD_t fd, Header h,
struct fileInfo * files;
int_32 installTime;
char * fileStates;
- int i, j;
+ int i;
int installFile = 0;
int otherOffset = 0;
char * ext = NULL, * newpath;
@@ -675,7 +676,6 @@ static int installSources(Header h, char * rootdir, FD_t fd,
void * notifyData,
char * labelFormat) {
char * specFile;
- char * sourceDir, * specDir;
int specFileIndex = -1;
char * realSourceDir, * realSpecDir;
char * instSpecFile, * correctSpecFile;
@@ -694,18 +694,21 @@ static int installSources(Header h, char * rootdir, FD_t fd,
rpmMessage(RPMMESS_DEBUG, _("installing a source package\n"));
- sourceDir = rpmGetVar(RPMVAR_SOURCEDIR);
- specDir = rpmGetVar(RPMVAR_SPECDIR);
-
- realSourceDir = alloca(strlen(rootdir) + strlen(sourceDir) + 2);
- strcpy(realSourceDir, rootdir);
- strcat(realSourceDir, "/");
- strcat(realSourceDir, sourceDir);
+ { char buf[BUFSIZ];
+ strcpy(buf, rootdir);
+ strcat(buf, "/%{_sourcedir}");
+ expandMacros(NULL, &globalMacroContext, buf, sizeof(buf));
+ realSourceDir = alloca(strlen(buf)+1);
+ strcpy(realSourceDir, buf);
+ }
- realSpecDir = alloca(strlen(rootdir) + strlen(specDir) + 2);
- strcpy(realSpecDir, rootdir);
- strcat(realSpecDir, "/");
- strcat(realSpecDir, specDir);
+ { char buf[BUFSIZ];
+ strcpy(buf, rootdir);
+ strcat(buf, "/%{_specdir}");
+ expandMacros(NULL, &globalMacroContext, buf, sizeof(buf));
+ realSpecDir = alloca(strlen(buf)+1);
+ strcpy(realSpecDir, buf);
+ }
if (access(realSourceDir, W_OK)) {
rpmError(RPMERR_CREATE, _("cannot write to %s"), realSourceDir);