diff --git a/bin/repo-font-audit b/bin/repo-font-audit index 30cf991..0cff9e4 100755 --- a/bin/repo-font-audit +++ b/bin/repo-font-audit @@ -1,5 +1,5 @@ #!/bin/sh -# Quick and dirty script to audit font use in a package repository +# Quick and dirty script to audit font use in a yum package repository # # It is slow, it is ugly, and it requires a good network connection @@ -332,7 +332,7 @@ FREPOURL=$(echo "$REPOURL" | sed 's=^/=file:///=') echo "Looking for packages:" echo "— with font metadata…" -$REPOQUERY --repofrompath=$REPOID,$FREPOURL --repoid=$REPOID \ +repoquery --repofrompath=$REPOID,$FREPOURL --repoid=$REPOID \ --qf "%{sourcerpm}|%{name}|%{epoch}:%{version}-%{release}|%{arch}|%{packagesize}|M" \ --whatprovides "font(*)" --quiet \ | sort | uniq \ @@ -340,7 +340,7 @@ $REPOQUERY --repofrompath=$REPOID,$FREPOURL --repoid=$REPOID \ > "$FPL" echo "— that include files with common font extensions…" -$REPOQUERY --repofrompath=$REPOID,$FREPOURL --repoid=$REPOID \ +repoquery --repofrompath=$REPOID,$FREPOURL --repoid=$REPOID \ --qf "%{sourcerpm}|%{name}|%{epoch}:%{version}-%{release}|%{arch}|%{packagesize}|E" \ -f '*.ttf' -f '*.otf' -f '*.ttc' \ -f '*.pfb' -f '*.pfa' \ @@ -350,7 +350,7 @@ $REPOQUERY --repofrompath=$REPOID,$FREPOURL --repoid=$REPOID \ > "$PWFL" echo "— that use the core X11 protocol…" -$REPOQUERY --repofrompath=$REPOID,$FREPOURL --repoid=$REPOID \ +repoquery --repofrompath=$REPOID,$FREPOURL --repoid=$REPOID \ --qf "%{sourcerpm}|%{name}|%{epoch}:%{version}-%{release}|%{arch}|%{packagesize}|X" \ --whatrequires 'libX11.so*' \ | sort | uniq \ @@ -386,7 +386,7 @@ cat "$FL.1" | while read line ; do echo -n "– $rpm ◔" mkdir "$rpmd" cd "$rpmd" - rpm_loc=$($REPOQUERY --repofrompath=$REPOID,$REPOURL --repoid=$REPOID \ + rpm_loc=$(repoquery --repofrompath=$REPOID,$REPOURL --repoid=$REPOID \ --location "$rpm" 2>/dev/null \ | fix_url) if $(echo "$rpm_loc" | grep -q -e '^[\./~]') ; then @@ -1018,12 +1018,12 @@ To stop receiving this message, you need to: text library such as pango, pango-cairo, harfbuzz, or QT) You can self-check your packages at any time by: -1. installing $CREATEREPO and fontpackages-tools: -# $YUM install $CREATEREPO fontpackages-tools +1. installing createrepo and fontpackages-tools: +# yum install createrepo fontpackages-tools 2. putting your packages and any font package they depends on in a test directory -3. indexing this directory with $CREATEREPO: -$ $CREATEREPO path-to-test-directory +3. indexing this directory with createrepo: +$ createrepo path-to-test-directory 4. running repo-font-audit: $ repo-font-audit test absolute-path-to-test-directory @@ -1163,15 +1163,6 @@ RES="repo-font-audit-$ID-$TIMESTAMP" SRES="repo-font-audit-$ID-$TIMESTAMP-short" SPAM="repo-font-audit-$ID-$TIMESTAMP-mail" -if [ -x /usr/bin/dnf ] ; then - CREATEREPO='createrepo_c' - REPOQUERY='dnf repoquery' - YUM='dnf' -else - CREATEREPO='createrepo' - REPOQUERY='repoquery' - YUM='yum' -fi TMPDIR=$(mktemp -d --tmpdir=/tmp $RES-XXXXXXXXXX) cd $TMPDIR diff --git a/rpm/macros.fonts b/rpm/macros.fonts index 1a2331f..7ae71dc 100644 --- a/rpm/macros.fonts +++ b/rpm/macros.fonts @@ -74,6 +74,18 @@ print(meld(meld(pkgname,fontname),subname) .. "-fonts") %_font_pkg(n:f:) \ %define spn %_font_pkg_name %{-n:%{-n*}} \ +%post -n %{spn} \ +if [ -x %{_bindir}/fc-cache ]; then \ + %{_bindir}/fc-cache %{_fontdir} || : \ +fi \ +\ +\ +%postun -n %{spn} \ +if [ $1 -eq 0 -a -x %{_bindir}/fc-cache ] ; then \ + %{_bindir}/fc-cache %{_fontdir} || : \ +fi\ +\ +\ %files -n %{spn} \ %defattr(0644,root,root,0755) \ \