teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone
Blob Blame History Raw
diff --git a/build/rpmfc.c b/build/rpmfc.c
index 1bb1c3b..4e57869 100644
--- a/build/rpmfc.c
+++ b/build/rpmfc.c
@@ -484,6 +484,7 @@ static const struct rpmfcTokens_s const rpmfcTokens[] = {
   { "RPM v4",			RPMFC_ARCHIVE|RPMFC_INCLUDE },
 
   { " image",			RPMFC_IMAGE|RPMFC_INCLUDE },
+  { " font metrics",		RPMFC_WHITE|RPMFC_INCLUDE },
   { " font",			RPMFC_FONT|RPMFC_INCLUDE },
   { " Font",			RPMFC_FONT|RPMFC_INCLUDE },
 
@@ -496,19 +497,14 @@ static const struct rpmfcTokens_s const rpmfcTokens[] = {
   { "SGML",			RPMFC_WHITE|RPMFC_INCLUDE },
   { "XML",			RPMFC_WHITE|RPMFC_INCLUDE },
 
-  { " program text",		RPMFC_WHITE|RPMFC_INCLUDE },
   { " source",			RPMFC_WHITE|RPMFC_INCLUDE },
   { "GLS_BINARY_LSB_FIRST",	RPMFC_WHITE|RPMFC_INCLUDE },
   { " DB ",			RPMFC_WHITE|RPMFC_INCLUDE },
 
-  { "ASCII English text",	RPMFC_WHITE|RPMFC_INCLUDE },
-  { "ASCII text",		RPMFC_WHITE|RPMFC_INCLUDE },
-  { "ISO-8859 text",		RPMFC_WHITE|RPMFC_INCLUDE },
-
   { "symbolic link to",		RPMFC_SYMLINK|RPMFC_INCLUDE },
   { "socket",			RPMFC_DEVICE },
   { "special",			RPMFC_DEVICE },
-  { " text",			RPMFC_TEXT },
+  { " text",			RPMFC_TEXT|RPMFC_INCLUDE },
 
   { "ASCII",			RPMFC_WHITE },
   { "ISO-8859",			RPMFC_WHITE },
@@ -1184,6 +1180,31 @@ exit:
 #endif
 }
 
+static int rpmfcMISC(rpmfc fc)
+{
+    struct stat st;
+    int rc = -1;
+    const char *what = NULL;
+    const char * fn = fc->fn[fc->ix];
+    /* this part is enumerated, compare equality not bit flags */
+    int ftype = fc->fcolor->vals[fc->ix] & 0x000F0000;
+
+    if (ftype == RPMFC_FONT) {
+	what = "fontconfig";
+    } else if (ftype == RPMFC_TEXT && rpmFileHasSuffix(fn, ".desktop")) {
+	what = "desktop";
+    }
+
+    if (what == NULL || stat(fn, &st) < 0 || !S_ISREG(st.st_mode)) {
+	goto exit;
+    }
+
+    (void) rpmfcHelper(fc, 'P', what);
+    rc = 0;
+
+exit:
+    return rc;
+}
 typedef const struct rpmfcApplyTbl_s {
     int (*func) (rpmfc fc);
     int colormask;
@@ -1196,6 +1217,7 @@ static const struct rpmfcApplyTbl_s const rpmfcApplyTable[] = {
     { rpmfcSCRIPT,	(RPMFC_SCRIPT|RPMFC_BOURNE|
 			 RPMFC_PERL|RPMFC_PYTHON|RPMFC_MONO|
 			 RPMFC_PKGCONFIG|RPMFC_LIBTOOL) },
+    { rpmfcMISC,	RPMFC_FONT|RPMFC_TEXT },
     { rpmfcSYMLINK,	RPMFC_SYMLINK },
     { NULL, 0 }
 };
@@ -1315,7 +1337,7 @@ rpmRC rpmfcClassify(rpmfc fc, ARGV_t argv, rpm_mode_t * fmode)
     size_t slen;
     int fcolor;
     int xx;
-    int msflags = MAGIC_CHECK;	/* XXX MAGIC_COMPRESS flag? */
+    int msflags = MAGIC_CHECK | MAGIC_COMPRESS | MAGIC_NO_CHECK_TOKENS;
     magic_t ms = NULL;
 
     if (fc == NULL || argv == NULL)
diff --git a/macros.in b/macros.in
index c187f62..945e89b 100644
--- a/macros.in
+++ b/macros.in
@@ -489,6 +489,9 @@ print (t)\
 %__pkgconfig_provides   %{_rpmconfigdir}/pkgconfigdeps.sh --provides
 %__pkgconfig_requires   %{_rpmconfigdir}/pkgconfigdeps.sh --requires
 
+%__fontconfig_provides	%{_rpmconfigdir}/fontconfig.prov
+%__desktop_provides     %{_rpmconfigdir}/desktop-file.prov
+
 #==============================================================================
 # ---- Database configuration macros.
 #	Macros used to configure Berkley db parameters.