Skip to content

Commit

Permalink
Don't register trigger on Python for securedrop-app-code package
Browse files Browse the repository at this point in the history
We currently register a trigger with the Python
interpreter so dh_virtualenv can fix up the interpreter's symlinks
in case something changes as recommended in their docs[1].

However, our packages are designed for a single Ubuntu release, which
keeps the same version of Python for its entire lifetime, so the
interpreter in the venv will always be a symlink to `/usr/bin/python3`
and the dh_virtualenv postinst code will always be a no-op because it
skips all symlinks.

This was noticed because our custom postinst was not handling the
"triggered" state, which is valid per deb-postinst(5). Add that in for
future proofing even though we don't expect it to be called.

[1]
https://dh-virtualenv.readthedocs.io/en/latest/tutorial.html?highlight=trigger#step-2-set-up-packaging-for-your-project

Fixes #6230.
  • Loading branch information
legoktm authored and Conor Schaefer committed Jan 24, 2022
1 parent b4c2b3a commit b64f7a0
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,3 @@ securedrop_venv: "/opt/venvs/securedrop-app-code"
securedrop_venv_bin: "{{ securedrop_venv }}/bin"
securedrop_python_version: "{{ '3.8' if securedrop_target_distribution == 'focal' else '3.5' }}"
securedrop_venv_site_packages: "{{ securedrop_venv }}/lib/python{{ securedrop_python_version }}/site-packages"

securedrop_app_focal_files:
- src: securedrop-app-code.triggers-focal
dest: "{{ securedrop_app_code_prep_dir }}/debian/securedrop-app-code.triggers"

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@
src: "changelog-{{ securedrop_target_distribution }}"
dest: "{{ securedrop_app_code_prep_dir }}/debian/changelog"

- name: Replace the files required for focal package
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
with_items: "{{ securedrop_app_focal_files }}"
when: securedrop_target_distribution == "focal"

- name: Create the control file based on distribution
template:
src: "control.j2"
Expand Down
2 changes: 1 addition & 1 deletion install_files/securedrop-app-code/debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ case "$1" in

;;

abort-upgrade|abort-remove|abort-deconfigure)
abort-upgrade|abort-remove|abort-deconfigure|triggered)
;;

*)
Expand Down

This file was deleted.

0 comments on commit b64f7a0

Please sign in to comment.