[elbe-devel] [PATCH 3/8] elbepack: db: remove del_version()

Thomas Weißschuh thomas.weissschuh at linutronix.de
Wed Aug 14 11:26:29 CEST 2024


This function is not reachable by the user, only internal commands.
Drop it and the corresponding internal command.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 docs/elbe-db.rst        |  4 ----
 elbepack/commands/db.py |  8 --------
 elbepack/db.py          | 25 -------------------------
 3 files changed, 37 deletions(-)

diff --git a/docs/elbe-db.rst b/docs/elbe-db.rst
index f5437d250ecd..8c91b4e453a7 100644
--- a/docs/elbe-db.rst
+++ b/docs/elbe-db.rst
@@ -24,7 +24,6 @@ SYNOPSIS
       elbe db [options] del_user <userid>
       elbe db [options] add_user <username>
       elbe db [options] list_versions <project_dir>
-      elbe db [options] del_versions <project_dir> <version>
       elbe db [options] build <project_dir>
 
 DESCRIPTION
@@ -122,9 +121,6 @@ COMMANDS
    Saves current state of project <project_dir> as version. Options:
    description.
 
-*del_versions* <project_dir> <version>
-   Deletes the version <version> of project <project_dir>.
-
 ELBE
 ====
 
diff --git a/elbepack/commands/db.py b/elbepack/commands/db.py
index 10d9e57716ff..5a754ef0e28d 100644
--- a/elbepack/commands/db.py
+++ b/elbepack/commands/db.py
@@ -153,13 +153,6 @@ def _save_version(args):
     db.save_version(args.project_dir, args.description)
 
 
- at add_argument('project_dir')
- at add_argument('version')
-def _del_version(args):
-    db = ElbeDB()
-    db.del_version(args.project_dir, args.version)
-
-
 _actions = {
     'init':                _init,
     'add_user':            _add_user,
@@ -174,7 +167,6 @@ _actions = {
     'reset_project':       _reset_project,
     'list_versions':       _list_versions,
     'save_version':        _save_version,
-    'del_versions':        _del_version,
 }
 
 
diff --git a/elbepack/db.py b/elbepack/db.py
index 284f5b723e44..0031295b1ac9 100644
--- a/elbepack/db.py
+++ b/elbepack/db.py
@@ -498,31 +498,6 @@ class ElbeDB:
             copyfile(versionxmlpath, sourcexmlpath)
             v.project.version = version
 
-    def del_version(self, builddir, version, force=False):
-        with session_scope(self.session) as s:
-            try:
-                v = s.query(ProjectVersion).\
-                    filter(ProjectVersion.builddir == builddir).\
-                    filter(ProjectVersion.version == version).one()
-            except NoResultFound:
-                raise ElbeDBError(
-                    f'no such project version: {builddir} (version {version})')
-
-            if not force:
-                if v.project.status == 'busy':
-                    raise ElbeDBError(
-                        f'cannot delete version of project in {builddir} while '
-                        'it is busy')
-
-            xmlname = get_versioned_filename(v.project.name, version,
-                                             '.version.xml')
-            xmlpath = os.path.join(builddir, xmlname)
-            os.remove(xmlpath)
-            s.delete(v)
-
-            s.query(ProjectFile).filter(ProjectFile.builddir == builddir).\
-                filter(ProjectFile.name == xmlname).delete()
-
     def get_version_xml(self, builddir, version):
         with session_scope(self.session) as s:
             try:

-- 
2.46.0



More information about the elbe-devel mailing list