summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjbj <devnull@localhost>1999-11-19 18:19:41 +0000
committerjbj <devnull@localhost>1999-11-19 18:19:41 +0000
commitc6d768583ef384f1037d5d3fb3c73174cebd6bdf (patch)
tree3b8803c45679d92143e2408d9fc08b7d398df6ac
parent1f6614e61efc520d2da0c09604d4ee1c06117073 (diff)
downloadrpm-c6d768583ef384f1037d5d3fb3c73174cebd6bdf.tar.gz
rpm-c6d768583ef384f1037d5d3fb3c73174cebd6bdf.tar.bz2
rpm-c6d768583ef384f1037d5d3fb3c73174cebd6bdf.zip
macros.in: Add buildsubdir and scriptlet template macros.
build/build.c: Rewrite to use scriptlet templates. build/files.c: Rename variables to prepare for (possibly) URL's in %files. build/myftw.c: Use Lstat. build/parsePreamble.c: Permit URL's in BuildRoot tag if not from spec file. build/parseSpec.c: ditto build/parsePrep.c: Add buildsubdir macro. lib/macro.c: Add url2path (nickname u2p) and verbose macro primitives. lib/url.c: urlPath returns "" if url is NULL (rpmGenPath memory corruption). CVS patchset: 3430 CVS date: 1999/11/19 18:19:41
-rw-r--r--build/build.c238
-rw-r--r--build/files.c26
-rw-r--r--build/myftw.c8
-rw-r--r--build/pack.c16
-rw-r--r--build/parsePreamble.c50
-rw-r--r--build/parsePrep.c10
-rw-r--r--build/parseSpec.c21
-rw-r--r--build/rpmspec.h6
-rw-r--r--build/spec.c8
-rw-r--r--configure.in10
-rw-r--r--lib/dbindex.c8
-rw-r--r--lib/install.c4
-rw-r--r--lib/macro.c15
-rw-r--r--lib/misc.c26
-rw-r--r--lib/url.c19
-rw-r--r--macros.in210
-rw-r--r--po/rpm.pot179
-rw-r--r--rpmio/macro.c15
-rw-r--r--scripts/Makefile.in6
19 files changed, 560 insertions, 315 deletions
diff --git a/build/build.c b/build/build.c
index f07ea0ce5..48d273c05 100644
--- a/build/build.c
+++ b/build/build.c
@@ -35,136 +35,232 @@ static void doRmSource(Spec spec)
* The _preScript string is expanded to export values to a script environment.
*/
-static char *_preScriptEnvironment = "%{_preScriptEnvironment}";
-
-static char *_preScriptChdir =
- "umask 022\n"
- "cd %{_builddir}\n"
-;
-
int doScript(Spec spec, int what, const char *name, StringBuf sb, int test)
{
+ const char * rootURL = spec->rootURL;
+ const char * rootDir;
+ const char *scriptName = NULL;
+ const char * buildURL = rpmGenPath(rootURL, "%{_builddir}", "");
+#ifdef DYING
+ const char * buildDir;
+ const char * buildSubdir;
+ const char * buildScript;
+ const char * remsh = rpmGetPath("%{?_remsh:%{_remsh}}", NULL);
+ const char * remchroot = rpmGetPath("%{?_remchroot:%{_remchroot}}", NULL);
+ const char * buildShell =
+ rpmGetPath("%{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/sh}", NULL);
+ const char * buildEnv = rpmExpand("%{_preScriptEnvironment}", NULL);
+#else
+ const char * buildScript;
+ const char * buildCmd = NULL;
+ const char * buildTemplate = NULL;
+ const char * buildPost = NULL;
+ const char * mTemplate = NULL;
+ const char * mPost = NULL;
+ int argc = 0;
+ const char **argv = NULL;
+#endif
+ FILE * fp = NULL;
+ urlinfo u = NULL;
+
FD_t fd;
FD_t xfd;
- const char *scriptName;
- int pid;
+ int child;
int status;
- char buf[BUFSIZ];
- FILE * fp = NULL;
+ int rc;
switch (what) {
case RPMBUILD_PREP:
name = "%prep";
sb = spec->prep;
+ mTemplate = "%{__spec_prep_template}";
+ mPost = "%{__spec_prep_post}";
break;
case RPMBUILD_BUILD:
name = "%build";
sb = spec->build;
+ mTemplate = "%{__spec_build_template}";
+ mPost = "%{__spec_build_post}";
break;
case RPMBUILD_INSTALL:
name = "%install";
sb = spec->install;
+ mTemplate = "%{__spec_install_template}";
+ mPost = "%{__spec_install_post}";
break;
case RPMBUILD_CLEAN:
name = "%clean";
sb = spec->clean;
+ mTemplate = "%{__spec_clean_template}";
+ mPost = "%{__spec_clean_post}";
break;
case RPMBUILD_RMBUILD:
name = "--clean";
+ mTemplate = "%{__spec_clean_template}";
+ mPost = "%{__spec_clean_post}";
break;
case RPMBUILD_STRINGBUF:
+ default:
+ mTemplate = "%{___build_template}";
+ mPost = "%{___build_post}";
break;
}
- if ((what != RPMBUILD_RMBUILD) && sb == NULL)
- return 0;
+ if ((what != RPMBUILD_RMBUILD) && sb == NULL) {
+ rc = 0;
+ goto exit;
+ }
- if (makeTempFile(spec->rootdir, &scriptName, &fd)) {
- Fclose(fd);
- FREE(scriptName);
- rpmError(RPMERR_SCRIPT, _("Unable to open temp file"));
- return RPMERR_SCRIPT;
+ if (makeTempFile(rootURL, &scriptName, &fd)) {
+ Fclose(fd);
+ rpmError(RPMERR_SCRIPT, _("Unable to open temp file"));
+ rc = RPMERR_SCRIPT;
+ goto exit;
}
+
#ifdef HAVE_FCHMOD
- (void)fchmod(Fileno(fd), 0600); /* XXX fubar on ufdio */
-#endif
-#ifdef DYING
-/* XXX FIXME: build/build.c Fdopen assertion failure, makeTempFile uses fdio */
- xfd = Fdopen(fd, "w.fdio");
-#else
- xfd = Fdopen(fd, "w.fpio");
+ switch (rootut) {
+ case URL_IS_PATH:
+ case URL_IS_UNKNOWN:
+ (void)fchmod(Fileno(fd), 0600); /* XXX fubar on ufdio */
+ break;
+ default:
+ break;
+ }
#endif
- fp = fdGetFp(fd);
+
+ if (fdGetFp(fd) == NULL)
+ xfd = Fdopen(fd, "w.fpio");
+ else
+ xfd = fd;
+ if ((fp = fdGetFp(xfd)) == NULL) {
+ rc = RPMERR_SCRIPT;
+ goto exit;
+ }
- strcpy(buf, _preScriptEnvironment);
- expandMacros(spec, spec->macros, buf, sizeof(buf));
- strcat(buf, "\n");
- fputs(buf, fp);
+ (void) urlPath(rootURL, &rootDir);
+ if (*rootDir == '\0') rootDir = "/";
+#ifdef DYING
+ (void) urlPath(buildURL, &buildDir);
+ (void) urlPath(spec->buildSubdir, &buildSubdir);
+#endif
- fprintf(fp, rpmIsVerbose() ? "set -x\n\n" : "exec > /dev/null\n\n");
+ (void) urlPath(scriptName, &buildScript);
-/* XXX umask 022; cd %{_builddir} */
- strcpy(buf, _preScriptChdir);
- expandMacros(spec, spec->macros, buf, sizeof(buf));
- fputs(buf, fp);
+ buildTemplate = rpmExpand(mTemplate, NULL);
+ buildPost = rpmExpand(mPost, NULL);
+#ifdef DYING
+ fprintf(fp, "#!%s\n", buildShell);
+ fputs(buildEnv, fp);
+ fputs("\n", fp);
+
+ fprintf(fp, rpmIsVerbose()
+ ? "set -x\n\n"
+ : "exec > /dev/null\n\n");
+
+ fprintf(fp, "umask 022\ncd %s\n", buildDir);
+#else
+ fputs(buildTemplate, fp);
+#endif
+
+ if (what != RPMBUILD_PREP && what != RPMBUILD_RMBUILD && spec->buildSubdir)
+ fprintf(fp, "cd %s\n", spec->buildSubdir);
- if (what != RPMBUILD_PREP && what != RPMBUILD_RMBUILD) {
- if (spec->buildSubdir)
- fprintf(fp, "cd %s\n", spec->buildSubdir);
- }
if (what == RPMBUILD_RMBUILD) {
if (spec->buildSubdir)
fprintf(fp, "rm -rf %s\n", spec->buildSubdir);
} else
fprintf(fp, "%s", getStringBuf(sb));
+
+#ifdef DYING
fprintf(fp, "\nexit 0\n");
+#else
+ fputs(buildPost, fp);
+#endif
Fclose(xfd);
if (test) {
- FREE(scriptName);
- return 0;
+ rc = 0;
+ goto exit;
}
- rpmMessage(RPMMESS_NORMAL, _("Executing: %s\n"), name);
- if (!(pid = fork())) {
- const char *buildShell = rpmGetPath("%{_buildshell}", NULL);
-
- if (spec->rootdir)
- Chroot(spec->rootdir);
- chdir("/");
-
- switch (urlIsURL(scriptName)) {
- case URL_IS_PATH:
- scriptName += sizeof("file://") - 1;
- scriptName = strchr(scriptName, '/');
- /*@fallthrough@*/
- case URL_IS_UNKNOWN:
- execl(buildShell, buildShell, "-e", scriptName, scriptName, NULL);
- break;
- default:
- break;
+ if (buildURL && buildURL[0] != '/' && (urlSplit(buildURL, &u) != 0)) {
+ rc = RPMERR_SCRIPT;
+ goto exit;
+ }
+ if (u)
+ addMacro(spec->macros, "_build_hostname", NULL, u->path, RMIL_SPEC);
+
+ buildCmd = rpmExpand("%{___build_cmd}", " ", buildScript, NULL);
+ poptParseArgvString(buildCmd, &argc, &argv);
+
+ rpmMessage(RPMMESS_NORMAL, _("Executing(%s): %s\n"), name, buildCmd);
+ if (!(child = fork())) {
+
+#ifdef DYING
+fprintf(stderr, "*** root %s buildDir %s script %s remsh %s \n", rootDir, buildDir, scriptName, remsh);
+
+ if (u == NULL || *remsh == '\0') {
+fprintf(stderr, "*** LOCAL %s %s -e %s %s\n", buildShell, buildShell, buildScript, buildScript);
+ if (rootURL) {
+ if (!(rootDir[0] == '/' && rootDir[1] == '\0')) {
+ chroot(rootDir);
+ chdir("/");
+ }
+ }
+ errno = 0;
+ execl(buildShell, buildShell, "-e", buildScript, buildScript, NULL);
+ } else {
+ if (*remchroot == '\0') {
+fprintf(stderr, "*** REMSH %s %s %s -e %s %s\n", remsh, u->host, buildShell, buildScript, buildScript);
+ errno = 0;
+ execl(remsh, remsh, u->host, buildShell, "-e", buildScript, buildScript, NULL);
+ } else {
+fprintf(stderr, "*** REMCHROOT %s %s %s %s -e %s %s\n", remsh, u->host, remchroot, buildShell, buildScript, buildScript);
+ errno = 0;
+ execl(remsh, remsh, u->host, remchroot, buildShell, "-e", buildScript, buildScript, NULL);
+ }
}
+#else
+ execvp(argv[0], (char *const *)argv);
+#endif
+
+ rpmError(RPMERR_SCRIPT, _("Exec of %s failed (%s): %s"), scriptName, name, strerror(errno));
- rpmError(RPMERR_SCRIPT, _("Exec of %s failed (%s)"), scriptName, name);
_exit(-1);
}
- (void)wait(&status);
- if (! WIFEXITED(status) || WEXITSTATUS(status)) {
+ rc = waitpid(child, &status, 0);
+
+ if (!WIFEXITED(status) || WEXITSTATUS(status)) {
rpmError(RPMERR_SCRIPT, _("Bad exit status from %s (%s)"),
scriptName, name);
-#if HACK
- Unlink(scriptName);
-#endif
- FREE(scriptName);
- return RPMERR_SCRIPT;
- }
+ rc = RPMERR_SCRIPT;
+ } else
+ rc = 0;
- Unlink(scriptName);
- FREE(scriptName);
+exit:
+ if (scriptName) {
+ if (!rc)
+ Unlink(scriptName);
+ xfree(scriptName);
+ }
+#ifdef DYING
+ FREE(buildShell);
+ FREE(buildEnv);
+ FREE(remsh);
+ FREE(remchroot);
+#else
+ if (u)
+ delMacro(spec->macros, "_build_hostname");
+ FREE(argv);
+ FREE(buildCmd);
+ FREE(buildTemplate);
+#endif
+ FREE(buildURL);
- return 0;
+ return rc;
}
int buildSpec(Spec spec, int what, int test)
diff --git a/build/files.c b/build/files.c
index 797b87e09..04421104f 100644
--- a/build/files.c
+++ b/build/files.c
@@ -50,7 +50,7 @@ typedef struct {
} AttrRec;
struct FileList {
- const char *buildRoot;
+ const char *buildURL;
const char *prefix;
int fileCount;
@@ -929,14 +929,14 @@ static int addFile(struct FileList *fl, const char *diskName, struct stat *statp
const char *fileGname;
char *lang;
- /* Path may have prepended buildroot, so locate the original filename. */
+ /* Path may have prepended buildURL, so locate the original filename. */
{ const char *s;
char c;
- if ((s = fl->buildRoot) != NULL) {
+ if ((s = fl->buildURL) != NULL) {
c = '\0';
while (*s) {
- if (c == '/')
+ if (c == '/' && !(s[0] == '/' && s[1] == ':'))
while(*s && *s == '/') s++;
if (*s) {
fileName++;
@@ -977,7 +977,7 @@ static int addFile(struct FileList *fl, const char *diskName, struct stat *statp
/* instead of lstat(), which causes it to follow symlinks! */
/* It also has better callback support. */
- fl->inFtw = 1; /* Flag to indicate file has buildRoot prefixed */
+ fl->inFtw = 1; /* Flag to indicate file has buildURL prefixed */
fl->isDir = 1; /* Keep it from following myftw() again */
myftw(diskName, 16, (myftwFunc) addFile, fl);
fl->isDir = 0;
@@ -1100,16 +1100,16 @@ static int processBinaryFile(/*@unused@*/Package pkg, struct FileList *fl,
/* Copy file name or glob pattern removing multiple "/" chars. */
{ const char *s;
- char c, *t = alloca((fl->buildRoot ? strlen(fl->buildRoot) : 0) +
+ char c, *t = alloca((fl->buildURL ? strlen(fl->buildURL) : 0) +
strlen(fileName) + 1);
fn = t;
*t = c = '\0';
- /* With a buildroot, prepend the buildroot now. */
- if ((s = fl->buildRoot) != NULL) {
+ /* With a buildroot, prepend the buildURL now. */
+ if ((s = fl->buildURL) != NULL) {
while (*s) {
- if (c == '/')
+ if (c == '/' && !(s[0] == '/' && s[1] == ':'))
while(*s && *s == '/') s++;
if (*s)
*t++ = c = *s++;
@@ -1119,7 +1119,7 @@ static int processBinaryFile(/*@unused@*/Package pkg, struct FileList *fl,
}
if ((s = fileName) != NULL) {
while (*s) {
- if (c == '/')
+ if (c == '/' && !(s[0] == '/' && s[1] == ':'))
while(*s && *s == '/') s++;
if (*s)
*t++ = c = *s++;
@@ -1198,8 +1198,8 @@ static int processPackageFiles(Spec spec, Package pkg,
/* Init the file list structure */
- /* XXX spec->buildRoot == NULL, then xstrdup("") is returned */
- fl.buildRoot = rpmGetPath(spec->buildRoot, NULL);
+ /* XXX spec->buildURL == NULL, then xstrdup("") is returned */
+ fl.buildURL = rpmGenPath(spec->rootURL, spec->buildURL, NULL);
if (headerGetEntry(pkg->header, RPMTAG_DEFAULTPREFIX,
NULL, (void **)&fl.prefix, NULL)) {
@@ -1333,7 +1333,7 @@ static int processPackageFiles(Spec spec, Package pkg,
}
/* Clean up */
- FREE(fl.buildRoot);
+ FREE(fl.buildURL);
FREE(fl.prefix);
freeAttrRec(&fl.cur_ar);
diff --git a/build/myftw.c b/build/myftw.c
index b8ae93406..971061f33 100644
--- a/build/myftw.c
+++ b/build/myftw.c
@@ -1,4 +1,4 @@
-/* Modified ftw() -- uses lstat() instead of stat() */
+/* Modified ftw() -- uses Lstat() instead of stat() */
/* Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -21,6 +21,8 @@ Cambridge, MA 02139, USA. */
#include "system.h"
+#include <rpmio.h>
+
#ifndef NAMLEN
#define NAMLEN(a) strlen((a)->d_name)
#endif
@@ -84,7 +86,7 @@ myftw_dir (DIR **dirs, int level, int descriptors,
dir[len] = '/';
memcpy ((void *) (dir + len + 1), (void *) entry->d_name, d_namlen);
- if (lstat (dir, &s) < 0)
+ if (Lstat (dir, &s) < 0)
{
/* Following POSIX.1 2.4 ENOENT is returned if the file cannot
* be stat'ed. This can happen for a file returned by readdir
@@ -182,7 +184,7 @@ int myftw (const char *dir,
while (i-- > 0)
dirs[i] = NULL;
- if (lstat (dir, &s) < 0)
+ if (Lstat (dir, &s) < 0)
{
/* Following POSIX.1 2.4 ENOENT is returned if the file cannot
* be stat'ed. This can happen for a file returned by readdir
diff --git a/build/pack.c b/build/pack.c
index aa16e4357..95c52044e 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -245,9 +245,6 @@ int writeRPM(Header h, const char *fileName, int type,
char buf[BUFSIZ];
Header sig;
struct rpmlead lead;
-#ifdef DYING
- int fdno;
-#endif
if (Fileno(csa->cpioFdIn) < 0) {
csa->cpioArchiveSize = 0;
@@ -271,11 +268,6 @@ int writeRPM(Header h, const char *fileName, int type,
return RPMERR_CREATE;
}
-#ifdef DYING
- fd = fdLink(fd, "persist"); /* XXX keep fd from being freed */
- fdno = Fileno(fd); /* XXX HACK HACK HACK to keep fdno open */
-#endif
-
if (headerWrite(fd, h, HEADER_MAGIC_YES)) {
rc = RPMERR_NOSPACE;
} else { /* Write the archive and get the size */
@@ -289,10 +281,6 @@ int writeRPM(Header h, const char *fileName, int type,
}
}
-#ifdef DYING
- fdSetFdno(fd, fdno); /* XXX HACK HACK HACK to keep fdno open */
-#endif
-
if (rc != 0) {
Fclose(fd);
unlink(sigtarget);
@@ -434,11 +422,7 @@ static int cpio_doio(FD_t fdo, CSA_t * csa, const char * fmode)
const char *failedFile = NULL;
(void) Fflush(fdo);
-#ifndef DYING
cfd = Fdopen(fdDup(Fileno(fdo)), fmode);
-#else
- cfd = Fdopen(fdo, fmode);
-#endif
rc = cpioBuildArchive(cfd, csa->cpioList, csa->cpioCount, NULL, NULL,
&csa->cpioArchiveSize, &failedFile);
if (rc) {
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
index d4ed8e51d..d4b181897 100644
--- a/build/parsePreamble.c
+++ b/build/parsePreamble.c
@@ -1,6 +1,7 @@
#include "system.h"
#include <rpmbuild.h>
+#include <rpmurl.h>
static int_32 copyTagsDuringParse[] = {
RPMTAG_EPOCH,
@@ -229,9 +230,6 @@ static int readIcon(Header h, const char *file)
{
const char *fn = NULL;
char *icon;
-#ifdef DYING
- struct stat statbuf;
-#endif
FD_t fd;
int rc = 0;
off_t size;
@@ -240,14 +238,6 @@ static int readIcon(Header h, const char *file)
/* XXX use rpmGenPath(rootdir, "%{_sourcedir}/", file) for icon path. */
fn = rpmGetPath("%{_sourcedir}/", file, NULL);
-#ifdef DYING
- if (Stat(fn, &statbuf)) {
- rpmError(RPMERR_BADSPEC, _("Unable to stat icon: %s"), fn);
- rc = RPMERR_BADSPEC;
- goto exit;
- }
-#endif
-
fd = Fopen(fn, "r.ufdio");
if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_BADSPEC, _("Unable to open icon %s: %s"),
@@ -330,8 +320,8 @@ if (multiToken) { \
extern int noLang; /* XXX FIXME: pass as arg */
-static int handlePreambleTag(Spec spec, Package pkg, int tag, char *macro,
- char *lang)
+static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
+ const char *lang)
{
char *field = spec->line;
char *end;
@@ -406,28 +396,38 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, char *macro,
break;
case RPMTAG_BUILDROOT:
SINGLE_TOKEN_ONLY;
- if (spec->buildRoot == NULL) {
- /* XXX use rpmGenPath(rootdir, "%{buildroot}/", file) for buildroot path. */
- const char *buildroot = rpmGetPath("%{buildroot}", NULL);
- /* XXX FIXME make sure that buildroot has path, add urlbuildroot. */
- if (buildroot && *buildroot != '%') {
- spec->buildRoot = xstrdup(cleanFileName(buildroot));
+ { const char * buildRoot = NULL;
+ const char * buildURL = spec->buildURL;
+
+ if (buildURL == NULL) {
+
+ buildURL = rpmGenPath(spec->rootURL, "%{?buildroot:%{buildroot}}", NULL);
+
+ if (strcmp(spec->rootURL, buildURL)) {
+ spec->buildURL = buildURL;
macro = NULL;
} else {
- spec->buildRoot = xstrdup(cleanFileName(field));
+ const char * specURL = field;
+
+ (void) urlPath(specURL, (const char **)&field);
+
+ xfree(buildURL);
+ buildURL = rpmGenPath(NULL, specURL, NULL);
+ spec->buildURL = buildURL;
}
- xfree(buildroot);
} else {
macro = NULL;
}
- if (!strcmp(spec->buildRoot, "/")) {
+ (void) urlPath(buildURL, &buildRoot);
+ if (*buildRoot == '\0') buildRoot = "/";
+ if (!strcmp(buildRoot, "/")) {
rpmError(RPMERR_BADSPEC,
_("line %d: BuildRoot can not be \"/\": %s"),
spec->lineNum, spec->line);
return RPMERR_BADSPEC;
}
- spec->gotBuildRoot = 1;
- break;
+ spec->gotBuildURL = 1;
+ } break;
case RPMTAG_PREFIXES:
addOrAppendListEntry(pkg->header, tag, field);
headerGetEntry(pkg->header, tag, NULL, (void **)&array, &num);
@@ -735,7 +735,7 @@ int parsePreamble(Spec spec, int initialPackage)
/* Do some final processing on the header */
- if (!spec->gotBuildRoot && spec->buildRoot) {
+ if (!spec->gotBuildURL && spec->buildURL) {
rpmError(RPMERR_BADSPEC, _("Spec file can't use BuildRoot"));
return RPMERR_BADSPEC;
}
diff --git a/build/parsePrep.c b/build/parsePrep.c
index 9830f6bce..8987082f6 100644
--- a/build/parsePrep.c
+++ b/build/parsePrep.c
@@ -200,7 +200,6 @@ static int checkOwners(const char *file)
static int doSetupMacro(Spec spec, char *line)
{
- char *version, *name;
char buf[BUFSIZ];
StringBuf before;
StringBuf after;
@@ -264,19 +263,18 @@ static int doSetupMacro(Spec spec, char *line)
if (dirName) {
spec->buildSubdir = xstrdup(dirName);
} else {
- headerGetEntry(spec->packages->header, RPMTAG_VERSION, NULL,
- (void **) &version, NULL);
- headerGetEntry(spec->packages->header, RPMTAG_NAME, NULL,
- (void **) &name, NULL);
+ const char *name, *version;
+ headerNVR(spec->packages->header, &name, &version, NULL);
sprintf(buf, "%s-%s", name, version);
spec->buildSubdir = xstrdup(buf);
}
+ addMacro(spec->macros, "buildsubdir", NULL, spec->buildSubdir, RMIL_SPEC);
free(argv);
poptFreeContext(optCon);
/* cd to the build dir */
- { const char * buildURL = rpmGenPath(spec->rootdir, "%{_builddir}", "");
+ { const char * buildURL = rpmGenPath(spec->rootURL, "%{_builddir}", "");
const char *buildDir;
(void) urlPath(buildURL, &buildDir);
diff --git a/build/parseSpec.c b/build/parseSpec.c
index b74ab0038..36201a74b 100644
--- a/build/parseSpec.c
+++ b/build/parseSpec.c
@@ -1,6 +1,7 @@
#include "system.h"
-#include "rpmbuild.h"
+#include <rpmbuild.h>
+#include <rpmurl.h>
static struct PartRec {
int part;
@@ -326,8 +327,8 @@ void closeSpec(Spec spec)
int noLang = 0; /* XXX FIXME: pass as arg */
-int parseSpec(Spec *specp, const char *specFile, const char *rootdir,
- const char *buildRoot, int inBuildArch, const char *passPhrase,
+int parseSpec(Spec *specp, const char *specFile, const char *rootURL,
+ const char *buildURL, int inBuildArch, const char *passPhrase,
char *cookie, int anyarch, int force)
{
int parsePart = PART_PREAMBLE;
@@ -345,9 +346,11 @@ int parseSpec(Spec *specp, const char *specFile, const char *rootdir,
spec->fileStack->fileName = xstrdup(specFile);
spec->specFile = xstrdup(specFile);
- if (buildRoot) {
- spec->gotBuildRoot = 1;
- spec->buildRoot = xstrdup(buildRoot);
+ if (buildURL) {
+ const char * buildRoot;
+ spec->gotBuildURL = 1;
+ spec->buildURL = xstrdup(buildURL);
+ (void) urlPath(buildURL, &buildRoot);
addMacro(spec->macros, "buildroot", NULL, buildRoot, RMIL_SPEC);
}
addMacro(NULL, "_docdir", NULL, "%{_defaultdocdir}", RMIL_SPEC);
@@ -355,8 +358,8 @@ int parseSpec(Spec *specp, const char *specFile, const char *rootdir,
spec->anyarch = anyarch;
spec->force = force;
- if (rootdir && strcmp(rootdir, "/"))
- spec->rootdir = xstrdup(rootdir);
+ if (rootURL)
+ spec->rootURL = xstrdup(rootURL);
if (passPhrase)
spec->passPhrase = xstrdup(passPhrase);
if (cookie)
@@ -435,7 +438,7 @@ int parseSpec(Spec *specp, const char *specFile, const char *rootdir,
saveArch = xstrdup(saveArch);
rpmSetMachine(spec->buildArchitectures[x], NULL);
if (parseSpec(&(spec->buildArchitectureSpecs[index]),
- specFile, spec->rootdir, buildRoot, 1,
+ specFile, spec->rootURL, buildURL, 1,
passPhrase, cookie, anyarch, force)) {
spec->buildArchitectureCount = index;
freeSpec(spec);
diff --git a/build/rpmspec.h b/build/rpmspec.h
index 060ed6aa4..c87e1582d 100644
--- a/build/rpmspec.h
+++ b/build/rpmspec.h
@@ -97,8 +97,8 @@ struct SpecStruct {
int force;
int anyarch;
- int gotBuildRoot;
- /*@only@*/ const char *buildRoot;
+ int gotBuildURL;
+ /*@only@*/ const char *buildURL;
/*@only@*/ const char *buildSubdir;
char *passPhrase;
@@ -115,7 +115,7 @@ struct SpecStruct {
/*@dependent@*/ struct MacroContext *macros;
- /*@only@*/ const char *rootdir;
+ /*@only@*/ const char *rootURL;
/*@only@*/ StringBuf prep;
/*@only@*/ StringBuf build;
/*@only@*/ StringBuf install;
diff --git a/build/spec.c b/build/spec.c
index 2e9270f16..613f9984e 100644
--- a/build/spec.c
+++ b/build/spec.c
@@ -413,7 +413,7 @@ Spec newSpec(void)
spec->readStack->next = NULL;
spec->readStack->reading = 1;
- spec->rootdir = NULL;
+ spec->rootURL = NULL;
spec->prep = NULL;
spec->build = NULL;
spec->install = NULL;
@@ -429,8 +429,8 @@ Spec newSpec(void)
spec->sourceCpioCount = 0;
spec->sourceCpioList = NULL;
- spec->gotBuildRoot = 0;
- spec->buildRoot = NULL;
+ spec->gotBuildURL = 0;
+ spec->buildURL = NULL;
spec->buildSubdir = NULL;
spec->passPhrase = NULL;
@@ -464,7 +464,7 @@ void freeSpec(/*@only@*/ Spec spec)
freeStringBuf(spec->install); spec->install = NULL;
freeStringBuf(spec->clean); spec->clean = NULL;
- FREE(spec->buildRoot);
+ FREE(spec->buildURL);
FREE(spec->buildSubdir);
FREE(spec->specFile);
FREE(spec->sourceRpmName);
diff --git a/configure.in b/configure.in
index d52c3799c..25aaab116 100644
--- a/configure.in
+++ b/configure.in
@@ -155,21 +155,19 @@ dnl
dnl Find some common programs
dnl
AC_PATH_PROG(BZIP2BIN, bzip2, /usr/bin/bzip2, $MYPATH)
-
AC_PATH_PROG(__CAT, cat, /bin/cat, $MYPATH)
AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH)
AC_PATH_PROG(__CHMOD, chmod, /bin/chmod, $MYPATH)
AC_PATH_PROG(__CHOWN, chown, /bin/chown, $MYPATH)
AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH)
AC_PATH_PROG(__CPIO, cpio, /bin/cpio, $MYPATH)
-
AC_PATH_PROG(GZIPBIN, gzip, /bin/gzip, $MYPATH)
dnl Solaris prefers /usr/xpg4/bin/id
AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH)
+ AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH)
-
AC_PATH_PROG(__PATCH, patch, /usr/bin/patch, $MYPATH)
AC_MSG_CHECKING(old version of patch)
PATCHVERSION=`patch --version 2>&1`
@@ -183,7 +181,13 @@ dnl Solaris prefers /usr/xpg4/bin/id
AC_PATH_PROG(PGPBIN, pgp, /usr/bin/pgp, $MYPATH)
AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH)
+ AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH)
+ AC_PATH_PROG(__SSH, ssh, /usr/bin/ssh, $MYPATH)
AC_PATH_PROG(__TAR, tar, /bin/tar, $MYPATH)
+
+ AC_PATH_PROG(__OBJCOPY, objcopy, /usr/bin/objcopy, $MYPATH)
+ AC_PATH_PROG(__OBJDUMP, objdump, /usr/bin/objdump, $MYPATH)
+ AC_PATH_PROG(__STRIP, strip, /usr/bin/strip, $MYPATH)
fi
addlib() {
diff --git a/lib/dbindex.c b/lib/dbindex.c
index e6ea87dc8..5e8659f47 100644
--- a/lib/dbindex.c
+++ b/lib/dbindex.c
@@ -26,13 +26,13 @@ unsigned int dbiIndexRecordFileNumber(dbiIndexSet set, int recno) {
dbiIndex * dbiOpenIndex(const char * urlfn, int flags, int perms, DBTYPE type) {
dbiIndex * dbi;
const char * filename;
- int urltype = urlPath(urlfn, &filename);
+ (void) urlPath(urlfn, &filename);
dbi = xmalloc(sizeof(*dbi));
- dbi->db = dbopen(filename, flags, perms, type, NULL);
- if (!dbi->db) {
+ if (*filename == '\0' ||
+ (dbi->db = dbopen(filename, flags, perms, type, NULL)) == NULL) {
free(dbi);
- rpmError(RPMERR_DBOPEN, _("cannot open file %s: %s"), filename,
+ rpmError(RPMERR_DBOPEN, _("cannot open file %s: %s"), urlfn,
strerror(errno));
return NULL;
}
diff --git a/lib/install.c b/lib/install.c
index 1089e4d06..e2835b5df 100644
--- a/lib/install.c
+++ b/lib/install.c
@@ -349,11 +349,7 @@ static int installArchive(FD_t fd, struct fileInfo * files,
notifyData);
(void) Fflush(fd);
-#ifndef DYING
cfd = Fdopen(fdDup(Fileno(fd)), "r.gzdio");
-#else
- cfd = Fdopen(fd, "r.gzdio");
-#endif
rc = cpioInstallArchive(cfd, map, mappedFiles,
((notify && archiveSize) || specFile) ? callback : NULL,
&info, &failedFile);
diff --git a/lib/macro.c b/lib/macro.c
index b206e2c45..ea71b43c1 100644
--- a/lib/macro.c
+++ b/lib/macro.c
@@ -785,7 +785,7 @@ doOutput(MacroBuf *mb, int waserror, const char *msg, size_t msglen)
}
static void
-doFoo(MacroBuf *mb, const char *f, size_t fn, const char *g, size_t glen)
+doFoo(MacroBuf *mb, int negate, const char *f, size_t fn, const char *g, size_t glen)
{
char buf[BUFSIZ], *b = NULL, *be;
int c;
@@ -811,6 +811,14 @@ doFoo(MacroBuf *mb, const char *f, size_t fn, const char *g, size_t glen)
b++;
} else if (STREQ("expand", f, fn)) {
b = buf;
+ } else if (STREQ("verbose", f, fn)) {
+ if (negate)
+ b = (rpmIsVerbose() ? NULL : buf);
+ else
+ b = (rpmIsVerbose() ? buf : NULL);
+ } else if (STREQ("url2path", f, fn) || STREQ("u2p", f, fn)) {
+ (void)urlPath(buf, (const char **)&b);
+ if (*b == '\0') b = "/";
} else if (STREQ("uncompress", f, fn)) {
int compressed = 1;
for (b = buf; (c = *b) && isblank(c);)
@@ -1061,11 +1069,14 @@ expandMacro(MacroBuf *mb)
if (STREQ("basename", f, fn) ||
STREQ("suffix", f, fn) ||
STREQ("expand", f, fn) ||
+ STREQ("verbose", f, fn) ||
STREQ("uncompress", f, fn) ||
+ STREQ("url2path", f, fn) ||
+ STREQ("u2p", f, fn) ||
STREQ("S", f, fn) ||
STREQ("P", f, fn) ||
STREQ("F", f, fn)) {
- doFoo(mb, f, fn, g, gn);
+ doFoo(mb, negate, f, fn, g, gn);
s = se;
continue;
}
diff --git a/lib/misc.c b/lib/misc.c
index 7b3c8a125..5a22f205b 100644
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -53,6 +53,7 @@ int rpmfileexists(const char * urlfn) {
int urltype = urlPath(urlfn, &fn);
struct stat buf;
+ if (*fn == '\0') fn = "/";
switch (urltype) {
case URL_IS_FTP: /* XXX WRONG WRONG WRONG */
case URL_IS_HTTP: /* XXX WRONG WRONG WRONG */
@@ -355,16 +356,14 @@ char * gidToGname(gid_t gid) {
}
int makeTempFile(const char * prefix, const char ** fnptr, FD_t * fdptr) {
- const char * tempfn;
- const char * tfn;
+ const char * tempfn = NULL;
+ const char * tfn = NULL;
int temput;
FD_t fd;
int ran;
if (!prefix) prefix = "";
- tfn = NULL;
-
/* XXX should probably use mktemp here */
srand(time(NULL));
ran = rand() % 100000;
@@ -375,15 +374,17 @@ int makeTempFile(const char * prefix, const char ** fnptr, FD_t * fdptr) {
char tfnbuf[64];
#ifndef NOTYET
sprintf(tfnbuf, "rpm-tmp.%d", ran++);
- if (tfn) xfree(tfn);
+ if (tempfn) xfree(tempfn);
tempfn = rpmGenPath(prefix, "%{_tmppath}/", tfnbuf);
#else
strcpy(tfnbuf, "rpm-tmp.XXXXXX");
- if (tfn) xfree(tfn);
+ if (tempfn) xfree(tempfn);
tempfn = rpmGenPath(prefix, "%{_tmppath}/", mktemp(tfnbuf));
#endif
temput = urlPath(tempfn, &tfn);
+ if (*tfn == '\0') goto errxit;
+
switch (temput) {
case URL_IS_HTTP:
case URL_IS_DASH:
@@ -393,12 +394,7 @@ int makeTempFile(const char * prefix, const char ** fnptr, FD_t * fdptr) {
break;
}
-/* XXX FIXME: build/build.c Fdopen assertion failure, makeTempFile uses fdio */
-#ifdef DYING
- fd = fdio->open(tfn, (O_CREAT|O_RDWR|O_EXCL), 0700);
-#else
- fd = Fopen(tfn, "w+x.ufdio");
-#endif
+ fd = Fopen(tempfn, "w+x.ufdio");
} while ((fd == NULL || Ferror(fd)) && errno == EEXIST);
switch(temput) {
@@ -427,15 +423,15 @@ int makeTempFile(const char * prefix, const char ** fnptr, FD_t * fdptr) {
}
if (fnptr)
- *fnptr = tfn;
- else
+ *fnptr = tempfn;
+ else if (tempfn)
xfree(tempfn);
*fdptr = fd;
return 0;
errxit:
- xfree(tempfn);
+ if (tempfn) xfree(tempfn);
return 1;
}
diff --git a/lib/url.c b/lib/url.c
index 1d068d14b..85950d572 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -309,17 +309,12 @@ urltype urlIsURL(const char * url) {
return URL_IS_UNKNOWN;
}
+/* Return path portion of url (or pointer to NUL if url == NULL) */
int urlPath(const char * url, const char ** pathp)
{
const char *path;
int urltype;
- if (url == NULL) { /* XXX paranoia */
- if (pathp)
- *pathp = xstrdup("/");
- return URL_IS_UNKNOWN;
- }
-
path = url;
urltype = urlIsURL(url);
switch (urltype) {
@@ -338,8 +333,8 @@ int urlPath(const char * url, const char ** pathp)
path = "";
break;
}
- if (path == NULL)
- path = "/";
+ if (path == NULL) /* XXX gotta return something */
+ path = "";
if (pathp)
*pathp = path;
return urltype;
@@ -370,14 +365,6 @@ int urlSplit(const char * url, urlinfo *uret)
while (1) {
/* Point to end of next item */
while (*se && *se != '/') se++;
-#ifdef DYING
- if (*se == '\0') {
- /* XXX can't find path */
- if (myurl) free(myurl);
- u = urlFree(u, "urlSplit (error #2)");
- return -1;
- }
-#endif
/* Item was service. Save service and go for the rest ...*/
if (*se && (se != s) && se[-1] == ':' && se[0] == '/' && se[1] == '/') {
se[-1] = '\0';
diff --git a/macros.in b/macros.in
index c4a64f536..63840111e 100644
--- a/macros.in
+++ b/macros.in
@@ -1,4 +1,4 @@
-# $Id: macros.in,v 1.37 1999/09/29 23:29:57 jbj Exp $
+# $Id: macros.in,v 1.38 1999/11/19 18:19:41 jbj Exp $
#==============================================================================
# Macro naming conventions (preliminary):
#
@@ -22,9 +22,9 @@
%_var @varprefix@
#==============================================================================
-# ---- path macros
-# XXX The use of which here is overly simple (read: dumb).
+# ---- Generally useful path macros.
#
+%__awk @AWK@
%__bzip2 %{_bzip2bin}
%__cat @__CAT@
%__chgrp @__CHGRP@
@@ -34,17 +34,33 @@
%__cpio @__CPIO@
%__gzip %{_gzipbin}
%__id @__ID@
-%__install %(which install)
+%__install @__INSTALL@
+%__ln_s @LN_S@
%__make @__MAKE@
%__mkdir @__MKDIR@
+%__mkdir_p @MKDIR_P@
%__mv @__MV@
%__patch @__PATCH@
-%__ranlib %(which ranlib)
+%__pgp %{_pgpbin}
%__rm @__RM@
-%__strip %(which strip)
+%__rsh @__RSH@
+%__ssh @__SSH@
%__tar @__TAR@
-# XXX avoid weird failures from which if tools are not installed
+#==============================================================================
+# ---- Build system path macros.
+#
+%__ar @AR@
+%__cc @CC@
+%__cpp @CPP@
+%__ld @LD@
+%__nm @NM@
+%__objcopy @__OBJCOPY@
+%__objdump @__OBJDUMP@
+%__ranlib @RANLIB@
+%__strip @__STRIP@
+
+# XXX avoid failures if tools are not installed when rpm is built.
%__libtoolize libtoolize
%__aclocal aclocal
%__autoheader autoheader
@@ -90,11 +106,11 @@
#
#==============================================================================
# ---- Optional rpmrc macros.
-# Macros that used to be initialized as a side effect of rpmrc and/or
-# spec file parsing but were not set in the distributed configuration
-# /usr/lib/rpm/rpmrc file.
+# Macros that are initialized as a side effect of rpmrc and/or spec
+# file parsing.
#
#%buildroot
+#%buildsubdir
#%distribution
#%_excludedocs
#%_ftpport
@@ -127,25 +143,165 @@
#%optflags -O2
#==============================================================================
-# ---- script environment macros.
-# Macro(s) that establish the environment for running a script.
+# ---- Scriptlet template templates.
+# Global defaults for building scriptlet templates.
#
+# XXX legacy configuration.
%_preScriptEnvironment \
- RPM_SOURCE_DIR=\"%{_sourcedir}\"\
- RPM_BUILD_DIR=\"%{_builddir}\"\
- RPM_OPT_FLAGS=\"%{optflags}\"\
- RPM_ARCH=\"%{_arch}\"\
- RPM_OS=\"%{_os}\"\
- export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
- RPM_DOC_DIR=\"%{_docdir}\"\
- export RPM_DOC_DIR\
- RPM_PACKAGE_NAME=\"%{name}\"\
- RPM_PACKAGE_VERSION=\"%{version}\"\
- RPM_PACKAGE_RELEASE=\"%{release}\"\
- export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
- %{?buildroot:RPM_BUILD_ROOT=\"%{buildroot}\"\
- export RPM_BUILD_ROOT\
- }
+RPM_SOURCE_DIR=\"%{_sourcedir}\"\
+RPM_BUILD_DIR=\"%{_builddir}\"\
+RPM_OPT_FLAGS=\"%{optflags}\"\
+RPM_ARCH=\"%{_arch}\"\
+RPM_OS=\"%{_os}\"\
+export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
+RPM_DOC_DIR=\"%{_docdir}\"\
+export RPM_DOC_DIR\
+RPM_PACKAGE_NAME=\"%{name}\"\
+RPM_PACKAGE_VERSION=\"%{version}\"\
+RPM_PACKAGE_RELEASE=\"%{release}\"\
+export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
+%{?buildroot:RPM_BUILD_ROOT=\"%{buildroot}\"\
+export RPM_BUILD_ROOT}
+
+%___build_shell %{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/sh}
+%___build_args -e
+%___build_cmd %{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_build_hostname}}%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} }%{___build_shell} %{___build_args}
+%___build_pre \
+RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
+RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
+RPM_OPT_FLAGS=\"%{optflags}\"\
+RPM_ARCH=\"%{_arch}\"\
+RPM_OS=\"%{_os}\"\
+export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
+RPM_DOC_DIR=\"%{_docdir}\"\
+export RPM_DOC_DIR\
+RPM_PACKAGE_NAME=\"%{name}\"\
+RPM_PACKAGE_VERSION=\"%{version}\"\
+RPM_PACKAGE_RELEASE=\"%{release}\"\
+export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
+%{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
+export RPM_BUILD_ROOT}\
+\
+%{verbose:set -x}%{!verbose:exec > /dev/null}\
+umask 022\
+cd %{u2p:%{_builddir}}\
+
+
+#%___build_body %{nil}
+%___build_post exit 0
+
+%___build_template #!%{___build_shell}\
+%{___build_pre}\
+%{nil}
+
+#%{___build_body}\
+#%{___build_post}\
+#%{nil}
+
+#==============================================================================
+# ---- Scriptlet templates.
+# Macro(s) that expand to a command and script that is executed.
+# CAVEAT: All macro expansions must fit in a BUFSIZ (8192 byte) buffer.
+#
+%__spec_prep_shell %{___build_shell}
+%__spec_prep_args %{___build_args}
+%__spec_prep_cmd %{___build_cmd}
+%__spec_prep_pre %{___build_pre}
+%__spec_prep_body %{___build_body}
+%__spec_prep_post %{___build_post}
+%__spec_prep_template #!%{__spec_prep_shell}\
+%{__spec_prep_pre}\
+%{nil}
+
+#%{__spec_prep_body}\
+#%{__spec_prep_post}\
+#%{nil}
+
+%__spec_build_shell %{___build_shell}
+%__spec_build_args %{___build_args}
+%__spec_build_cmd %{___build_cmd}
+%__spec_build_pre %{___build_pre}
+%__spec_build_body %{___build_body}
+%__spec_build_post %{___build_post}
+%__spec_build_template #!%{__spec_build_shell}\
+%{__spec_build_pre}\
+%{nil}
+
+#%{__spec_build_body}\
+#%{__spec_build_post}\
+#%{nil}
+
+%__spec_install_shell %{___build_shell}
+%__spec_install_args %{___build_args}
+%__spec_install_cmd %{___build_cmd}
+%__spec_install_pre %{___build_pre}
+%__spec_install_body %{___build_body}
+%__spec_install_post %{___build_post}
+%__spec_install_template #!%{__spec_install_shell}\
+%{__spec_install_pre}\
+%{nil}
+
+#%{__spec_install_body}\
+#%{__spec_install_post}\
+#%{nil}
+
+#%__spec_autodep_shell %{___build_shell}
+#%__spec_autodep_args %{___build_args}
+#%__spec_autodep_cmd %{___build_cmd}
+#%__spec_autodep_pre %{___build_pre}
+#%__spec_autodep_body %{___build_body}
+#%__spec_autodep_post %{___build_post}
+#%__spec_autodep_template #!%{__spec_autodep_shell}\
+#%{__spec_autodep_pre}\
+#%{nil}
+
+#%{__spec_autodep_body}\
+#%{__spec_autodep_post}\
+#%{nil}
+
+%__spec_clean_shell %{___build_shell}
+%__spec_clean_args %{___build_args}
+%__spec_clean_cmd %{___build_cmd}
+%__spec_clean_pre %{___build_pre}
+%__spec_clean_body %{___build_body}
+%__spec_clean_post %{___build_post}
+%__spec_clean_template #!%{__spec_clean_shell}\
+%{__spec_clean_pre}\
+%{nil}
+
+#%{__spec_clean_body}\
+#%{__spec_clean_post}\
+#%{nil}
+
+%__spec_rmbuild_shell %{___build_shell}
+%__spec_rmbuild_args %{___build_args}
+%__spec_rmbuild_cmd %{___build_cmd}
+%__spec_rmbuild_pre %{___build_pre}
+%__spec_rmbuild_body %{___build_body}
+%__spec_rmbuild_post %{___build_post}
+%__spec_rmbuild_template #!%{__spec_rmbuild_shell}\
+%{__spec_rmbuild_pre}\
+%{nil}
+
+#%{__spec_rmbuild_body}\
+#%{__spec_rmbuild_post}\
+#%{nil}
+
+# XXX We don't expand pre/post install scriptlets (yet).
+#%__spec_pre_pre %{nil}
+#%__spec_pre_post %{nil}
+#%__spec_post_pre %{nil}
+#%__spec_post_post %{nil}
+#%__spec_preun_pre %{nil}
+#%__spec_preun_post %{nil}
+#%__spec_postun_pre %{nil}
+#%__spec_postun_post %{nil}
+#%__spec_triggerpostun_pre %{nil}
+#%__spec_triggerpostun_post %{nil}
+#%__spec_triggerun_pre %{nil}
+#%__spec_triggerun_post %{nil}
+#%__spec_triggerin_pre %{nil}
+#%__spec_triggerin_post %{nil}
#==============================================================================
# ---- configure macros.
diff --git a/po/rpm.pot b/po/rpm.pot
index 639d6ec52..f918f7981 100644
--- a/po/rpm.pot
+++ b/po/rpm.pot
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-11-18 12:30-0500\n"
+"POT-Creation-Date: 1999-11-19 12:50-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"
@@ -1234,21 +1234,21 @@ msgstr ""
msgid "cannot re-open payload: %s\n"
msgstr ""
-#: build/build.c:85 build/pack.c:270
+#: build/build.c:116 build/pack.c:267
msgid "Unable to open temp file"
msgstr ""
-#: build/build.c:129
+#: build/build.c:198
#, c-format
-msgid "Executing: %s\n"
+msgid "Executing(%s): %s\n"
msgstr ""
-#: build/build.c:149
+#: build/build.c:229
#, c-format
-msgid "Exec of %s failed (%s)"
+msgid "Exec of %s failed (%s): %s"
msgstr ""
-#: build/build.c:155
+#: build/build.c:237
#, c-format
msgid "Bad exit status from %s (%s)"
msgstr ""
@@ -1416,7 +1416,7 @@ msgstr ""
msgid "Could not open %%files file %s: %s"
msgstr ""
-#: build/files.c:1191 build/pack.c:496
+#: build/files.c:1191 build/pack.c:480
#, c-format
msgid "line: %s"
msgstr ""
@@ -1505,86 +1505,86 @@ msgstr ""
msgid "readRPM: reading header from %s\n"
msgstr ""
-#: build/pack.c:287
+#: build/pack.c:279
msgid "Bad CSA data"
msgstr ""
-#: build/pack.c:326
+#: build/pack.c:314
#, c-format
msgid "Could not open %s: %s\n"
msgstr ""
-#: build/pack.c:359
+#: build/pack.c:347
#, c-format
msgid "Unable to write package: %s"
msgstr ""
-#: build/pack.c:374
+#: build/pack.c:362
#, c-format
msgid "Generating signature: %d\n"
msgstr ""
-#: build/pack.c:390
+#: build/pack.c:378
#, c-format
msgid "Unable to open sigtarget %s: %s"
msgstr ""
-#: build/pack.c:400
+#: build/pack.c:388
#, c-format
msgid "Unable to read sigtarget %s: %s"
msgstr ""
-#: build/pack.c:410
+#: build/pack.c:398
#, c-format
msgid "Unable to write package %s: %s"
msgstr ""
-#: build/pack.c:425
+#: build/pack.c:413
#, c-format
msgid "Wrote: %s\n"
msgstr ""
-#: build/pack.c:445
+#: build/pack.c:429
#, c-format
msgid "create archive failed on file %s: %s"
msgstr ""
-#: build/pack.c:464
+#: build/pack.c:448
#, c-format
msgid "cpio_copy write failed: %s"
msgstr ""
-#: build/pack.c:471
+#: build/pack.c:455
#, c-format
msgid "cpio_copy read failed: %s"
msgstr ""
-#: build/pack.c:552
+#: build/pack.c:536
#, c-format
msgid "Could not open PreIn file: %s"
msgstr ""
-#: build/pack.c:559
+#: build/pack.c:543
#, c-format
msgid "Could not open PreUn file: %s"
msgstr ""
-#: build/pack.c:566
+#: build/pack.c:550
#, c-format
msgid "Could not open PostIn file: %s"
msgstr ""
-#: build/pack.c:573
+#: build/pack.c:557
#, c-format
msgid "Could not open PostUn file: %s"
msgstr ""
-#: build/pack.c:581
+#: build/pack.c:565
#, c-format
msgid "Could not open VerifyScript file: %s"
msgstr ""
-#: build/pack.c:597
+#: build/pack.c:581
#, c-format
msgid "Could not open Trigger script file: %s"
msgstr ""
@@ -1650,68 +1650,63 @@ msgstr ""
msgid "line %d: Second %%files list"
msgstr ""
-#: build/parsePreamble.c:141
+#: build/parsePreamble.c:142
#, c-format
msgid "Architecture is excluded: %s"
msgstr ""
-#: build/parsePreamble.c:146
+#: build/parsePreamble.c:147
#, c-format
msgid "Architecture is not included: %s"
msgstr ""
-#: build/parsePreamble.c:151
+#: build/parsePreamble.c:152
#, c-format
msgid "OS is excluded: %s"
msgstr ""
-#: build/parsePreamble.c:156
+#: build/parsePreamble.c:157
#, c-format
msgid "OS is not included: %s"
msgstr ""
-#: build/parsePreamble.c:170
+#: build/parsePreamble.c:171
#, c-format
msgid "%s field must be present in package: %s"
msgstr ""
-#: build/parsePreamble.c:195
+#: build/parsePreamble.c:196
#, c-format
msgid "Duplicate %s entries in package: %s"
msgstr ""
-#: build/parsePreamble.c:245
-#, c-format
-msgid "Unable to stat icon: %s"
-msgstr ""
-
-#: build/parsePreamble.c:253
+#: build/parsePreamble.c:243
#, c-format
msgid "Unable to open icon %s: %s"
msgstr ""
-#: build/parsePreamble.c:271
+#: build/parsePreamble.c:261
#, c-format
msgid "Unable to read icon %s: %s"
msgstr ""
-#: build/parsePreamble.c:284
+#: build/parsePreamble.c:274
#, c-format
msgid "Unknown icon type: %s"
msgstr ""
-#: build/parsePreamble.c:347
+#: build/parsePreamble.c:337
#, c-format
msgid "line %d: Malformed tag: %s"
msgstr ""
#. Empty field
-#: build/parsePreamble.c:355
+#: build/parsePreamble.c:345
#, c-format
msgid "line %d: Empty tag: %s"
msgstr ""
-#: build/parsePreamble.c:378 build/parsePreamble.c:385
+#: build/parsePreamble.c:368 build/parsePreamble.c:375
#, c-format
msgid "line %d: Illegal char '-' in %s: %s"
msgstr ""
@@ -1785,43 +1780,43 @@ msgstr ""
msgid "Couldn't download nosource %s: %s"
msgstr ""
-#: build/parsePrep.c:220
+#: build/parsePrep.c:219
msgid "Error parsing %%setup: %s"
msgstr ""
-#: build/parsePrep.c:235
+#: build/parsePrep.c:234
msgid "line %d: Bad arg to %%setup %c: %s"
msgstr ""
-#: build/parsePrep.c:253
+#: build/parsePrep.c:252
msgid "line %d: Bad %%setup option %s: %s"
msgstr ""
-#: build/parsePrep.c:381
+#: build/parsePrep.c:379
msgid "line %d: Need arg to %%patch -b: %s"
msgstr ""
-#: build/parsePrep.c:389
+#: build/parsePrep.c:387
msgid "line %d: Need arg to %%patch -z: %s"
msgstr ""
-#: build/parsePrep.c:401
+#: build/parsePrep.c:399
msgid "line %d: Need arg to %%patch -p: %s"
msgstr ""
-#: build/parsePrep.c:407
+#: build/parsePrep.c:405
msgid "line %d: Bad arg to %%patch -p: %s"
msgstr ""
-#: build/parsePrep.c:414
+#: build/parsePrep.c:412
msgid "Too many patches!"
msgstr ""
-#: build/parsePrep.c:418
+#: build/parsePrep.c:416
msgid "line %d: Bad arg to %%patch: %s"
msgstr ""
-#: build/parsePrep.c:454
+#: build/parsePrep.c:452
msgid "line %d: second %%prep"
msgstr ""
@@ -1871,50 +1866,50 @@ msgstr ""
msgid "line %d: Second %s"
msgstr ""
-#: build/parseSpec.c:126
+#: build/parseSpec.c:127
#, c-format
msgid "line %d: %s"
msgstr ""
#. XXX Fstrerror
-#: build/parseSpec.c:175
+#: build/parseSpec.c:176
#, c-format
msgid "Unable to open %s: %s\n"
msgstr ""
-#: build/parseSpec.c:187
+#: build/parseSpec.c:188
msgid "Unclosed %%if"
msgstr ""
-#: build/parseSpec.c:246
+#: build/parseSpec.c:247
#, c-format
msgid "%s:%d: parseExpressionBoolean returns %d"
msgstr ""
#. Got an else with no %if !
-#: build/parseSpec.c:254
+#: build/parseSpec.c:255
msgid "%s:%d: Got a %%else with no if"
msgstr ""
#. Got an end with no %if !
-#: build/parseSpec.c:265
+#: build/parseSpec.c:266
msgid "%s:%d: Got a %%endif with no if"
msgstr ""
-#: build/parseSpec.c:279 build/parseSpec.c:288
+#: build/parseSpec.c:280 build/parseSpec.c:289
msgid "malformed %%include statement"
msgstr ""
-#: build/parseSpec.c:369
+#: build/parseSpec.c:372
#, c-format
msgid "Timecheck value must be an integer: %s"
msgstr ""
-#: build/parseSpec.c:452
+#: build/parseSpec.c:455
msgid "No buildable architectures"
msgstr ""
-#: build/parseSpec.c:499
+#: build/parseSpec.c:502
msgid "Package has no %%description: %s"
msgstr ""
@@ -2226,86 +2221,86 @@ 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:366
+#: lib/install.c:362
#, c-format
msgid "unpacking of archive failed%s%s: %s"
msgstr ""
-#: lib/install.c:367
+#: lib/install.c:363
msgid " on file "
msgstr ""
-#: lib/install.c:410
+#: lib/install.c:406
msgid "installing a source package\n"
msgstr ""
-#: lib/install.c:421
+#: lib/install.c:417
#, c-format
msgid "cannot create %s: %s"
msgstr ""
-#: lib/install.c:429 lib/install.c:451
+#: lib/install.c:425 lib/install.c:447
#, c-format
msgid "cannot write to %s"
msgstr ""
-#: lib/install.c:433
+#: lib/install.c:429
#, c-format
msgid "sources in: %s\n"
msgstr ""
-#: lib/install.c:444
+#: lib/install.c:440
#, c-format
msgid "cannot create %s"
msgstr ""
-#: lib/install.c:455
+#: lib/install.c:451
#, c-format
msgid "spec file in: %s\n"
msgstr ""
-#: lib/install.c:489 lib/install.c:517
+#: lib/install.c:485 lib/install.c:513
msgid "source package contains no .spec file"
msgstr ""
-#: lib/install.c:539
+#: lib/install.c:535
#, c-format
msgid "renaming %s to %s\n"
msgstr ""
-#: lib/install.c:541 lib/install.c:820 lib/uninstall.c:27
+#: lib/install.c:537 lib/install.c:816 lib/uninstall.c:27
#, c-format
msgid "rename of %s to %s failed: %s"
msgstr ""
-#: lib/install.c:632
+#: lib/install.c:628
msgid "source package expected, binary found"
msgstr ""
-#: lib/install.c:689
+#: lib/install.c:685
#, c-format
msgid "package: %s-%s-%s files test = %d\n"
msgstr ""
-#: lib/install.c:750
+#: lib/install.c:746
msgid "stopping install as we're running --test\n"
msgstr ""
-#: lib/install.c:755
+#: lib/install.c:751
msgid "running preinstall script (if any)\n"
msgstr ""
-#: lib/install.c:780
+#: lib/install.c:776
#, c-format
msgid "warning: %s created as %s"
msgstr ""
-#: lib/install.c:816
+#: lib/install.c:812
#, c-format
msgid "warning: %s saved as %s"
msgstr ""
-#: lib/install.c:890
+#: lib/install.c:886
msgid "running postinstall scripts (if any)\n"
msgstr ""
@@ -2363,35 +2358,35 @@ msgstr ""
msgid "Unknown option %c in %s(%s)"
msgstr ""
-#: lib/macro.c:882
+#: lib/macro.c:890
#, c-format
msgid "Recursion depth(%d) greater than max(%d)"
msgstr ""
-#: lib/macro.c:948 lib/macro.c:964
+#: lib/macro.c:956 lib/macro.c:972
#, c-format
msgid "Unterminated %c: %s"
msgstr ""
-#: lib/macro.c:1004
+#: lib/macro.c:1012
msgid "A %% is followed by an unparseable macro"
msgstr ""
-#: lib/macro.c:1127
+#: lib/macro.c:1138
msgid "Macro %%%.*s not found, skipping"
msgstr ""
-#: lib/macro.c:1208
+#: lib/macro.c:1219
msgid "Target buffer overflow"
msgstr ""
#. XXX Fstrerror
-#: lib/macro.c:1363 lib/macro.c:1368
+#: lib/macro.c:1374 lib/macro.c:1379
#, c-format
msgid "File %s: %s"
msgstr ""
-#: lib/macro.c:1371
+#: lib/macro.c:1382
#, c-format
msgid "File %s is smaller than %d bytes"
msgstr ""
@@ -2412,7 +2407,7 @@ msgstr ""
msgid "internal error (rpm bug?): "
msgstr ""
-#: lib/misc.c:409 lib/misc.c:414 lib/misc.c:420
+#: lib/misc.c:405 lib/misc.c:410 lib/misc.c:416
#, c-format
msgid "error creating temporary file %s"
msgstr ""
@@ -2843,7 +2838,7 @@ msgstr ""
msgid "opening database mode 0x%x in %s\n"
msgstr ""
-#: lib/rpmdb.c:155 lib/url.c:457
+#: lib/rpmdb.c:155 lib/url.c:444
#, c-format
msgid "failed to open %s: %s\n"
msgstr ""
@@ -3089,7 +3084,7 @@ msgstr ""
msgid "Unknown or unexpected error"
msgstr ""
-#: lib/rpmio.c:1243
+#: lib/rpmio.c:1232
#, c-format
msgid "logging into %s as %s, pw %s\n"
msgstr ""
@@ -3413,12 +3408,12 @@ msgstr ""
msgid "error: %sport must be a number\n"
msgstr ""
-#: lib/url.c:421
+#: lib/url.c:408
msgid "url port must be a number\n"
msgstr ""
#. XXX Fstrerror
-#: lib/url.c:480
+#: lib/url.c:467
#, c-format
msgid "failed to create %s: %s\n"
msgstr ""
diff --git a/rpmio/macro.c b/rpmio/macro.c
index b206e2c45..ea71b43c1 100644
--- a/rpmio/macro.c
+++ b/rpmio/macro.c
@@ -785,7 +785,7 @@ doOutput(MacroBuf *mb, int waserror, const char *msg, size_t msglen)
}
static void
-doFoo(MacroBuf *mb, const char *f, size_t fn, const char *g, size_t glen)
+doFoo(MacroBuf *mb, int negate, const char *f, size_t fn, const char *g, size_t glen)
{
char buf[BUFSIZ], *b = NULL, *be;
int c;
@@ -811,6 +811,14 @@ doFoo(MacroBuf *mb, const char *f, size_t fn, const char *g, size_t glen)
b++;
} else if (STREQ("expand", f, fn)) {
b = buf;
+ } else if (STREQ("verbose", f, fn)) {
+ if (negate)
+ b = (rpmIsVerbose() ? NULL : buf);
+ else
+ b = (rpmIsVerbose() ? buf : NULL);
+ } else if (STREQ("url2path", f, fn) || STREQ("u2p", f, fn)) {
+ (void)urlPath(buf, (const char **)&b);
+ if (*b == '\0') b = "/";
} else if (STREQ("uncompress", f, fn)) {
int compressed = 1;
for (b = buf; (c = *b) && isblank(c);)
@@ -1061,11 +1069,14 @@ expandMacro(MacroBuf *mb)
if (STREQ("basename", f, fn) ||
STREQ("suffix", f, fn) ||
STREQ("expand", f, fn) ||
+ STREQ("verbose", f, fn) ||
STREQ("uncompress", f, fn) ||
+ STREQ("url2path", f, fn) ||
+ STREQ("u2p", f, fn) ||
STREQ("S", f, fn) ||
STREQ("P", f, fn) ||
STREQ("F", f, fn)) {
- doFoo(mb, f, fn, g, gn);
+ doFoo(mb, negate, f, fn, g, gn);
s = se;
continue;
}
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index b3010cbfc..88470d033 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -134,11 +134,17 @@ __CHOWN = @__CHOWN@
__CP = @__CP@
__CPIO = @__CPIO@
__ID = @__ID@
+__INSTALL = @__INSTALL@
__MAKE = @__MAKE@
__MKDIR = @__MKDIR@
__MV = @__MV@
+__OBJCOPY = @__OBJCOPY@
+__OBJDUMP = @__OBJDUMP@
__PATCH = @__PATCH@
__RM = @__RM@
+__RSH = @__RSH@
+__SSH = @__SSH@
+__STRIP = @__STRIP@
__TAR = @__TAR@
l = @l@
testdir = @testdir@