public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Panu Matilainen <pmatilai@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/rpm] pmatilai-v6: - extract mimehandler provides from .desktop files
Date: Mon, 23 Nov 2026 09:25:29 GMT	[thread overview]
Message-ID: <179542592970.1.6810740698581807332.rpms-rpm-c66608cfaa78@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/rpm
            Branch : pmatilai-v6
            Commit : c66608cfaa788819ca22135317288d2f8c05fdbb
            Author : Panu Matilainen <pmatilai@fedoraproject.org>
            Date   : 2009-02-04T14:50:56+00:00
            Stats  : +118/-5 in 3 file(s)
            URL    : https://src.fedoraproject.org/rpms/rpm/c/c66608cfaa788819ca22135317288d2f8c05fdbb?branch=pmatilai-v6

            Log:
            - extract mimehandler provides from .desktop files
- preliminaries for extracting font provides (not enabled yet)
- dont classify font metrics data as fonts
- only run script dep extraction once per file, duh

---
diff --git a/desktop-file.prov b/desktop-file.prov
new file mode 100755
index 0000000..ead3c13
--- /dev/null
+++ b/desktop-file.prov
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# Transform desktop mimetype info into RPM mimehandler(type) provides
+#
+# Author: Richard Hughes <richard@hughsie.com>
+# Based on other provides scripts from RPM
+
+OLD_IFS="$IFS"
+while read instfile ; do
+	case "$instfile" in
+	*.desktop)
+		mime=`cat $instfile | grep MimeType= | cut -d'=' -f2`
+                IFS=';'
+		for type in $mime ; do
+		        echo 'mimehandler('$type')'
+	        done
+		;;
+	esac
+done
+IFS=$OLD_IFS
+

diff --git a/rpm-4.6.0-extra-provides.patch b/rpm-4.6.0-extra-provides.patch
new file mode 100644
index 0000000..9f7f871
--- /dev/null
+++ b/rpm-4.6.0-extra-provides.patch
@@ -0,0 +1,83 @@
+diff -up rpm-4.6.0-rc4/build/rpmfc.c.extra-prov rpm-4.6.0-rc4/build/rpmfc.c
+--- rpm-4.6.0-rc4/build/rpmfc.c.extra-prov	2009-02-04 15:18:05.000000000 +0200
++++ rpm-4.6.0-rc4/build/rpmfc.c	2009-02-04 15:20:46.000000000 +0200
+@@ -485,6 +485,7 @@ static const struct rpmfcTokens_s const 
+   { "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 },
+ 
+@@ -1189,6 +1190,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;
+@@ -1198,12 +1224,11 @@ typedef const struct rpmfcApplyTbl_s {
+  */
+ static const struct rpmfcApplyTbl_s const rpmfcApplyTable[] = {
+     { rpmfcELF,		RPMFC_ELF },
+-    { rpmfcSCRIPT,	(RPMFC_SCRIPT|RPMFC_PERL) },
+-    { rpmfcSCRIPT,	(RPMFC_SCRIPT|RPMFC_PYTHON) },
+-    { rpmfcSCRIPT,	(RPMFC_SCRIPT|RPMFC_PKGCONFIG) },
+-    { rpmfcSCRIPT,	(RPMFC_SCRIPT|RPMFC_LIBTOOL) },
+-    { rpmfcSCRIPT,      RPMFC_MONO },
+-    { rpmfcSYMLINK,     RPMFC_SYMLINK },
++    { 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 }
+ };
+ 
+@@ -1322,7 +1347,7 @@ rpmRC rpmfcClassify(rpmfc fc, ARGV_t arg
+     size_t slen;
+     int fcolor;
+     int xx;
+-    int msflags = MAGIC_CHECK;	/* XXX MAGIC_COMPRESS flag? */
++    int msflags = MAGIC_CHECK | MAGIC_COMPRESS;
+     magic_t ms = NULL;
+ 
+     if (fc == NULL || argv == NULL)
+diff -up rpm-4.6.0-rc4/macros.in.extra-prov rpm-4.6.0-rc4/macros.in
+--- rpm-4.6.0-rc4/macros.in.extra-prov	2009-02-04 15:18:05.000000000 +0200
++++ rpm-4.6.0-rc4/macros.in	2009-02-04 15:18:05.000000000 +0200
+@@ -463,6 +463,9 @@ print (t)\
+ %__pkgconfig_provides   @RPMCONFIGDIR@/pkgconfigdeps.sh --provides
+ %__pkgconfig_requires   @RPMCONFIGDIR@/pkgconfigdeps.sh --requires
+ 
++#%__fontconfig_provides	/usr/lib/rpm/fontconfig.prov
++%__desktop_provides     /usr/lib/rpm/desktop-file.prov
++
+ #==============================================================================
+ # ---- Database configuration macros.
+ #	Macros used to configure Berkley db parameters.

diff --git a/rpm.spec b/rpm.spec
index 6f487ec..7b24df0 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -18,13 +18,14 @@
 Summary: The RPM package management system
 Name: rpm
 Version: %{rpmver}
-Release: 0.%{snapver}.2%{?dist}
+Release: 0.%{snapver}.3%{?dist}
 Group: System Environment/Base
 Url: http://www.rpm.org/
 Source0: http://rpm.org/releases/testing/%{name}-%{srcver}.tar.bz2
 %if %{with int_bdb}
 Source1: db-%{bdbver}.tar.gz
 %endif
+Source10: desktop-file.prov
 
 Patch0: rpm-4.5.90-devel-autodep.patch
 Patch1: rpm-4.5.90-pkgconfig-path.patch
@@ -34,7 +35,7 @@ Patch2: rpm-4.5.90-gstreamer-provides.patch
 Patch200: rpm-4.6.0-rc1-defaultdocdir.patch
 
 # These are not yet upstream
-Patch300: rpm-4.5.90-posttrans.patch
+Patch300: rpm-4.6.0-extra-provides.patch
 
 # Partially GPL/LGPL dual-licensed and some bits with BSD
 # SourceLicense: (GPLv2+ and LGPLv2+ with exceptions) and BSD 
@@ -169,8 +170,7 @@ that will manipulate RPM packages and databases.
 # upstream but not on 4.6.x branch yet, oops
 %patch200 -p1 -b .defaultdocdir
 
-# needs a bit of upstream love first...
-#%patch300 -p1 -b .posttrans
+%patch300 -p1 -b .extra-prov
 
 %if %{with int_bdb}
 ln -s db-%{bdbver} db
@@ -213,6 +213,8 @@ install -m 755 scripts/rpm.daily ${RPM_BUILD_ROOT}%{_sysconfdir}/cron.daily/rpm
 mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d
 install -m 644 scripts/rpm.log ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/rpm
 
+install -p -m 755 %{SOURCE10} ${RPM_BUILD_ROOT}%{rpmhome}/
+
 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rpm
 
 mkdir -p $RPM_BUILD_ROOT/var/lib/rpm
@@ -341,6 +343,7 @@ exit 0
 %{rpmhome}/config.sub
 %{rpmhome}/mkinstalldirs
 %{rpmhome}/rpmdiff*
+%{rpmhome}/desktop-file.prov
 
 %{rpmhome}/macros.perl
 %{rpmhome}/macros.python
@@ -367,7 +370,13 @@ exit 0
 %doc doc/librpm/html/*
 
 %changelog
-* Sat Jan 31 2009 Panu Matilainen <pmatilai@redhat.com>
+* Wed Feb 04 2009 Panu Matilainen <pmatilai@redhat.com> - 4.6.0-0.rc4.3
+- extract mimehandler provides from .desktop files
+- preliminaries for extracting font provides (not enabled yet)
+- dont classify font metrics data as fonts
+- only run script dep extraction once per file, duh
+
+* Sat Jan 31 2009 Panu Matilainen <pmatilai@redhat.com> - 4.6.0-0.rc4.2
 - change platform sharedstatedir to something more sensible (#185862)
 - add rpmdb_foo links to db utils for documentation compatibility
 

                 reply	other threads:[~2026-11-23  9:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179542592970.1.6810740698581807332.rpms-rpm-c66608cfaa78@fedoraproject.org \
    --to=pmatilai@fedoraproject.org \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox