print all dependencies for each package at end of build.
authorjbj <devnull@localhost>
Thu, 22 Jul 1999 22:38:44 +0000 (22:38 +0000)
committerjbj <devnull@localhost>
Thu, 22 Jul 1999 22:38:44 +0000 (22:38 +0000)
CVS patchset: 3199
CVS date: 1999/07/22 22:38:44

CHANGES
build/files.c
build/parseReqs.c
lib/rpmlib.h
po/rpm.pot

diff --git a/CHANGES b/CHANGES
index 982301c..d15bb88 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -13,6 +13,7 @@
        - fix: incomplete cleanup if --rebuilddb fails (#4115).
        - add versions to provides.
        - fix: sanity test on specfile fails when encountering i18n chars.
+       - print all dependencies for each package at end of build.
 
 3.0.1 -> 3.0.2
        - eliminate armv4 entries from rpmrc (Andrew E. Mileski).
index 82ff9a2..8d59d7f 100644 (file)
@@ -1697,53 +1697,116 @@ static int generateAutoReqProv(Spec spec, Package pkg,
     return 0;
 }
 
-static void printReqs(Spec spec, Package pkg)
+typedef struct {
+    const char *msg;
+    int ntag;
+    int vtag;
+    int ftag;
+    int mask;
+    int xor;
+} DepMsg_t;
+
+DepMsg_t depMsgs[] = {
+  { "Provides",
+       RPMTAG_PROVIDENAME, RPMTAG_PROVIDEVERSION, RPMTAG_PROVIDEFLAGS,
+       0, -1 },
+  { "PreReq",
+       RPMTAG_REQUIRENAME, RPMTAG_REQUIREVERSION, RPMTAG_REQUIREFLAGS,
+       RPMSENSE_PREREQ, 0 },
+  { "Requires",
+       -1, -1, -1,     /* XXX inherit previous arrays */
+       RPMSENSE_PREREQ, RPMSENSE_PREREQ },
+  { "Conflicts",
+       RPMTAG_CONFLICTNAME, RPMTAG_CONFLICTVERSION, RPMTAG_CONFLICTFLAGS,
+       0, -1 },
+  { "Obsoletes",
+       RPMTAG_OBSOLETENAME, RPMTAG_OBSOLETEVERSION, RPMTAG_OBSOLETEFLAGS,
+       0, -1 },
+  { NULL, 0, 0, 0, 0, 0 }
+};
+
+static void printDepMsg(DepMsg_t *dm, int count, const char **names,
+       const char **versions, int *flags)
 {
-    int startedPreReq = 0;
-    int startedReq = 0;
-
-    char **names;
-    int x, count;
-    int *flags;
-
-    if (headerGetEntry(pkg->header, RPMTAG_PROVIDES,
-                      NULL, (void **) &names, &count)) {
-       rpmMessage(RPMMESS_NORMAL, _("Provides:"));
-       for (x = 0; x < count; x++) {
-           rpmMessage(RPMMESS_NORMAL, " %s", names[x]);
+    int hasVersions = (versions != NULL);
+    int hasFlags = (flags != NULL);
+    int i, bingo;
+
+    bingo = 0;
+    for (i = 0; i < count; i++, names++, versions++, flags++) {
+       if (hasFlags && !((*flags & dm->mask) ^ dm->xor))
+           continue;
+       if (bingo == 0) {
+           rpmMessage(RPMMESS_NORMAL, "%s:", dm->msg);
+           bingo = 1;
        }
+       rpmMessage(RPMMESS_NORMAL, " %s", *names);
+
+       if (hasVersions && !(*versions != NULL && **versions != '\0'))
+           continue;
+       if (!(hasFlags && (*flags && RPMSENSE_SENSEMASK)))
+           continue;
+
+       rpmMessage(RPMMESS_NORMAL, " ");
+       if (*flags & RPMSENSE_LESS)
+           rpmMessage(RPMMESS_NORMAL, "<");
+       if (*flags & RPMSENSE_GREATER)
+           rpmMessage(RPMMESS_NORMAL, ">");
+       if (*flags & RPMSENSE_EQUAL)
+           rpmMessage(RPMMESS_NORMAL, "=");
+
+       rpmMessage(RPMMESS_NORMAL, " %s", *versions);
+    }
+    if (bingo)
        rpmMessage(RPMMESS_NORMAL, "\n");
-       FREE(names);
-    }
-
-    if (headerGetEntry(pkg->header, RPMTAG_REQUIRENAME,
-                      NULL, (void **) &names, &count)) {
-       headerGetEntry(pkg->header, RPMTAG_REQUIREFLAGS,
-                      NULL, (void **) &flags, NULL);
-       for (x = 0; x < count; x++) {
-           if (flags[x] & RPMSENSE_PREREQ) {
-               if (! startedPreReq) {
-                   rpmMessage(RPMMESS_NORMAL, _("Prereqs:"));
-                   startedPreReq = 1;
-               }
-               rpmMessage(RPMMESS_NORMAL, " %s", names[x]);
-           }
+}
+
+static void printDeps(Header h)
+{
+    const char **names = NULL;
+    const char **versions = NULL;
+    int *flags = NULL;
+    DepMsg_t *dm;
+    int type, count;
+
+    for (dm = depMsgs; dm->msg != NULL; dm++) {
+       switch (dm->ntag) {
+       case 0:
+           FREE(names);
+           break;
+       case -1:
+           break;
+       default:
+           FREE(names);
+           if (!headerGetEntry(h, dm->ntag, &type, (void **) &names, &count))
+               continue;
+           break;
        }
-       if (startedPreReq) {
-           rpmMessage(RPMMESS_NORMAL, "\n");
+       switch (dm->vtag) {
+       case 0:
+           FREE(versions);
+           break;
+       case -1:
+           break;
+       default:
+           FREE(versions);
+           headerGetEntry(h, dm->vtag, NULL, (void **) &versions, NULL);
+           break;
        }
-       for (x = 0; x < count; x++) {
-           if (! (flags[x] & RPMSENSE_PREREQ)) {
-               if (! startedReq) {
-                   rpmMessage(RPMMESS_NORMAL, _("Requires:"));
-                   startedReq = 1;
-               }
-               rpmMessage(RPMMESS_NORMAL, " %s", names[x]);
-           }
+       switch (dm->ftag) {
+       case 0:
+           flags = NULL;
+           break;
+       case -1:
+           break;
+       default:
+           headerGetEntry(h, dm->ftag, NULL, (void **) &flags, NULL);
+           break;
        }
-       rpmMessage(RPMMESS_NORMAL, "\n");
-       FREE(names);
+       printDepMsg(dm, count, names, versions, flags);
     }
+    FREE(names);
+    FREE(versions);
 }
 
 int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
@@ -1766,7 +1829,7 @@ int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
        }
 
        generateAutoReqProv(spec, pkg, pkg->cpioList, pkg->cpioCount);
-       printReqs(spec, pkg);
+       printDeps(pkg->header);
        
     }
 
index 89c78d1..deb8ba3 100644 (file)
@@ -10,24 +10,13 @@ static struct ReqComp {
     { "=<", RPMSENSE_LESS | RPMSENSE_EQUAL},
     { "<", RPMSENSE_LESS},
 
+    { "==", RPMSENSE_EQUAL},
     { "=", RPMSENSE_EQUAL},
     
     { ">=", RPMSENSE_GREATER | RPMSENSE_EQUAL},
     { "=>", RPMSENSE_GREATER | RPMSENSE_EQUAL},
     { ">", RPMSENSE_GREATER},
 
-#if defined(RPMSENSE_SERIAL)
-    { "<=S", RPMSENSE_LESS | RPMSENSE_EQUAL | RPMSENSE_SERIAL},
-    { "=<S", RPMSENSE_LESS | RPMSENSE_EQUAL | RPMSENSE_SERIAL},
-    { "<S", RPMSENSE_LESS | RPMSENSE_SERIAL},
-
-    { "=S", RPMSENSE_EQUAL | RPMSENSE_SERIAL},
-
-    { ">=S", RPMSENSE_GREATER | RPMSENSE_EQUAL | RPMSENSE_SERIAL},
-    { "=>S", RPMSENSE_GREATER | RPMSENSE_EQUAL | RPMSENSE_SERIAL},
-    { ">S", RPMSENSE_GREATER | RPMSENSE_SERIAL},
-#endif /* RPMSENSE_SERIAL */
-
     { NULL, 0 },
 };
 
index fab9772..58b7956 100644 (file)
@@ -114,7 +114,8 @@ extern const struct headerSprintfExtension rpmHeaderFormats[];
 #define        RPMTAG_PREUNPROG                1087
 #define        RPMTAG_POSTUNPROG               1088
 #define        RPMTAG_BUILDARCHS               1089
-#define        RPMTAG_OBSOLETES                1090
+#define        RPMTAG_OBSOLETENAME             1090
+#define        RPMTAG_OBSOLETES RPMTAG_OBSOLETENAME    /* backward comaptibility */
 #define        RPMTAG_VERIFYSCRIPTPROG         1091
 #define        RPMTAG_TRIGGERSCRIPTPROG        1092
 #define        RPMTAG_DOCDIR                   1093 /* internal */
index 06be4ec..435fc2f 100644 (file)
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-07-22 15:36-0400\n"
+"POT-Creation-Date: 1999-07-22 18:35-0400\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"
@@ -1452,19 +1452,7 @@ msgstr ""
 msgid "Failed to find requires"
 msgstr ""
 
-#: ../build/files.c:1711
-msgid "Provides:"
-msgstr ""
-
-#: ../build/files.c:1726
-msgid "Prereqs:"
-msgstr ""
-
-#: ../build/files.c:1738
-msgid "Requires:"
-msgstr ""
-
-#: ../build/files.c:1762
+#: ../build/files.c:1825
 #, c-format
 msgid "Processing files: %s\n"
 msgstr ""
@@ -1815,28 +1803,28 @@ msgstr ""
 msgid "line %d: second %%prep"
 msgstr ""
 
-#: ../build/parseReqs.c:102
+#: ../build/parseReqs.c:91
 #, c-format
 msgid ""
 "line %d: Dependency tokens must begin with alpha-numeric, '_' or '/': %s"
 msgstr ""
 
-#: ../build/parseReqs.c:113
+#: ../build/parseReqs.c:102
 #, c-format
 msgid "line %d: File name not permitted: %s"
 msgstr ""
 
-#: ../build/parseReqs.c:145
+#: ../build/parseReqs.c:134
 #, c-format
 msgid "line %d: Versioned file name not permitted: %s"
 msgstr ""
 
-#: ../build/parseReqs.c:155
+#: ../build/parseReqs.c:144
 #, c-format
 msgid "line %d: Version not permitted: %s"
 msgstr ""
 
-#: ../build/parseReqs.c:175
+#: ../build/parseReqs.c:164
 #, c-format
 msgid "line %d: Version required: %s"
 msgstr ""