Classify .desktop files by just path
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 18 Feb 2010 10:44:05 +0000 (12:44 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Thu, 18 Feb 2010 10:44:05 +0000 (12:44 +0200)
- Previously we required a file to be classified as text and have
  .desktop suffix, for now replace that with just a regex. We'll eventually
  want/need some extra qualifying logic to handle cases like these,
  eg "only apply path attributes if condition X is also true"

build/rpmfc.c

index cf9ef29..9e248ab 100644 (file)
@@ -539,6 +539,8 @@ static struct rpmfcPathTbl_s rpmfcPathTable[] = {
        "python" },
     { "^%{_bindir}/python[[:digit:]]\\.[[:digit:]]$",
        "python" },
+    { "^%{_datadir}/.*/.*\\.desktop$",
+       "desktop" },
     { NULL, NULL },
 };
 
@@ -800,7 +802,7 @@ static int rpmfcMISC(rpmfc fc)
 
     if (hasAttr(fattrs, "font")) {
        what = "font";
-    } else if (hasAttr(fattrs, "text") && rpmFileHasSuffix(fn, ".desktop")) {
+    } else if (hasAttr(fattrs, "desktop")) {
        what = "desktop";
     }
 
@@ -823,7 +825,7 @@ static const struct rpmfcApplyTbl_s const rpmfcApplyTable[] = {
     { rpmfcELF,                "elf" },
     { rpmfcSCRIPT,     "script" },
     { rpmfcLANG,       "perl,python,mono,ocaml,pkgconfig,libtool" },
-    { rpmfcMISC,       "font,text" },
+    { rpmfcMISC,       "font,desktop" },
     { NULL, 0 }
 };