Require file attribute config to have .attr suffix
authorPanu Matilainen <pmatilai@redhat.com>
Tue, 5 Oct 2010 06:53:13 +0000 (09:53 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 5 Oct 2010 07:08:53 +0000 (10:08 +0300)
- Allows for more precise globbing, avoiding potential issues from
  leftover / accidentally placed files in the fileattrs directory.

14 files changed:
build/rpmfc.c
fileattrs/Makefile.am
fileattrs/desktop.attr [moved from fileattrs/desktop with 100% similarity]
fileattrs/elf.attr [moved from fileattrs/elf with 100% similarity]
fileattrs/font.attr [moved from fileattrs/font with 100% similarity]
fileattrs/libtool.attr [moved from fileattrs/libtool with 100% similarity]
fileattrs/mono.attr [moved from fileattrs/mono with 100% similarity]
fileattrs/ocaml.attr [moved from fileattrs/ocaml with 100% similarity]
fileattrs/perl.attr [moved from fileattrs/perl with 100% similarity]
fileattrs/perllib.attr [moved from fileattrs/perllib with 100% similarity]
fileattrs/pkgconfig.attr [moved from fileattrs/pkgconfig with 100% similarity]
fileattrs/python.attr [moved from fileattrs/python with 100% similarity]
fileattrs/script.attr [moved from fileattrs/script with 100% similarity]
lib/rpmrc.c

index 34aa1a7..5af4cd8 100644 (file)
@@ -839,7 +839,7 @@ assert(dix >= 0);
 static int initAttrs(rpmfc fc)
 {
     ARGV_t files = NULL;
-    char * attrPath = rpmExpand("%{_fileattrsdir}/*", NULL);
+    char * attrPath = rpmExpand("%{_fileattrsdir}/*.attr", NULL);
     int nattrs = 0;
 
     /* Discover known attributes from pathnames + initialize them */
@@ -847,7 +847,9 @@ static int initAttrs(rpmfc fc)
        nattrs = argvCount(files);
        fc->atypes = xcalloc(nattrs + 1, sizeof(*fc->atypes));
        for (int i = 0; i < nattrs; i++) {
-           fc->atypes[i] = rpmfcAttrNew(basename(files[i]));
+           char *bn = basename(files[i]);
+           bn[strlen(bn)-strlen(".attr")] = '\0';
+           fc->atypes[i] = rpmfcAttrNew(bn);
        }
        fc->atypes[nattrs] = NULL;
        argvFree(files);
index 379737a..8458fe9 100644 (file)
@@ -5,7 +5,7 @@ include $(top_srcdir)/rpm.am
 fattrsdir = $(rpmconfigdir)/fileattrs
 
 fattrs_DATA = \
-       desktop elf font libtool perl perllib pkgconfig python \
-       ocaml script
+       desktop.attr elf.attr font.attr libtool.attr perl.attr perllib.attr \
+       pkgconfig.attr python.attr ocaml.attr script.attr
 
 EXTRA_DIST = $(fattrs_DATA)
similarity index 100%
rename from fileattrs/desktop
rename to fileattrs/desktop.attr
similarity index 100%
rename from fileattrs/elf
rename to fileattrs/elf.attr
similarity index 100%
rename from fileattrs/font
rename to fileattrs/font.attr
similarity index 100%
rename from fileattrs/libtool
rename to fileattrs/libtool.attr
similarity index 100%
rename from fileattrs/mono
rename to fileattrs/mono.attr
similarity index 100%
rename from fileattrs/ocaml
rename to fileattrs/ocaml.attr
similarity index 100%
rename from fileattrs/perl
rename to fileattrs/perl.attr
similarity index 100%
rename from fileattrs/perllib
rename to fileattrs/perllib.attr
similarity index 100%
rename from fileattrs/pkgconfig
rename to fileattrs/pkgconfig.attr
similarity index 100%
rename from fileattrs/python
rename to fileattrs/python.attr
similarity index 100%
rename from fileattrs/script
rename to fileattrs/script.attr
index 050b442..634a021 100644 (file)
@@ -430,7 +430,7 @@ static void setDefaults(void)
     if (!macrofiles) {
        macrofiles = rstrscat(NULL, confdir, "/macros", ":",
                                confdir, "/platform/%{_target}/macros", ":",
-                               confdir, "/fileattrs/*", ":",
+                               confdir, "/fileattrs/*.attr", ":",
                                confdir, "/" RPMCANONVENDOR "/macros", ":",
                                SYSCONFDIR "/rpm/macros.*", ":",
                                SYSCONFDIR "/rpm/macros", ":",