Combine spec parsing options into a common flag bitfield
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 1 Sep 2010 15:03:05 +0000 (18:03 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 1 Sep 2010 15:03:05 +0000 (18:03 +0300)
build/parsePreamble.c
build/parsePrep.c
build/parseSpec.c
build/rpmspec.h
build/spec.c

index 6a923a9..6a56335 100644 (file)
@@ -1075,7 +1075,7 @@ int parsePreamble(rpmSpec spec, int initialPackage)
     }
 
     /* XXX Skip valid arch check if not building binary package */
-    if (!spec->anyarch && checkForValidArchitectures(spec)) {
+    if (!(spec->flags & RPMSPEC_ANYARCH) && checkForValidArchitectures(spec)) {
        goto exit;
     }
 
index f7849cc..3952acc 100644 (file)
@@ -79,7 +79,7 @@ static char *doPatch(rpmSpec spec, uint32_t c, int strip, const char *db,
     fn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
 
     /* On non-build parse's, file cannot be stat'd or read. */
-    if (spec->force || checkOwners(fn)) goto exit;
+    if ((spec->flags & RPMSPEC_FORCE) || checkOwners(fn)) goto exit;
 
     if (db) {
        rasprintf(&arg_backup,
@@ -180,7 +180,7 @@ static char *doUntar(rpmSpec spec, uint32_t c, int quietly)
 #endif
 
     /* XXX On non-build parse's, file cannot be stat'd or read */
-    if (!spec->force && (rpmFileIsCompressed(fn, &compressed) || checkOwners(fn))) {
+    if (!(spec->flags & RPMSPEC_FORCE) && (rpmFileIsCompressed(fn, &compressed) || checkOwners(fn))) {
        fn = _free(fn);
        return NULL;
     }
@@ -533,7 +533,7 @@ int parsePrep(rpmSpec spec)
        } else {
            appendLineStringBuf(spec->prep, *lines);
        }
-       if (res && !spec->force) {
+       if (res && !(spec->flags & RPMSPEC_FORCE)) {
            /* fixup from RPMRC_FAIL do*Macro() codes for now */
            nextPart = PART_ERROR; 
            goto exit;
index 074d337..4f68fca 100644 (file)
@@ -540,8 +540,7 @@ static rpmSpec parseSpec(const char *specFile, rpmSpecFlags flags,
     }
     addMacro(NULL, "_docdir", NULL, "%{_defaultdocdir}", RMIL_SPEC);
     spec->recursing = recursing;
-    spec->anyarch = (flags & RPMSPEC_ANYARCH);
-    spec->force = (flags & RPMSPEC_FORCE);
+    spec->flags = flags;
 
     /* All the parse*() functions expect to have a line pre-read */
     /* in the spec's line buffer.  Except for parsePreamble(),   */
index 836123e..1ecfaaa 100644 (file)
@@ -71,8 +71,7 @@ struct rpmSpec_s {
     int BACount;
     int recursing;             /*!< parse is recursive? */
 
-    int force;
-    int anyarch;
+    rpmSpecFlags flags;
 
     struct Source * sources;
     int numSources;
index 7c31808..ac3b8d9 100644 (file)
@@ -230,8 +230,7 @@ rpmSpec newSpec(void)
     spec->recursing = 0;
     spec->BASpecs = NULL;
 
-    spec->force = 0;
-    spec->anyarch = 0;
+    spec->flags = RPMSPEC_NONE;
 
     spec->macros = rpmGlobalMacroContext;