From f5e81e19974100d7cdedd5107095d7d037b92ec1 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 26 Oct 2018 22:04:22 -0500 Subject: [PATCH] apt_udeb: allow downloading of non-udeb packages, with fallout it becomes mandatory to call download_debs subsequent to download_udebs, but that's fine because we have to call it with a list of deb packages necessary to add the 'grub2' bootloader to a minimal live system. When running with a full system (e.g., xfce-desktop) this list is slight overkill since for example libreetype6 is likely to be installed anyhow; but these are small packages compared to the whole installed system so we'll let it go. --- lwr/apt_udeb.py | 16 ++++++++++++++++ lwr/run.py | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/lwr/apt_udeb.py b/lwr/apt_udeb.py index b93ccf8..ea3b004 100644 --- a/lwr/apt_udeb.py +++ b/lwr/apt_udeb.py @@ -167,6 +167,22 @@ class AptUdebDownloader(object): packages = re.sub(r"/tmp.*pool", "pool", packages) with open(os.path.join(meta_dir, 'Packages'), 'w') as pkgout: pkgout.write(packages) + def download_debs(self, settings, packages): + main_pool = os.path.join(self.destdir, '..', 'pool', 'main') + handler = get_apt_handler(main_pool, + settings['mirror'], + settings['distribution'], + settings['architecture']) + for pkg_name in packages: + logging.debug(pkg_name) + prefix = pkg_name[0] + # destdir is just a base, needs pool/main/[index]/[name] + if pkg_name[:3] == 'lib': + prefix = pkg_name[:4] + pkg_dir = os.path.join(main_pool, prefix) + if not os.path.isdir(pkg_dir): os.makedirs(pkg_dir) + filename = handler.download_package(pkg_name, pkg_dir) + handler.clean_up_apt() # More mess, this time for debs packages = check_output(['apt-ftparchive', '-o', 'Packages::Extensions=.deb', 'packages', os.path.join(self.destdir, '..', 'pool', 'main')]) meta_dir = os.path.normpath(os.path.join(self.destdir, '..', 'dists', self.codename, 'main', 'binary-%s' % (self.architecture,))) diff --git a/lwr/run.py b/lwr/run.py index ca462d0..8cd0ccf 100644 --- a/lwr/run.py +++ b/lwr/run.py @@ -277,6 +277,10 @@ class LiveWrapper(cliapp.Application): # download all udebs in the suite, except exclude_list apt_udeb.download_udebs(exclude_list) + apt_udeb.download_debs(self.settings, + ["gettext-base", "grub-common", "grub-pc", + "grub-pc-bin", "grub2-common", "libfreetype6", "libfuse2", + "libpng16-16", "os-prober", "ucf"]) # FIXME: generate a Release file apt_udeb.clean_up_apt() print("... completed udeb downloads")