[Pkg-debile-commits] [debile-slave] 02/02: Add support for dput conf generation (builders' binaries)

Léo Cavaillé leo.cavaille-guest at alioth.debian.org
Fri Aug 23 11:27:24 UTC 2013


This is an automated email from the git hooks/post-receive script.

leo.cavaille-guest pushed a commit to branch master
in repository debile-slave.

commit f9ecdbf963a7ef14a974a02834c5bb9089575009
Author: Léo Cavaillé <leo at cavaille.net>
Date:   Fri Aug 23 13:26:24 2013 +0200

    Add support for dput conf generation (builders' binaries)
---
 debile/slave/daemon.py |   11 ++++++++++-
 debile/slave/utils.py  |   20 +++++++++++++-------
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/debile/slave/daemon.py b/debile/slave/daemon.py
index cdbc8f4..2f572c1 100644
--- a/debile/slave/daemon.py
+++ b/debile/slave/daemon.py
@@ -147,14 +147,23 @@ def iterate():
                         raise Exception("SHIT.")
 
 
+def regenerate_dputcf():
+    dputcf = proxy.get_dputcf()
+    dputcf_file = os.path.join(os.environ['HOME'], '.dput.cf')
+    with open(dputcf_file, 'w') as f:
+        f.write(dputcf)
+
+
 def main():
     logging.basicConfig(
         format='%(asctime)s - %(levelname)8s - [debile-slave] %(message)s',
         level=logging.DEBUG)
     logging.info("Booting debile-slave daemon")
     while True:
-        logging.debug("Checking for new jobs")
         try:
+            logging.debug("Regenerating dput.cf")
+            regenerate_dputcf()
+            logging.debug("Checking for new jobs")
             iterate()
         except IDidNothingError:
             logging.debug("Nothing to do for now, sleeping 30s")
diff --git a/debile/slave/utils.py b/debile/slave/utils.py
index 0011be4..c60dd5f 100644
--- a/debile/slave/utils.py
+++ b/debile/slave/utils.py
@@ -102,17 +102,17 @@ class EthelSubprocessError(EthelError):
         self.cmd = cmd
 
 
-def jobize(path, job_id):
+def jobize(path, job):
     f = open(path, 'r')
     obj = deb822.Deb822(f)
-    obj['X-Lucy-Job'] = str(job_id)
+    obj['X-Lucy-Job'] = str(job.id)
     obj.dump(fd=open(path, 'wb'))
     return obj
 
 
-def prepare_binary_for_upload(changes, job_id):
+def prepare_binary_for_upload(changes, job):
     config = Config()
-    jobize(changes, job_id)
+    jobize(changes, job)
     gpg = config.get('gpg', 'fingerprint')
     out, err, ret = run_command(['debsign', '-k%s' % (gpg), changes])
     if ret != 0:
@@ -121,14 +121,20 @@ def prepare_binary_for_upload(changes, job_id):
         raise Exception("bad debsign")
 
 
-def upload(changes, job_id):
+def upload(changes, job, package):
+    """
+    This is called when we need to upload a binary to debile pool after
+    a build job.
+    """
     config = Config()
 
-    prepare_binary_for_upload(changes, job_id)
+    prepare_binary_for_upload(changes, job)
+    # Find the dput target we need
+    dput_target = "%s-%s" % (package.user.login, job.subtype)
 
     out, err, ret = run_command([
         'dput',
-        config.get('lucy', 'dput-host'),
+        dput_target,
         changes
     ])
     if ret != 0:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-debile/debile-slave.git



More information about the Pkg-debile-commits mailing list