diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2010-10-05 09:35:45 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2010-10-05 09:35:45 +0300 |
commit | fb4bc9b7d758798ccca698a52f650cdeea7c7ff5 (patch) | |
tree | 134eec0ec0d018a677d89484f6f16e68450801ac | |
parent | 152d1f0bc4b3b99ca72d994f90fee0f91f627daf (diff) | |
download | librpm-tizen-fb4bc9b7d758798ccca698a52f650cdeea7c7ff5.tar.gz librpm-tizen-fb4bc9b7d758798ccca698a52f650cdeea7c7ff5.tar.bz2 librpm-tizen-fb4bc9b7d758798ccca698a52f650cdeea7c7ff5.zip |
Replace __foo_exeonly attribute with a more generic mechanism
- Use a list of text keyword tokens to allow for more flags without
requiring adding special processing for every new flag we make
-rw-r--r-- | build/rpmfc.c | 11 | ||||
-rw-r--r-- | fileattrs/elf | 2 | ||||
-rw-r--r-- | fileattrs/perl | 2 | ||||
-rw-r--r-- | fileattrs/script | 2 |
4 files changed, 9 insertions, 8 deletions
diff --git a/build/rpmfc.c b/build/rpmfc.c index f8494c800..34aa1a754 100644 --- a/build/rpmfc.c +++ b/build/rpmfc.c @@ -23,7 +23,7 @@ typedef struct rpmfcAttr_s { char *name; regex_t *pattern; regex_t *magic; - int exeonly; + ARGV_t flags; } * rpmfcAttr; /** @@ -84,9 +84,9 @@ static rpmfcAttr rpmfcAttrNew(const char *name) { rpmfcAttr attr = xcalloc(1, sizeof(*attr)); - char *eom = rpmfcAttrMacro(name, "exeonly"); - attr->exeonly = rpmExpandNumeric(eom); - free(eom); + char *flags = rpmfcAttrMacro(name, "flags"); + attr->flags = argvSplitString(flags, ",", ARGV_SKIPEMPTY); + free(flags); attr->name = xstrdup(name); attr->pattern = rpmfcAttrReg(name, "pattern"); @@ -106,6 +106,7 @@ static rpmfcAttr rpmfcAttrFree(rpmfcAttr attr) regfree(attr->magic); rfree(attr->magic); } + argvFree(attr->flags); rfree(attr->name); rfree(attr); } @@ -592,7 +593,7 @@ static void rpmfcAttributes(rpmfc fc, const char *ftype, const char *fullpath) for (rpmfcAttr *attr = fc->atypes; attr && *attr; attr++) { /* Filter out by file modes if set */ - if ((*attr)->exeonly && !is_executable) + if (hasAttr((*attr)->flags, "exeonly") && !is_executable) continue; /* Add attributes on libmagic type & path pattern matches */ diff --git a/fileattrs/elf b/fileattrs/elf index c924dbb7d..fba180bca 100644 --- a/fileattrs/elf +++ b/fileattrs/elf @@ -1,4 +1,4 @@ %__elf_provides %{_rpmconfigdir}/elfdeps --provides %{?__filter_GLIBC_PRIVATE:--filter-private} %__elf_requires %{_rpmconfigdir}/elfdeps --requires %{?__filter_GLIBC_PRIVATE:--filter-private} %__elf_magic ^ELF (32|64)-bit.*$ -%__elf_exeonly 1 +%__elf_flags exeonly diff --git a/fileattrs/perl b/fileattrs/perl index 6cb57d17e..23b873fbe 100644 --- a/fileattrs/perl +++ b/fileattrs/perl @@ -1,3 +1,3 @@ %__perl_requires %{_rpmconfigdir}/perl.req %__perl_magic ^.*perl .*$ -%__perl_exeonly 1 +%__perl_flags exeonly diff --git a/fileattrs/script b/fileattrs/script index 950113391..13b8ba0b6 100644 --- a/fileattrs/script +++ b/fileattrs/script @@ -1,3 +1,3 @@ %__script_requires %{_rpmconfigdir}/script.req %__script_magic ^.* script text.*$ -%__script_exeonly 1 +%__script_flags exeonly |