[elbe-devel] [PATCH 1/2] elbepack: projectmanager: add method to enqueue jobs

Thomas Weißschuh thomas.weissschuh at linutronix.de
Mon Sep 9 14:17:32 CEST 2024


To ease future changes to the enqueueing, move the logic to a method.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/projectmanager.py | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/elbepack/projectmanager.py b/elbepack/projectmanager.py
index b93493cb3af3..64f56ce453ab 100644
--- a/elbepack/projectmanager.py
+++ b/elbepack/projectmanager.py
@@ -45,6 +45,9 @@ class ProjectManager:
     def stop(self):
         self.worker.stop()
 
+    def _enqueue(self, job):
+        self.worker.enqueue(job)
+
     def new_project(self, userid):
         subdir = str(uuid7())
         builddir = path.join(self.basepath, subdir)
@@ -113,16 +116,15 @@ class ProjectManager:
             build_src,
             skip_pbuilder):
         ep = self.open_project(userid, builddir, allow_busy=False)
-        self.worker.enqueue(BuildJob(ep, build_bin, build_src,
-                                     skip_pbuilder))
+        self._enqueue(BuildJob(ep, build_bin, build_src, skip_pbuilder))
 
     def update_pbuilder(self, userid, builddir):
         ep = self.open_project(userid, builddir, allow_busy=False)
-        self.worker.enqueue(UpdatePbuilderJob(ep))
+        self._enqueue(UpdatePbuilderJob(ep))
 
     def build_pbuilder(self, userid, builddir, cross, noccache, ccachesize):
         ep = self.open_project(userid, builddir, allow_busy=False)
-        self.worker.enqueue(CreatePbuilderJob(ep, ccachesize, cross, noccache))
+        self._enqueue(CreatePbuilderJob(ep, ccachesize, cross, noccache))
 
     def build_pdebuild(self, userid, builddir, profile, cross):
         ep = self.open_project(userid, builddir, allow_busy=False)
@@ -131,7 +133,7 @@ class ProjectManager:
             raise InvalidState('No pbuilder exists: run "elbe pbuilder '
                                f'create --project {ep.builddir}" first')
 
-        self.worker.enqueue(PdebuildJob(ep, profile, cross))
+        self._enqueue(PdebuildJob(ep, profile, cross))
 
     def set_orig_fname(self, userid, builddir, fname):
         ep = self.open_project(userid, builddir, allow_busy=False)
@@ -158,19 +160,19 @@ class ProjectManager:
 
     def build_chroot_tarball(self, userid, builddir):
         ep = self.open_project(userid, builddir, allow_busy=False)
-        self.worker.enqueue(BuildChrootTarJob(ep))
+        self._enqueue(BuildChrootTarJob(ep))
 
     def build_sysroot(self, userid, builddir):
         ep = self.open_project(userid, builddir, allow_busy=False)
-        self.worker.enqueue(BuildSysrootJob(ep))
+        self._enqueue(BuildSysrootJob(ep))
 
     def build_sdk(self, userid, builddir):
         ep = self.open_project(userid, builddir, allow_busy=False)
-        self.worker.enqueue(BuildSDKJob(ep))
+        self._enqueue(BuildSDKJob(ep))
 
     def build_cdroms(self, userid, builddir, build_bin, build_src):
         ep = self.open_project(userid, builddir, allow_busy=False)
-        self.worker.enqueue(BuildCDROMsJob(ep, build_bin, build_src))
+        self._enqueue(BuildCDROMsJob(ep, build_bin, build_src))
 
     def rm_log(self, userid, builddir):
         ep = self.open_project(userid, builddir)

-- 
2.46.0



More information about the elbe-devel mailing list