mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-03-05 00:11:10 +00:00
Minimize the number of manually installed packages in images by marking
dependencies of metapackages as automatically installed.
This commit is contained in:
parent
f04caf6104
commit
9360135b2c
7
debian/changelog
vendored
7
debian/changelog
vendored
@ -1,3 +1,10 @@
|
||||
livecd-rootfs (2.536ubuntu1) UNRELEASED; urgency=medium
|
||||
|
||||
* Minimize the number of manually installed packages in images by marking
|
||||
dependencies of metapackages as automatically installed.
|
||||
|
||||
-- Julian Andres Klode <juliank@ubuntu.com> Tue, 18 Sep 2018 08:55:04 +0200
|
||||
|
||||
livecd-rootfs (2.536) cosmic; urgency=medium
|
||||
|
||||
* Fix live-server journald config snippet to actually disable journald rate
|
||||
|
1
debian/control
vendored
1
debian/control
vendored
@ -26,6 +26,7 @@ Depends: ${misc:Depends},
|
||||
parted,
|
||||
procps,
|
||||
python-minimal | python,
|
||||
python3-apt,
|
||||
python3-software-properties,
|
||||
qemu-utils,
|
||||
rsync,
|
||||
|
@ -445,6 +445,8 @@ EOF
|
||||
(cd chroot && find usr/share/doc -maxdepth 1 -type d | xargs du -s | sort -nr)
|
||||
echo END docdirs
|
||||
|
||||
live-build/auto/minimize-manual.py chroot
|
||||
|
||||
lb binary "$@"
|
||||
touch binary.success
|
||||
) 2>&1 | tee binary.log
|
||||
|
48
live-build/auto/minimize-manual.py
Normal file
48
live-build/auto/minimize-manual.py
Normal file
@ -0,0 +1,48 @@
|
||||
#!/usr/bin/python3
|
||||
"""Minimize the number of manually installed packages in the image.
|
||||
|
||||
Finds all manually meta packages and marks their dependencies as
|
||||
automatically installed.
|
||||
"""
|
||||
import apt
|
||||
import sys
|
||||
|
||||
|
||||
def is_root(pkg):
|
||||
return (pkg.is_installed and
|
||||
not pkg.is_auto_installed and
|
||||
(pkg.section == "metapackages" or
|
||||
pkg.section.endswith("/metapackages")))
|
||||
|
||||
|
||||
c = apt.Cache(rootdir=sys.argv[1] if len(sys.argv) > 1 else None)
|
||||
|
||||
roots = set(pkg for pkg in c if is_root(pkg))
|
||||
workset = set(roots)
|
||||
seen = set()
|
||||
|
||||
with c.actiongroup():
|
||||
while True:
|
||||
|
||||
print("Iteration", file=sys.stderr)
|
||||
to_proc = workset - seen
|
||||
if not to_proc:
|
||||
break
|
||||
for pkg in sorted(to_proc):
|
||||
print(" Visiting", pkg, file=sys.stderr)
|
||||
|
||||
# Mark every
|
||||
if pkg not in roots:
|
||||
pkg.mark_auto()
|
||||
|
||||
for dep in pkg.installed.dependencies + pkg.installed.recommends:
|
||||
if dep.rawtype not in ('Depends', 'PreDepends', 'Recommends'):
|
||||
continue
|
||||
for bdep in dep.or_dependencies:
|
||||
for v in bdep.target_versions:
|
||||
if v.package.is_installed:
|
||||
workset.add(v.package)
|
||||
|
||||
seen.add(pkg)
|
||||
|
||||
c.commit()
|
Loading…
x
Reference in New Issue
Block a user