add name/version/release macros during src.rpm install.

attempt mkdir sourcedir/specdir during src.rpm install.

CVS patchset: 2938
CVS date: 1999/04/03 00:05:03
This commit is contained in:
jbj 1999-04-03 00:05:03 +00:00
parent 4e50407fdd
commit 30fde13087
5 changed files with 88 additions and 27 deletions

View File

@ -19,6 +19,8 @@
- add per-target macrofiles to search path.
- take globalMacroContext out of macro api.
- fix: flush all macros between builds.
- add name/version/release macros during src.rpm install.
- attempt mkdir sourcedir/specdir during src.rpm install.
2.91 -> 2.92
- update with libtool-2.4f.

View File

@ -1,7 +1,6 @@
#include "system.h"
#include "rpmbuild.h"
#include "rpmmacro.h" /* XXX for rpmGetPath */
#include "popt/popt.h"

View File

@ -58,6 +58,31 @@ static void freeFileMemory(struct fileMemory fileMem);
static void trimChangelog(Header h);
static int markReplacedFiles(rpmdb db, struct sharedFileInfo * replList);
/* XXX add more tags */
static struct tagMacro {
const char * macroname;
int tag;
} tagMacros[] = {
{ "name", RPMTAG_NAME },
{ "version", RPMTAG_VERSION },
{ "release", RPMTAG_RELEASE },
{ NULL, 0 }
};
static int rpmInstallLoadMacros(Header h) {
struct tagMacro *tagm;
const char *body;
int type;
for (tagm = tagMacros; tagm->macroname != NULL; tagm++) {
if (headerGetEntry(h, tagm->tag, &type, (void **) &body, NULL) &&
type == RPM_STRING_TYPE) {
addMacro(NULL, tagm->macroname, NULL, body, -1);
}
}
return 0;
}
/* 0 success */
/* 1 bad magic */
/* 2 error */
@ -89,6 +114,8 @@ int rpmInstallSourcePackage(const char * rootdir, FD_t fd,
}
}
rpmInstallLoadMacros(h);
rc = installSources(h, rootdir, fd, specFile, notify, notifyData);
if (h != NULL) headerFree(h);
@ -639,26 +666,53 @@ static int installSources(Header h, const char * rootdir, FD_t fd,
int currDirLen;
uid_t currUid = getuid();
gid_t currGid = getgid();
struct stat st;
int rc = 0;
rpmMessage(RPMMESS_DEBUG, _("installing a source package\n"));
realSourceDir = rpmGetPath(rootdir, "/%{_sourcedir}", NULL);
realSpecDir = rpmGetPath(rootdir, "/%{_specdir}", NULL);
if (stat(realSourceDir, &st) < 0) {
switch (errno) {
case ENOENT:
/* XXX this will only create last component of directory path */
if (mkdir(realSourceDir, 0755) == 0)
break;
/* fall thru */
default:
rpmError(RPMERR_CREATE, _("cannot create %s"), realSourceDir);
rc = 2;
goto exit;
break;
}
}
if (access(realSourceDir, W_OK)) {
rpmError(RPMERR_CREATE, _("cannot write to %s"), realSourceDir);
rc = 2;
goto exit;
}
rpmMessage(RPMMESS_DEBUG, _("sources in: %s\n"), realSourceDir);
realSpecDir = rpmGetPath(rootdir, "/%{_specdir}", NULL);
if (stat(realSpecDir, &st) < 0) {
switch (errno) {
case ENOENT:
/* XXX this will only create last component of directory path */
if (mkdir(realSpecDir, 0755) == 0)
break;
/* fall thru */
default:
rpmError(RPMERR_CREATE, _("cannot create %s"), realSpecDir);
rc = 2;
goto exit;
break;
}
}
if (access(realSpecDir, W_OK)) {
rpmError(RPMERR_CREATE, _("cannot write to %s"), realSpecDir);
rc = 2;
goto exit;
}
rpmMessage(RPMMESS_DEBUG, _("sources in: %s\n"), realSourceDir);
rpmMessage(RPMMESS_DEBUG, _("spec file in: %s\n"), realSpecDir);
if (h && headerIsEntry(h, RPMTAG_FILENAMES)) {

View File

@ -1,6 +1,7 @@
#include "system.h"
#include "rpmlib.h"
#include "rpmmacro.h" /* XXX for rpmGetPath */
#include "misc.h"

View File

@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 1999-04-01 16:34-0500\n"
"POT-Creation-Date: 1999-04-02 23:54-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -2432,96 +2432,101 @@ msgstr ""
msgid "(unknown type)"
msgstr ""
#: ../lib/install.c:75
#: ../lib/install.c:100
msgid "source package expected, binary found"
msgstr ""
#: ../lib/install.c:155 ../lib/uninstall.c:111
#: ../lib/install.c:182 ../lib/uninstall.c:111
#, c-format
msgid " file: %s action: %s\n"
msgstr ""
#: ../lib/install.c:172
#: ../lib/install.c:199
#, c-format
msgid "user %s does not exist - using root"
msgstr ""
#: ../lib/install.c:180
#: ../lib/install.c:207
#, c-format
msgid "group %s does not exist - using root"
msgstr ""
#: ../lib/install.c:207
#: ../lib/install.c:234
msgid "%%instchangelog value in macro file should be a number, but isn't"
msgstr ""
#: ../lib/install.c:275
#: ../lib/install.c:302
#, c-format
msgid "package: %s-%s-%s files test = %d\n"
msgstr ""
#: ../lib/install.c:338
#: ../lib/install.c:365
msgid "stopping install as we're running --test\n"
msgstr ""
#: ../lib/install.c:343
#: ../lib/install.c:370
msgid "running preinstall script (if any)\n"
msgstr ""
#: ../lib/install.c:373
#: ../lib/install.c:400
#, c-format
msgid "warning: %s created as %s"
msgstr ""
#: ../lib/install.c:409
#: ../lib/install.c:436
#, c-format
msgid "warning: %s saved as %s"
msgstr ""
#: ../lib/install.c:413 ../lib/install.c:750 ../lib/uninstall.c:337
#: ../lib/install.c:440 ../lib/install.c:804 ../lib/uninstall.c:337
#, c-format
msgid "rename of %s to %s failed: %s"
msgstr ""
#: ../lib/install.c:496
#: ../lib/install.c:523
msgid "running postinstall script (if any)\n"
msgstr ""
#. this would probably be a good place to check if disk space
#. was used up - if so, we should return a different error
#: ../lib/install.c:604
#: ../lib/install.c:631
#, c-format
msgid "unpacking of archive failed%s%s: %s"
msgstr ""
#: ../lib/install.c:605
#: ../lib/install.c:632
msgid " on file "
msgstr ""
#: ../lib/install.c:644
#: ../lib/install.c:672
msgid "installing a source package\n"
msgstr ""
#: ../lib/install.c:650 ../lib/install.c:656
#: ../lib/install.c:683 ../lib/install.c:705
#, c-format
msgid "cannot create %s"
msgstr ""
#: ../lib/install.c:690 ../lib/install.c:712
#, c-format
msgid "cannot write to %s"
msgstr ""
#: ../lib/install.c:661
#: ../lib/install.c:694
#, c-format
msgid "sources in: %s\n"
msgstr ""
#: ../lib/install.c:662
#: ../lib/install.c:716
#, c-format
msgid "spec file in: %s\n"
msgstr ""
#: ../lib/install.c:695 ../lib/install.c:727
#: ../lib/install.c:749 ../lib/install.c:781
msgid "source package contains no .spec file"
msgstr ""
#: ../lib/install.c:748
#: ../lib/install.c:802
#, c-format
msgid "renaming %s to %s\n"
msgstr ""
@ -2628,7 +2633,7 @@ msgstr ""
msgid "internal error (rpm bug?): "
msgstr ""
#: ../lib/misc.c:341 ../lib/misc.c:347 ../lib/misc.c:354
#: ../lib/misc.c:342 ../lib/misc.c:348 ../lib/misc.c:355
#, c-format
msgid "error creating temporary file %s"
msgstr ""