From: Benjamin Drung Date: Thu, 5 Jun 2014 17:46:09 +0000 (+0200) Subject: debian_build.py: Change distribution for archive01 in changes file. X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=87842322e011d19edaa2bd802eb630ea75a134ac;p=profitbricks%2Fjenkins-build-scripts.git debian_build.py: Change distribution for archive01 in changes file. --- diff --git a/debian_build.py b/debian_build.py index 1775a2d..c01145b 100755 --- a/debian_build.py +++ b/debian_build.py @@ -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)