[elbe-devel] [PATCH 4/8] elbepack: db: remove save_version()

Thomas Weißschuh thomas.weissschuh at linutronix.de
Wed Aug 14 11:26:30 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        |  9 ---------
 elbepack/commands/db.py |  8 --------
 elbepack/db.py          | 37 -------------------------------------
 3 files changed, 54 deletions(-)

diff --git a/docs/elbe-db.rst b/docs/elbe-db.rst
index 8c91b4e453a7..fe8b3b06abbe 100644
--- a/docs/elbe-db.rst
+++ b/docs/elbe-db.rst
@@ -17,7 +17,6 @@ SYNOPSIS
       elbe db [options] get_files <project_dir>
       elbe db [options] reset_project <project_dir>
       elbe db [options] list_users
-      elbe db [options] save_version <project_dir>
       elbe db [options] set_xml <project_dir> <xml_file>
       elbe db [options] del_project <project_dir>
       elbe db [options] init
@@ -68,10 +67,6 @@ OPTIONS
 --clean
    Deletes the target and chroot directory in <project-dir>.
 
---description
-   Description of the project version which shall be stored in the
-   database.
-
 COMMANDS
 ========
 
@@ -117,10 +112,6 @@ COMMANDS
 *list_versions* <project_dir>
    Lists all versions of project <project_dir>.
 
-*save_version* <project_dir>
-   Saves current state of project <project_dir> as version. Options:
-   description.
-
 ELBE
 ====
 
diff --git a/elbepack/commands/db.py b/elbepack/commands/db.py
index 5a754ef0e28d..bed656c7f9a9 100644
--- a/elbepack/commands/db.py
+++ b/elbepack/commands/db.py
@@ -146,13 +146,6 @@ def _list_versions(args):
             print(v.version)
 
 
- at add_argument('--description', dest='description')
- at add_argument('project_dir')
-def _save_version(args):
-    db = ElbeDB()
-    db.save_version(args.project_dir, args.description)
-
-
 _actions = {
     'init':                _init,
     'add_user':            _add_user,
@@ -166,7 +159,6 @@ _actions = {
     'get_files':           _get_files,
     'reset_project':       _reset_project,
     'list_versions':       _list_versions,
-    'save_version':        _save_version,
 }
 
 
diff --git a/elbepack/db.py b/elbepack/db.py
index 0031295b1ac9..86deb0c6ccc4 100644
--- a/elbepack/db.py
+++ b/elbepack/db.py
@@ -441,43 +441,6 @@ class ElbeDB:
 
             return [ProjectVersionData(v) for v in p.versions]
 
-    def save_version(self, builddir, description=None):
-        with session_scope(self.session) as s:
-            try:
-                p = s.query(Project).filter(Project.builddir == builddir).\
-                    one()
-            except NoResultFound:
-                raise ElbeDBError(
-                    f'project {builddir} is not registered in the database')
-
-            assert p.status == 'busy'
-
-            sourcexmlpath = os.path.join(builddir, 'source.xml')
-            sourcexml = ElbeXML(sourcexmlpath,
-                                url_validation=ValidationMode.NO_CHECK)
-
-            version = sourcexml.text('project/version')
-            if s.query(ProjectVersion).\
-                    filter(ProjectVersion.builddir == builddir).\
-                    filter(ProjectVersion.version == version).count() > 0:
-                raise ElbeDBError(
-                    f'Version {version} already exists for project in '
-                    f'{builddir}, please change version number first')
-
-            versionxmlname = get_versioned_filename(p.name, version,
-                                                    '.version.xml')
-            versionxmlpath = os.path.join(builddir, versionxmlname)
-            copyfile(sourcexmlpath, versionxmlpath)
-
-            v = ProjectVersion(builddir=builddir,
-                               version=version,
-                               description=description)
-            s.add(v)
-
-            _update_project_file(s, builddir, versionxmlname,
-                                 'application/xml',
-                                 f'source.xml for version {version}')
-
     def checkout_version_xml(self, builddir, version):
         with session_scope(self.session) as s:
             try:

-- 
2.46.0



More information about the elbe-devel mailing list