Merge ~sespiros/ubuntu-security-tools/+git/ubuntu-security-tools:esm-chroot-names-3 into ubuntu-security-tools:master

Proposed by Spyros Seimenis
Status: Merged
Merged at revision: 4533396465317ea642a286fe8b9e81a676bd42aa
Proposed branch: ~sespiros/ubuntu-security-tools/+git/ubuntu-security-tools:esm-chroot-names-3
Merge into: ubuntu-security-tools:master
Diff against target: 94 lines (+21/-21)
1 file modified
build-tools/umt (+21/-21)
Reviewer Review Type Date Requested Status
Alex Murray Approve
Eduardo Barretto Pending
Review via email: mp+424782@code.launchpad.net

Commit message

Reverting previous changes to chroot name handling for a potentially better approach.

1) A bug was fixed in umt so that ESM releases gets properly detected from the file path and matched against the release_list in .ubuntu-security-tools.conf. Packages built for an ESM release will now have the details['release'] properly filled (i.e esm-infra/xenial) and another field details['base_release'] will be used to hold the base release name (i.e xenial).

2) Since chroot names cannot have a '/' (similarly to the paths when downloading a package for an ESM release), '/' is replaced with '_' to match release names.

3) With 1,2 in place, chroot names for ESM can follow the standard convention of <release>-<arch> so that they are detected automatically from umt. The difference now is that <release> can be any of the form esm-X_<base_release> or <release>_esm (trusty only) so different chroots for different releases are needed.

To post a comment you must log in.
Revision history for this message
Alex Murray (alexmurray) wrote :

LGTM but I think perhaps it would be nicer to avoid all the duplicated code for the chroot release name - see suggestion inline.

review: Needs Fixing
Revision history for this message
Spyros Seimenis (sespiros) wrote :

Thanks for the suggestion Alex. I kept the old style of concatenating strings since from a quick search I couldn't decide what's the best way to concat strings in Python (between using format(), %, + or the newer f strings.

Revision history for this message
Alex Murray (alexmurray) wrote :

Thanks, LGTM!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/build-tools/umt b/build-tools/umt
2index 41c979c..1ab74f9 100755
3--- a/build-tools/umt
4+++ b/build-tools/umt
5@@ -524,18 +524,12 @@ def perform_source_build(details, opt):
6 if "ubuntu1" in details['base_version']:
7 prepare_merge_debdiff(opt.start_version, details['package'])
8
9- chroot = details['release']
10-
11- if 'esm' in details['version']:
12- chroot += "-esm"
13+ chroot_release = details['release'].replace('/','_')
14
15+ details['chroot'] = "%s-i386" % chroot_release
16 (rc, arch) = runcmd(['uname', '-m'])
17 if arch.strip() == "x86_64":
18- chroot += "-amd64"
19- else:
20- chroot += "-i386"
21-
22- details['chroot'] = chroot
23+ details['chroot'] = "%s-amd64" % chroot_release
24
25 if opt.chroot:
26 details['chroot'] = opt.chroot
27@@ -639,18 +633,12 @@ def perform_binary_build(details, opt):
28 if opt.hardening:
29 extra_deps.append('hardening-wrapper')
30
31- chroot = details['release']
32-
33- if 'esm' in details['version']:
34- chroot += "-esm"
35+ chroot_release = details['release'].replace('/','_')
36
37+ details['chroot'] = "%s-i386" % chroot_release
38 (rc, arch) = runcmd(['uname', '-m'])
39 if arch.strip() == "x86_64":
40- chroot += "-amd64"
41- else:
42- chroot += "-i386"
43-
44- details['chroot'] = chroot
45+ details['chroot'] = "%s-amd64" % chroot_release
46
47 if opt.chroot:
48 details['chroot'] = opt.chroot
49@@ -4033,6 +4021,7 @@ def parse_package_details(release = None, skip_sanity = False, force_component =
50 else:
51 # Attempt to calculate release based on directory path naming
52 guess = os.path.basename(os.path.dirname(os.getcwd()))
53+ guess = guess.replace('_','/')
54 releases = ust['release_list'].split()
55 for r in releases:
56 if r == guess:
57@@ -4042,6 +4031,16 @@ def parse_package_details(release = None, skip_sanity = False, force_component =
58 # If we didn't find a match, fall back to the devel release
59 details.setdefault('release', details['changelog_release'])
60
61+ # Find base release
62+ base_release = details["release"]
63+ if 'esm' in base_release:
64+ if 'trusty' in base_release:
65+ base_release = 'trusty'
66+ else:
67+ base_release = base_release.split('/')[1]
68+
69+ details['base_release'] = base_release
70+
71 # Find previous version
72 previous_version = ''
73 if override_previous:
74@@ -4070,8 +4069,8 @@ def parse_package_details(release = None, skip_sanity = False, force_component =
75 # Perform sanity checking
76 if not skip_sanity:
77 # Sanity check release
78- if details['changelog_release'] != details['release']:
79- err("oops! changelog release (%s) != '%s'" % (details['changelog_release'], details['release']))
80+ if details['changelog_release'] != details['base_release']:
81+ err("oops! changelog release (%s) != '%s'" % (details['changelog_release'], details['base_release']))
82 sys.exit(1)
83 # Sanity check pocket
84 if (details['release'] != ust['release_devel']) and (details['release'] != 'unstable') and \
85@@ -4588,7 +4587,8 @@ def build_binary(dscfile, buildopts, script, chroot, ulimit):
86 # the wrong architecture.(Debian #609151)
87 chroot_args = [ '-d', chroot ]
88 if '-' in chroot:
89- (dist, arch) = chroot.split('-')[0:2]
90+ (dist, arch) = chroot.rsplit('-', 1)
91+ dist = dist.replace('_','/')
92 # qemu-static-user allows to emulate most of these on amd64 in
93 # groovy so assume we can use any if specified - from
94 # https://wiki.ubuntu.com/SecurityTeam/FAQ#Architectures

Subscribers

People subscribed via source and target branches