Accepting request 202118 from home:pgajdos

- run fonts-config only once when installing or upgrading more 
  fonts in one transaction

OBS-URL: https://build.opensuse.org/request/show/202118
OBS-URL: https://build.opensuse.org/package/show/M17N:fonts/fontpackages?expand=0&rev=17
This commit is contained in:
2013-10-04 09:00:11 +00:00
committed by Git OBS Bridge
parent ead3c81539
commit a6ee90f51c
5 changed files with 68 additions and 26 deletions

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Sep 30 08:44:46 UTC 2013 - pgajdos@suse.com
- run fonts-config only once when installing or upgrading more
fonts in one transaction
-------------------------------------------------------------------
Wed Jan 2 09:25:45 UTC 2013 - pgajdos@suse.com

View File

@@ -17,12 +17,14 @@
Name: fontpackages
Version: 0.1
Version: 0.2
Release: 0
Summary: Commons for Font Packages
License: BSD-3-Clause
Group: System/Base
Source0: rpm-macros.fonts-config
Source1: reconfigure-fonts.sh
Source2: reconfigure-fonts-cjk.sh
Source100: COPYING
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
@@ -46,10 +48,14 @@ cp %{SOURCE100} .
%install
mkdir -p %{buildroot}%{_sysconfdir}/rpm
cp -a %{SOURCE0} %{buildroot}%{_sysconfdir}/rpm/macros.fonts-config
mkdir -p %{buildroot}%{_datadir}/%{name}-devel
cp -a %{SOURCE1} %{SOURCE2} %{buildroot}%{_datadir}/%{name}-devel
%files devel
%defattr(-,root,root)
%doc COPYING
%config %{_sysconfdir}/rpm/macros.fonts-config
%dir %{_datadir}/%{name}-devel
%{_datadir}/%{name}-devel/*.sh
%changelog

11
reconfigure-fonts-cjk.sh Normal file
View File

@@ -0,0 +1,11 @@
adobecifontconfig=/usr/sbin/acroread-cidfont-config
ghostscriptcjkconfig=/usr/sbin/ghostscript-cjk-config
runflag=/var/run/fontpackages/reconfigure-fonts-cjk
if [ -e $runflag ]; then
if [ -x $adobecidfontconfig ]; then
$adobecidfontconfig
fi
if [ -x $ghostscriptcjkconfig ]; then
$ghostscriptcjkconfig
fi
fi

8
reconfigure-fonts.sh Normal file
View File

@@ -0,0 +1,8 @@
runflag=/var/run/fontpackages/reconfigure-fonts
fontsconfig=/usr/sbin/fonts-config
if [ -e $runflag ]; then
if [ -x $fontsconfig ]; then
$fontsconfig --quiet
fi
rm $runflag
fi

View File

@@ -5,13 +5,18 @@
%_fontsconfdir %{_sysconfdir}/fonts
%_fontsconfddir %{_fontsconfdir}/conf.d
%_fontsconfavaildir %{_datadir}/%{name}/conf.avail
# private
%__fontsconfigrunflag /var/run/fontpackages/reconfigure-fonts
%__run_fonts_config /usr/share/fontpackages-devel/reconfigure-fonts.sh
%__run_cjk_init /usr/share/fontpackages-devel/reconfigure-fonts-cjk.sh
%__fontsupdatescript /var/adm/update-scripts/%{name}-%{version}-%{release}-reconfigure-fonts
# macro: link_avail_to_system_fontsconf name
# (takes exactly one argument, name of configuration file)
# creates symlink pointing from /etc/fonts/conf.d/name to
# ../../../usr/share/%{name}/conf.avail/name
%link_avail_to_system_fontsconf() \
if test "x%1" == "x%%1"; then \
if [ "x%1" == "x%%1" ]; then \
echo "Missing argument in call to %%link_avail_to_system_fontsconf: name of configuration file." \
false \
fi \
@@ -29,7 +34,7 @@
# 4. link %{_fontsavaildir}/01-fonts.conf %{_fontsconfddir}
%install_fontsconf() \
if test "x%1" == "x%%1"; then \
if [ "x%1" == "x%%1" ]; then \
echo "Missing argument in call to %%install_fontsconf: path and name of configuration file." \
false \
fi \
@@ -68,33 +73,24 @@
Requires(pre): perl aaa_base \
%nil
# macro: reconfigure_fonts
# font setup for suse
# options:
# -c (the fonts are CJK fonts, also do setup which is only needed
# for CJK)
%reconfigure_fonts(c) \
if test -x /usr/sbin/fonts-config ; then \
LC_ALL=POSIX \
/usr/sbin/fonts-config --verbose \
fi \
%{-c: \
if test -x /usr/sbin/acroread-cidfont-config ; then \
/usr/sbin/acroread-cidfont-config \
fi \
if test -x /usr/sbin/ghostscript-cjk-config ; then \
/usr/sbin/ghostscript-cjk-config \
fi} \
%nil
# macro: reconfigure_fonts_post
# now alias to reconfigure_fonts, this can change in the future
# options:
# -c (the fonts are CJK fonts, also do setup which is only needed
# for CJK)
%reconfigure_fonts_post(c) \
if [ $1 -ne 2 ]; then \
%reconfigure_fonts c \
mkdir -p `dirname %{__fontsconfigrunflag}` \
touch %{__fontsconfigrunflag} \
%{-c: \
touch %{__fontsconfigrunflag}-cjk \
} \
if [ -n "$ZYPP_IS_RUNNING" ]; then \
cp %{__run_fonts_config} %{__fontsupdatescript} \
echo 'rm %{__fontsupdatescript}' >> %{__fontsupdatescript} \
%{-c: \
cp %{__run_cjk_init} %{__fontsupdatescript}-cjk \
echo 'rm %{__fontsupdatescript}-cjk' >> %{__fontsupdatescript}-cjk \
} \
fi \
%nil
@@ -104,7 +100,15 @@ Requires(pre): perl aaa_base \
# -c (the fonts are CJK fonts, also do setup which is only needed
# for CJK)
%reconfigure_fonts_postun(c) \
%reconfigure_fonts c \
mkdir -p `dirname %{__fontsconfigrunflag}` \
touch %{__fontsconfigrunflag} \
%{-c: \
touch %{__fontsconfigrunflag}-cjk \
} \
if [ $1 -eq 0 ]; then \
sh %{__run_fonts_config} \
%{-c: sh %{__run_cjk_init}} \
fi \
%nil
# macro: reconfigure_fonts_post
@@ -112,7 +116,11 @@ Requires(pre): perl aaa_base \
# options:
# -c (the fonts are CJK fonts, also do setup which is only needed
# for CJK)
%reconfigure_fonts_posttrans(c) \
%reconfigure_fonts_posttrans \
if [ -z "$ZYPP_IS_RUNNING" ]; then \
sh %{__run_fonts_config} \
sh %{__run_cjk_init} \
fi \
%nil
# macro: reconfigure_fonts_scriptles
@@ -129,5 +137,8 @@ Requires(pre): perl aaa_base \
%postun %{-n:-n %{-n*}} \
%reconfigure_fonts_postun c \
\
%posttrans %{-n:-n %{-n*}} \
%reconfigure_fonts_posttrans \
\
%nil