Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean Python cache in prerm only #6782

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions securedrop/debian/securedrop-app-code.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,6 @@ migrate_crontab() {
#
#
refresh_bytecode() {
# Remove any existing byte code files, to ensure that obsolete
# dependencies can't linger after they've been removed.
find "${SDVE}" -name '*.py[co]' -delete
find /var/www/securedrop -name '*.py[co]' -delete
# Now generate the new byte-code
py3compile "${SDVE}"
py3compile /var/www/securedrop
Expand Down
6 changes: 0 additions & 6 deletions securedrop/debian/securedrop-app-code.postrm
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,11 @@ set -e
# the debian-policy package
. /usr/share/debconf/confmodule

clean_pyc() {
find /var/www/securedrop/ -name '*.pyc' -delete
find /var/www/securedrop/ -name __pycache__ -delete
}

case "$1" in
upgrade|failed-upgrade)
;;

remove|abort-install|abort-upgrade|disappear)
clean_pyc
;;

purge)
Expand Down
40 changes: 40 additions & 0 deletions securedrop/debian/securedrop-app-code.prerm
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/sh
# prerm script for securedrop-app-code
#
# See: dh_installdeb(1).

set -e

# Summary of how this script can be called:
# * <prerm> 'remove'
# * <old-prerm> 'upgrade' <new-version>
# * <new-prerm> 'failed-upgrade' <old-version>
# * <conflictor's-prerm> 'remove' 'in-favour' <package> <new-version>
# * <deconfigured's-prerm> 'deconfigure' 'in-favour'
# <package-being-installed> <version> 'removing'
# <conflicting-package> <version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package.


case "$1" in
remove|upgrade|deconfigure)
py3clean /opt/venvs/securedrop-app-code
py3clean /var/www/securedrop
;;

failed-upgrade)
;;

*)
echo "prerm called with unknown argument '$1'" >&2
exit 1
;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0