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.
This commit is contained in:
Jeff Epler 2018-10-26 22:04:22 -05:00
parent 3a02de0f40
commit f5e81e1997
2 changed files with 20 additions and 0 deletions

View file

@ -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,)))

View file

@ -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")