[elbe-devel] [PATCH 8/8] elbepack: commands: drop internal adjustpkgs command
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Mon Jul 8 11:24:01 CEST 2024
The adjustpkgs command is a remnant from the time before the SOAP
service managing all buildenv interaction.
Nowadays it is only a maintenance burden, remove it.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
debian/python3-elbe-buildenv.install | 1 -
docs/conf.py | 2 +-
elbepack/commands/adjustpkgs.py | 106 ----------------------------------
newsfragments/+adjustpkgs.removal.rst | 1 +
4 files changed, 2 insertions(+), 108 deletions(-)
diff --git a/debian/python3-elbe-buildenv.install b/debian/python3-elbe-buildenv.install
index dbc4a5e928dc..43a86242b034 100644
--- a/debian/python3-elbe-buildenv.install
+++ b/debian/python3-elbe-buildenv.install
@@ -1,4 +1,3 @@
-usr/lib/python3.*/*-packages/elbepack/commands/adjustpkgs.py
usr/lib/python3.*/*-packages/elbepack/commands/chroot.py
usr/lib/python3.*/*-packages/elbepack/commands/db.py
usr/lib/python3.*/*-packages/elbepack/commands/fetch_initvm_pkgs.py
diff --git a/docs/conf.py b/docs/conf.py
index 5a09202b1c40..ab912969c73b 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -160,7 +160,7 @@ man_pages = [
] + [
('elbe-' + cmd, 'elbe-' + cmd, '', [], 1)
for cmd in elbepack.directories.get_cmdlist()
- if cmd not in {'adjustpkgs', 'bootup-check', 'check-build', 'pin_versions'}
+ if cmd not in {'bootup-check', 'check-build', 'pin_versions'}
]
diff --git a/elbepack/commands/adjustpkgs.py b/elbepack/commands/adjustpkgs.py
deleted file mode 100644
index 2dd8e319d7b2..000000000000
--- a/elbepack/commands/adjustpkgs.py
+++ /dev/null
@@ -1,106 +0,0 @@
-# ELBE - Debian Based Embedded Rootfilesystem Builder
-# SPDX-License-Identifier: GPL-3.0-or-later
-# SPDX-FileCopyrightText: 2013-2017 Linutronix GmbH
-
-import logging
-import sys
-from optparse import OptionParser
-
-import apt
-import apt.progress
-
-from elbepack.log import elbe_logging
-from elbepack.treeutils import etree
-
-
-def set_pkgs(pkglist):
-
- cache = apt.Cache()
- cache.update()
- cache.open(None)
-
- errors = 0
-
- with cache.actiongroup():
-
- for p in cache:
- if not p.is_installed:
- continue
- if p.essential or \
- p.is_auto_installed or \
- p.name in pkglist or \
- p.installed.priority == 'important' or \
- p.installed.priority == 'required':
- continue
- logging.info('MARK REMOVE %s', p.name)
- p.mark_delete(auto_fix=False, purge=True)
-
- for name in pkglist:
-
- if name not in cache:
- logging.warning('Package "%s" does not exist', name)
- errors += 1
- continue
-
- cp = cache[name]
-
- cp.mark_install()
- logging.info('MARK INSTALL %s', cp.name)
-
- cache.commit(apt.progress.base.AcquireProgress(),
- apt.progress.base.InstallProgress())
-
- cache.update()
- cache.open(None)
-
- for p in cache:
- if not p.is_installed:
- continue
- if p.is_auto_removable:
- p.mark_delete(purge=True)
- logging.info('MARKED AS AUTOREMOVE %s', p.name)
-
- cache.commit(apt.progress.base.AcquireProgress(),
- apt.progress.base.InstallProgress())
-
- return errors
-
-
-def run_command(argv):
- oparser = OptionParser(usage='usage: %prog adjustpkgs [options] <xmlfile>')
-
- oparser.add_option('-o', '--output', dest='output',
- help='name of logfile')
- oparser.add_option('-n', '--name', dest='name',
- help='name of the project (included in the report)')
- (opt, args) = oparser.parse_args(argv)
-
- if len(args) != 1:
- print('Wrong number of arguments')
- oparser.print_help()
- sys.exit(62)
-
- if not opt.output:
- return 0
-
- xml = etree(args[0])
- xml_pkglist = xml.node('/target/pkg-list')
- xml_pkgs = [p.et.text for p in xml_pkglist]
-
- # TODO: install buildimage packages after target image generation
- # and remove theme before target image generation
- # we need to introduce additional arguments for this
- # in default copy mode chroot to the target and remove elbe-daemon
- # and its dependencies (if it is not in target/pkg-list.
- buildenv_pkgs = ['python3-elbe-buildenv']
- if xml.has('./project/buildimage/pkg-list'):
- buildenv_pkgs.extend([p.et.text for p in xml.node(
- 'project/buildimage/pkg-list')])
-
- with elbe_logging({'files': opt.output}):
- logging.info('ELBE Report for Project %s', opt.name)
- return set_pkgs(xml_pkgs + buildenv_pkgs)
-
-
-if __name__ == '__main__':
- run_command(sys.argv[1:])
diff --git a/newsfragments/+adjustpkgs.removal.rst b/newsfragments/+adjustpkgs.removal.rst
new file mode 100644
index 000000000000..a9196a572fa8
--- /dev/null
+++ b/newsfragments/+adjustpkgs.removal.rst
@@ -0,0 +1 @@
+The *internal* command `elbe adjustpkgs`.
--
2.45.2
More information about the elbe-devel
mailing list