]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
debian_build.py: Change distribution for archive01 in changes file.
authorBenjamin Drung <benjamin.drung@profitbricks.com>
Thu, 5 Jun 2014 17:46:09 +0000 (19:46 +0200)
committerBenjamin Drung <benjamin.drung@profitbricks.com>
Thu, 5 Jun 2014 17:46:09 +0000 (19:46 +0200)
debian_build.py

index 1775a2d1f8b60ae3ed649d4fcd089bcd63be4ebf..c01145baec3011e77adade11e915ea364b9598c7 100755 (executable)
@@ -106,15 +106,16 @@ def getopts():
 
 def upload_to_archive01(archive01_target, archive01_dist, changes_file, logger):
     try:
-        # dpkg-genchanges -b -DDistribution=$dist > $changes_file
-        cmd = ['dpkg-genchanges', '-b', '-DDistribution=' + archive01_dist]
-        logger.debug('Executing "{command}" ...'.format(command=' '.join(cmd)))
-        process = subprocess.Popen(cmd, close_fds=True, stdout=subprocess.PIPE, cwd=os.getcwd())
-        changes = process.communicate()[0]
-
-        filehandler = open(changes_file, 'w')
-        filehandler.write(changes)
-        filehandler.close()
+        # Change distribution for archive01 in changes file
+        cmd = ['sed', '-i', r's/^\(Distribution: \).*$/\1' + archive01_dist + '/',
+               changes_file]
+        command = ' '.join(cmd)
+        logger.debug('Executing "{command}" ...'.format(command=command))
+        if subprocess.call(cmd) == 0:
+            logger.debug('%s succeeded.' % command)
+        else:
+            logger.warn('%s failed.' % command)
+            return
 
         cmd = ['dput', archive01_target, changes_file]
         command = ' '.join(cmd)