[elbe-devel] [PATCH 12/17] elbepack: projectmanager: drop unused function save_current_project_version
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Fri Jul 19 13:31:03 CEST 2024
This function is never used, so delete it.
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 | 51 +-------------------------------------
elbepack/pkgarchive.py | 61 ----------------------------------------------
elbepack/projectmanager.py | 7 ------
3 files changed, 1 insertion(+), 118 deletions(-)
diff --git a/elbepack/asyncworker.py b/elbepack/asyncworker.py
index 126ae79b6943..6376614c84e8 100644
--- a/elbepack/asyncworker.py
+++ b/elbepack/asyncworker.py
@@ -13,9 +13,8 @@ from elbepack.db import get_versioned_filename
from elbepack.dump import dump_fullpkgs
from elbepack.elbeproject import AptCacheCommitError, AptCacheUpdateError
from elbepack.log import elbe_logging, read_maxlevel, reset_level
-from elbepack.pkgarchive import checkout_binpkg_archive, gen_binpkg_archive
+from elbepack.pkgarchive import checkout_binpkg_archive
from elbepack.rfs import DebootstrapException
-from elbepack.shellhelper import do
from elbepack.updatepkg import gen_update_pkg
@@ -423,54 +422,6 @@ class GenUpdateJob(AsyncWorkerJob):
return filename
-class SaveVersionJob(AsyncWorkerJob):
- def __init__(self, project, description):
- AsyncWorkerJob.__init__(self, project)
- self.description = description
- self.name = self.project.xml.text('project/name')
- self.version = self.project.xml.text('project/version')
- self.old_status = None
-
- def enqueue(self, queue, db):
- self.old_status = db.set_busy(self.project.builddir,
- ['build_done', 'has_changes'])
-
- # Create the database entry now. This has the advantage that the
- # user will see an error message immediately, if he tries to use
- # the same version number twice. The time-consuming part is creating
- # the package archive, which is done in execute.
- try:
- db.save_version(self.project.builddir, self.description)
- except BaseException:
- db.reset_busy(self.project.builddir, self.old_status)
- raise
-
- if self.project.savesh_file:
- logging.info('save version script:')
- do([
- self.project.savesh_file, self.project.builddir,
- self.project.xml.text('project/version'),
- self.project.xml.text('project/name'),
- ], check=False)
-
- logging.info('Enqueueing project to save package archive')
- AsyncWorkerJob.enqueue(self, queue, db)
-
- def execute(self, db):
- logging.info('Generating package archive')
- repodir = get_versioned_filename(self.name, self.version,
- '.pkgarchive')
- try:
- gen_binpkg_archive(self.project, repodir)
- except Exception:
- logging.exception('Saving version failed')
- db.del_version(self.project.builddir, self.version, force=True)
- else:
- logging.info('Version saved successfully')
- finally:
- db.reset_busy(self.project.builddir, self.old_status)
-
-
class CheckoutVersionJob(AsyncWorkerJob):
def __init__(self, project, version):
AsyncWorkerJob.__init__(self, project)
diff --git a/elbepack/pkgarchive.py b/elbepack/pkgarchive.py
index 346133e7823a..4fca6012dbe0 100644
--- a/elbepack/pkgarchive.py
+++ b/elbepack/pkgarchive.py
@@ -2,13 +2,10 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2014-2017 Linutronix GmbH
-import errno
import logging
from os import path, remove
from shutil import copytree, move, rmtree
-from apt.package import FetchError
-
from elbepack.repomanager import RepoAttributes, RepoBase
@@ -28,64 +25,6 @@ class ArchiveRepo(RepoBase):
origin)
-def gen_binpkg_archive(ep, repodir):
- repopath = path.join(ep.builddir, repodir)
-
- try:
- rmtree(repopath)
- except OSError as e:
- if e.errno != errno.ENOENT:
- raise
-
- # Create archive directory for packages we have to download
- ep.buildenv.rfs.mkdir_p('/var/cache/elbe/pkgarchive')
-
- try:
- # Repository containing all packages currently installed
- repo = ArchiveRepo(ep.xml, repopath, 'Elbe',
- 'Elbe package archive', ['main'])
-
- c = ep.get_rpcaptcache()
- pkglist = c.get_installed_pkgs()
-
- for pkg in pkglist:
- # Use package from local APT archive, if the file exists
- filename = pkg.installed_deb
- rel_path = path.join('var/cache/apt/archives', filename)
- abs_path = ep.buildenv.rfs.fname(rel_path)
-
- if not path.isfile(abs_path):
- # Package file does not exist, download it and adjust path name
- logging.warning('Package file "%s" not found'
- 'in var/cache/apt/archives, downloading it',
- filename)
- abs_path = ep.buildenv.rfs.fname(rel_path)
- pkg_id = f'{pkg.name}-{pkg.installed_version}'
- try:
- abs_path = c.download_binary(pkg.name,
- '/var/cache/elbe/pkgarchive',
- pkg.installed_version)
- except ValueError:
- logging.error('No package "%s"', pkg_id)
- raise
- except FetchError:
- logging.error('Package "%s" could not be downloaded', pkg_id)
- raise
- except TypeError:
- logging.error('Package "%s" missing name or version', pkg_id)
- raise
-
- # Add package to repository
- # XXX Use correct component
- repo.includedeb(abs_path, 'main')
-
- repo.finalize()
-
- finally:
- rmtree(ep.buildenv.rfs.fname('var/cache/elbe/pkgarchive'))
- repo.finalize()
-
-
def checkout_binpkg_archive(ep, repodir):
repopath = path.join(ep.builddir, repodir)
diff --git a/elbepack/projectmanager.py b/elbepack/projectmanager.py
index eb3d0b56a114..9d22e399a85a 100644
--- a/elbepack/projectmanager.py
+++ b/elbepack/projectmanager.py
@@ -22,7 +22,6 @@ from elbepack.asyncworker import (
CreatePbuilderJob,
GenUpdateJob,
PdebuildJob,
- SaveVersionJob,
UpdatePbuilderJob,
)
from elbepack.db import ElbeDB, get_versioned_filename
@@ -177,12 +176,6 @@ class ProjectManager:
# Make db reload the xml file
self.db.set_xml(ep.builddir, None)
- def save_current_project_version(self, userid, description=None):
- with self.lock:
- ep = self._get_current_project(userid, allow_busy=False)
-
- self.worker.enqueue(SaveVersionJob(ep, description))
-
def checkout_project_version(self, userid, version):
with self.lock:
ep = self._get_current_project(userid, allow_busy=False)
--
2.45.2
More information about the elbe-devel
mailing list