[elbe-devel] [PATCH 08/17] elbepack: projectmanager: drop unused function set_current_project_postsh

Thomas Weißschuh thomas.weissschuh at linutronix.de
Fri Jul 19 13:30:59 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/db.py             | 35 +----------------------------------
 elbepack/projectmanager.py |  7 -------
 2 files changed, 1 insertion(+), 41 deletions(-)

diff --git a/elbepack/db.py b/elbepack/db.py
index e0fb7fa9daf6..e19fbc2c1609 100644
--- a/elbepack/db.py
+++ b/elbepack/db.py
@@ -10,7 +10,7 @@ import re
 import warnings
 from contextlib import contextmanager
 from datetime import datetime
-from shutil import copyfile, copyfileobj, rmtree
+from shutil import copyfile, rmtree
 from threading import Thread
 from urllib.parse import quote
 
@@ -34,7 +34,6 @@ from sqlalchemy.exc import OperationalError
 from sqlalchemy.orm import declarative_base, relationship, scoped_session, sessionmaker
 from sqlalchemy.orm.exc import NoResultFound
 
-from elbepack.dosunix import dos2unix
 from elbepack.elbeproject import ElbeProject
 from elbepack.elbexml import ElbeXML, ValidationMode
 
@@ -148,38 +147,6 @@ class ElbeDB:
 
             return ProjectData(p)
 
-    def set_postsh(self, builddir, postsh_file):
-        if not os.path.exists(builddir):
-            raise ElbeDBError('project directory does not exist')
-
-        with session_scope(self.session) as s:
-            p = None
-            try:
-                p = s.query(Project). \
-                    filter(Project.builddir == builddir).one()
-            except NoResultFound:
-                raise ElbeDBError(
-                    f'project {builddir} is not registered in the database')
-
-            if p.status == 'busy':
-                raise ElbeDBError(
-                    f'cannot set postsh file while project {builddir} is busy')
-
-            p.edit = datetime.utcnow()
-            if p.status == 'empty_project' or p.status == 'build_failed':
-                p.status = 'needs_build'
-            elif p.status == 'build_done':
-                p.status = 'has_changes'
-
-            with open(builddir + '/post.sh', 'w') as dst:
-                copyfileobj(postsh_file, dst)
-
-            dos2unix(builddir + '/post.sh')
-
-            return _update_project_file(
-                s, builddir,
-                'post.sh', 'application/sh', 'post install script')
-
     def set_xml(self, builddir, xml_file):
         # This method can throw: ElbeDBError, ValidationError, OSError
 
diff --git a/elbepack/projectmanager.py b/elbepack/projectmanager.py
index 0e8731acf6ab..fdb1fc7593c5 100644
--- a/elbepack/projectmanager.py
+++ b/elbepack/projectmanager.py
@@ -177,13 +177,6 @@ class ProjectManager:
             # Make db reload the xml file
             self.db.set_xml(ep.builddir, None)
 
-    def set_current_project_postsh(self, userid, postsh_file):
-        with self.lock:
-            ep = self._get_current_project(userid, allow_busy=False)
-
-            f = self.db.set_postsh(ep.builddir, postsh_file)
-            ep.postsh_file = f
-
     def set_current_project_version(self, userid, new_version):
         with self.lock:
             ep = self._get_current_project(userid, allow_busy=False)

-- 
2.45.2



More information about the elbe-devel mailing list