1) added 's', 'm', 'n' to fflags type tag
authorewt <devnull@localhost>
Tue, 17 Jun 1997 15:37:28 +0000 (15:37 +0000)
committerewt <devnull@localhost>
Tue, 17 Jun 1997 15:37:28 +0000 (15:37 +0000)
2) implemented missingok
3) added --allfiles

CVS patchset: 1691
CVS date: 1997/06/17 15:37:28

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

diff --git a/CHANGES b/CHANGES
index c107468..5d4e9c5 100644 (file)
--- a/CHANGES
+++ b/CHANGES
          any time
        - added --changelog alias to query a packages changelog entry
        - added mntctl() support for AIX (I think, I can't test this)
+       - fflags query type displays 's' for specfiles, 'm' for missingok
+         files, and 'n' for noreplace files
+       - implemented %config(missingok) flag in install
+       - added --allfiles flag for -i and -U, which forces all files (even
+         missingok files) to be installed
 
 2.4 -> 2.4.1:
        - take advantage of lchown() if it's available
index 3530961..a100fef 100644 (file)
@@ -102,7 +102,7 @@ static char * permsFormat(int_32 type, const void * data,
 static char * fflagsFormat(int_32 type, const void * data, 
                         char * formatPrefix, int padding, int element) {
     char * val;
-    char buf[10];
+    char buf[15];
     int anint = *((int_32 *) data);
 
     if (type != RPM_INT32_TYPE) {
@@ -114,6 +114,12 @@ static char * fflagsFormat(int_32 type, const void * data,
            strcat(buf, "d");
        if (anint & RPMFILE_CONFIG)
            strcat(buf, "c");
+       if (anint & RPMFILE_SPECFILE)
+           strcat(buf, "s");
+       if (anint & RPMFILE_MISSINGOK)
+           strcat(buf, "m");
+       if (anint & RPMFILE_NOREPLACE)
+           strcat(buf, "n");
 
        val = malloc(5 + padding);
        strcat(formatPrefix, "s");
index 8c17ba6..a24b07c 100644 (file)
@@ -70,7 +70,8 @@ static int filecmp(short mode1, char * md51, char * link1,
                   short mode2, char * md52, char * link2);
 static enum instActions decideFileFate(char * filespec, short dbMode, 
                                char * dbMd5, char * dbLink, short newMode, 
-                               char * newMd5, char * newLink, int brokenMd5);
+                               char * newMd5, char * newLink, int newFlags,
+                               int instFlags, int brokenMd5);
 static int installArchive(int fd, struct fileInfo * files,
                          int fileCount, rpmNotifyFunction notify, 
                          char ** specFile, int archiveSize);
@@ -725,7 +726,8 @@ static int filecmp(short mode1, char * md51, char * link1,
 
 static enum instActions decideFileFate(char * filespec, short dbMode, 
                                char * dbMd5, char * dbLink, short newMode, 
-                               char * newMd5, char * newLink, int brokenMd5) {
+                               char * newMd5, char * newLink, int newFlags,
+                               int instFlags, int brokenMd5) {
     char buffer[1024];
     char * dbAttr, * newAttr;
     enum fileTypes dbWhat, newWhat, diskWhat;
@@ -733,8 +735,15 @@ static enum instActions decideFileFate(char * filespec, short dbMode,
     int i, rc;
 
     if (lstat(filespec, &sb)) {
-       /* the file doesn't exist on the disk - might as well make it */
-       return CREATE;
+       /* the file doesn't exist on the disk create it unless the new
+          package has marked it as missingok */
+       if (!(instFlags & RPMINSTALL_ALLFILES) && 
+             (newFlags & RPMFILE_MISSINGOK)) {
+           rpmMessage(RPMMESS_DEBUG, "%s skipped due to missingok flag\n",
+                       filespec);
+           return SKIP;
+       } else
+           return CREATE;
     }
 
     diskWhat = whatis(sb.st_mode);
@@ -967,6 +976,8 @@ static int instHandleSharedFiles(rpmdb db, int ignoreOffset,
                               secFileMd5List[secNum], secFileLinksList[secNum],
                               files[mainNum].mode, files[mainNum].md5,
                               files[mainNum].link, 
+                              files[sharedList[i].mainFileNumber].flags,
+                              flags,
                               !headerIsEntry(sech, RPMTAG_RPMVERSION));
        }
     }
index 5ed6c99..862a26b 100644 (file)
@@ -124,6 +124,7 @@ extern const struct headerSprintfExtension rpmHeaderFormats[];
 #define RPMINSTALL_NOSCRIPTS            (1 << 6)
 #define RPMINSTALL_NOARCH               (1 << 7)
 #define RPMINSTALL_NOOS                 (1 << 8)
+#define RPMINSTALL_ALLFILES             (1 << 9)
 
 #define RPMUNINSTALL_TEST               (1 << 0)
 #define RPMUNINSTALL_NOSCRIPTS          (1 << 1)
diff --git a/rpm.c b/rpm.c
index 0d85434..c362d23 100755 (executable)
--- a/rpm.c
+++ b/rpm.c
@@ -87,7 +87,7 @@ static void printUsage(void) {
     puts(_("                        [--replacepkgs] [--replacefiles] [--root <dir>]"));
     puts(_("                        [--excludedocs] [--includedocs] [--noscripts]"));
     puts(_("                        [--rcfile <file>] [--ignorearch] [--dbpath <dir>]"));
-    puts(_("                        [--prefix <dir>] [--ignoreos] [--nodeps]"));
+    puts(_("                        [--prefix <dir>] [--ignoreos] [--nodeps] [--allfiles]"));
     puts(_("                        [--ftpproxy <host>] [--ftpport <port>]"));
     puts(_("                        file1.rpm ... fileN.rpm"));
     puts(_("       rpm {--upgrade -U} [-v] [--hash -h] [--percent] [--force] [--test]"));
@@ -95,7 +95,8 @@ static void printUsage(void) {
     puts(_("                        [--excludedocs] [--includedocs] [--rcfile <file>]"));
     puts(_("                        [--ignorearch]  [--dbpath <dir>] [--prefix <dir>] "));
     puts(_("                        [--ftpproxy <host>] [--ftpport <port>]"));
-    puts(_("                        [--ignoreos] [--nodeps] file1.rpm ... fileN.rpm"));
+    puts(_("                        [--ignoreos] [--nodeps] [--allfiles]"));
+    puts(_("                        file1.rpm ... fileN.rpm"));
     puts(_("       rpm {--query -q} [-afpg] [-i] [-l] [-s] [-d] [-c] [-v] [-R]"));
     puts(_("                        [--scripts] [--root <dir>] [--rcfile <file>]"));
     puts(_("                        [--whatprovides] [--whatrequires] [--requires]"));
@@ -253,6 +254,9 @@ static void printHelp(void) {
     puts(         "      -h");
     printHelpLine("      --hash              ",
                  _("print hash marks as package installs (good with -v)"));
+    printHelpLine("      --allfiles          ",
+                 _("install all files, even configurations which might "
+                   "otherwise be skipped"));
     printHelpLine("      --ignorearch        ",
                  _("don't verify package architecture"));
     printHelpLine("      --ignoreos          ",
@@ -486,7 +490,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;
+    int noMd5 = 0, allFiles = 0;
     int checksigFlags = 0;
     char *tce;
     int timeCheck = 0;
@@ -515,6 +519,7 @@ int main(int argc, char ** argv) {
     struct poptOption optionsTable[] = {
            { "addsign", '\0', 0, 0, GETOPT_ADDSIGN },
            { "all", 'a', 0, 0, 'a' },
+           { "allfiles", '\0', 0, &allFiles, 0 },
            { "allmatches", 'a', 0, &allMatches, 0 },
            { "build", 'b', POPT_ARG_STRING, 0, 'b' },
            { "buildarch", '\0', POPT_ARG_STRING, 0, 0 },
@@ -970,6 +975,10 @@ int main(int argc, char ** argv) {
        argerror(_("--allmatches may only be specified during package "
                   "erasure"));
 
+    if (allFiles && bigMode != MODE_INSTALL)
+       argerror(_("--allfiles may only be specified during package "
+                  "installation"));
+
     if (bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL && 
        bigMode != MODE_VERIFY && noScripts)
        argerror(_("--noscripts may only be specified during package "
@@ -1208,6 +1217,7 @@ int main(int argc, char ** argv) {
        if (noScripts) installFlags |= RPMINSTALL_NOSCRIPTS;
        if (ignoreArch) installFlags |= RPMINSTALL_NOARCH;
        if (ignoreOs) installFlags |= RPMINSTALL_NOOS;
+       if (allFiles) installFlags |= RPMINSTALL_ALLFILES;
 
        if (showPercents) interfaceFlags |= INSTALL_PERCENT;
        if (showHash) interfaceFlags |= INSTALL_HASH;