Merge lp:~benji/charmworld/bundles-to-piles-rename into lp:~juju-jitsu/charmworld/trunk

Proposed by Benji York
Status: Merged
Approved by: Aaron Bentley
Approved revision: 310
Merged at revision: 316
Proposed branch: lp:~benji/charmworld/bundles-to-piles-rename
Merge into: lp:~juju-jitsu/charmworld/trunk
Prerequisite: lp:~abentley/charmworld/support-bundles
Diff against target: 188 lines (+32/-31)
4 files modified
charmworld/jobs/config.py (+2/-1)
charmworld/jobs/lp.py (+12/-12)
charmworld/jobs/tests/test_lp.py (+17/-17)
charmworld/lp.py (+1/-1)
To merge this branch: bzr merge lp:~benji/charmworld/bundles-to-piles-rename
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+175352@code.launchpad.net

Commit message

Rename tokens from "bundles" to "piles"-- deployer files can contain multiple bundles.

Description of the change

Rename the things we were calling "bundles" to "piles", because they are really
derived from deployer files which can contain multiple bundles.

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you.

review: Approve (code)
Revision history for this message
Charmworld Lander (charmworld-lander) wrote :

No commit message specified.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmworld/jobs/config.py'
2--- charmworld/jobs/config.py 2013-07-16 14:28:58 +0000
3+++ charmworld/jobs/config.py 2013-07-17 17:52:35 +0000
4@@ -13,7 +13,8 @@
5 os.path.expanduser("%s/var/charms" % os.environ['HOME']))
6
7 CHARM_QUEUE = 'charm-queue'
8-BUNDLE_QUEUE = 'bundle-queue'
9+# A pile is a bunch of bundles (a deployer file makes a pile).
10+PILE_QUEUE = 'pile-queue'
11
12 MONGO_URL = settings.get('mongo.url')
13 if MONGO_URL is None:
14
15=== modified file 'charmworld/jobs/lp.py'
16--- charmworld/jobs/lp.py 2013-07-16 14:28:58 +0000
17+++ charmworld/jobs/lp.py 2013-07-17 17:52:35 +0000
18@@ -7,7 +7,7 @@
19 import pymongo
20
21 from charmworld.lp import (
22- BUNDLE_SERIES,
23+ PILE_SERIES,
24 get_branch_tips,
25 )
26 from charmworld.models import (
27@@ -19,7 +19,7 @@
28 get_ini,
29 )
30 from config import (
31- BUNDLE_QUEUE,
32+ PILE_QUEUE,
33 CHARM_IMPORT_FILTER,
34 CHARM_QUEUE,
35 )
36@@ -36,7 +36,7 @@
37 # Return data needed for the ingest job for charm branches on Launchpad.
38 log = logging.getLogger("charm.launchpad")
39 charms = []
40- bundles = []
41+ piles = []
42 if not charm_data:
43 charm_data = get_branch_tips()
44
45@@ -45,9 +45,9 @@
46
47 data = parse_branch(repo, series, commit)
48
49- if data['series'] == BUNDLE_SERIES:
50+ if data['series'] == PILE_SERIES:
51 if data['bname'] == 'bundle':
52- bundles.append(data)
53+ piles.append(data)
54 continue
55
56 if data["bname"] not in ("trunk", "trunk-1"):
57@@ -57,7 +57,7 @@
58 data['promulgated'] = data['series'] in data['distro_series']
59 data['branch_deleted'] = False
60 charms.append(data)
61- return charms, bundles
62+ return charms, piles
63
64
65 def db_charms(db):
66@@ -100,17 +100,17 @@
67 break
68
69
70-def queue_from_branches(db, charm_queue, bundle_queue, limit=None,
71+def queue_from_branches(db, charm_queue, pile_queue, limit=None,
72 import_filter=default):
73 log = logging.getLogger("charm.launchpad")
74- charm_data, bundles = all_branch_data()
75+ charm_data, piles = all_branch_data()
76 for charm in all_charms(db, charm_data, limit=limit,
77 import_filter=import_filter):
78 added = charm_queue.put(charm)
79 if added and 0:
80 log.info("Queued %s", charm)
81- for bundle in bundles:
82- bundle_queue.put(bundle)
83+ for pile in piles:
84+ pile_queue.put(pile)
85
86
87 def dequeue():
88@@ -162,8 +162,8 @@
89 with lock('ingest-queue', int(settings['script_lease_time']) * 60,
90 db, log):
91 charm_queue = get_queue(CHARM_QUEUE)
92- bundle_queue = get_queue(BUNDLE_QUEUE)
93- queue_from_branches(db, charm_queue, bundle_queue,
94+ pile_queue = get_queue(PILE_QUEUE)
95+ queue_from_branches(db, charm_queue, pile_queue,
96 charm_import_limit, args.prefix)
97 except LockHeld, error:
98 log.warn(str(error))
99
100=== modified file 'charmworld/jobs/tests/test_lp.py'
101--- charmworld/jobs/tests/test_lp.py 2013-07-16 14:28:58 +0000
102+++ charmworld/jobs/tests/test_lp.py 2013-07-17 17:52:35 +0000
103@@ -10,7 +10,7 @@
104 patch,
105 )
106
107-from charmworld.lp import BUNDLE_SERIES
108+from charmworld.lp import PILE_SERIES
109 from charmworld.testing import (
110 factory,
111 JobTestBase,
112@@ -47,7 +47,7 @@
113 return json.dumps(charm_data)
114
115 with HTTMock(all_branch_data_mock):
116- charms, bundles = all_branch_data()
117+ charms, piles = all_branch_data()
118
119 self.assertEqual([{
120 'branch_spec': u'~charmers/charms/precise/someproject/trunk',
121@@ -69,7 +69,7 @@
122 return json.dumps(charm_data)
123
124 with HTTMock(available_mock):
125- charms, bundles = all_branch_data()
126+ charms, piles = all_branch_data()
127
128 self.assertEqual([{
129 'branch_spec': u'~charmers/charms/precise/someproject/trunk',
130@@ -155,17 +155,17 @@
131 def test_all_branch_data_uses_series(self):
132 branch = '~foo/charms/not-bundle/bar/trunk'
133 revision_id = 'jrandom@example.org-asdf'
134- charms, bundles = all_branch_data([(branch, revision_id, [])])
135- self.assertEqual([], bundles)
136+ charms, piles = all_branch_data([(branch, revision_id, [])])
137+ self.assertEqual([], piles)
138 self.assertEqual(1, len(charms))
139- branch = '~foo/charms/' + BUNDLE_SERIES + '/bar/bundle'
140- charms, bundles = all_branch_data([(branch, revision_id, [])])
141- self.assertEqual([], charms)
142- self.assertEqual(1, len(bundles))
143- branch = '~foo/charms/' + BUNDLE_SERIES + '/bar/trunk'
144- charms, bundles = all_branch_data([(branch, revision_id, [])])
145- self.assertEqual([], charms)
146- self.assertEqual([], bundles)
147+ branch = '~foo/charms/' + PILE_SERIES + '/bar/bundle'
148+ charms, piles = all_branch_data([(branch, revision_id, [])])
149+ self.assertEqual([], charms)
150+ self.assertEqual(1, len(piles))
151+ branch = '~foo/charms/' + PILE_SERIES + '/bar/trunk'
152+ charms, piles = all_branch_data([(branch, revision_id, [])])
153+ self.assertEqual([], charms)
154+ self.assertEqual([], piles)
155
156 def test_db_charms(self):
157 charm_1 = factory.makeCharm(
158@@ -249,13 +249,13 @@
159 @patch('charmworld.jobs.lp.all_branch_data', all_branch_data_mock)
160 def test_queue_from_branches(self):
161 charm_queue = get_queue('test_charm_queue')
162- bundle_queue = get_queue('test_bundle_queue')
163- self.addCleanup(bundle_queue.clear)
164- queue_from_branches(self.db, charm_queue, bundle_queue)
165+ pile_queue = get_queue('test_pile_queue')
166+ self.addCleanup(pile_queue.clear)
167+ queue_from_branches(self.db, charm_queue, pile_queue)
168 item = charm_queue.next()
169 self.assertEqual(
170 {'branch_dir': 'foo', 'branch_spec': 'bar'}, item.payload)
171- item = bundle_queue.next()
172+ item = pile_queue.next()
173 self.assertEqual({'foo': 'bar'}, item.payload)
174
175 def test_dequeue(self):
176
177=== modified file 'charmworld/lp.py'
178--- charmworld/lp.py 2013-07-15 21:47:50 +0000
179+++ charmworld/lp.py 2013-07-17 17:52:35 +0000
180@@ -11,7 +11,7 @@
181
182 API = 'https://api.launchpad.net/devel'
183
184-BUNDLE_SERIES = 'bundles'
185+PILE_SERIES = 'bundles'
186
187
188 def get_branch_tips():

Subscribers

People subscribed via source and target branches