Add provide-extractors for fonts and desktop files
- extract mime handler capabilities from application .desktop files - extract font family names and supported languages from font files - both are used by PackageKit for on-demand installing of fonts and applications, but are useful for other things too
This commit is contained in:
parent
457606983f
commit
75c0d816a8
|
@ -1080,6 +1080,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;
|
||||
|
@ -1092,6 +1117,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 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
|
|
|
@ -495,6 +495,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.
|
||||
|
|
|
@ -19,7 +19,8 @@ EXTRA_DIST = \
|
|||
find-requires.php find-provides.php \
|
||||
find-php-provides find-php-requires \
|
||||
mono-find-requires mono-find-provides \
|
||||
pkgconfigdeps.sh libtooldeps.sh
|
||||
pkgconfigdeps.sh libtooldeps.sh \
|
||||
fontconfig.prov desktop-file.prov
|
||||
|
||||
rpmconfig_SCRIPTS = \
|
||||
brp-compress brp-python-bytecompile brp-java-gcjcompile \
|
||||
|
@ -31,6 +32,7 @@ rpmconfig_SCRIPTS = \
|
|||
perl.prov perl.req perldeps.pl pythondeps.sh osgideps.pl \
|
||||
mono-find-requires mono-find-provides \
|
||||
pkgconfigdeps.sh libtooldeps.sh \
|
||||
fontconfig.prov desktop-file.prov \
|
||||
rpmdb_loadcvt rpmdiff rpm2cpio.sh tcl.req tgpg
|
||||
|
||||
rpmconfig_DATA = \
|
||||
|
|
|
@ -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
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Script to install in:
|
||||
# /usr/lib/rpm/redhat/find-provides.d
|
||||
#
|
||||
# Transform font files into RPM provides
|
||||
# Requires fontconfig >= 2.6.90
|
||||
#
|
||||
# Author: Behdad Esfahbod <behdad@redhat.com>
|
||||
# Based on other provides scripts from RPM
|
||||
#
|
||||
|
||||
fcquery=/usr/bin/fc-query
|
||||
|
||||
[ -x $fcquery ] || exit 0
|
||||
|
||||
# filter out anything outside main fontconfig path
|
||||
grep /usr/share/fonts/ |
|
||||
while read fn; do
|
||||
$fcquery --format '%{=pkgkit}' "${fn}" 2> /dev/null
|
||||
done
|
Loading…
Reference in New Issue