[elbe-devel] [PATCH 17/17] elbepack: projectmanager: drop unused apt functions
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Fri Jul 19 13:31:08 CEST 2024
These functions are never used, so delete them.
Also propagate the deletion to other components which are now unused.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/asyncworker.py | 92 ------------------------------------------
elbepack/projectmanager.py | 99 ----------------------------------------------
elbepack/rpcaptcache.py | 51 ------------------------
3 files changed, 242 deletions(-)
diff --git a/elbepack/asyncworker.py b/elbepack/asyncworker.py
index 2edefdbe70e8..dc6c9087b348 100644
--- a/elbepack/asyncworker.py
+++ b/elbepack/asyncworker.py
@@ -9,7 +9,6 @@ from queue import Queue
from threading import Thread
from urllib.parse import quote
-from elbepack.dump import dump_fullpkgs
from elbepack.elbeproject import AptCacheCommitError, AptCacheUpdateError
from elbepack.log import elbe_logging, read_maxlevel, reset_level
from elbepack.rfs import DebootstrapException
@@ -282,97 +281,6 @@ class UpdatePbuilderJob(AsyncWorkerJob):
db.reset_busy(self.project.builddir, success)
-class APTUpdateJob(AsyncWorkerJob):
-
- def enqueue(self, queue, db):
- db.set_busy(self.project.builddir,
- ['build_done', 'has_changes'])
- logging.info('Enqueueing project for APT cache update')
- AsyncWorkerJob.enqueue(self, queue, db)
-
- def execute(self, db):
- success = self.build_failed
- try:
- logging.info('APT cache update started')
- with self.project.buildenv:
- self.project.get_rpcaptcache().update()
- except Exception:
- logging.exception('APT cache update failed')
- else:
- if read_maxlevel(self.project.builddir) >= logging.ERROR:
- logging.info('APT cache update finished with Error')
- else:
- logging.info('APT cache update finished successfully')
- success = self.has_changes
- finally:
- db.reset_busy(self.project.builddir, success)
-
-
-class APTUpdUpgrJob(AsyncWorkerJob):
-
- def enqueue(self, queue, db):
- db.set_busy(self.project.builddir, ['build_done', 'has_changes'])
- logging.info('Enqueueing project for APT update & upgrade')
- AsyncWorkerJob.enqueue(self, queue, db)
-
- def execute(self, db):
- success = self.build_failed
- try:
- logging.info('APT update started')
- with self.project.buildenv:
- self.project.get_rpcaptcache().update()
- logging.info('APT update finished, upgrade started')
- self.project.get_rpcaptcache().upgrade()
- except Exception:
- logging.exception('APT update & upgrade failed')
- else:
- if read_maxlevel(self.project.builddir) >= logging.ERROR:
- logging.info('APT upgrade finished with Error')
- else:
- logging.info('APT upgrade finished')
- success = self.has_changes
- finally:
- db.reset_busy(self.project.builddir, success)
-
-
-class APTCommitJob(AsyncWorkerJob):
-
- def enqueue(self, queue, db):
- old_status = db.set_busy(self.project.builddir,
- ['build_done', 'has_changes'])
- if self.project.get_rpcaptcache().get_changes():
- logging.info('Enqueueing project for package changes')
- AsyncWorkerJob.enqueue(self, queue, db)
- else:
- db.reset_busy(self.project.builddir, old_status)
-
- def execute(self, db):
- success = self.build_failed
- try:
- logging.info('Applying package changes')
- with self.project.buildenv:
- # Commit changes, update full package list and write
- # out new source.xml
- self.project.get_rpcaptcache().commit()
- dump_fullpkgs(self.project.xml,
- self.project.buildenv.rfs,
- self.project.get_rpcaptcache())
-
- sourcexmlpath = path.join(self.project.builddir,
- 'source.xml')
- self.project.xml.xml.write(sourcexmlpath)
- except Exception:
- logging.exception('Applying package changes failed')
- else:
- if read_maxlevel(self.project.builddir) >= logging.ERROR:
- logging.info('Package changes applied with Error')
- else:
- logging.info('Package changes applied successfully')
- success = self.has_changes
- finally:
- db.reset_busy(self.project.builddir, success)
-
-
class GenUpdateJob(AsyncWorkerJob):
def __init__(self, project, base_version):
AsyncWorkerJob.__init__(self, project)
diff --git a/elbepack/projectmanager.py b/elbepack/projectmanager.py
index 5d96e67d526c..6c4b8602a536 100644
--- a/elbepack/projectmanager.py
+++ b/elbepack/projectmanager.py
@@ -7,9 +7,6 @@ from os import path
from threading import Lock
from elbepack.asyncworker import (
- APTCommitJob,
- APTUpdUpgrJob,
- APTUpdateJob,
AsyncWorker,
BuildCDROMsJob,
BuildChrootTarJob,
@@ -257,102 +254,6 @@ class ProjectManager:
ep = self._get_current_project(userid)
self.worker.enqueue(GenUpdateJob(ep, base_version))
- def apt_upd_upgr(self, userid):
- with self.lock:
- ep = self._get_current_project(userid, allow_busy=False)
- self.worker.enqueue(APTUpdUpgrJob(ep))
-
- def apt_update(self, userid):
- with self.lock:
- ep = self._get_current_project(userid, allow_busy=False)
- self.worker.enqueue(APTUpdateJob(ep))
-
- def apt_commit(self, userid):
- with self.lock:
- ep = self._get_current_project(userid, allow_busy=False)
- self.worker.enqueue(APTCommitJob(ep))
-
- def apt_clear(self, userid):
- with self.lock:
- c = self._get_current_project_apt_cache(userid)
- c.clear()
-
- def apt_mark_install(self, userid, pkgname, version):
- with self.lock:
- c = self._get_current_project_apt_cache(userid)
- c.mark_install(pkgname, version)
- ep = self._get_current_project(userid)
- pkgs = ep.xml.get_target_packages()
- if pkgname not in pkgs:
- pkgs.append(pkgname)
- ep.xml.set_target_packages(pkgs)
-
- def apt_mark_upgrade(self, userid, pkgname, version):
- with self.lock:
- c = self._get_current_project_apt_cache(userid)
- c.mark_upgrade(pkgname, version)
-
- def apt_mark_keep(self, userid, pkgname, version):
- with self.lock:
- c = self._get_current_project_apt_cache(userid)
- c.mark_keep(pkgname, version)
-
- ep = self._get_current_project(userid)
- pkgs = ep.xml.get_target_packages()
- if pkgname not in pkgs:
- pkgs.append(pkgname)
- ep.xml.set_target_packages(pkgs)
-
- def apt_get_target_packages(self, userid):
- with self.lock:
- ep = self._get_current_project(userid)
- return ep.xml.get_target_packages()
-
- def apt_upgrade(self, userid, dist_upgrade=False):
- with self.lock:
- c = self._get_current_project_apt_cache(userid)
- c.upgrade(dist_upgrade)
-
- def apt_get_changes(self, userid):
- with self.lock:
- c = self._get_current_project_apt_cache(userid)
- return c.get_changes()
-
- def apt_get_marked_install(self, userid, section='all'):
- with self.lock:
- c = self._get_current_project_apt_cache(userid)
- return c.get_marked_install(section=section)
-
- def apt_get_installed(self, userid, section='all'):
- with self.lock:
- c = self._get_current_project_apt_cache(userid)
- return c.get_installed_pkgs(section=section)
-
- def apt_get_upgradeable(self, userid, section='all'):
- with self.lock:
- c = self._get_current_project_apt_cache(userid)
- return c.get_upgradeable(section=section)
-
- def apt_get_pkglist(self, userid, section='all'):
- with self.lock:
- c = self._get_current_project_apt_cache(userid)
- return c.get_pkglist(section)
-
- def apt_get_pkg(self, userid, term):
- with self.lock:
- c = self._get_current_project_apt_cache(userid)
- return c.get_pkg(term)
-
- def apt_get_pkgs(self, userid, term):
- with self.lock:
- c = self._get_current_project_apt_cache(userid)
- return c.get_pkgs(term)
-
- def apt_get_sections(self, userid):
- with self.lock:
- c = self._get_current_project_apt_cache(userid)
- return c.get_sections()
-
def read_current_project_log(self, userid):
with self.lock:
ep = self._get_current_project(userid)
diff --git a/elbepack/rpcaptcache.py b/elbepack/rpcaptcache.py
index ddc2c2db2ad1..9b17abba45f3 100644
--- a/elbepack/rpcaptcache.py
+++ b/elbepack/rpcaptcache.py
@@ -98,19 +98,6 @@ class RPCAPTCache(InChRootObject):
f'{p.is_now_broken} {p.is_inst_broken} '
f'{p.is_upgradable}\n')
- def get_sections(self):
- ret = list({p.section for p in self.cache})
- ret.sort()
- return ret
-
- def get_pkglist(self, section):
- if section == 'all':
- ret = [APTPackage(p) for p in self.cache]
- else:
- ret = [APTPackage(p) for p in self.cache if p.section == section]
-
- return ret
-
def mark_install(self, pkgname, version, from_user=True, nodeps=False):
print(f'Mark for install "{pkgname}"')
p = self.cache[pkgname]
@@ -214,20 +201,10 @@ class RPCAPTCache(InChRootObject):
if remove:
p.mark_delete(auto_fix=True, purge=True)
- def mark_upgrade(self, pkgname, version):
- p = self.cache[pkgname]
- if version:
- p.candidate = p.versions[version]
- p.mark_upgrade()
-
def mark_delete(self, pkgname):
p = self.cache[pkgname]
p.mark_delete(purge=True)
- def mark_keep(self, pkgname, _version):
- p = self.cache[pkgname]
- p.mark_keep()
-
def update(self):
self.cache.update(fetch_progress=ElbeAcquireProgress())
self.cache.open(progress=ElbeOpProgress())
@@ -244,9 +221,6 @@ class RPCAPTCache(InChRootObject):
ElbeInstallProgress(fileno=sys.stdout.fileno()))
self.cache.open(progress=ElbeOpProgress())
- def clear(self):
- self.cache.clear()
-
def get_dependencies(self, pkgname):
deps = getalldeps(self.cache, pkgname)
return [APTPackage(p, cache=self.cache) for p in deps]
@@ -277,25 +251,6 @@ class RPCAPTCache(InChRootObject):
return index
- def get_marked_install(self, section='all'):
- if section == 'all':
- ret = [APTPackage(p) for p in self.cache if p.marked_install]
- else:
- ret = [APTPackage(p) for p in self.cache if (p.section == section
- and p.marked_install)]
- return ret
-
- def get_upgradeable(self, section='all'):
- if section == 'all':
- ret = [APTPackage(p) for p in self.cache if p.is_upgradable]
- else:
- ret = [APTPackage(p) for p in self.cache if (p.section == section
- and p.is_upgradable)]
- return ret
-
- def upgrade(self, dist_upgrade=False):
- self.cache.upgrade(dist_upgrade)
-
def get_changes(self):
changes = self.cache.get_changes()
return [APTPackage(p) for p in changes]
@@ -311,12 +266,6 @@ class RPCAPTCache(InChRootObject):
def get_pkg(self, pkgname):
return APTPackage(self.cache[pkgname])
- def get_pkgs(self, pkgname):
- return [
- APTPackage(
- self.cache[p]) for p in sorted(
- self.cache.keys()) if pkgname in p.lower()]
-
def get_corresponding_source_packages(self, pkg_lst=None):
return get_corresponding_source_packages(self.cache, pkg_lst)
--
2.45.2
More information about the elbe-devel
mailing list