Added --justdb
authorewt <devnull@localhost>
Thu, 24 Jul 1997 15:15:48 +0000 (15:15 +0000)
committerewt <devnull@localhost>
Thu, 24 Jul 1997 15:15:48 +0000 (15:15 +0000)
CVS patchset: 1771
CVS date: 1997/07/24 15:15:48

CHANGES
lib/install.c
lib/rpmlib.h
lib/uninstall.c
rpm.c

diff --git a/CHANGES b/CHANGES
index a935783..be91700 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -22,6 +22,8 @@
        - look for random() in libm if it can't be found be default
        - fixed problems in Solaris's autodeps stuff (Eric Mumpower)
        - --setperms should work properly on directories now
+       - --justdb on install, upgrade, and erasure causes a database
+         update w/o the filesystem being touched
 
 2.4.2 -> 2.4.3:
        - implemented install time prerequisites
index 02a6f3f..77f8aba 100644 (file)
@@ -224,6 +224,9 @@ int rpmInstallPackage(char * rootdir, rpmdb db, int fd, char * location,
     char * currDir = NULL, * tmpptr;
     int currDirLen;
 
+    if (flags & RPMINSTALL_JUSTDB)
+       flags |= RPMINSTALL_NOSCRIPTS;
+
     oldVersions = alloca(sizeof(int));
     *oldVersions = 0;
 
@@ -243,6 +246,8 @@ int rpmInstallPackage(char * rootdir, rpmdb db, int fd, char * location,
            h = NULL;
        }
 
+       if (flags & RPMINSTALL_JUSTDB) return 0;
+
        rc = installSources(h, rootdir, fd, NULL, notify, labelFormat);
        if (h) headerFree(h);
 
@@ -378,7 +383,7 @@ int rpmInstallPackage(char * rootdir, rpmdb db, int fd, char * location,
        chroot(rootdir);
     }
 
-    if (headerIsEntry(h, RPMTAG_FILENAMES)) {
+    if (!(flags & RPMINSTALL_JUSTDB) && headerIsEntry(h, RPMTAG_FILENAMES)) {
        char ** netsharedPaths;
        char ** nsp;
 
index 803d9d4..77362bf 100644 (file)
@@ -131,9 +131,11 @@ extern const struct headerSprintfExtension rpmHeaderFormats[];
 #define RPMINSTALL_NOARCH               (1 << 7)
 #define RPMINSTALL_NOOS                 (1 << 8)
 #define RPMINSTALL_ALLFILES             (1 << 9)
+#define RPMINSTALL_JUSTDB               (1 << 10)
 
 #define RPMUNINSTALL_TEST               (1 << 0)
 #define RPMUNINSTALL_NOSCRIPTS          (1 << 1)
+#define RPMUNINSTALL_JUSTDB             (1 << 2)
 
 #define RPMVERIFY_NONE             0
 #define RPMVERIFY_MD5              (1 << 0)
index d41e571..2eddb97 100644 (file)
@@ -213,6 +213,9 @@ int rpmRemovePackage(char * prefix, rpmdb db, unsigned int offset, int flags) {
     enum { REMOVE, BACKUP, KEEP } * fileActions;
     int scriptArg;
 
+    if (flags & RPMUNINSTALL_JUSTDB)
+       flags |= RPMUNINSTALL_NOSCRIPTS;
+
     h = rpmdbGetRecord(db, offset);
     if (!h) {
        rpmError(RPMERR_DBCORRUPT, "cannot read header at %d for uninstall",
@@ -249,8 +252,9 @@ int rpmRemovePackage(char * prefix, rpmdb db, unsigned int offset, int flags) {
     }
     
     rpmMessage(RPMMESS_DEBUG, "%s files test = %d\n", rmmess, flags & RPMUNINSTALL_TEST);
-    if (headerGetEntry(h, RPMTAG_FILENAMES, &type, (void **) &fileList, 
-        &fileCount)) {
+    if (!(flags & RPMUNINSTALL_JUSTDB) &&
+       headerGetEntry(h, RPMTAG_FILENAMES, &type, (void **) &fileList, 
+                      &fileCount)) {
        if (prefix[0]) {
            fnbuffersize = 1024;
            fnbuffer = alloca(fnbuffersize);
diff --git a/rpm.c b/rpm.c
index c3cde1d..f11e87a 100755 (executable)
--- a/rpm.c
+++ b/rpm.c
@@ -88,14 +88,14 @@ static void printUsage(void) {
     puts(_("                        [--excludedocs] [--includedocs] [--noscripts]"));
     puts(_("                        [--rcfile <file>] [--ignorearch] [--dbpath <dir>]"));
     puts(_("                        [--prefix <dir>] [--ignoreos] [--nodeps] [--allfiles]"));
-    puts(_("                        [--ftpproxy <host>] [--ftpport <port>]"));
+    puts(_("                        [--ftpproxy <host>] [--ftpport <port>] [--justdb]"));
     puts(_("                        file1.rpm ... fileN.rpm"));
     puts(_("       rpm {--upgrade -U} [-v] [--hash -h] [--percent] [--force] [--test]"));
     puts(_("                        [--oldpackage] [--root <dir>] [--noscripts]"));
     puts(_("                        [--excludedocs] [--includedocs] [--rcfile <file>]"));
     puts(_("                        [--ignorearch]  [--dbpath <dir>] [--prefix <dir>] "));
     puts(_("                        [--ftpproxy <host>] [--ftpport <port>]"));
-    puts(_("                        [--ignoreos] [--nodeps] [--allfiles]"));
+    puts(_("                        [--ignoreos] [--nodeps] [--allfiles] [--justdb]"));
     puts(_("                        file1.rpm ... fileN.rpm"));
     puts(_("       rpm {--query -q} [-afpg] [-i] [-l] [-s] [-d] [-c] [-v] [-R]"));
     puts(_("                        [--scripts] [--root <dir>] [--rcfile <file>]"));
@@ -110,7 +110,7 @@ static void printUsage(void) {
     puts(_("       rpm {--setugids} [-afpg] [target]"));
     puts(_("       rpm {--erase -e} [--root <dir>] [--noscripts] [--rcfile <file>]"));
     puts(_("                        [--dbpath <dir>] [--nodeps] [--allmatches]"));
-    puts(_("                        package1 ... packageN"));
+    puts(_("                        [--justdb] package1 ... packageN"));
     puts(_("       rpm {-b|t}[plciba] [-v] [--short-circuit] [--clean] [--rcfile  <file>]"));
     puts(_("                        [--sign] [--test] [--timecheck <s>] [--buildos <os>]"));
     puts(_("                        [--buildarch <arch>] specfile"));
@@ -263,6 +263,8 @@ static void printHelp(void) {
                  _("don't verify package operating system"));
     printHelpLine("      --includedocs       ",
                  _("install documentation"));
+    printHelpLine("      --justdb            ",
+                 _("update the database, but do not modify the filesystem"));
     printHelpLine("      --nodeps            ",
                  _("do not verify package dependencies"));
     printHelpLine("      --noscripts         ",
@@ -291,6 +293,8 @@ static void printHelp(void) {
                  _("remove all packages which match <package> (normally an error is generated if <package> specified multiple packages)"));
     printHelpLine("      --dbpath <dir>      ",
                  _("use <dir> as the directory for the database"));
+    printHelpLine("      --justdb            ",
+                 _("update the database, but do not modify the filesystem"));
     printHelpLine("      --nodeps            ",
                  _("do not verify package dependencies"));
     printHelpLine("      --noscripts         ",
@@ -490,7 +494,7 @@ int main(int argc, char ** argv) {
     int incldocs = 0, noScripts = 0, noDeps = 0, allMatches = 0;
     int noPgp = 0, dump = 0, initdb = 0, ignoreArch = 0, showrc = 0;
     int gotDbpath = 0, building = 0, ignoreOs = 0, noFiles = 0, verifyFlags;
-    int noMd5 = 0, allFiles = 0;
+    int noMd5 = 0, allFiles = 0, justdb = 0;
     int checksigFlags = 0;
     char *tce;
     int timeCheck = 0;
@@ -547,6 +551,7 @@ int main(int argc, char ** argv) {
            { "initdb", '\0', 0, &initdb, 0 },
        /* info and install both using 'i' is dumb */
            { "install", '\0', 0, 0, GETOPT_INSTALL },
+           { "justdb", '\0', 0, &justdb, 0 },
            { "list", 'l', 0, 0, 'l' },
            { "nodeps", '\0', 0, &noDeps, 0 },
            { "nofiles", '\0', 0, &noFiles, 0 },
@@ -979,6 +984,10 @@ int main(int argc, char ** argv) {
        argerror(_("--allfiles may only be specified during package "
                   "installation"));
 
+    if (justdb && bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL)
+       argerror(_("--justdb may only be specified during package "
+                  "installation and erasure"));
+
     if (bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL && 
        bigMode != MODE_VERIFY && noScripts)
        argerror(_("--noscripts may only be specified during package "
@@ -1201,6 +1210,7 @@ int main(int argc, char ** argv) {
 
        if (noScripts) uninstallFlags |= RPMUNINSTALL_NOSCRIPTS;
        if (test) uninstallFlags |= RPMUNINSTALL_TEST;
+       if (justdb) uninstallFlags |= RPMUNINSTALL_JUSTDB;
        if (noDeps) interfaceFlags |= UNINSTALL_NODEPS;
        if (allMatches) interfaceFlags |= UNINSTALL_ALLMATCHES;
 
@@ -1218,6 +1228,7 @@ int main(int argc, char ** argv) {
        if (ignoreArch) installFlags |= RPMINSTALL_NOARCH;
        if (ignoreOs) installFlags |= RPMINSTALL_NOOS;
        if (allFiles) installFlags |= RPMINSTALL_ALLFILES;
+       if (justdb) installFlags |= RPMINSTALL_JUSTDB;
 
        if (showPercents) interfaceFlags |= INSTALL_PERCENT;
        if (showHash) interfaceFlags |= INSTALL_HASH;