[elbe-devel] [PATCH 10/22] elbepack: projectmanager: avoid cache indirection in set_orig_fname()

Thomas Weißschuh thomas.weissschuh at linutronix.de
Wed Aug 14 15:29:24 CEST 2024


The target project is already available, there is no need for the
indirection refetching it from the cache.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/daemons/soap/esoap.py | 10 +---------
 elbepack/projectmanager.py     |  8 ++++++--
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/elbepack/daemons/soap/esoap.py b/elbepack/daemons/soap/esoap.py
index 9cac449b2bc1..f7c6bd012e72 100644
--- a/elbepack/daemons/soap/esoap.py
+++ b/elbepack/daemons/soap/esoap.py
@@ -273,15 +273,7 @@ class ESoap (ServiceBase):
     @rpc(String, String)
     @authenticated_uid
     def start_upload_orig(self, uid, builddir, fname):
-        self.app.pm.open_project(uid, builddir)
-
-        orig_fname = os.path.join(builddir, fname)
-
-        # Now write empty File
-        fp = open(orig_fname, 'w')
-        fp.close()
-
-        self.app.pm.set_orig_fname(uid, fname)
+        self.app.pm.set_orig_fname(uid, builddir, fname)
 
     @rpc(String, String)
     @authenticated_uid
diff --git a/elbepack/projectmanager.py b/elbepack/projectmanager.py
index 23c8bb4e2cc8..52c379eaa89c 100644
--- a/elbepack/projectmanager.py
+++ b/elbepack/projectmanager.py
@@ -208,9 +208,13 @@ class ProjectManager:
 
             self.worker.enqueue(PdebuildJob(ep, profile, cross))
 
-    def set_orig_fname(self, userid, fname):
+    def set_orig_fname(self, userid, builddir, fname):
+        ep = self.open_project(userid, builddir, allow_busy=False)
         with self.lock:
-            ep = self._get_current_project(userid, allow_busy=False)
+            # Write empty File
+            with open(os.path.join(builddir, fname), 'w'):
+                pass
+
             if (not path.isdir(path.join(ep.builddir, 'pbuilder')) and
                     not path.isdir(path.join(ep.builddir, 'pbuilder_cross'))):
                 raise InvalidState('No pbuilder exists: run "elbe pbuilder '

-- 
2.46.0



More information about the elbe-devel mailing list