Merge lp:~smoser/cloud-archive-utils/add-cloud-tools into lp:cloud-archive-utils

Proposed by Scott Moser
Status: Merged
Approved by: Adam Gandelman
Approved revision: no longer in the source branch.
Merged at revision: 16
Proposed branch: lp:~smoser/cloud-archive-utils/add-cloud-tools
Merge into: lp:cloud-archive-utils
Diff against target: 237 lines (+107/-12)
6 files modified
bin/cloud-archive-tools-backport (+51/-0)
cloudarchive/backport.py (+27/-9)
cloudarchive/common.py (+8/-0)
cloudarchive/dput/scripts.py (+1/-0)
cloudarchive/utils.py (+10/-3)
dput.d/profiles/cact.json (+10/-0)
To merge this branch: bzr merge lp:~smoser/cloud-archive-utils/add-cloud-tools
Reviewer Review Type Date Requested Status
Adam Gandelman (community) Approve
Review via email: mp+185891@code.launchpad.net

Description of the change

add cloud-tools support.

2 primary things here:
 * add bin/cloud-archive-tools-backport an analog of cloud-archive-backport
   but for the cloud-tools pocket.
 * make do_backport a wrapper around newly added do_explicit_backport
   do_explicit_backport just contains explicit arguments for each of the
   things that do_backport was figuring out internally.
   do_backport should remain backwards compatible.

To post a comment you must log in.
Revision history for this message
Adam Gandelman (gandelman-a) wrote :

LGTM.

review: Approve
16. By Adam Gandelman

[smoser] add cact (cloud archive cloud tools) dput-ng profile

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'bin/cloud-archive-tools-backport'
--- bin/cloud-archive-tools-backport 1970-01-01 00:00:00 +0000
+++ bin/cloud-archive-tools-backport 2013-09-16 19:00:42 +0000
@@ -0,0 +1,51 @@
1#! /usr/bin/python
2
3import optparse
4import sys
5
6from cloudarchive.backport import do_explicit_backport, CABackportException
7from cloudarchive.common import UBUNTU_DEV, UBUNTU_STABLE, SERIES
8from ubuntutools.logger import Logger
9
10if __name__ == '__main__':
11 usage = 'usage: %prog [options] package(s)'
12 parser = optparse.OptionParser(usage=usage)
13 parser.add_option('-N', '--next',
14 help='target cloud-tools-next rather than '
15 'cloud-tools-staging',
16 dest='next', action='store_true', default=False)
17 parser.add_option('-c', '--changelog-message',
18 help='Changelog message to use.',
19 dest='changelog', action='store')
20 parser.add_option('-s', '--suffix',
21 help='Backport suffix to use (default=~cloud0).',
22 dest='suffix', action='store', default="~cloud0")
23 parser.add_option('-o', '--outdir',
24 help='Directory to save source package',
25 dest='out_dir', action='store', default=None)
26 parser.add_option('-y', '--yes', help='Assume yes to any prompt.',
27 dest='assume_yes', action='store_true', default=False)
28 (opts, args) = parser.parse_args()
29
30 if len(args) == 0:
31 parser.print_usage()
32 sys.exit(1)
33 else:
34 packages = args
35
36 chlog_dist = SERIES
37 changes_dist = SERIES
38 if opts.next:
39 ubuntu_series = UBUNTU_DEV
40 target_ppa = 'cloud-tools-next'
41 else:
42 ubuntu_series = UBUNTU_STABLE
43 target_ppa = 'cloud-tools-staging'
44
45 for package in args:
46 Logger.normal('Backporting %s from %s to %s.',
47 package, ubuntu_series, target_ppa)
48 do_explicit_backport(package, ubuntu_series, target_ppa, chlog_dist,
49 changes_dist=SERIES, message=opts.changelog,
50 suffix=opts.suffix, out_dir=opts.out_dir,
51 assume_yes=opts.assume_yes)
052
=== modified file 'cloudarchive/backport.py'
--- cloudarchive/backport.py 2013-08-28 18:42:45 +0000
+++ cloudarchive/backport.py 2013-09-16 19:00:42 +0000
@@ -32,6 +32,23 @@
32def do_backport(package, release, message=None, suffix="~cloud0",32def do_backport(package, release, message=None, suffix="~cloud0",
33 out_dir=None, assume_yes=False):33 out_dir=None, assume_yes=False):
3434
35 ubuntu_series = SOURCE_RELEASE[release]
36 os_series = release
37 check_ppa = "{}-staging".format(os_series)
38 chlog_dist = '{}-{}'.format(SERIES, os_series)
39
40 return do_explicit_backport(package, ubuntu_series=ubuntu_series,
41 check_ppa=check_ppa, chlog_dist=chlog_dist,
42 changes_dist=SERIES, message=message,
43 suffix=suffix, out_dir=out_dir,
44 assume_yes=assume_yes)
45
46
47def do_explicit_backport(package, ubuntu_series, check_ppa, chlog_dist,
48 changes_dist=SERIES,
49 message=None, suffix="~cloud0", out_dir=None,
50 assume_yes=False):
51
35 if not out_dir:52 if not out_dir:
36 out_dir = os.getcwd()53 out_dir = os.getcwd()
37 else:54 else:
@@ -42,20 +59,20 @@
4259
43 archive = Distribution('ubuntu').getArchive()60 archive = Distribution('ubuntu').getArchive()
44 Logger.normal('Looking for package %s in %s',61 Logger.normal('Looking for package %s in %s',
45 package, SOURCE_RELEASE[release])62 package, ubuntu_series)
4663
47 pkgs = []64 pkgs = []
48 for pocket in ['Security', 'Release', 'Updates']:65 for pocket in ['Security', 'Release', 'Updates']:
49 try:66 try:
50 pkg = archive.getSourcePackage(67 pkg = archive.getSourcePackage(package, ubuntu_series,
51 package, SOURCE_RELEASE[release], pocket=pocket)68 pocket=pocket)
52 pkgs.append(pkg)69 pkgs.append(pkg)
53 except PackageNotFoundException:70 except PackageNotFoundException:
54 pass71 pass
5572
56 if not pkgs:73 if not pkgs:
57 raise CABackportException("Unable to find source package %s in %s",74 raise CABackportException("Unable to find source package %s in %s",
58 package, SOURCE_RELEASE[release])75 package, ubuntu_series)
5976
60 # find the most recent upload in all pockets.77 # find the most recent upload in all pockets.
61 pkgs = sorted(pkgs, cmp=version_compare,78 pkgs = sorted(pkgs, cmp=version_compare,
@@ -68,9 +85,9 @@
68 Logger.normal('Backporting from %s.' % spph.getSeriesAndPocket())85 Logger.normal('Backporting from %s.' % spph.getSeriesAndPocket())
69 Logger.normal('Version: %s', version)86 Logger.normal('Version: %s', version)
7087
71 old_version = utils.get_package_version(package, release)88 old_version = utils.get_package_version(package, ppa=check_ppa)
72 Logger.normal('Existing version for %s in %s Cloud Archive: %s',89 Logger.normal('Existing version for %s in %s Cloud Archive: %s',
73 package, release, old_version)90 package, ubuntu_series, old_version)
74 if not old_version:91 if not old_version:
75 old_version = "0"92 old_version = "0"
76 new_version = '{}{}'.format(version, suffix)93 new_version = '{}{}'.format(version, suffix)
@@ -81,7 +98,7 @@
8198
82 out_dir = os.path.join(out_dir, '{}-{}'.format(package, new_version))99 out_dir = os.path.join(out_dir, '{}-{}'.format(package, new_version))
83100
84 dirname = '{}-{}'.format(package, SOURCE_RELEASE[release])101 dirname = '{}-{}'.format(package, ubuntu_series)
85 dirname = os.path.join(out_dir, dirname)102 dirname = os.path.join(out_dir, dirname)
86103
87 for d in [out_dir, dirname]:104 for d in [out_dir, dirname]:
@@ -119,7 +136,7 @@
119 '--newversion', new_version,136 '--newversion', new_version,
120 '--force-bad-version',137 '--force-bad-version',
121 '--preserve',138 '--preserve',
122 '--distribution', '{}-{}'.format(SERIES, release),139 '--distribution', chlog_dist,
123 '--force-distribution', message140 '--force-distribution', message
124 ]141 ]
125 check_call(cmd, cwd=dirname)142 check_call(cmd, cwd=dirname)
@@ -128,8 +145,9 @@
128 'debuild', '--no-lintian',145 'debuild', '--no-lintian',
129 '-S', '-sa', '-nc', '-uc', '-us',146 '-S', '-sa', '-nc', '-uc', '-us',
130 '-v{}'.format(previous_version),147 '-v{}'.format(previous_version),
131 '--changes-option=-DDistribution={}'.format(SERIES)148 '--changes-option=-DDistribution={}'.format(changes_dist)
132 ]149 ]
150
133 if version_compare(upstream_version(version),151 if version_compare(upstream_version(version),
134 upstream_version(old_version)) == 1:152 upstream_version(old_version)) == 1:
135 cmd.append('-sa')153 cmd.append('-sa')
136154
=== modified file 'cloudarchive/common.py'
--- cloudarchive/common.py 2013-07-01 20:47:20 +0000
+++ cloudarchive/common.py 2013-09-16 19:00:42 +0000
@@ -27,6 +27,14 @@
27 "havana": "saucy"27 "havana": "saucy"
28}28}
2929
30UBUNTU_SERIES = [
31 'raring',
32 'saucy',
33]
34
35UBUNTU_DEV = UBUNTU_SERIES[-1]
36UBUNTU_STABLE = UBUNTU_SERIES[-2]
37
30LTS_SERIES = {38LTS_SERIES = {
31 'precise': ['essex', 'folsom', 'grizzly', 'havana', 'icehouse']39 'precise': ['essex', 'folsom', 'grizzly', 'havana', 'icehouse']
32}40}
3341
=== modified file 'cloudarchive/dput/scripts.py'
--- cloudarchive/dput/scripts.py 2013-06-20 13:02:22 +0000
+++ cloudarchive/dput/scripts.py 2013-09-16 19:00:42 +0000
@@ -39,6 +39,7 @@
39 else:39 else:
40 logger.info('OK: Upload is targetting Ubuntu: %s.', distribution)40 logger.info('OK: Upload is targetting Ubuntu: %s.', distribution)
4141
42 logger.info("profile: %s", profile)
42 openstack_target = changes.get("Changes").split()[2]\43 openstack_target = changes.get("Changes").split()[2]\
43 .strip(';').split('-')[-1]44 .strip(';').split('-')[-1]
44 upload_target = profile['incoming'].split('/')[-1].split('-')[0]45 upload_target = profile['incoming'].split('/')[-1].split('-')[0]
4546
=== modified file 'cloudarchive/utils.py'
--- cloudarchive/utils.py 2013-08-21 01:23:49 +0000
+++ cloudarchive/utils.py 2013-09-16 19:00:42 +0000
@@ -3,6 +3,7 @@
33
4from apt_pkg import version_compare4from apt_pkg import version_compare
55
6from ubuntutools.logger import Logger
6from common import SERIES, SOURCE_RELEASE, LTS_SERIES7from common import SERIES, SOURCE_RELEASE, LTS_SERIES
78
8from ubuntutools.lp.lpapicache import (Launchpad, Distribution,9from ubuntutools.lp.lpapicache import (Launchpad, Distribution,
@@ -32,6 +33,8 @@
32 release=SERIES):33 release=SERIES):
33 ''' Query a PPA for source packages and versions '''34 ''' Query a PPA for source packages and versions '''
34 get_lp()35 get_lp()
36 Logger.normal("query_ca_ppa: checking ppa=%s, release=%s, owner=%s",
37 ppa, release, owner)
35 ppa = Launchpad.people[owner].getPPAByName(name=ppa)38 ppa = Launchpad.people[owner].getPPAByName(name=ppa)
36 distro = ppa.distribution.getSeries(name_or_version=release)39 distro = ppa.distribution.getSeries(name_or_version=release)
37 out = {}40 out = {}
@@ -61,13 +64,17 @@
61 return pkgs[0].getVersion()64 return pkgs[0].getVersion()
6265
6366
64def get_package_version(package, os_series="folsom"):67def get_package_version(package, os_series="folsom", ppa=None):
65 ''' Retrieve the version of package from the staging PPA for os_series '''68 ''' Retrieve the version of package from the staging PPA for os_series '''
66 source_versions = query_ca_ppa(ppa="{}-staging".format(os_series),69 if ppa is None:
67 release=SERIES)70 ppa = "{}-staging".format(os_series)
71
72 source_versions = query_ca_ppa(ppa=ppa, release=SERIES)
73
68 if package in source_versions:74 if package in source_versions:
69 return source_versions[package]75 return source_versions[package]
70 else:76 else:
77 Logger.normal("quering distro for %s", package)
71 return query_distro(package)78 return query_distro(package)
7279
7380
7481
=== added file 'dput.d/profiles/cact.json'
--- dput.d/profiles/cact.json 1970-01-01 00:00:00 +0000
+++ dput.d/profiles/cact.json 2013-09-16 19:00:42 +0000
@@ -0,0 +1,10 @@
1{
2 "meta": "ubuntu",
3 "fqdn": "ppa.launchpad.net",
4 "incoming": "~ubuntu-cloud-archive/cloud-tools-%(cact)s",
5 "+hooks": [
6 ],
7 "-hooks": [
8 "suite-mismatch"
9 ]
10}

Subscribers

People subscribed via source and target branches