[elbe-devel] [PATCH 1/2] add elbe control command to remove log file
Philipp Arras
philipp.arras at linutronix.de
Thu May 4 17:33:06 CEST 2017
use elbe control rm_log XYZ" where XYZ is the project directory
and calls rm_log before pbuilder build action
Signed-off-by: Philipp Arras <philipp.arras at linutronix.de>
---
elbepack/daemons/soap/esoap.py | 6 ++++++
elbepack/pbuilderaction.py | 1 +
elbepack/projectmanager.py | 5 +++++
elbepack/soapclient.py | 18 ++++++++++++++++++
4 files changed, 30 insertions(+)
diff --git a/elbepack/daemons/soap/esoap.py b/elbepack/daemons/soap/esoap.py
index cc608f4..d4e9198 100644
--- a/elbepack/daemons/soap/esoap.py
+++ b/elbepack/daemons/soap/esoap.py
@@ -309,3 +309,9 @@ class ESoap (ServiceBase):
def shutdown_initvm (self, uid):
system ("systemctl --no-block poweroff")
+ @rpc (String)
+ @authenticated_uid
+ @soap_faults
+ def rm_log (self, uid, builddir):
+ self.app.pm.open_project (uid, builddir)
+ self.app.pm.rm_log (uid, builddir)
diff --git a/elbepack/pbuilderaction.py b/elbepack/pbuilderaction.py
index 2d62e46..3c2d8e1 100644
--- a/elbepack/pbuilderaction.py
+++ b/elbepack/pbuilderaction.py
@@ -162,6 +162,7 @@ class BuildAction(PBuilderAction):
print ("")
elif opt.project:
prjdir = opt.project
+ system ('%s control rm_log %s' % (elbe_exe, prjdir))
else:
print ('you need to specify --project or --xmlfile option', file=sys.stderr)
sys.exit(20)
diff --git a/elbepack/projectmanager.py b/elbepack/projectmanager.py
index 6b17fc9..b1d45d1 100644
--- a/elbepack/projectmanager.py
+++ b/elbepack/projectmanager.py
@@ -476,6 +476,11 @@ class ProjectManager(object):
f.close()
return data
+ def rm_log (self, userid, builddir):
+ ep = self._get_current_project( userid )
+ with open (os.path.join (ep.builddir, 'log.txt'), 'w', 0):
+ pass
+
def current_project_has_changes (self, userid):
with self.lock:
builddir = self._get_current_project( userid ).builddir
diff --git a/elbepack/soapclient.py b/elbepack/soapclient.py
index bc38a61..39e08e2 100644
--- a/elbepack/soapclient.py
+++ b/elbepack/soapclient.py
@@ -123,6 +123,24 @@ class ClientAction(object):
def __init__(self, node):
self.node = node
+class RemoveLogAction(ClientAction):
+
+ tag = 'rm_log'
+
+ def __init__(self, node):
+ ClientAction.__init__(self, node)
+
+ def execute(self, client, opt, args):
+ if len (args) != 1:
+ print ("usage: elbe control rm_log <project_dir>", file=sys.stderr)
+ sys.exit(20)
+
+ builddir = args[0]
+ client.service.rm_log (builddir)
+
+
+ClientAction.register(RemoveLogAction)
+
class ListProjectsAction(ClientAction):
tag = 'list_projects'
--
2.1.4
More information about the elbe-devel
mailing list