[elbe-devel] [PATCH 07/17] elbepack: projectmanager: drop unused function set_current_project_presh

Thomas Weißschuh thomas.weissschuh at linutronix.de
Fri Jul 19 13:30:58 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             | 31 -------------------------------
 elbepack/projectmanager.py |  7 -------
 2 files changed, 38 deletions(-)

diff --git a/elbepack/db.py b/elbepack/db.py
index c1afaf612e58..e0fb7fa9daf6 100644
--- a/elbepack/db.py
+++ b/elbepack/db.py
@@ -148,37 +148,6 @@ class ElbeDB:
 
             return ProjectData(p)
 
-    def set_presh(self, builddir, presh_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 presh 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 + '/pre.sh', 'w') as dst:
-                copyfileobj(presh_file, dst)
-
-            dos2unix(builddir + '/pre.sh')
-
-            return _update_project_file(
-                s, builddir, 'pre.sh', 'application/sh', 'pre install script')
-
     def set_postsh(self, builddir, postsh_file):
         if not os.path.exists(builddir):
             raise ElbeDBError('project directory does not exist')
diff --git a/elbepack/projectmanager.py b/elbepack/projectmanager.py
index 76bbabe00f11..0e8731acf6ab 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_presh(self, userid, presh_file):
-        with self.lock:
-            ep = self._get_current_project(userid, allow_busy=False)
-
-            f = self.db.set_presh(ep.builddir, presh_file)
-            ep.presh_file = f
-
     def set_current_project_postsh(self, userid, postsh_file):
         with self.lock:
             ep = self._get_current_project(userid, allow_busy=False)

-- 
2.45.2



More information about the elbe-devel mailing list