From 30f4c6e7312ac0941b4eeadaa2b0916de4918399 Mon Sep 17 00:00:00 2001 From: David Ward Date: Sun, 25 Mar 2018 19:04:39 -0400 Subject: Fix handling of Debian packaging files in ACE/bin/make_release.py Remove unused code to handle TAO, which is not packaged for Debian. Remove code to handle ACE/debian/ace.dsc which was deleted. (A .dsc file is produced automatically by building a Debian source package.) Examine ACE/debian/control instead of ACE/debian/debian.control. Update the version inside ACE/debian/*-.lintain-overrides files, in addition to renaming these files. Adjust a regular expression to avoid matching on whitespace or other characters past the end of the file or package name. This had caused version updates to occur in the wrong places in ACE/debian/control. --- ACE/bin/make_release.py | 103 ++++++++++++++++++------------------------------ 1 file changed, 39 insertions(+), 64 deletions(-) diff --git a/ACE/bin/make_release.py b/ACE/bin/make_release.py index a55ba82d9da..d5042bc4ade 100755 --- a/ACE/bin/make_release.py +++ b/ACE/bin/make_release.py @@ -302,66 +302,64 @@ def update_spec_file (): def update_debianbuild (): """ Updates ACE_ROOT/debian directory. - - renames all files with version nrs in name to new scheme. - - updates version nrs in file debian/control - Currently ONLY ACE & TAO stuff is handled here """ + - renames all files with version numbers in name; if file contains + lintian overrides, update version numbers inside file + - updates version numbers inside file debian/control + Currently ONLY ACE is handled here """ global comp_versions - import glob import re - from os.path import basename - from os.path import dirname - from os.path import join + from os import listdir files = list () prev_ace_ver = None - prev_tao_ver = None - # rename files - mask = re.compile ("(libace|libkokyu|libnetsvcs)(.*)(\d+\.\d+\.\d+)(.*)") - tao = re.compile ("tao", re.IGNORECASE) + dname = doc_root + '/ACE_TAO/ACE/debian/' - for fname in glob.iglob(doc_root + '/ACE_TAO/ACE/debian/*'): - print "Considering " + fname - match = None + mask = re.compile ("(libace|libACE|libkokyu|libKokyu|libnetsvcs)([^\s,:]*-)(\d+\.\d+\.\d+)([^\s,:]*)") - fbase = basename (fname) + def update_ver (match): + return match.group (1) + match.group (2) + comp_versions["ACE_version"] + match.group (4) - match = mask.search (fbase) - fnewname = None - if match is not None: - if tao.search (fbase) is not None: - fnewname = join (dirname (fname), match.group (1) + match.group (2) + comp_versions["TAO_version"] + match.group (4)) - prev_tao_ver = match.group (3) - else: - fnewname = join (dirname (fname), match.group (1) + match.group (2) + comp_versions["ACE_version"] + match.group (4)) - prev_ace_ver = match.group (3) + # find files in debian/* matching mask + for fname in listdir(dname): + match = mask.search (fname) + if match is None: + continue - print prev_ace_ver -# print prev_tao_var + fnewname = update_ver (match) + prev_ace_ver = match.group (3) - if fnewname is not None: - if opts.take_action: - print "Rename: " + fname + " to " + fnewname + "\n" - ex ("git mv " + fname + " " + fnewname) - else: - print "Rename: " + fname + " to " + fnewname + "\n" + # if file contains lintian overrides, update file + if match.group (4) == '.lintian-overrides': + with open (dname + fname, 'r+') as lintian_overrides_file: + new_lintian_overrides = "" + for line in lintian_overrides_file.readlines (): + new_lintian_overrides += mask.sub (update_ver, line) - # update debianbuild/control - def update_ver (match): - if match.group (1) == 'libtao': - return match.group (1) + match.group (2) + comp_versions["TAO_version"] + match.group (4) - else: - return match.group (1) + match.group (2) + comp_versions["ACE_version"] + match.group (4) + if opts.take_action: + lintian_overrides_file.seek (0) + lintian_overrides_file.truncate (0) + lintian_overrides_file.writelines (new_lintian_overrides) + else: + print "New lintian-overrides file:" + print "".join (new_lintian_overrides) - with open (doc_root + "/ACE_TAO/ACE/debian/debian.control", 'r+') as control_file: + files.append (dname + fnewname) + + # rename file + print "Rename: " + dname + fname + " to " + dname + fnewname + "\n" + if opts.take_action: + ex ("git mv " + dname + fname + " " + dname + fnewname) + + # update debian/control + with open (dname + "control", 'r+') as control_file: new_ctrl = "" for line in control_file.readlines (): if re.search ("^(Package|Depends|Suggests):", line) is not None: line = mask.sub (update_ver, line) elif re.search ('^Replaces:', line) is not None: - print comp_versions["ACE_version"] line = line.replace (prev_ace_ver, comp_versions["ACE_version"]) new_ctrl += line @@ -374,30 +372,7 @@ def update_debianbuild (): print "New control file:" print "".join (new_ctrl) - files.append (doc_root + "/ACE_TAO/ACE/debian/debian.control") - - # rewrite debian/dsc - dsc_lines = """Format: 1.0 -Source: ACE+src-%s -Version: %s -Binary: ace -Maintainer: Johnny Willemsen -Architecture: any -Build-Depends: gcc, make, g++, debhelper (>= 5), dpkg-dev, libssl-dev (>= 0.9.7d), dpatch (>= 2.0.10), libxt-dev (>= 4.3.0), libfltk1.1-dev (>= 1.1.4), libqt4-dev (>= 4.4~rc1-4), tk-dev, docbook-to-man, autoconf, automake, libtool, autotools-dev, doxygen, graphviz, libfox-1.6-dev -Files: - 65b34001c9605f056713a7e146b052d1 46346654 ACE-src-%s.tar.gz - -""" % (comp_versions["ACE_version"], comp_versions["TAO_version"], comp_versions["ACE_version"]) - if opts.take_action: - with open (doc_root + "/ACE_TAO/ACE/debian/ace.dsc", 'r+') as dsc_file: - dsc_file.seek (0) - dsc_file.truncate (0) - dsc_file.writelines (dsc_lines) - else: - print "New dsc file:\n" - print dsc_lines - - files.append (doc_root + "/ACE_TAO/ACE/debian/ace.dsc") + files.append (dname + "control") return files -- cgit v1.2.1