[elbe-devel] [PATCH 7/7] elbepack: asyncworker: simplify cwd maintenance
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Mon Aug 19 16:50:19 CEST 2024
Replace the current logic with a hardcoded and understandable default cwd.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/asyncworker.py | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/elbepack/asyncworker.py b/elbepack/asyncworker.py
index 1db4ab819d34..aa4af9277e4c 100644
--- a/elbepack/asyncworker.py
+++ b/elbepack/asyncworker.py
@@ -4,8 +4,7 @@
import logging
import multiprocessing
-from contextlib import contextmanager
-from os import chdir, getcwd
+from os import chdir
from elbepack.elbeproject import AptCacheCommitError, AptCacheUpdateError
from elbepack.log import elbe_logging, read_maxlevel, reset_level
@@ -278,15 +277,6 @@ class UpdatePbuilderJob(AsyncWorkerJob):
db.reset_busy(self.project.builddir, success)
- at contextmanager
-def savecwd():
- oldcwd = getcwd()
- try:
- yield
- finally:
- chdir(oldcwd)
-
-
class AsyncWorker(multiprocessing.Process):
def __init__(self, db):
super().__init__(name='AsyncWorker')
@@ -308,7 +298,7 @@ class AsyncWorker(multiprocessing.Process):
if job is None:
break
- with savecwd():
- with elbe_logging(projects=job.project.builddir):
- job.execute(self.db)
+ chdir('/')
+ with elbe_logging(projects=job.project.builddir):
+ job.execute(self.db)
self.queue.task_done()
--
2.46.0
More information about the elbe-devel
mailing list