Commit d09ecc72 authored by intrigeri's avatar intrigeri

Revert "ASP: remove code to exit if running from live build"

This reverts commit c3631c8b.

Today the build fails for me with:

 The following NEW packages will be installed:
 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
 Need to get 125 kB of archives.
 After this operation, 305 kB of additional disk space will be used.
 Get:1 devel/main amd64 squashfs-tools amd64 1:4.3-3.0tails4 [125 kB]
 Traceback (most recent call last):
   File "/usr/local/sbin/tails-additional-software", line 16, in <module>
     from tailslib import LIVE_USERNAME
 ImportError: cannot import name 'LIVE_USERNAME'
 Fetched 125 kB in 0s (3463 kB/s)
 E: Sub-process /usr/local/sbin/tails-additional-software apt-pre returned an error code (1)
 E: Failure running script /usr/local/sbin/tails-additional-software apt-pre

I'm not sure why it did not fail recently but in any case, I believe the
justification for commit:c3631c8b
("the ASP dpkg hooks are installed in the end of the build, making this code
useless") was based on a misunderstanding:
config/chroot_local-hooks/99-zz-install-ASP-DPKG-hooks is not "the end of the
build" and we do run APT again later. So let's reintroduce the safeguard.
parent 30ebdc90
......@@ -41,6 +41,12 @@ APT_ARCHIVES_DIR = "/var/cache/apt/archives"
APT_LISTS_DIR = "/var/lib/apt/lists"
def _exit_if_in_live_build():
"""Exits with success if running inside live-build."""
if "SOURCE_DATE_EPOCH" in os.environ:
def _launch_apt_get(specific_args):
"""Launch apt-get with given arguments.
......@@ -391,6 +397,7 @@ def show_system_log():
def apt_hook_pre():
"""Subcommand to handle Dpkg::Pre-Install-Pkgs."""
_exit_if_in_live_build()"Saving package changes")
apt_cache = apt.cache.Cache()
......@@ -447,6 +454,7 @@ def apt_hook_post():
Retrieve the list of packages saved by apt_hook_pre, filter packages not
interesting and pass the resulting list to the appropriate method.
_exit_if_in_live_build()"Examining package changes")
with open(ASP_STATE_PACKAGES) as f:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment