Accepting request 256945 from home:jsmeix:branches:Printing

- Make and install Python compiled bytecode files
  (.pyc compiled python and .pyo optimized compiled python)
  because normal users do not have write permissions to the
  install location /usr/share/hplip/ so that for normal users
  Python would recompile the sources every time,
  see https://en.opensuse.org/openSUSE:Packaging_Python
- Hardlink .pyc and .pyo when they have same content but
  do not run "fdupes buildroot/_datadir/hplip" because
  fdupes will link any files with same content there
  which can have unexpected side-effects (cf. bnc#784670).
- Removed RPM preun script that had deleted leftover .pyc
  and .pyo files if made during run-time (see the entry below
  dated Fri Feb 16 11:52:28 CET 2007) because now those files
  are provided in the package.
- Removed trailing whitespaces in RPM changelog file.

OBS-URL: https://build.opensuse.org/request/show/256945
OBS-URL: https://build.opensuse.org/package/show/Printing/hplip?expand=0&rev=101
This commit is contained in:
Johannes Meixner 2014-10-16 15:24:13 +00:00 committed by Git OBS Bridge
parent 836a684ab2
commit 74c1a36c82
2 changed files with 60 additions and 30 deletions

View File

@ -1,3 +1,22 @@
-------------------------------------------------------------------
Thu Oct 16 15:37:28 CEST 2014 - jsmeix@suse.de
- Make and install Python compiled bytecode files
(.pyc compiled python and .pyo optimized compiled python)
because normal users do not have write permissions to the
install location /usr/share/hplip/ so that for normal users
Python would recompile the sources every time,
see https://en.opensuse.org/openSUSE:Packaging_Python
- Hardlink .pyc and .pyo when they have same content but
do not run "fdupes buildroot/_datadir/hplip" because
fdupes will link any files with same content there
which can have unexpected side-effects (cf. bnc#784670).
- Removed RPM preun script that had deleted leftover .pyc
and .pyo files if made during run-time (see the entry below
dated Fri Feb 16 11:52:28 CET 2007) because now those files
are provided in the package.
- Removed trailing whitespaces in RPM changelog file.
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Sep 18 10:31:14 CEST 2014 - jsmeix@suse.de Thu Sep 18 10:31:14 CEST 2014 - jsmeix@suse.de

View File

@ -431,6 +431,30 @@ make %{?_smp_mflags}
%install %install
make install DESTDIR=%{buildroot} make install DESTDIR=%{buildroot}
# Make and install Python compiled bytecode files
# (.pyc compiled python and .pyo optimized compiled python)
# because normal users do not have write permissions
# to the install location /usr/share/hplip/ so that
# for normal users Python would recompile the sources every time
# which results longer program startup time and waste of CPU for compiling,
# see https://en.opensuse.org/openSUSE:Packaging_Python#Byte_Compiled_Files
# and http://lists.opensuse.org/opensuse-packaging/2014-10/msg00028.html
# Make and install .pyc files:
%py_compile %{buildroot}%{_datadir}/hplip
# Make and install .pyo files:
%py_compile -O %{buildroot}%{_datadir}/hplip
# Hardlink .pyc and .pyo when they have same content.
# Do not run "fdupes buildroot/_datadir/hplip" because
# fdupes will link any files with same content there
# which can have unexpected side-effects, compare
# https://bugzilla.opensuse.org/show_bug.cgi?id=784670
for pyc in $( find %{buildroot}%{_datadir}/hplip -name '*.pyc' )
do pyo="${pyc%.pyc}.pyo"
if test -f $pyo && diff -q $pyc $pyo 1>/dev/null
then echo hardlinking $pyc and $pyo because both have same content
ln -f $pyc $pyo
fi
done
# HPLIP's "make install" installs -rw-r--r-- usr/share/hplip/fax/pstotiff # HPLIP's "make install" installs -rw-r--r-- usr/share/hplip/fax/pstotiff
# and usr/lib/cups/filter/pstotiff -> usr/share/hplip/fax/pstotiff # and usr/lib/cups/filter/pstotiff -> usr/share/hplip/fax/pstotiff
# so that when the CUPS filter usr/lib/cups/filter/pstotiff is called, # so that when the CUPS filter usr/lib/cups/filter/pstotiff is called,
@ -606,19 +630,6 @@ then if ! grep -q 'hpaio' /etc/sane.d/dll.conf
fi fi
exit 0 exit 0
%preun
# If the package was removed and if it was updated
# remove all byte-compiled Python .pyc (and perhaps .pyo) files
# which are created at run-time by Python in /usr/share/hplip/.
# Use a generic method via "find" so that it works in any case
# without the need to maintain a long list of individual files.
# Even if this may accidentally remove "foreign" .pyc/.pyo files
# which do not originate from matching .py files from this package
# (e.g. third-party stuff in /usr/share/hplip/), there is no damage
# because Python could re-create them or work only with .py files.
find /usr/share/hplip/ -name '*.py[co]' -delete
exit 0
%postun %postun
%if 0%{?suse_version} >= 1140 %if 0%{?suse_version} >= 1140
%desktop_database_postun %desktop_database_postun