Package: release.debian.org Severity: normal User: release.debian....@packages.debian.org Usertags: unblock
Please unblock package calibre Upgrade tests showed that the switch from hand-written *.pyc (compiled python files) cleanup to pyclean trigger an error when upgrading from an old version, in particular from current stable to current testing. This happens only if calibre is once started as root, so I never tested this one. When starting as root, python files under /usr/lib/calibre/ will be compiled to .pyc files, which were NOT shipped in old versions (current stable). Then, after upgrade from stable to testing, these .pyc files are not properly removed, in particular the .pyc files in /usr/lib/calibre/regex which is a directory that disappears. To deal with this special case, I added postinst code that checks whether we are updating from one of the affected versions, and in the respective case manually purges .pyc (and .pyo) files and remove the regex directory. If this is not done, calibre fails to start as shown in #865879 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=865879 The debdiff is diff -Nru calibre-3.39.1+dfsg/debian/calibre.postinst calibre-3.39.1+dfsg/debian/calibre.postinst --- calibre-3.39.1+dfsg/debian/calibre.postinst 2019-02-08 17:41:17.000000000 +0900 +++ calibre-3.39.1+dfsg/debian/calibre.postinst 2019-05-10 11:47:37.000000000 +0900 @@ -2,6 +2,29 @@ set -eu +# +# deal with .py[co] files that are left overs from pre-pycompile switch +# since we drop regexp etc files + +case "$1" in + configure|reconfigure) + + old_version=$2 + + if [ -n "$old_version" ] && dpkg --compare-versions "$old_version" lt "3.4.0+dfsg-2"; then + find /usr/lib/calibre -name \*.pyc -o -name \*.pyo | while read file ; do + rm "${file}" + done + # regex directory was there but disappeared, try to remove it + # now that all the pyc files should be gone. + if [ -d /usr/lib/calibre/regex ] ; then + rmdir /usr/lib/calibre/regex + fi + fi + ;; +esac + + if which pycompile >/dev/null 2>&1; then pycompile -p calibre /usr/lib/calibre -V 2.7-2.9 fi diff -Nru calibre-3.39.1+dfsg/debian/changelog calibre-3.39.1+dfsg/debian/changelog --- calibre-3.39.1+dfsg/debian/changelog 2019-02-08 17:41:17.000000000 +0900 +++ calibre-3.39.1+dfsg/debian/changelog 2019-05-10 11:47:37.000000000 +0900 @@ -1,3 +1,9 @@ +calibre (3.39.1+dfsg-3) unstable; urgency=medium + + * remove .pyc files on upgrade from pre-pyclean versions (Closes: #865879) + + -- Norbert Preining <norb...@preining.info> Fri, 10 May 2019 11:47:37 +0900 + calibre (3.39.1+dfsg-2) unstable; urgency=medium * update my email and VCS fields (Closes: #921473) Thanks for considering Norbert unblock calibre/3.39.1+dfsg-3 -- System Information: Debian Release: 10.0 APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 5.1.0 (SMP w/8 CPU cores) Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system)