[elbe-devel] [PATCH 5/8] elbepack: db: remove list_versions()

Thomas Weißschuh thomas.weissschuh at linutronix.de
Tue Aug 13 09:31:21 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 | 13 -------------
 elbepack/db.py          | 30 ------------------------------
 3 files changed, 47 deletions(-)

diff --git a/docs/elbe-db.rst b/docs/elbe-db.rst
index fe8b3b06abbe..5866674cbd8b 100644
--- a/docs/elbe-db.rst
+++ b/docs/elbe-db.rst
@@ -22,7 +22,6 @@ SYNOPSIS
       elbe db [options] init
       elbe db [options] del_user <userid>
       elbe db [options] add_user <username>
-      elbe db [options] list_versions <project_dir>
       elbe db [options] build <project_dir>
 
 DESCRIPTION
@@ -109,9 +108,6 @@ COMMANDS
    has been aborted and the project is set ``busy`` in in the database
    obstructing future actions on this project. Options: clean[=False].
 
-*list_versions* <project_dir>
-   Lists all versions of project <project_dir>.
-
 ELBE
 ====
 
diff --git a/elbepack/commands/db.py b/elbepack/commands/db.py
index bed656c7f9a9..bd8d83b043ea 100644
--- a/elbepack/commands/db.py
+++ b/elbepack/commands/db.py
@@ -134,18 +134,6 @@ def _reset_project(args):
     db.reset_project(args.project_dir, args.clean)
 
 
- at add_argument('project_dir')
-def _list_versions(args):
-    db = ElbeDB()
-    versions = db.list_project_versions(args.project_dir)
-
-    for v in versions:
-        if v.description:
-            print(f'{v.version}: {v.description}')
-        else:
-            print(v.version)
-
-
 _actions = {
     'init':                _init,
     'add_user':            _add_user,
@@ -158,7 +146,6 @@ _actions = {
     'build':               _build,
     'get_files':           _get_files,
     'reset_project':       _reset_project,
-    'list_versions':       _list_versions,
 }
 
 
diff --git a/elbepack/db.py b/elbepack/db.py
index 7f4c80037453..b7180d4bd258 100644
--- a/elbepack/db.py
+++ b/elbepack/db.py
@@ -431,17 +431,6 @@ class ElbeDB:
 
             return int(p.owner_id)
 
-    def list_project_versions(self, builddir):
-        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')
-
-            return [ProjectVersionData(v) for v in p.versions]
-
     def checkout_version_xml(self, builddir, version):
         with session_scope(self.session) as s:
             try:
@@ -814,25 +803,6 @@ class ProjectVersion (Base):
     timestamp = Column(DateTime, default=datetime.utcnow)
 
 
-class ProjectVersionData:
-    def __init__(self, pv):
-        self.builddir = str(pv.builddir)
-        self.version = str(pv.version)
-        if pv.description:
-            self.description = str(pv.description)
-        else:
-            self.description = None
-        self.timestamp = datetime(
-            pv.timestamp.year,
-            pv.timestamp.month,
-            pv.timestamp.day,
-            pv.timestamp.hour,
-            pv.timestamp.minute,
-            pv.timestamp.second,
-            pv.timestamp.microsecond,
-            pv.timestamp.tzinfo)
-
-
 class ProjectFile (Base):
     __tablename__ = 'files'
 

-- 
2.46.0



More information about the elbe-devel mailing list