Spec: Add rootdir (as in chroot).
authorjbj <devnull@localhost>
Sun, 31 Oct 1999 21:38:21 +0000 (21:38 +0000)
committerjbj <devnull@localhost>
Sun, 31 Oct 1999 21:38:21 +0000 (21:38 +0000)
parseSpec(): Pass rootdir argument.
rpm.c: Rework bigMode enum to simplify per-mode option checks.
build/build.c: Attempt a chroot before execl().
falloc.c: thinko: test for non-existent packages database was broke.
makeTempFile(): Skip possible URL leader on tempfile name expansion.
rpmio.c: Mkdir/Chdir/Rmdir/Rename/Chroot/Unlink syscall wrappers.
rpmdb.c: Coalesce and simplify legacy openDatabase() wrappers.
uninstall.c: Skip possible URL leader on chroot arg.

CVS patchset: 3409
CVS date: 1999/10/31 21:38:21

17 files changed:
build.c
build.h
build/build.c
build/files.c
build/parseSpec.c
build/rpmbuild.h
build/rpmspec.h
build/spec.c
lib/falloc.c
lib/misc.c
lib/query.c
lib/rebuilddb.c
lib/rpmdb.c
lib/rpmio.h
lib/uninstall.c
po/rpm.pot
rpm.c

diff --git a/build.c b/build.c
index 98362ea..2c8c515 100644 (file)
--- a/build.c
+++ b/build.c
@@ -223,8 +223,8 @@ static int buildForTarget(const char *arg, struct rpmBuildArguments *ba,
     /* Parse the spec file */
 #define        _anyarch(_f)    \
 (((_f)&(RPMBUILD_PREP|RPMBUILD_BUILD|RPMBUILD_INSTALL|RPMBUILD_PACKAGEBINARY)) == 0)
-    if (parseSpec(&spec, specfile, buildRoot, 0, passPhrase, cookie,
-       _anyarch(buildAmount), force)) {
+    if (parseSpec(&spec, specfile, ba->rootdir, buildRoot, 0, passPhrase,
+       cookie, _anyarch(buildAmount), force)) {
            return 1;
     }
 #undef _anyarch
diff --git a/build.h b/build.h
index 64a6ff0..325d159 100644 (file)
--- a/build.h
+++ b/build.h
@@ -16,6 +16,7 @@ struct rpmBuildArguments {
     int noBuild;
     int shortCircuit;
     char buildChar;
+    /*@dependent@*/ const char *rootdir;
 };
 
 int build(const char *arg, struct rpmBuildArguments *ba, const char *passPhrase,
index c3832f2..91f2b03 100644 (file)
@@ -1,6 +1,7 @@
 #include "system.h"
 
-#include "rpmbuild.h"
+#include <rpmbuild.h>
+#include <rpmurl.h>
 
 static void doRmSource(Spec spec)
 {
@@ -73,11 +74,11 @@ int doScript(Spec spec, int what, const char *name, StringBuf sb, int test)
       case RPMBUILD_STRINGBUF:
        break;
     }
-    if ((what != RPMBUILD_RMBUILD) && sb == NULL) {
+
+    if ((what != RPMBUILD_RMBUILD) && sb == NULL)
        return 0;
-    }
     
-    if (makeTempFile(NULL, &scriptName, &fd)) {
+    if (makeTempFile(spec->rootdir, &scriptName, &fd)) {
            Fclose(fd);
            FREE(scriptName);
            rpmError(RPMERR_SCRIPT, _("Unable to open temp file"));
@@ -101,17 +102,14 @@ int doScript(Spec spec, int what, const char *name, StringBuf sb, int test)
     fputs(buf, f);
 
     if (what != RPMBUILD_PREP && what != RPMBUILD_RMBUILD) {
-       if (spec->buildSubdir) {
+       if (spec->buildSubdir)
            fprintf(f, "cd %s\n", spec->buildSubdir);
-       }
     }
     if (what == RPMBUILD_RMBUILD) {
-       if (spec->buildSubdir) {
+       if (spec->buildSubdir)
            fprintf(f, "rm -rf %s\n", spec->buildSubdir);
-       }
-    } else {
+    } else
        fprintf(f, "%s", getStringBuf(sb));
-    }
     fprintf(f, "\nexit 0\n");
     
     fclose(f);
@@ -124,27 +122,39 @@ int doScript(Spec spec, int what, const char *name, StringBuf sb, int test)
     rpmMessage(RPMMESS_NORMAL, _("Executing: %s\n"), name);
     if (!(pid = fork())) {
        const char *buildShell = rpmGetPath("%{_buildshell}", NULL);
-       execl(buildShell, buildShell, "-e", scriptName, scriptName, NULL);
-       rpmError(RPMERR_SCRIPT, _("Exec of %s failed (%s)"),
-                scriptName, name);
-#if 0   /* XXX don't erase the failing script */
-       unlink(scriptName);
-#endif
-       FREE(scriptName);
-       return RPMERR_SCRIPT;
+
+       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;
+       }
+
+       rpmError(RPMERR_SCRIPT, _("Exec of %s failed (%s)"), scriptName, name);
+       _exit(-1);
     }
+
     (void)wait(&status);
     if (! WIFEXITED(status) || WEXITSTATUS(status)) {
        rpmError(RPMERR_SCRIPT, _("Bad exit status from %s (%s)"),
                 scriptName, name);
 #if HACK
-       unlink(scriptName);
+       Unlink(scriptName);
 #endif
        FREE(scriptName);
        return RPMERR_SCRIPT;
     }
     
-    unlink(scriptName);
+    Unlink(scriptName);
     FREE(scriptName);
 
     return 0;
@@ -166,66 +176,49 @@ int buildSpec(Spec spec, int what, int test)
            }
        }
     } else {
-       if (what & RPMBUILD_PREP) {
-           if ((rc = doScript(spec, RPMBUILD_PREP, NULL, NULL, test))) {
+       if ((what & RPMBUILD_PREP) &&
+           (rc = doScript(spec, RPMBUILD_PREP, NULL, NULL, test)))
                return rc;
-           }
-       }
-       if (what & RPMBUILD_BUILD) {
-           if ((rc = doScript(spec, RPMBUILD_BUILD, NULL, NULL, test))) {
+
+       if ((what & RPMBUILD_BUILD) &&
+           (rc = doScript(spec, RPMBUILD_BUILD, NULL, NULL, test)))
                return rc;
-           }
-       }
-       if (what & RPMBUILD_INSTALL) {
-           if ((rc = doScript(spec, RPMBUILD_INSTALL, NULL, NULL, test))) {
+
+       if ((what & RPMBUILD_INSTALL) &&
+           (rc = doScript(spec, RPMBUILD_INSTALL, NULL, NULL, test)))
                return rc;
-           }
-       }
 
-       if (what & RPMBUILD_PACKAGESOURCE) {
-           if ((rc = processSourceFiles(spec))) {
+       if ((what & RPMBUILD_PACKAGESOURCE) &&
+           (rc = processSourceFiles(spec)))
                return rc;
-           }
-       }
 
-       if ((what & RPMBUILD_INSTALL) || (what & RPMBUILD_PACKAGEBINARY) ||
-           (what & RPMBUILD_FILECHECK)) {
-           if ((rc = processBinaryFiles(spec, what & RPMBUILD_INSTALL,
-                                        test))) {
+       if (((what & RPMBUILD_INSTALL) || (what & RPMBUILD_PACKAGEBINARY) ||
+           (what & RPMBUILD_FILECHECK)) &&
+           (rc = processBinaryFiles(spec, what & RPMBUILD_INSTALL, test)))
                return rc;
-           }
-       }
 
-       if (what & RPMBUILD_PACKAGESOURCE && !test) {
-           if ((rc = packageSources(spec))) {
+       if (((what & RPMBUILD_PACKAGESOURCE) && !test) &&
+           (rc = packageSources(spec)))
                return rc;
-           }
-       }
-       if (what & RPMBUILD_PACKAGEBINARY && !test) {
-           if ((rc = packageBinaries(spec))) {
+
+       if (((what & RPMBUILD_PACKAGEBINARY) && !test) &&
+           (rc = packageBinaries(spec)))
                return rc;
-           }
-       }
        
-       if (what & RPMBUILD_CLEAN) {
-           if ((rc = doScript(spec, RPMBUILD_CLEAN, NULL, NULL, test))) {
+       if ((what & RPMBUILD_CLEAN) &&
+           (rc = doScript(spec, RPMBUILD_CLEAN, NULL, NULL, test)))
                return rc;
-           }
-       }
-       if (what & RPMBUILD_RMBUILD) {
-           if ((rc = doScript(spec, RPMBUILD_RMBUILD, NULL, NULL, test))) {
+
+       if ((what & RPMBUILD_RMBUILD) &&
+           (rc = doScript(spec, RPMBUILD_RMBUILD, NULL, NULL, test)))
                return rc;
-           }
-       }
     }
 
-    if (what & RPMBUILD_RMSOURCE) {
+    if (what & RPMBUILD_RMSOURCE)
        doRmSource(spec);
-    }
 
-    if (what & RPMBUILD_RMSPEC) {
+    if (what & RPMBUILD_RMSPEC)
        unlink(spec->specFile);
-    }
 
     return 0;
 }
index 2a2c1b3..156b602 100644 (file)
@@ -1497,16 +1497,16 @@ int processSourceFiles(Spec spec)
        }
 
        switch (urlIsURL(s)) {
-       case URL_IS_DASH:       /* stdin */
-       case URL_IS_FTP:        /* ftp://... */
-       case URL_IS_HTTP:       /* http://... */
-           continue;           /* XXX just skip for now */
        case URL_IS_PATH:       /* file://... */
            s += sizeof("file://") - 1;
            s = strchr(s, '/');
            /*@fallthrough@*/
        case URL_IS_UNKNOWN:    /* plain file path */
            break;
+       case URL_IS_DASH:       /* stdin */
+       case URL_IS_FTP:        /* ftp://... */
+       case URL_IS_HTTP:       /* http://... */
+           continue;           /* XXX just skip for now */
        }
 
        flp->diskName = xstrdup(s);
index 2497eec..ccca6a2 100644 (file)
@@ -325,9 +325,9 @@ void closeSpec(Spec spec)
 
 int noLang = 0;                /* XXX FIXME: pass as arg */
 
-int parseSpec(Spec *specp, const char *specFile, const char *buildRoot,
-             int inBuildArch, const char *passPhrase, char *cookie,
-             int anyarch, int force)
+int parseSpec(Spec *specp, const char *specFile, const char *rootdir,
+               const char *buildRoot, int inBuildArch, const char *passPhrase,
+               char *cookie, int anyarch, int force)
 {
     int parsePart = PART_PREAMBLE;
     int initialPackage = 1;
@@ -354,12 +354,12 @@ int parseSpec(Spec *specp, const char *specFile, const char *buildRoot,
     spec->anyarch = anyarch;
     spec->force = force;
 
-    if (passPhrase) {
+    if (rootdir && strcmp(rootdir, "/"))
+       spec->rootdir = xstrdup(rootdir);
+    if (passPhrase)
        spec->passPhrase = xstrdup(passPhrase);
-    }
-    if (cookie) {
+    if (cookie)
        spec->cookie = xstrdup(cookie);
-    }
 
     {  const char *timecheck = rpmExpand("%{_timecheck}", NULL);
        if (timecheck && *timecheck != '%') {
@@ -434,7 +434,7 @@ int parseSpec(Spec *specp, const char *specFile, const char *buildRoot,
                    saveArch = xstrdup(saveArch);
                    rpmSetMachine(spec->buildArchitectures[x], NULL);
                    if (parseSpec(&(spec->buildArchitectureSpecs[index]),
-                                 specFile, buildRoot, 1,
+                                 specFile, spec->rootdir, buildRoot, 1,
                                  passPhrase, cookie, anyarch, force)) {
                        spec->buildArchitectureCount = index;
                        freeSpec(spec);
index a874e64..5b5908c 100644 (file)
@@ -139,13 +139,13 @@ int processSourceFiles(Spec spec);
 
 /* global entry points */
 
-int parseSpec(Spec *specp, const char *specFile, const char *buildRoot,
-               int inBuildArch, const char *passPhrase, char *cookie, int anyarch,
-               int force);
+int parseSpec(Spec *specp, const char *specFile, const char *rootdir,
+               const char *buildRoot, int inBuildArch, const char *passPhrase,
+               char *cookie, int anyarch, int force);
 
-extern int (*parseSpecVec) (Spec *specp, const char *specFile, const char *buildRoot,
-               int inBuildArch, const char *passPhrase, char *cookie, int anyarch,
-               int force);     /* XXX FIXME */
+extern int (*parseSpecVec) (Spec *specp, const char *specFile, const char *rootdir,
+               const char *buildRoot, int inBuildArch, const char *passPhrase,
+               char *cookie, int anyarch, int force);  /* XXX FIXME */
 
 int buildSpec(Spec spec, int what, int test);
 
index 70028ec..63d2544 100644 (file)
@@ -115,6 +115,7 @@ struct SpecStruct {
 
     /*@dependent@*/ struct MacroContext *macros;
 
+    /*@only@*/ const char *rootdir;
     /*@only@*/ StringBuf prep;
     /*@only@*/ StringBuf build;
     /*@only@*/ StringBuf install;
index 6acc9e4..2bfce9c 100644 (file)
@@ -413,6 +413,7 @@ Spec newSpec(void)
     spec->readStack->next = NULL;
     spec->readStack->reading = 1;
 
+    spec->rootdir = NULL;
     spec->prep = NULL;
     spec->build = NULL;
     spec->install = NULL;
@@ -430,7 +431,6 @@ Spec newSpec(void)
     
     spec->gotBuildRoot = 0;
     spec->buildRoot = NULL;
-    
     spec->buildSubdir = NULL;
 
     spec->passPhrase = NULL;
index b2796bc..7156e60 100644 (file)
@@ -53,7 +53,7 @@ FD_t fadOpen(const char * path, int flags, int perms)
     fadSetFileSize(fd, Fseek(fd, 0, SEEK_END));
 
     /* is this file brand new? */
-    if (fadGetFileSize(fd) < 0) {
+    if (fadGetFileSize(fd) == 0) {
        newHdr.magic = FA_MAGIC;
        newHdr.firstFree = 0;
        if (Fwrite(&newHdr, sizeof(newHdr), 1, fd) != sizeof(newHdr)) {
@@ -256,6 +256,7 @@ unsigned int fadAlloc(FD_t fd, unsigned int size)
        header.freePrev = header.freeNext = 0;
 
        /* reserve all space up front */
+       /* XXX TODO: check max. no. of bytes to write */
        if (Pwrite(fd, space, size, newBlockOffset) != size)
            return 0;
 
@@ -325,6 +326,7 @@ void fadFree(FD_t fd, unsigned int offset)
     header.freePrev = prevFreeOffset;
     footer.isFree = 1;
 
+    /* XXX TODO: set max. no. of bytes to write */
     (void)Pwrite(fd, &header, sizeof(header), offset);
 
     (void)Pwrite(fd, &footer, sizeof(footer), footerOffset);
@@ -347,6 +349,7 @@ void fadFree(FD_t fd, unsigned int offset)
        faHeader.magic = FA_MAGIC;
        faHeader.firstFree = fadGetFirstFree(fd);
 
+       /* XXX TODO: set max. no. of bytes to write */
        if (Pwrite(fd, &faHeader, sizeof(faHeader), 0) != sizeof(faHeader))
            return;
     }
index 36ab312..dd42f9a 100644 (file)
@@ -69,6 +69,7 @@ int rpmfileexists(const char * filespec) {
     case URL_IS_FTP:
     case URL_IS_HTTP:
     default:
+       return 0;
        break;
     }
 
@@ -355,14 +356,14 @@ char * gidToGname(gid_t gid) {
 }
 
 int makeTempFile(const char * prefix, const char ** fnptr, FD_t * fdptr) {
-    const char * fn;
+    const char * fnpath, * fn;
     FD_t fd;
     int ran;
     struct stat sb, sb2;
 
     if (!prefix) prefix = "";
 
-    fn = NULL;
+    fnpath = NULL;
 
     srand(time(NULL));
     ran = rand() % 100000;
@@ -372,34 +373,46 @@ int makeTempFile(const char * prefix, const char ** fnptr, FD_t * fdptr) {
     do {
        char tfn[32];
        sprintf(tfn, "rpm-tmp.%d", ran++);
-       if (fn) xfree(fn);
-       fn = rpmGetPath(prefix, "%{_tmppath}/", tfn, NULL);
+       if (fnpath)     xfree(fnpath);
+       fnpath = rpmGetPath(prefix, "%{_tmppath}/", tfn, NULL);
+
+       switch (urlIsURL(fnpath)) {
+       case URL_IS_PATH:
+           fn = fnpath + sizeof("file://") - 1;
+           fn = strchr(fn, '/');
+           break;
+       case URL_IS_UNKNOWN:
+           fn = fnpath;
+           break;
+       default:
+           return 1;
+       }
        fd = fdOpen(fn, O_CREAT | O_RDWR | O_EXCL, 0700);
     } while (Ferror(fd) && errno == EEXIST);
 
     if (!stat(fn, &sb) && S_ISLNK(sb.st_mode)) {
-       rpmError(RPMERR_SCRIPT, _("error creating temporary file %s"), fn);
-       xfree(fn);
+       rpmError(RPMERR_SCRIPT, _("error creating temporary file %s"), fnpath);
+       xfree(fnpath);
        return 1;
     }
 
     if (sb.st_nlink != 1) {
-       rpmError(RPMERR_SCRIPT, _("error creating temporary file %s"), fn);
-       xfree(fn);
+       rpmError(RPMERR_SCRIPT, _("error creating temporary file %s"), fnpath);
+       xfree(fnpath);
        return 1;
     }
 
     fstat(Fileno(fd), &sb2);
     if (sb2.st_ino != sb.st_ino || sb2.st_dev != sb.st_dev) {
-       rpmError(RPMERR_SCRIPT, _("error creating temporary file %s"), fn);
-       xfree(fn);
+       rpmError(RPMERR_SCRIPT, _("error creating temporary file %s"), fnpath);
+       xfree(fnpath);
        return 1;
     }
 
     if (fnptr)
-       *fnptr = fn;
+       *fnptr = fnpath;
     else
-       xfree(fn);
+       xfree(fnpath);
     *fdptr = fd;
 
     return 0;
index aa7e8b2..2242db9 100644 (file)
@@ -436,9 +436,9 @@ int showMatches(QVA_t *qva, rpmdb db, dbiIndexSet matches, QVF_t showPackage)
 /*
  * XXX Eliminate linkage loop into librpmbuild.a
  */
-int    (*parseSpecVec) (Spec *specp, const char *specFile, const char *buildRoot,
-                int inBuildArch, const char *passPhrase, char *cookie, int anyarch,
-                int force) = NULL;
+int    (*parseSpecVec) (Spec *specp, const char *specFile, const char *rootdir,
+               const char *buildRoot, int inBuildArch, const char *passPhrase,
+               char *cookie, int anyarch, int force) = NULL;
 void   (*freeSpecVec) (Spec spec) = NULL;
 char   *specedit = NULL;
 
@@ -509,7 +509,7 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg,
        int anyarch = 1;
        int force = 1;
 
-       rc = parseSpecVec(&spec, arg, buildRoot, inBuildArch, passPhrase,
+       rc = parseSpecVec(&spec, arg, "/", buildRoot, inBuildArch, passPhrase,
                cookie, anyarch, force);
        if (rc || spec == NULL) {
            
index edcd075..fc88cc9 100644 (file)
@@ -36,7 +36,7 @@ int rpmdbRebuild(const char * rootdir)
     }
 
     rpmMessage(RPMMESS_DEBUG, _("creating directory: %s\n"), newrootdbpath);
-    if (mkdir(newrootdbpath, 0755)) {
+    if (Mkdir(newrootdbpath, 0755)) {
        rpmError(RPMERR_MKDIR, _("error creating directory %s: %s"),
              newrootdbpath, strerror(errno));
     }
@@ -104,7 +104,7 @@ int rpmdbRebuild(const char * rootdir)
            rc = 1;
            goto exit;
        }
-       if (rmdir(newrootdbpath))
+       if (Rmdir(newrootdbpath))
            rpmMessage(RPMMESS_ERROR, _("failed to remove directory %s: %s\n"),
                        newrootdbpath, strerror(errno));
     }
index a8fe989..090a2e7 100644 (file)
@@ -60,52 +60,6 @@ static void unblockSignals(void)
     sigprocmask(SIG_SETMASK, &signalMask, NULL);
 }
 
-int rpmdbOpenForTraversal(const char * prefix, rpmdb * rpmdbp)
-{
-    const char * dbpath = rpmGetPath("%{_dbpath}", NULL);
-    int rc = 0;
-
-    if (!(dbpath && dbpath[0] != '%')) {
-       rpmMessage(RPMMESS_DEBUG, _("no dbpath has been set"));
-       rc = 1;
-    } else if (openDatabase(prefix, dbpath, rpmdbp, O_RDONLY, 0644, 
-                    RPMDB_FLAG_MINIMAL)) {
-       rc = 1;
-    }
-    xfree(dbpath);
-    return rc;
-}
-
-int rpmdbOpen (const char * prefix, rpmdb *rpmdbp, int mode, int perms)
-{
-    const char * dbpath = rpmGetPath("%{_dbpath}", NULL);
-    int rc;
-
-    if (!(dbpath && dbpath[0] != '%')) {
-       rpmMessage(RPMMESS_DEBUG, _("no dbpath has been set"));
-       rc = 1;
-    } else
-       rc = openDatabase(prefix, dbpath, rpmdbp, mode, perms, 0);
-    xfree(dbpath);
-    return rc;
-}
-
-int rpmdbInit (const char * prefix, int perms)
-{
-    const char * dbpath = rpmGetPath("%{_dbpath}", NULL);
-    rpmdb db;
-    int rc;
-
-    if (!(dbpath && dbpath[0] != '%')) {
-       rpmMessage(RPMMESS_DEBUG, _("no dbpath has been set"));
-       rc = 1;
-    } else
-       rc = openDatabase(prefix, dbpath, &db, O_CREAT | O_RDWR, perms, 
-                       RPMDB_FLAG_JUSTCHECK);
-    xfree(dbpath);
-    return rc;
-}
-
 static int openDbFile(const char * prefix, const char * dbpath, const char * shortName, 
         int justCheck, int mode, int perms, dbiIndex ** db, DBTYPE type)
 {
@@ -158,7 +112,6 @@ int openDatabase(const char * prefix, const char * dbpath, rpmdb *rpmdbp, int mo
     int minimal = flags & RPMDB_FLAG_MINIMAL;
     const char * akey;
 
-fprintf(stderr, "==> openDatabase %s\n", dbpath);
     if (mode & O_WRONLY) 
        return 1;
 
@@ -182,7 +135,7 @@ fprintf(stderr, "==> openDatabase %s\n", dbpath);
 
     switch (urlIsURL(dbpath)) {
     case URL_IS_UNKNOWN:
-       strcpy(filename, prefix); 
+       strcat(filename, prefix); 
        break;
     default:
        break;
@@ -284,6 +237,37 @@ fprintf(stderr, "==> openDatabase %s\n", dbpath);
      return rc;
 }
 
+static int doRpmdbOpen (const char * prefix, rpmdb * rpmdbp,
+                       int mode, int perms, int flags)
+{
+    const char * dbpath = rpmGetPath("%{_dbpath}", NULL);
+    int rc;
+
+    if (!(dbpath && dbpath[0] != '%')) {
+       rpmMessage(RPMMESS_DEBUG, _("no dbpath has been set"));
+       rc = 1;
+    } else
+       rc = openDatabase(prefix, dbpath, rpmdbp, mode, perms, flags);
+    xfree(dbpath);
+    return rc;
+}
+
+int rpmdbOpenForTraversal(const char * prefix, rpmdb * rpmdbp)
+{
+    return doRpmdbOpen(prefix, rpmdbp, O_RDONLY, 0644, RPMDB_FLAG_MINIMAL);
+}
+
+int rpmdbOpen (const char * prefix, rpmdb *rpmdbp, int mode, int perms)
+{
+    return doRpmdbOpen(prefix, rpmdbp, mode, perms, 0);
+}
+
+int rpmdbInit (const char * prefix, int perms)
+{
+    rpmdb db;
+    return doRpmdbOpen(prefix, &db, (O_CREAT | O_RDWR), perms, RPMDB_FLAG_JUSTCHECK);
+}
+
 void rpmdbClose (rpmdb db)
 {
     if (db->pkgs != NULL) Fclose(db->pkgs);
@@ -669,6 +653,7 @@ int rpmdbAdd(rpmdb db, Header dbentry)
     if (!dboffset) {
        rc = 1;
     } else {
+       /* XXX TODO: set max. no. of bytes to write */
        (void)Fseek(db->pkgs, dboffset, SEEK_SET);
        rc = headerWrite(db->pkgs, dbentry, HEADER_MAGIC_NO);
     }
@@ -751,6 +736,7 @@ int rpmdbUpdateRecord(rpmdb db, int offset, Header newHeader)
     } else {
        blockSignals();
 
+       /* XXX TODO: set max. no. of bytes to write */
        (void)Fseek(db->pkgs, offset, SEEK_SET);
 
        rc = headerWrite(db->pkgs, newHeader, HEADER_MAGIC_NO);
@@ -819,7 +805,7 @@ int rpmdbMoveDatabase(const char * rootdir, const char * olddbpath, const char *
     for (rpmdbfnp = rpmdb_filenames; *rpmdbfnp; rpmdbfnp++) {
        sprintf(ofilename, "%s/%s/%s", rootdir, olddbpath, *rpmdbfnp);
        sprintf(nfilename, "%s/%s/%s", rootdir, newdbpath, *rpmdbfnp);
-       if (rename(ofilename, nfilename)) rc = 1;
+       if (Rename(ofilename, nfilename)) rc = 1;
     }
 
     return rc;
index 8aec3d1..034bcf3 100644 (file)
@@ -19,16 +19,16 @@ typedef     /*@abstract@*/ struct _FD {
        long int        fileSize;       /* fadio: */
        long int        fd_cpioPos;     /* cfdio: */
        long int        fd_pos;
-/*@dependent@*/ cookie_io_functions_t *fd_io;
+/*@dependent@*/ cookie_io_functions_t * fd_io;
 } *FD_t;
 
-/*@observer@*/ const char * Fstrerror(FD_t);
+/*@observer@*/ const char * Fstrerror(FD_t fd);
 
-size_t Fread   (/*@out@*/ void *buf, size_t size, size_t nmemb, FD_t fd);
+size_t Fread   (/*@out@*/ void * buf, size_t size, size_t nmemb, FD_t fd);
 size_t Fwrite  (const void *buf, size_t size, size_t nmemb, FD_t fd);
 int    Fseek   (FD_t fd, long int offset, int whence);
 int    Fclose  ( /*@only@*/ FD_t fd);
-FILE * Fopen   (const char *path, const char *fmode);
+FILE * Fopen   (const char * path, const char * fmode);
 
 int    Ferror  (FD_t fd);
 int    Fileno  (FD_t fd);
@@ -36,6 +36,12 @@ int  Fileno  (FD_t fd);
 int    Fcntl   (FD_t, int op, void *lip);
 ssize_t Pread  (FD_t fd, /*@out@*/ void * buf, size_t count, off_t offset);
 ssize_t Pwrite (FD_t fd, const void * buf, size_t count, off_t offset);
+int    Mkdir   (const char * path, mode_t mode);
+int    Chdir   (const char * path);
+int    Rmdir   (const char * path);
+int    Rename  (const char * oldpath, const char * newpath);
+int    Chroot  (const char * path);
+int    Unlink  (const char * path);
 
 #endif /* H_RPMIO */
 
@@ -51,9 +57,9 @@ int timedRead(FD_t fd, /*@out@*/void * bufptr, int length);
 extern /*@only@*/ /*@null@*/ FD_t fdNew(cookie_io_functions_t * iop);
 extern int fdValid(FD_t fd);
 
-extern /*@only@*/ /*@null@*/ FD_t fdOpen(const char *pathname, int flags, mode_t mode);
+extern /*@only@*/ /*@null@*/ FD_t fdOpen(const char * pathname, int flags, mode_t mode);
 extern /*@only@*/ /*@null@*/ FD_t fdDup(int fdno);
-extern /*@dependent@*/ /*@null@*/ FILE *fdFdopen( /*@only@*/ FD_t fd, const char *mode);
+extern /*@dependent@*/ /*@null@*/ FILE *fdFdopen( /*@only@*/ FD_t fd, const char * mode);
 
 /*@observer@*/ const cookie_io_functions_t * fdGetIoCookie(FD_t fd);
 void fdSetIoCookie(FD_t fd, cookie_io_functions_t * io);
@@ -68,7 +74,7 @@ extern cookie_io_functions_t fdio;
  */
 /*@only@*/ FD_t        ufdOpen(const char * pathname, int flags, mode_t mode);
 /*@dependent@*/ void * ufdGetUrlinfo(FD_t fd);
-/*@observer@*/ const char *urlStrerror(const char *url);
+/*@observer@*/ const char * urlStrerror(const char * url);
 
 extern cookie_io_functions_t ufdio;
 
@@ -92,9 +98,9 @@ extern cookie_io_functions_t fadio;
 
 extern /*@dependent@*/ /*@null@*/ gzFile * gzdFileno(FD_t fd);
 
-extern /*@only@*/ /*@null@*/ FD_t gzdOpen(const char *pathname, const char *mode);
+extern /*@only@*/ /*@null@*/ FD_t gzdOpen(const char * pathname, const char * mode);
 
-extern /*@only@*/ /*@null@*/ FD_t gzdFdopen( /*@only@*/ FD_t fd, const char *mode);
+extern /*@only@*/ /*@null@*/ FD_t gzdFdopen( /*@only@*/ FD_t fd, const char * mode);
 
 extern int gzdFlush(FD_t fd);
 
@@ -111,9 +117,9 @@ extern cookie_io_functions_t gzdio;
 
 extern /*@dependent@*/ /*@null@*/ BZFILE * bzdFileno(FD_t fd);
 
-extern /*@only@*/ /*@null@*/ FD_t bzdOpen(const char *pathname, const char *mode);
+extern /*@only@*/ /*@null@*/ FD_t bzdOpen(const char * pathname, const char * mode);
 
-extern /*@only@*/ /*@null@*/ FD_t bzdFdopen( /*@only@*/ FD_t fd, const char *mode);
+extern /*@only@*/ /*@null@*/ FD_t bzdFdopen( /*@only@*/ FD_t fd, const char * mode);
 
 extern int bzdFlush(FD_t fd);
 
index 85e36de..dec6de4 100644 (file)
@@ -1,6 +1,7 @@
 #include "system.h"
 
 #include <rpmlib.h>
+#include <rpmurl.h>
 
 #include "depends.h"
 #include "install.h"
@@ -355,13 +356,21 @@ static int runScript(Header h, const char * root, int progArgc, const char ** pr
            }
        }
 
-       if (strcmp(root, "/")) {
-           /*@-unrecog@*/ chroot(root); /*@=unrecog@*/
+       switch(urlIsURL(root)) {
+       case URL_IS_PATH:
+           root += sizeof("file://") - 1;
+           root = strchr(root, '/');
+           /*@fallthrough@*/
+       case URL_IS_UNKNOWN:
+           if (strcmp(root, "/"))
+               /*@-unrecog@*/ chroot(root); /*@=unrecog@*/
+           chdir("/");
+           execv(argv[0], (char *const *)argv);
+           break;
+       default:
+           break;
        }
 
-       chdir("/");
-
-       execv(argv[0], (char *const *)argv);
        _exit(-1);
        /*@notreached@*/
     }
index bc4f94f..d63e9ed 100644 (file)
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-10-30 17:08-0400\n"
+"POT-Creation-Date: 1999-10-31 16:21-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"
@@ -90,7 +90,7 @@ msgstr ""
 msgid "override build root"
 msgstr ""
 
-#: build.c:374 rpm.c:458
+#: build.c:374 rpm.c:482
 msgid "remove build tree when done"
 msgstr ""
 
@@ -110,7 +110,7 @@ msgstr ""
 msgid "remove specfile when done"
 msgstr ""
 
-#: build.c:384 rpm.c:456
+#: build.c:384 rpm.c:480
 msgid "skip straight to specified stage (only for c,i)"
 msgstr ""
 
@@ -164,1056 +164,1056 @@ msgstr ""
 msgid "no copyright!\n"
 msgstr ""
 
-#: rpm.c:160
+#: rpm.c:184
 #, c-format
 msgid "rpm: %s\n"
 msgstr ""
 
-#: rpm.c:171
+#: rpm.c:195
 #, c-format
 msgid "RPM version %s\n"
 msgstr ""
 
-#: rpm.c:175
+#: rpm.c:199
 msgid "Copyright (C) 1998 - Red Hat Software"
 msgstr ""
 
-#: rpm.c:176
+#: rpm.c:200
 msgid "This may be freely redistributed under the terms of the GNU GPL"
 msgstr ""
 
-#: rpm.c:184
+#: rpm.c:208
 msgid "usage: rpm {--help}"
 msgstr ""
 
-#: rpm.c:185
+#: rpm.c:209
 msgid "       rpm {--version}"
 msgstr ""
 
-#: rpm.c:186
+#: rpm.c:210
 msgid "       rpm {--initdb}   [--dbpath <dir>]"
 msgstr ""
 
-#: rpm.c:187
+#: rpm.c:211
 msgid ""
 "       rpm {--install -i} [-v] [--hash -h] [--percent] [--force] [--test]"
 msgstr ""
 
-#: rpm.c:188
+#: rpm.c:212
 msgid "                        [--replacepkgs] [--replacefiles] [--root <dir>]"
 msgstr ""
 
-#: rpm.c:189
+#: rpm.c:213
 msgid "                        [--excludedocs] [--includedocs] [--noscripts]"
 msgstr ""
 
-#: rpm.c:190
+#: rpm.c:214
 msgid ""
 "                        [--rcfile <file>] [--ignorearch] [--dbpath <dir>]"
 msgstr ""
 
-#: rpm.c:191
+#: rpm.c:215
 msgid ""
 "                        [--prefix <dir>] [--ignoreos] [--nodeps] [--allfiles]"
 msgstr ""
 
-#: rpm.c:192
+#: rpm.c:216
 msgid ""
 "                        [--ftpproxy <host>] [--ftpport <port>] [--justdb]"
 msgstr ""
 
-#: rpm.c:193 rpm.c:202 rpm.c:211
+#: rpm.c:217 rpm.c:226 rpm.c:235
 msgid "                        [--httpproxy <host>] [--httpport <port>] "
 msgstr ""
 
-#: rpm.c:194 rpm.c:204
+#: rpm.c:218 rpm.c:228
 msgid "                        [--noorder] [--relocate oldpath=newpath]"
 msgstr ""
 
-#: rpm.c:195
+#: rpm.c:219
 msgid ""
 "                        [--badreloc] [--notriggers] [--excludepath <path>]"
 msgstr ""
 
-#: rpm.c:196
+#: rpm.c:220
 msgid "                        [--ignoresize] file1.rpm ... fileN.rpm"
 msgstr ""
 
-#: rpm.c:197
+#: rpm.c:221
 msgid ""
 "       rpm {--upgrade -U} [-v] [--hash -h] [--percent] [--force] [--test]"
 msgstr ""
 
-#: rpm.c:198
+#: rpm.c:222
 msgid "                        [--oldpackage] [--root <dir>] [--noscripts]"
 msgstr ""
 
-#: rpm.c:199
+#: rpm.c:223
 msgid ""
 "                        [--excludedocs] [--includedocs] [--rcfile <file>]"
 msgstr ""
 
-#: rpm.c:200
+#: rpm.c:224
 msgid ""
 "                        [--ignorearch]  [--dbpath <dir>] [--prefix <dir>] "
 msgstr ""
 
-#: rpm.c:201
+#: rpm.c:225
 msgid "                        [--ftpproxy <host>] [--ftpport <port>]"
 msgstr ""
 
-#: rpm.c:203
+#: rpm.c:227
 msgid "                        [--ignoreos] [--nodeps] [--allfiles] [--justdb]"
 msgstr ""
 
-#: rpm.c:205
+#: rpm.c:229
 msgid ""
 "                        [--badreloc] [--excludepath <path>] [--ignoresize]"
 msgstr ""
 
-#: rpm.c:206
+#: rpm.c:230
 msgid "                        file1.rpm ... fileN.rpm"
 msgstr ""
 
-#: rpm.c:207
+#: rpm.c:231
 msgid "       rpm {--query -q} [-afpg] [-i] [-l] [-s] [-d] [-c] [-v] [-R]"
 msgstr ""
 
-#: rpm.c:208
+#: rpm.c:232
 msgid "                        [--scripts] [--root <dir>] [--rcfile <file>]"
 msgstr ""
 
-#: rpm.c:209
+#: rpm.c:233
 msgid "                        [--whatprovides] [--whatrequires] [--requires]"
 msgstr ""
 
-#: rpm.c:210
+#: rpm.c:234
 msgid ""
 "                        [--triggeredby] [--ftpuseport] [--ftpproxy <host>]"
 msgstr ""
 
-#: rpm.c:212
+#: rpm.c:236
 msgid ""
 "                        [--ftpport <port>] [--provides] [--triggers] [--dump]"
 msgstr ""
 
-#: rpm.c:213
+#: rpm.c:237
 msgid "                        [--changelog] [--dbpath <dir>] [targets]"
 msgstr ""
 
-#: rpm.c:214
+#: rpm.c:238
 msgid "       rpm {--verify -V -y} [-afpg] [--root <dir>] [--rcfile <file>]"
 msgstr ""
 
-#: rpm.c:215
+#: rpm.c:239
 msgid ""
 "                        [--dbpath <dir>] [--nodeps] [--nofiles] [--noscripts]"
 msgstr ""
 
-#: rpm.c:216
+#: rpm.c:240
 msgid "                        [--nomd5] [targets]"
 msgstr ""
 
-#: rpm.c:217
+#: rpm.c:241
 msgid "       rpm {--setperms} [-afpg] [target]"
 msgstr ""
 
-#: rpm.c:218
+#: rpm.c:242
 msgid "       rpm {--setugids} [-afpg] [target]"
 msgstr ""
 
-#: rpm.c:219
+#: rpm.c:243
 msgid "       rpm {--freshen -F} file1.rpm ... fileN.rpm"
 msgstr ""
 
-#: rpm.c:220
+#: rpm.c:244
 msgid "       rpm {--erase -e} [--root <dir>] [--noscripts] [--rcfile <file>]"
 msgstr ""
 
-#: rpm.c:221
+#: rpm.c:245
 msgid "                        [--dbpath <dir>] [--nodeps] [--allmatches]"
 msgstr ""
 
-#: rpm.c:222
+#: rpm.c:246
 msgid ""
 "                        [--justdb] [--notriggers] rpackage1 ... packageN"
 msgstr ""
 
-#: rpm.c:223
+#: rpm.c:247
 msgid ""
 "       rpm {-b|t}[plciba] [-v] [--short-circuit] [--clean] [--rcfile  <file>]"
 msgstr ""
 
-#: rpm.c:224
+#: rpm.c:248
 msgid "                        [--sign] [--nobuild] [--timecheck <s>] ]"
 msgstr ""
 
-#: rpm.c:225
+#: rpm.c:249
 msgid "                        [--target=platform1[,platform2...]]"
 msgstr ""
 
-#: rpm.c:226
+#: rpm.c:250
 msgid "                        [--rmsource] specfile"
 msgstr ""
 
-#: rpm.c:227
+#: rpm.c:251
 msgid "       rpm {--rmsource} [--rcfile <file>] [-v] specfile"
 msgstr ""
 
-#: rpm.c:228
+#: rpm.c:252
 msgid ""
 "       rpm {--rebuild} [--rcfile <file>] [-v] source1.rpm ... sourceN.rpm"
 msgstr ""
 
-#: rpm.c:229
+#: rpm.c:253
 msgid ""
 "       rpm {--recompile} [--rcfile <file>] [-v] source1.rpm ... sourceN.rpm"
 msgstr ""
 
-#: rpm.c:230
+#: rpm.c:254
 msgid "       rpm {--resign} [--rcfile <file>] package1 package2 ... packageN"
 msgstr ""
 
-#: rpm.c:231
+#: rpm.c:255
 msgid "       rpm {--addsign} [--rcfile <file>] package1 package2 ... packageN"
 msgstr ""
 
-#: rpm.c:232
+#: rpm.c:256
 msgid ""
 "       rpm {--checksig -K} [--nopgp] [--nogpg] [--nomd5] [--rcfile <file>]"
 msgstr ""
 
-#: rpm.c:233
+#: rpm.c:257
 msgid "                           package1 ... packageN"
 msgstr ""
 
-#: rpm.c:234
+#: rpm.c:258
 msgid "       rpm {--rebuilddb} [--rcfile <file>] [--dbpath <dir>]"
 msgstr ""
 
-#: rpm.c:235
+#: rpm.c:259
 msgid "       rpm {--querytags}"
 msgstr ""
 
-#: rpm.c:269
+#: rpm.c:293
 msgid "usage:"
 msgstr ""
 
-#: rpm.c:271
+#: rpm.c:295
 msgid "print this message"
 msgstr ""
 
-#: rpm.c:273
+#: rpm.c:297
 msgid "print the version of rpm being used"
 msgstr ""
 
-#: rpm.c:274
+#: rpm.c:298
 msgid "   all modes support the following arguments:"
 msgstr ""
 
-#: rpm.c:275
+#: rpm.c:299
 msgid "      --rcfile <file>     "
 msgstr ""
 
-#: rpm.c:276
+#: rpm.c:300
 msgid "use <file> instead of /etc/rpmrc and $HOME/.rpmrc"
 msgstr ""
 
-#: rpm.c:278
+#: rpm.c:302
 msgid "be a little more verbose"
 msgstr ""
 
-#: rpm.c:280
+#: rpm.c:304
 msgid "be incredibly verbose (for debugging)"
 msgstr ""
 
-#: rpm.c:282
+#: rpm.c:306
 msgid "query mode"
 msgstr ""
 
-#: rpm.c:283 rpm.c:345 rpm.c:409 rpm.c:437
+#: rpm.c:307 rpm.c:369 rpm.c:433 rpm.c:461
 msgid "      --root <dir>        "
 msgstr ""
 
-#: rpm.c:284 rpm.c:346 rpm.c:410 rpm.c:438 rpm.c:500
+#: rpm.c:308 rpm.c:370 rpm.c:434 rpm.c:462 rpm.c:524
 msgid "use <dir> as the top level directory"
 msgstr ""
 
-#: rpm.c:285 rpm.c:343 rpm.c:373 rpm.c:425 rpm.c:497
+#: rpm.c:309 rpm.c:367 rpm.c:397 rpm.c:449 rpm.c:521
 msgid "      --dbpath <dir>      "
 msgstr ""
 
-#: rpm.c:286 rpm.c:344 rpm.c:374 rpm.c:426 rpm.c:498
+#: rpm.c:310 rpm.c:368 rpm.c:398 rpm.c:450 rpm.c:522
 msgid "use <dir> as the directory for the database"
 msgstr ""
 
-#: rpm.c:287
+#: rpm.c:311
 msgid "      --queryformat <qfmt>"
 msgstr ""
 
-#: rpm.c:288
+#: rpm.c:312
 msgid "use <qfmt> as the header format (implies -i)"
 msgstr ""
 
-#: rpm.c:289
+#: rpm.c:313
 msgid ""
 "   install, upgrade and query (with -p) allow ftp URL's to be used in place"
 msgstr ""
 
-#: rpm.c:290
+#: rpm.c:314
 msgid "   of file names as well as the following options:"
 msgstr ""
 
-#: rpm.c:291
+#: rpm.c:315
 msgid "      --ftpproxy <host>   "
 msgstr ""
 
-#: rpm.c:292
+#: rpm.c:316
 msgid "hostname or IP of ftp proxy"
 msgstr ""
 
-#: rpm.c:293
+#: rpm.c:317
 msgid "      --ftpport <port>    "
 msgstr ""
 
-#: rpm.c:294
+#: rpm.c:318
 msgid "port number of ftp server (or proxy)"
 msgstr ""
 
-#: rpm.c:295
+#: rpm.c:319
 msgid "      --httpproxy <host>   "
 msgstr ""
 
-#: rpm.c:296
+#: rpm.c:320
 msgid "hostname or IP of http proxy"
 msgstr ""
 
-#: rpm.c:297
+#: rpm.c:321
 msgid "      --httpport <port>    "
 msgstr ""
 
-#: rpm.c:298
+#: rpm.c:322
 msgid "port number of http server (or proxy)"
 msgstr ""
 
-#: rpm.c:299
+#: rpm.c:323
 msgid "      Package specification options:"
 msgstr ""
 
-#: rpm.c:301
+#: rpm.c:325
 msgid "query all packages"
 msgstr ""
 
-#: rpm.c:302
+#: rpm.c:326
 msgid "        -f <file>+        "
 msgstr ""
 
-#: rpm.c:303
+#: rpm.c:327
 msgid "query package owning <file>"
 msgstr ""
 
-#: rpm.c:304
+#: rpm.c:328
 msgid "        -p <packagefile>+ "
 msgstr ""
 
-#: rpm.c:305
+#: rpm.c:329
 msgid "query (uninstalled) package <packagefile>"
 msgstr ""
 
-#: rpm.c:306
+#: rpm.c:330
 msgid "        --triggeredby <pkg>"
 msgstr ""
 
-#: rpm.c:307
+#: rpm.c:331
 msgid "query packages triggered by <pkg>"
 msgstr ""
 
-#: rpm.c:308
+#: rpm.c:332
 msgid "        --whatprovides <cap>"
 msgstr ""
 
-#: rpm.c:309
+#: rpm.c:333
 msgid "query packages which provide <cap> capability"
 msgstr ""
 
-#: rpm.c:310
+#: rpm.c:334
 msgid "        --whatrequires <cap>"
 msgstr ""
 
-#: rpm.c:311
+#: rpm.c:335
 msgid "query packages which require <cap> capability"
 msgstr ""
 
-#: rpm.c:312
+#: rpm.c:336
 msgid "      Information selection options:"
 msgstr ""
 
-#: rpm.c:314
+#: rpm.c:338
 msgid "display package information"
 msgstr ""
 
-#: rpm.c:316
+#: rpm.c:340
 msgid "display the package's change log"
 msgstr ""
 
-#: rpm.c:318
+#: rpm.c:342
 msgid "display package file list"
 msgstr ""
 
-#: rpm.c:320
+#: rpm.c:344
 msgid "show file states (implies -l)"
 msgstr ""
 
-#: rpm.c:322
+#: rpm.c:346
 msgid "list only documentation files (implies -l)"
 msgstr ""
 
-#: rpm.c:324
+#: rpm.c:348
 msgid "list only configuration files (implies -l)"
 msgstr ""
 
-#: rpm.c:326
+#: rpm.c:350
 msgid ""
 "show all verifiable information for each file (must be used with -l, -c, or "
 "-d)"
 msgstr ""
 
-#: rpm.c:328
+#: rpm.c:352
 msgid "list capabilities package provides"
 msgstr ""
 
-#: rpm.c:329
+#: rpm.c:353
 msgid "        --requires"
 msgstr ""
 
-#: rpm.c:331
+#: rpm.c:355
 msgid "list package dependencies"
 msgstr ""
 
-#: rpm.c:333
+#: rpm.c:357
 msgid "print the various [un]install scripts"
 msgstr ""
 
-#: rpm.c:335
+#: rpm.c:359
 msgid "show the trigger scripts contained in the package"
 msgstr ""
 
-#: rpm.c:339
+#: rpm.c:363
 msgid "    --pipe <cmd>          "
 msgstr ""
 
-#: rpm.c:340
+#: rpm.c:364
 msgid "send stdout to <cmd>"
 msgstr ""
 
-#: rpm.c:342
+#: rpm.c:366
 msgid ""
 "verify a package installation using the same same package specification "
 "options as -q"
 msgstr ""
 
-#: rpm.c:348 rpm.c:396 rpm.c:430
+#: rpm.c:372 rpm.c:420 rpm.c:454
 msgid "do not verify package dependencies"
 msgstr ""
 
-#: rpm.c:350
+#: rpm.c:374
 msgid "do not verify file md5 checksums"
 msgstr ""
 
-#: rpm.c:352
+#: rpm.c:376
 msgid "do not verify file attributes"
 msgstr ""
 
-#: rpm.c:355
+#: rpm.c:379
 msgid ""
 "set the file permissions to those in the package database using the same "
 "package specification options as -q"
 msgstr ""
 
-#: rpm.c:358
+#: rpm.c:382
 msgid ""
 "set the file owner and group to those in the package database using the same "
 "package specification options as -q"
 msgstr ""
 
-#: rpm.c:362
+#: rpm.c:386
 msgid "    --install <packagefile>"
 msgstr ""
 
-#: rpm.c:363
+#: rpm.c:387
 msgid "    -i <packagefile>      "
 msgstr ""
 
-#: rpm.c:364
+#: rpm.c:388
 msgid "install package"
 msgstr ""
 
-#: rpm.c:365
+#: rpm.c:389
 msgid "      --excludepath <path>"
 msgstr ""
 
-#: rpm.c:366
+#: rpm.c:390
 msgid "skip files in path <path>"
 msgstr ""
 
-#: rpm.c:367
+#: rpm.c:391
 msgid "      --relocate <oldpath>=<newpath>"
 msgstr ""
 
-#: rpm.c:368
+#: rpm.c:392
 msgid "relocate files from <oldpath> to <newpath>"
 msgstr ""
 
-#: rpm.c:370
+#: rpm.c:394
 msgid "relocate files even though the package doesn't allow it"
 msgstr ""
 
-#: rpm.c:371
+#: rpm.c:395
 msgid "      --prefix <dir>      "
 msgstr ""
 
-#: rpm.c:372
+#: rpm.c:396
 msgid "relocate the package to <dir>, if relocatable"
 msgstr ""
 
-#: rpm.c:376
+#: rpm.c:400
 msgid "do not install documentation"
 msgstr ""
 
-#: rpm.c:378
+#: rpm.c:402
 msgid "short hand for --replacepkgs --replacefiles"
 msgstr ""
 
-#: rpm.c:381
+#: rpm.c:405
 msgid "print hash marks as package installs (good with -v)"
 msgstr ""
 
-#: rpm.c:383
+#: rpm.c:407
 msgid "install all files, even configurations which might otherwise be skipped"
 msgstr ""
 
-#: rpm.c:386
+#: rpm.c:410
 msgid "don't verify package architecture"
 msgstr ""
 
-#: rpm.c:388
+#: rpm.c:412
 msgid "don't check disk space before installing"
 msgstr ""
 
-#: rpm.c:390
+#: rpm.c:414
 msgid "don't verify package operating system"
 msgstr ""
 
-#: rpm.c:392
+#: rpm.c:416
 msgid "install documentation"
 msgstr ""
 
-#: rpm.c:394 rpm.c:428
+#: rpm.c:418 rpm.c:452
 msgid "update the database, but do not modify the filesystem"
 msgstr ""
 
-#: rpm.c:398 rpm.c:432
+#: rpm.c:422 rpm.c:456
 msgid "do not reorder package installation to satisfy dependencies"
 msgstr ""
 
-#: rpm.c:400
+#: rpm.c:424
 msgid "don't execute any installation scripts"
 msgstr ""
 
-#: rpm.c:402 rpm.c:436
+#: rpm.c:426 rpm.c:460
 msgid "don't execute any scripts triggered by this package"
 msgstr ""
 
-#: rpm.c:404
+#: rpm.c:428
 msgid "print percentages as package installs"
 msgstr ""
 
-#: rpm.c:406
+#: rpm.c:430
 msgid "install even if the package replaces installed files"
 msgstr ""
 
-#: rpm.c:408
+#: rpm.c:432
 msgid "reinstall if the package is already present"
 msgstr ""
 
-#: rpm.c:412
+#: rpm.c:436
 msgid "don't install, but tell if it would work or not"
 msgstr ""
 
-#: rpm.c:414
+#: rpm.c:438
 msgid "    --upgrade <packagefile>"
 msgstr ""
 
-#: rpm.c:415
+#: rpm.c:439
 msgid "    -U <packagefile>      "
 msgstr ""
 
-#: rpm.c:416
+#: rpm.c:440
 msgid "upgrade package (same options as --install, plus)"
 msgstr ""
 
-#: rpm.c:418
+#: rpm.c:442
 msgid ""
 "upgrade to an old version of the package (--force on upgrades does this "
 "automatically)"
 msgstr ""
 
-#: rpm.c:420
+#: rpm.c:444
 msgid "    --erase <package>"
 msgstr ""
 
-#: rpm.c:422
+#: rpm.c:446
 msgid "erase (uninstall) package"
 msgstr ""
 
-#: rpm.c:424
+#: rpm.c:448
 msgid ""
 "remove all packages which match <package> (normally an error is generated if "
 "<package> specified multiple packages)"
 msgstr ""
 
-#: rpm.c:434
+#: rpm.c:458
 msgid "do not execute any package specific scripts"
 msgstr ""
 
-#: rpm.c:440
+#: rpm.c:464
 msgid "    -b<stage> <spec>      "
 msgstr ""
 
-#: rpm.c:441
+#: rpm.c:465
 msgid "    -t<stage> <tarball>   "
 msgstr ""
 
-#: rpm.c:442
+#: rpm.c:466
 msgid "build package, where <stage> is one of:"
 msgstr ""
 
-#: rpm.c:444
+#: rpm.c:468
 msgid "prep (unpack sources and apply patches)"
 msgstr ""
 
-#: rpm.c:446
+#: rpm.c:470
 #, c-format
 msgid "list check (do some cursory checks on %files)"
 msgstr ""
 
-#: rpm.c:448
+#: rpm.c:472
 msgid "compile (prep and compile)"
 msgstr ""
 
-#: rpm.c:450
+#: rpm.c:474
 msgid "install (prep, compile, install)"
 msgstr ""
 
-#: rpm.c:452
+#: rpm.c:476
 msgid "binary package (prep, compile, install, package)"
 msgstr ""
 
-#: rpm.c:454
+#: rpm.c:478
 msgid "bin/src package (prep, compile, install, package)"
 msgstr ""
 
-#: rpm.c:460
+#: rpm.c:484
 msgid "remove sources and spec file when done"
 msgstr ""
 
-#: rpm.c:462
+#: rpm.c:486
 msgid "generate PGP/GPG signature"
 msgstr ""
 
-#: rpm.c:463
+#: rpm.c:487
 msgid "      --buildroot <dir>   "
 msgstr ""
 
-#: rpm.c:464
+#: rpm.c:488
 msgid "use <dir> as the build root"
 msgstr ""
 
-#: rpm.c:465
+#: rpm.c:489
 msgid "      --target=<platform>+"
 msgstr ""
 
-#: rpm.c:466
+#: rpm.c:490
 msgid "build the packages for the build targets platform1...platformN."
 msgstr ""
 
-#: rpm.c:468
+#: rpm.c:492
 msgid "do not execute any stages"
 msgstr ""
 
-#: rpm.c:469
+#: rpm.c:493
 msgid "      --timecheck <secs>  "
 msgstr ""
 
-#: rpm.c:470
+#: rpm.c:494
 msgid "set the time check to <secs> seconds (0 disables)"
 msgstr ""
 
-#: rpm.c:472
+#: rpm.c:496
 msgid "    --rebuild <src_pkg>   "
 msgstr ""
 
-#: rpm.c:473
+#: rpm.c:497
 msgid ""
 "install source package, build binary package and remove spec file, sources, "
 "patches, and icons."
 msgstr ""
 
-#: rpm.c:474
+#: rpm.c:498
 msgid "    --rmsource <spec>     "
 msgstr ""
 
-#: rpm.c:475
+#: rpm.c:499
 msgid "remove sources and spec file"
 msgstr ""
 
-#: rpm.c:476
+#: rpm.c:500
 msgid "    --recompile <src_pkg> "
 msgstr ""
 
-#: rpm.c:477
+#: rpm.c:501
 msgid "like --rebuild, but don't build any package"
 msgstr ""
 
-#: rpm.c:478
+#: rpm.c:502
 msgid "    --resign <pkg>+       "
 msgstr ""
 
-#: rpm.c:479
+#: rpm.c:503
 msgid "sign a package (discard current signature)"
 msgstr ""
 
-#: rpm.c:480
+#: rpm.c:504
 msgid "    --addsign <pkg>+      "
 msgstr ""
 
-#: rpm.c:481
+#: rpm.c:505
 msgid "add a signature to a package"
 msgstr ""
 
-#: rpm.c:483
+#: rpm.c:507
 msgid "    --checksig <pkg>+     "
 msgstr ""
 
-#: rpm.c:484
+#: rpm.c:508
 msgid "verify package signature"
 msgstr ""
 
-#: rpm.c:486
+#: rpm.c:510
 msgid "skip any PGP signatures"
 msgstr ""
 
-#: rpm.c:488
+#: rpm.c:512
 msgid "skip any GPG signatures"
 msgstr ""
 
-#: rpm.c:490
+#: rpm.c:514
 msgid "skip any MD5 signatures"
 msgstr ""
 
-#: rpm.c:492
+#: rpm.c:516
 msgid "list the tags that can be used in a query format"
 msgstr ""
 
-#: rpm.c:494
+#: rpm.c:518
 msgid "make sure a valid database exists"
 msgstr ""
 
-#: rpm.c:496
+#: rpm.c:520
 msgid "rebuild database from existing database"
 msgstr ""
 
-#: rpm.c:641 rpm.c:647 rpm.c:654 rpm.c:660 rpm.c:669 rpm.c:676 rpm.c:723
-#: rpm.c:729 rpm.c:763 rpm.c:769 rpm.c:775 rpm.c:783 rpm.c:824 rpm.c:879
-#: rpm.c:886
+#: rpm.c:665 rpm.c:671 rpm.c:678 rpm.c:684 rpm.c:693 rpm.c:700 rpm.c:747
+#: rpm.c:753 rpm.c:787 rpm.c:793 rpm.c:799 rpm.c:807 rpm.c:848 rpm.c:903
+#: rpm.c:910
 msgid "only one major mode may be specified"
 msgstr ""
 
-#: rpm.c:662
+#: rpm.c:686
 msgid "-u and --uninstall are deprecated and no longer work.\n"
 msgstr ""
 
-#: rpm.c:664
+#: rpm.c:688
 msgid "Use -e or --erase instead.\n"
 msgstr ""
 
-#: rpm.c:680
+#: rpm.c:704
 msgid "--build (-b) requires one of a,b,i,c,p,l as its sole argument"
 msgstr ""
 
-#: rpm.c:684
+#: rpm.c:708
 msgid "--tarbuild (-t) requires one of a,b,i,c,p,l as its sole argument"
 msgstr ""
 
-#: rpm.c:736 rpm.c:742 rpm.c:749 rpm.c:756 rpm.c:893
+#: rpm.c:760 rpm.c:766 rpm.c:773 rpm.c:780 rpm.c:917
 msgid "one type of query/verify may be performed at a time"
 msgstr ""
 
-#: rpm.c:793
+#: rpm.c:817
 msgid "arguments to --dbpath must begin with a /"
 msgstr ""
 
-#: rpm.c:830
+#: rpm.c:854
 msgid "relocations must begin with a /"
 msgstr ""
 
-#: rpm.c:832
+#: rpm.c:856
 msgid "relocations must contain a ="
 msgstr ""
 
-#: rpm.c:835
+#: rpm.c:859
 msgid "relocations must have a / following the ="
 msgstr ""
 
-#: rpm.c:844
+#: rpm.c:868
 msgid "exclude paths must begin with a /"
 msgstr ""
 
-#: rpm.c:853
+#: rpm.c:877
 #, c-format
 msgid "Internal error in argument processing (%d) :-(\n"
 msgstr ""
 
-#: rpm.c:907
+#: rpm.c:928
 msgid "--dbpath given for operation that does not use a database"
 msgstr ""
 
-#: rpm.c:912
+#: rpm.c:932
 msgid "--timecheck may only be used during package builds"
 msgstr ""
 
-#: rpm.c:915
+#: rpm.c:935
 msgid "unexpected query flags"
 msgstr ""
 
-#: rpm.c:918
+#: rpm.c:938
 msgid "unexpected query format"
 msgstr ""
 
-#: rpm.c:922
+#: rpm.c:941
 msgid "unexpected query source"
 msgstr ""
 
-#: rpm.c:928
+#: rpm.c:947
 msgid "only installation, upgrading, rmsource and rmspec may be forced"
 msgstr ""
 
-#: rpm.c:931
+#: rpm.c:950
 msgid "files may only be relocated during package installation"
 msgstr ""
 
-#: rpm.c:934
+#: rpm.c:953
 msgid "only one of --prefix or --relocate may be used"
 msgstr ""
 
-#: rpm.c:937
+#: rpm.c:956
 msgid ""
 "--relocate and --excludepath may only be used when installing new packages"
 msgstr ""
 
-#: rpm.c:940
+#: rpm.c:959
 msgid "--prefix may only be used when installing new packages"
 msgstr ""
 
-#: rpm.c:943
+#: rpm.c:962
 msgid "arguments to --prefix must begin with a /"
 msgstr ""
 
-#: rpm.c:946
+#: rpm.c:965
 msgid "--hash (-h) may only be specified during package installation"
 msgstr ""
 
-#: rpm.c:950
+#: rpm.c:969
 msgid "--percent may only be specified during package installation"
 msgstr ""
 
-#: rpm.c:954
+#: rpm.c:973
 msgid "--replacefiles may only be specified during package installation"
 msgstr ""
 
-#: rpm.c:958
+#: rpm.c:977
 msgid "--replacepkgs may only be specified during package installation"
 msgstr ""
 
-#: rpm.c:962
+#: rpm.c:981
 msgid "--excludedocs may only be specified during package installation"
 msgstr ""
 
-#: rpm.c:966
+#: rpm.c:985
 msgid "--includedocs may only be specified during package installation"
 msgstr ""
 
-#: rpm.c:970
+#: rpm.c:989
 msgid "only one of --excludedocs and --includedocs may be specified"
 msgstr ""
 
-#: rpm.c:974
+#: rpm.c:993
 msgid "--ignorearch may only be specified during package installation"
 msgstr ""
 
-#: rpm.c:978
+#: rpm.c:997
 msgid "--ignoreos may only be specified during package installation"
 msgstr ""
 
-#: rpm.c:982
+#: rpm.c:1001
 msgid "--ignoresize may only be specified during package installation"
 msgstr ""
 
-#: rpm.c:986
+#: rpm.c:1005
 msgid "--allmatches may only be specified during package erasure"
 msgstr ""
 
-#: rpm.c:990
+#: rpm.c:1009
 msgid "--allfiles may only be specified during package installation"
 msgstr ""
 
-#: rpm.c:994
+#: rpm.c:1013
 msgid "--justdb may only be specified during package installation and erasure"
 msgstr ""
 
-#: rpm.c:999
+#: rpm.c:1018
 msgid ""
 "--noscripts may only be specified during package installation, erasure, and "
 "verification"
 msgstr ""
 
-#: rpm.c:1003
+#: rpm.c:1022
 msgid ""
 "--notriggers may only be specified during package installation, erasure, and "
 "verification"
 msgstr ""
 
-#: rpm.c:1009
+#: rpm.c:1026
 msgid ""
 "--nodeps may only be specified during package building, installation, "
 "erasure, and verification"
 msgstr ""
 
-#: rpm.c:1014
+#: rpm.c:1030
 msgid ""
 "--test may only be specified during package installation, erasure, and "
 "building"
 msgstr ""
 
-#: rpm.c:1019
+#: rpm.c:1034
 msgid ""
 "--root (-r) may only be specified during installation, erasure, querying, "
 "and database rebuilds"
 msgstr ""
 
-#: rpm.c:1024
+#: rpm.c:1046
 msgid "arguments to --root (-r) must begin with a /"
 msgstr ""
 
-#: rpm.c:1027
+#: rpm.c:1052
 msgid "--oldpackage may only be used during upgrades"
 msgstr ""
 
-#: rpm.c:1032
+#: rpm.c:1057
 msgid ""
 "ftp options can only be used during package queries, installs, and upgrades"
 msgstr ""
 
-#: rpm.c:1038
+#: rpm.c:1063
 msgid ""
 "http options can only be used during package queries, installs, and upgrades"
 msgstr ""
 
-#: rpm.c:1042
+#: rpm.c:1067
 msgid "--nopgp may only be used during signature checking"
 msgstr ""
 
-#: rpm.c:1045
+#: rpm.c:1070
 msgid "--nogpg may only be used during signature checking"
 msgstr ""
 
-#: rpm.c:1048
+#: rpm.c:1073
 msgid ""
 "--nomd5 may only be used during signature checking and package verification"
 msgstr ""
 
-#: rpm.c:1072
+#: rpm.c:1097
 msgid "no files to sign\n"
 msgstr ""
 
-#: rpm.c:1077
+#: rpm.c:1102
 #, c-format
 msgid "cannot access file %s\n"
 msgstr ""
 
-#: rpm.c:1092
+#: rpm.c:1117
 msgid "pgp not found: "
 msgstr ""
 
-#: rpm.c:1096
+#: rpm.c:1121
 msgid "Enter pass phrase: "
 msgstr ""
 
-#: rpm.c:1098
+#: rpm.c:1123
 msgid "Pass phrase check failed\n"
 msgstr ""
 
-#: rpm.c:1101
+#: rpm.c:1126
 msgid "Pass phrase is good.\n"
 msgstr ""
 
-#: rpm.c:1106
+#: rpm.c:1131
 msgid "Invalid %%_signature spec in macro file.\n"
 msgstr ""
 
-#: rpm.c:1112
+#: rpm.c:1137
 msgid "--sign may only be used during package building"
 msgstr ""
 
-#: rpm.c:1127
+#: rpm.c:1152
 msgid "exec failed\n"
 msgstr ""
 
-#: rpm.c:1146
+#: rpm.c:1171
 msgid "unexpected arguments to --querytags "
 msgstr ""
 
-#: rpm.c:1157
+#: rpm.c:1182
 msgid "no packages given for signature check"
 msgstr ""
 
-#: rpm.c:1168
+#: rpm.c:1193
 msgid "no packages given for signing"
 msgstr ""
 
-#: rpm.c:1180
+#: rpm.c:1205
 msgid "no packages files given for rebuild"
 msgstr ""
 
-#: rpm.c:1242
+#: rpm.c:1268
 msgid "no spec files given for build"
 msgstr ""
 
-#: rpm.c:1244
+#: rpm.c:1270
 msgid "no tar files given for build"
 msgstr ""
 
-#: rpm.c:1259
+#: rpm.c:1286
 msgid "no packages given for uninstall"
 msgstr ""
 
-#: rpm.c:1309
+#: rpm.c:1336
 msgid "no packages given for install"
 msgstr ""
 
-#: rpm.c:1332
+#: rpm.c:1359
 msgid "extra arguments given for query of all packages"
 msgstr ""
 
-#: rpm.c:1337
+#: rpm.c:1364
 msgid "no arguments given for query"
 msgstr ""
 
-#: rpm.c:1354
+#: rpm.c:1381
 msgid "extra arguments given for verify of all packages"
 msgstr ""
 
-#: rpm.c:1358
+#: rpm.c:1385
 msgid "no arguments given for verify"
 msgstr ""
 
@@ -1225,21 +1225,21 @@ msgstr ""
 msgid "error reading header from package\n"
 msgstr ""
 
-#: build/build.c:83 build/pack.c:272
+#: build/build.c:84 build/pack.c:272
 msgid "Unable to open temp file"
 msgstr ""
 
-#: build/build.c:124
+#: build/build.c:122
 #, c-format
 msgid "Executing: %s\n"
 msgstr ""
 
-#: build/build.c:128
+#: build/build.c:142
 #, c-format
 msgid "Exec of %s failed (%s)"
 msgstr ""
 
-#: build/build.c:138
+#: build/build.c:148
 #, c-format
 msgid "Bad exit status from %s (%s)"
 msgstr ""
@@ -2239,7 +2239,7 @@ msgstr ""
 msgid "(unknown type)"
 msgstr ""
 
-#: lib/install.c:141 lib/uninstall.c:193
+#: lib/install.c:141 lib/uninstall.c:194
 #, c-format
 msgid "   file: %s action: %s\n"
 msgstr ""
@@ -2307,7 +2307,7 @@ msgstr ""
 msgid "renaming %s to %s\n"
 msgstr ""
 
-#: lib/install.c:529 lib/install.c:807 lib/uninstall.c:26
+#: lib/install.c:529 lib/install.c:807 lib/uninstall.c:27
 #, c-format
 msgid "rename of %s to %s failed: %s"
 msgstr ""
@@ -2446,7 +2446,7 @@ msgstr ""
 msgid "internal error (rpm bug?): "
 msgstr ""
 
-#: lib/misc.c:381 lib/misc.c:387 lib/misc.c:394
+#: lib/misc.c:394 lib/misc.c:400 lib/misc.c:407
 #, c-format
 msgid "error creating temporary file %s"
 msgstr ""
@@ -2734,7 +2734,7 @@ msgstr ""
 msgid "rebuilding database in rootdir %s\n"
 msgstr ""
 
-#: lib/rebuilddb.c:24 lib/rpmdb.c:69 lib/rpmdb.c:85 lib/rpmdb.c:100
+#: lib/rebuilddb.c:24 lib/rpmdb.c:247
 msgid "no dbpath has been set"
 msgstr ""
 
@@ -2873,106 +2873,106 @@ msgstr ""
 msgid "OK"
 msgstr ""
 
-#: lib/rpmdb.c:192
+#: lib/rpmdb.c:145
 #, c-format
 msgid "opening database mode 0x%x in %s\n"
 msgstr ""
 
 #. XXX Fstrerror
-#: lib/rpmdb.c:203 lib/url.c:342
+#: lib/rpmdb.c:156 lib/url.c:342
 #, c-format
 msgid "failed to open %s\n"
 msgstr ""
 
-#: lib/rpmdb.c:216 lib/rpmdb.c:224
+#: lib/rpmdb.c:169 lib/rpmdb.c:177
 #, c-format
 msgid "cannot get %s lock on database"
 msgstr ""
 
-#: lib/rpmdb.c:217
+#: lib/rpmdb.c:170
 msgid "exclusive"
 msgstr ""
 
-#: lib/rpmdb.c:225
+#: lib/rpmdb.c:178
 msgid "shared"
 msgstr ""
 
-#: lib/rpmdb.c:256
+#: lib/rpmdb.c:209
 msgid ""
 "old format database is present; use --rebuilddb to generate a new format "
 "database"
 msgstr ""
 
-#: lib/rpmdb.c:478
+#: lib/rpmdb.c:462
 #, c-format
 msgid "package %s not listed in %s"
 msgstr ""
 
-#: lib/rpmdb.c:489
+#: lib/rpmdb.c:473
 #, c-format
 msgid "package %s not found in %s"
 msgstr ""
 
-#: lib/rpmdb.c:513 lib/uninstall.c:85
+#: lib/rpmdb.c:497 lib/uninstall.c:86
 #, c-format
 msgid "cannot read header at %d for uninstall"
 msgstr ""
 
-#: lib/rpmdb.c:521
+#: lib/rpmdb.c:505
 msgid "package has no name"
 msgstr ""
 
-#: lib/rpmdb.c:523
+#: lib/rpmdb.c:507
 msgid "removing name index\n"
 msgstr ""
 
-#: lib/rpmdb.c:528
+#: lib/rpmdb.c:512
 msgid "package has no group\n"
 msgstr ""
 
-#: lib/rpmdb.c:530
+#: lib/rpmdb.c:514
 msgid "removing group index\n"
 msgstr ""
 
-#: lib/rpmdb.c:537
+#: lib/rpmdb.c:521
 #, c-format
 msgid "removing provides index for %s\n"
 msgstr ""
 
-#: lib/rpmdb.c:552
+#: lib/rpmdb.c:536
 #, c-format
 msgid "removing requiredby index for %s\n"
 msgstr ""
 
-#: lib/rpmdb.c:564
+#: lib/rpmdb.c:548
 #, c-format
 msgid "removing trigger index for %s\n"
 msgstr ""
 
-#: lib/rpmdb.c:575
+#: lib/rpmdb.c:559
 #, c-format
 msgid "removing conflict index for %s\n"
 msgstr ""
 
-#: lib/rpmdb.c:586
+#: lib/rpmdb.c:570
 #, c-format
 msgid "removing file index for %s\n"
 msgstr ""
 
-#: lib/rpmdb.c:595
+#: lib/rpmdb.c:579
 msgid "package has no files\n"
 msgstr ""
 
-#: lib/rpmdb.c:677
+#: lib/rpmdb.c:662
 msgid "cannot allocate space for database"
 msgstr ""
 
-#: lib/rpmdb.c:736
+#: lib/rpmdb.c:721
 #, c-format
 msgid "cannot read header at %d for update"
 msgstr ""
 
-#: lib/rpmdb.c:745
+#: lib/rpmdb.c:730
 msgid "header changed size!"
 msgstr ""
 
@@ -3337,40 +3337,40 @@ msgstr ""
 msgid "%s skipped due to missingok flag\n"
 msgstr ""
 
-#: lib/uninstall.c:37
+#: lib/uninstall.c:38
 #, c-format
 msgid "cannot remove %s - directory not empty"
 msgstr ""
 
-#: lib/uninstall.c:40
+#: lib/uninstall.c:41
 #, c-format
 msgid "rmdir of %s failed: %s"
 msgstr ""
 
-#: lib/uninstall.c:48
+#: lib/uninstall.c:49
 #, c-format
 msgid "removal of %s failed: %s"
 msgstr ""
 
-#: lib/uninstall.c:97
+#: lib/uninstall.c:98
 #, c-format
 msgid "cannot read packages named %s for uninstall"
 msgstr ""
 
-#: lib/uninstall.c:130
+#: lib/uninstall.c:131
 #, c-format
 msgid "will remove files test = %d\n"
 msgstr ""
 
-#: lib/uninstall.c:207
+#: lib/uninstall.c:208
 msgid "running postuninstall script (if any)\n"
 msgstr ""
 
-#: lib/uninstall.c:220
+#: lib/uninstall.c:221
 msgid "removing database entry\n"
 msgstr ""
 
-#: lib/uninstall.c:381
+#: lib/uninstall.c:390
 msgid "execution of script failed"
 msgstr ""
 
diff --git a/rpm.c b/rpm.c
index 6ae7eb5..caf3890 100755 (executable)
--- a/rpm.c
+++ b/rpm.c
 #define        GETOPT_DEFINEMACRO      1020
 #define        GETOPT_EVALMACRO        1021
 
-enum modes { MODE_QUERY, MODE_INSTALL, MODE_UNINSTALL, MODE_VERIFY,
-            MODE_BUILD, MODE_REBUILD, MODE_CHECKSIG, MODE_RESIGN,
-            MODE_RECOMPILE, MODE_QUERYTAGS, MODE_INITDB, MODE_TARBUILD,
-            MODE_REBUILDDB, MODE_UNKNOWN };
+enum modes {
+    MODE_UNKNOWN       = 0,
+    MODE_QUERY         = (1 <<  0),
+    MODE_INSTALL       = (1 <<  1),
+    MODE_UNINSTALL     = (1 <<  2),
+    MODE_VERIFY                = (1 <<  3),
+    MODE_BUILD         = (1 <<  4),
+    MODE_REBUILD       = (1 <<  5),
+    MODE_CHECKSIG      = (1 <<  6),
+    MODE_RESIGN                = (1 <<  7),
+    MODE_RECOMPILE     = (1 <<  8),
+    MODE_QUERYTAGS     = (1 <<  9),
+    MODE_INITDB                = (1 << 10),
+    MODE_TARBUILD      = (1 << 11),
+    MODE_REBUILDDB     = (1 << 12)
+};
+
+#define        MODES_QV (MODE_QUERY | MODE_VERIFY)
+#define        MODES_BT (MODE_BUILD | MODE_TARBUILD | MODE_REBUILD | MODE_RECOMPILE)
+#define        MODES_IE (MODE_INSTALL | MODE_UNINSTALL)
+#define        MODES_DB (MODE_INITDB | MODE_REBUILDDB)
+#define        MODES_K  (MODE_CHECKSIG | MODES_RESIGN)
+
+#define        MODES_FOR_DBPATH        (MODES_BT | MODES_IE | MODES_QV | MODES_DB)
+#define        MODES_FOR_TIMECHECK     (MODES_BT)
+#define        MODES_FOR_NODEPS        (MODES_BT | MODES_IE | MODE_VERIFY)
+#define        MODES_FOR_TEST          (MODES_BT | MODES_IE)
+#define        MODES_FOR_ROOT          (MODES_BT | MODES_IE | MODES_QV | MODES_DB)
 
 /* the flags for the various options */
 static int allFiles;
@@ -900,25 +924,20 @@ int main(int argc, const char ** argv)
        argerror("--buildroot may only be used during package builds");
     }
 
-    if (bigMode != MODE_QUERY && bigMode != MODE_INSTALL && 
-       bigMode != MODE_UNINSTALL && bigMode != MODE_VERIFY &&
-       bigMode != MODE_INITDB && bigMode != MODE_REBUILDDB &&
-       bigMode != MODE_REBUILD && gotDbpath)
+    if (gotDbpath && (bigMode & ~MODES_FOR_DBPATH))
        argerror(_("--dbpath given for operation that does not use a "
                        "database"));
 
-    if (timeCheck && bigMode != MODE_BUILD && bigMode != MODE_REBUILD &&
-       bigMode != MODE_RECOMPILE && bigMode != MODE_TARBUILD) 
+    if (timeCheck && (bigMode & ~MODES_FOR_TIMECHECK))
        argerror(_("--timecheck may only be used during package builds"));
     
-    if (!(bigMode == MODE_QUERY || bigMode == MODE_VERIFY) && qva->qva_flags
+    if (qva->qva_flags && (bigMode & ~MODES_QV)
        argerror(_("unexpected query flags"));
 
-    if (bigMode != MODE_QUERY && qva->qva_queryFormat
+    if (qva->qva_queryFormat && (bigMode & ~MODES_QV)
        argerror(_("unexpected query format"));
 
-    if (bigMode != MODE_QUERY && bigMode != MODE_VERIFY &&
-       QVSource != RPMQV_PACKAGE) 
+    if (QVSource != RPMQV_PACKAGE && (bigMode & ~MODES_QV)) 
        argerror(_("unexpected query source"));
 
     if (!(bigMode == MODE_INSTALL ||
@@ -1003,25 +1022,31 @@ int main(int argc, const char ** argv)
        argerror(_("--notriggers may only be specified during package "
                   "installation, erasure, and verification"));
 
-    if (bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL && 
-       bigMode != MODE_BUILD && bigMode != MODE_TARBUILD &&
-       bigMode != MODE_VERIFY && noDeps)
+    if (noDeps & (bigMode & ~MODES_FOR_NODEPS))
        argerror(_("--nodeps may only be specified during package "
                   "building, installation, erasure, and verification"));
 
-    if (bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL &&
-       bigMode != MODE_BUILD && bigMode != MODE_TARBUILD && test )
+    if (test && (bigMode & ~MODES_FOR_TEST))
        argerror(_("--test may only be specified during package installation, "
                 "erasure, and building"));
 
-    if (bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL && 
-       bigMode != MODE_QUERY   && bigMode != MODE_VERIFY    &&                         bigMode != MODE_REBUILDDB && bigMode != MODE_INITDB && rootdir[1])
+    if (rootdir[1] && (bigMode & ~MODES_FOR_ROOT))
        argerror(_("--root (-r) may only be specified during "
                 "installation, erasure, querying, and "
                 "database rebuilds"));
 
-    if (rootdir && rootdir[0] != '/')
-       argerror(_("arguments to --root (-r) must begin with a /"));
+    if (rootdir) {
+       switch (urlIsURL(rootdir)) {
+       default:
+           if (bigMode & MODES_FOR_ROOT)
+               break;
+           /*@fallthrough@*/
+       case URL_IS_UNKNOWN:
+           if (rootdir[0] != '/')
+               argerror(_("arguments to --root (-r) must begin with a /"));
+           break;
+       }
+    }
 
     if (oldPackage && !upgrade)
        argerror(_("--oldpackage may only be used during upgrades"));
@@ -1193,6 +1218,7 @@ int main(int argc, const char ** argv)
            if (ec)
                break;
 
+           ba->rootdir = rootdir;
            ec = build(specFile, ba, passPhrase, 0, cookie, rcfile, force, noDeps);
            if (ec)
                break;
@@ -1245,6 +1271,7 @@ int main(int argc, const char ** argv)
        }
 
        while ((pkg = poptGetArg(optCon))) {
+           ba->rootdir = rootdir;
            ec = build(pkg, ba, passPhrase, bigMode == MODE_TARBUILD,
                        NULL, rcfile, force, noDeps);
            if (ec)