- set file states to missing for --justdb packages
authorewt <devnull@localhost>
Tue, 26 May 1998 13:45:16 +0000 (13:45 +0000)
committerewt <devnull@localhost>
Tue, 26 May 1998 13:45:16 +0000 (13:45 +0000)
- handle missing file states properly in -e code
- install time wasn missing for --justdb packages

CVS patchset: 2135
CVS date: 1998/05/26 13:45:16

CHANGES
lib/install.c
lib/uninstall.c

diff --git a/CHANGES b/CHANGES
index 16da897..039a0e4 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -8,6 +8,12 @@
        - set bzip2path via lib-rpmrc/configure (Toshio Kuratomi)
        - added finish translation (Raimo Koski)
        - prefer db_185.h to db.h (Christopher Seawood)
+       - included updated hpux.req (Ralph Goers)
+       - added aix.req (Ralph Goers)
+       - updated hpux.prov, osf.req, osf.prov (Tim Mooney)
+       - set file states for --justdb packages to "not installed"
+       - handle missing file states properly in -e code
+       - install time wasn missing for --justdb packages
 
 2.4.109 -> 2.5:
        - fixed return code bug in build code
index 3f8ca65..4cefc5a 100644 (file)
@@ -877,22 +877,31 @@ int rpmInstallPackage(char * rootdir, rpmdb db, int fd,
            return 2;
        }
 
-       if (files) {
-           fileStates = malloc(sizeof(*fileStates) * fileCount);
-           for (i = 0; i < fileCount; i++)
-               fileStates[i] = files[i].state;
+       fileStates = malloc(sizeof(*fileStates) * fileCount);
+       for (i = 0; i < fileCount; i++)
+           fileStates[i] = files[i].state;
+
+       headerAddEntry(h, RPMTAG_FILESTATES, RPM_CHAR_TYPE, fileStates, 
+                       fileCount);
+
+       free(fileStates);
+       if (freeFileMem) freeFileMemory(fileMem);
+    } else if (flags & RPMINSTALL_JUSTDB) {
+       char ** fileNames;
 
+       if (headerGetEntry(h, RPMTAG_FILENAMES, NULL, (void **) &fileNames,
+                          &fileCount)) {
+           fileStates = malloc(sizeof(*fileStates) * fileCount);
+           memset(fileStates, RPMFILE_STATE_NOTINSTALLED, fileCount);
            headerAddEntry(h, RPMTAG_FILESTATES, RPM_CHAR_TYPE, fileStates, 
                            fileCount);
-
            free(fileStates);
-           if (freeFileMem) freeFileMemory(fileMem);
        }
-
-       installTime = time(NULL);
-       headerAddEntry(h, RPMTAG_INSTALLTIME, RPM_INT32_TYPE, &installTime, 1);
     }
 
+    installTime = time(NULL);
+    headerAddEntry(h, RPMTAG_INSTALLTIME, RPM_INT32_TYPE, &installTime, 1);
+
     if (rootdir) {
        chroot(".");
        chdir(currDir);
index 1c96607..4798df0 100644 (file)
@@ -157,8 +157,18 @@ static int handleSharedFiles(rpmdb db, int offset, char ** fileList,
                break;
            }
 
-           headerGetEntry(sech, RPMTAG_FILESTATES, &type, 
-                    (void **) &secFileStatesList, &secFileCount);
+           if (!headerGetEntry(sech, RPMTAG_FILESTATES, &type, 
+                               (void **) &secFileStatesList, NULL)) {
+               /* This shouldn't happen, but some versions of RPM didn't
+                  implement --justdb properly, and chose to leave this stuff
+                  out. */
+               rpmMessage(RPMMESS_DEBUG, 
+                           "package is missing FILESTATES\n");
+               secFileStatesList = alloca(secFileCount);
+               memset(secFileStatesList, RPMFILE_STATE_NOTINSTALLED,
+                       secFileCount);
+           }
+
            headerGetEntry(sech, RPMTAG_FILEMD5S, &type, 
                     (void **) &secFileMd5List, &secFileCount);
        }
@@ -268,8 +278,6 @@ int rpmRemovePackage(char * prefix, rpmdb db, unsigned int offset, int flags) {
            fnbuffer = alloca(fnbuffersize);
        }
 
-       headerGetEntry(h, RPMTAG_FILESTATES, &type, (void **) &fileStatesList, 
-                &fileCount);
        headerGetEntry(h, RPMTAG_FILEMD5S, &type, (void **) &fileMd5List, 
                 &fileCount);
        headerGetEntry(h, RPMTAG_FILEFLAGS, &type, (void **) &fileFlagsList, 
@@ -277,6 +285,17 @@ int rpmRemovePackage(char * prefix, rpmdb db, unsigned int offset, int flags) {
        headerGetEntry(h, RPMTAG_FILEMODES, &type, (void **) &fileModesList, 
                 &fileCount);
 
+       if (!headerGetEntry(h, RPMTAG_FILESTATES, &type, 
+                           (void **) &fileStatesList, NULL)) {
+           /* This shouldn't happen, but some versions of RPM didn't
+              implement --justdb properly, and chose to leave this stuff
+              out. */
+           rpmMessage(RPMMESS_DEBUG, "package is missing FILESTATES\n");
+           fileStatesList = alloca(fileCount);
+           memset(fileStatesList, RPMFILE_STATE_NOTINSTALLED,
+                   fileCount);
+       }
+
        fileActions = alloca(sizeof(*fileActions) * fileCount);
        for (i = 0; i < fileCount; i++) 
            if (fileStatesList[i] == RPMFILE_STATE_NOTINSTALLED ||