Explicitly differentate internal/exported file attributes
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 16 May 2012 07:40:01 +0000 (10:40 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 16 May 2012 07:58:00 +0000 (10:58 +0300)
- RPMFILE_EXCLUDE only exists during spec parse, and doesn't "leak"
  into headers only because the file is, well, excluded to start with.
  Unexport the internal-only bit and explicitly strip out any excess
  bits from data going to header. The current 16/16 split is artificial
  of course, RPMTAG_FILEATTRS is 32bit so there's plenty of room
  for growing new file attributes, with internal-only adjustments
  required.
- Eliminate RPMFILE_UNPATCHED while at it, this is a leftover
  from Suse patch rpms which are no longer used anywhere.

build/files.c
lib/rpmfi.h
python/rpmmodule.c

index 436d53b..87ce601 100644 (file)
@@ -54,6 +54,14 @@ enum specfFlags_e {
 
 typedef rpmFlags specfFlags;
 
+/* internal %files parsing state attributes */
+enum parseAttrs_e {
+    RPMFILE_EXCLUDE    = (1 << 16),    /*!< from %%exclude */
+};
+
+/* bits up to 15 (for now) reserved for exported rpmfileAttrs */
+#define PARSEATTR_MASK 0x0000ffff
+
 /**
  */
 typedef struct FileListRec_s {
@@ -1199,6 +1207,8 @@ static void genCpioListAndHeader(FileList fl,
        /* XXX Should directories have %doc/%config attributes? (#14531) */
        if (S_ISDIR(flp->fl_mode))
            flp->flags &= ~(RPMFILE_CONFIG|RPMFILE_DOC);
+       /* Strip internal parse data */
+       flp->flags &= PARSEATTR_MASK;
 
        headerPutUint32(h, RPMTAG_FILEFLAGS, &(flp->flags) ,1);
     }
index e007772..c526c90 100644 (file)
@@ -46,7 +46,7 @@ typedef enum rpmfileState_e {
 #define RPMFILE_IS_INSTALLED(_x) ((_x) == RPMFILE_STATE_NORMAL || (_x) == RPMFILE_STATE_NETSHARED)
 
 /**
- * File Attributes.
+ * Exported File Attributes (ie RPMTAG_FILEFLAGS)
  */
 enum rpmfileAttrs_e {
     RPMFILE_NONE       = 0,
@@ -59,8 +59,7 @@ enum rpmfileAttrs_e {
     RPMFILE_GHOST      = (1 <<  6),    /*!< from %%ghost */
     RPMFILE_LICENSE    = (1 <<  7),    /*!< from %%license */
     RPMFILE_README     = (1 <<  8),    /*!< from %%readme */
-    RPMFILE_EXCLUDE    = (1 <<  9),    /*!< from %%exclude, internal */
-    RPMFILE_UNPATCHED  = (1 << 10),    /*!< placeholder (SuSE) */
+    /* bits 9-10 unused */
     RPMFILE_PUBKEY     = (1 << 11),    /*!< from %%pubkey */
 };
 
index b82a06d..27430ee 100644 (file)
@@ -367,8 +367,6 @@ static int initModule(PyObject *m)
     REGISTER_ENUM(RPMFILE_GHOST);
     REGISTER_ENUM(RPMFILE_LICENSE);
     REGISTER_ENUM(RPMFILE_README);
-    REGISTER_ENUM(RPMFILE_EXCLUDE);
-    REGISTER_ENUM(RPMFILE_UNPATCHED);
     REGISTER_ENUM(RPMFILE_PUBKEY);
 
     REGISTER_ENUM(RPMDEP_SENSE_REQUIRES);