Merge lp:~jelmer/bzr-builddeb/multi-tarball-pt8 into lp:bzr-builddeb

Proposed by Jelmer Vernooij
Status: Merged
Approved by: James Westby
Approved revision: 601
Merged at revision: 586
Proposed branch: lp:~jelmer/bzr-builddeb/multi-tarball-pt8
Merge into: lp:bzr-builddeb
Prerequisite: lp:~jelmer/bzr-builddeb/multi-tarball-pt7
Diff against target: 161 lines (+64/-46)
3 files modified
cmds.py (+1/-1)
import_dsc.py (+40/-42)
upstream/pristinetar.py (+23/-3)
To merge this branch: bzr merge lp:~jelmer/bzr-builddeb/multi-tarball-pt8
Reviewer Review Type Date Requested Status
James Westby Approve
Review via email: mp+68225@code.launchpad.net

This proposal supersedes a proposal from 2011-07-18.

To post a comment you must log in.
Revision history for this message
James Westby (james-w) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmds.py'
2--- cmds.py 2011-06-28 08:41:44 +0000
3+++ cmds.py 2011-07-18 10:01:30 +0000
4@@ -964,7 +964,7 @@
5 db.extract_upstream_tree(parents[0], tempdir)
6 else:
7 db._create_empty_upstream_tree(tempdir)
8- tree = db.get_branch_tip_revtree()
9+ tree = db.branch.basis_tree()
10 tree.lock_read()
11 dbs = DistributionBranchSet()
12 dbs.add_branch(db)
13
14=== modified file 'import_dsc.py'
15--- import_dsc.py 2011-07-18 10:01:30 +0000
16+++ import_dsc.py 2011-07-18 10:01:30 +0000
17@@ -818,46 +818,48 @@
18 % (version, upstream_part, str(upstream_parents)))
19 assert self.pristine_upstream_tree is not None, \
20 "Can't import upstream with no tree"
21- if len(upstream_parents) > 0:
22- parent_revid = upstream_parents[0]
23- else:
24- parent_revid = NULL_REVISION
25- self.pristine_upstream_tree.pull(self.pristine_upstream_tree.branch,
26- overwrite=True, stop_revision=parent_revid)
27 other_branches = self.get_other_branches()
28- upstream_trees = [o.pristine_upstream_branch.basis_tree()
29- for o in other_branches]
30- target_tree = None
31- if upstream_branch is not None:
32- if upstream_revision is None:
33- upstream_revision = upstream_branch.last_revision()
34- self.pristine_upstream_branch.fetch(upstream_branch,
35- last_revision=upstream_revision)
36- upstream_branch.tags.merge_to(self.pristine_upstream_branch.tags)
37- upstream_parents.append(upstream_revision)
38- target_tree = self.pristine_upstream_branch.repository.revision_tree(
39- upstream_revision)
40- if file_ids_from is not None:
41- upstream_trees = file_ids_from + upstream_trees
42- if self.tree:
43- self_tree = self.tree
44- self_tree.lock_write() # might also be upstream tree for dh_make
45- else:
46- self_tree = self.get_branch_tip_revtree()
47- self_tree.lock_read()
48- try:
49- import_dir(self.pristine_upstream_tree, upstream_part,
50- file_ids_from=[self_tree] + upstream_trees,
51- target_tree=target_tree)
52- finally:
53- self_tree.unlock()
54- revprops = {}
55 ret = []
56 for (tarball, component, md5) in upstream_tarballs:
57+ upstream_trees = [o.pristine_upstream_branch.basis_tree()
58+ for o in other_branches]
59+ target_tree = None
60+ if upstream_branch is not None:
61+ if upstream_revision is None:
62+ upstream_revision = upstream_branch.last_revision()
63+ self.pristine_upstream_branch.fetch(upstream_branch,
64+ last_revision=upstream_revision)
65+ upstream_branch.tags.merge_to(self.pristine_upstream_branch.tags)
66+ upstream_parents.append(upstream_revision)
67+ target_tree = self.pristine_upstream_branch.repository.revision_tree(
68+ upstream_revision)
69+ if file_ids_from is not None:
70+ upstream_trees = file_ids_from + upstream_trees
71+ if self.tree:
72+ self_tree = self.tree
73+ self_tree.lock_write() # might also be upstream tree for dh_make
74+ else:
75+ self_tree = self.branch.basis_tree()
76+ self_tree.lock_read()
77+ if len(upstream_parents) > 0:
78+ parent_revid = upstream_parents[0]
79+ else:
80+ parent_revid = NULL_REVISION
81+ self.pristine_upstream_tree.pull(self.pristine_upstream_tree.branch,
82+ overwrite=True, stop_revision=parent_revid)
83+ if component is None:
84+ path = upstream_part
85+ else:
86+ path = os.path.join(upstream_part, component)
87+ try:
88+ import_dir(self.pristine_upstream_tree, path,
89+ file_ids_from=[self_tree] + upstream_trees,
90+ target_tree=target_tree)
91+ finally:
92+ self_tree.unlock()
93 (tag, revid) = self.pristine_upstream_source.import_component_tarball(
94- package, version, self.pristine_upstream_tree, component,
95- md5, tarball, author=author, timestamp=timestamp,
96- parent_ids=upstream_parents)
97+ package, version, self.pristine_upstream_tree, upstream_parents, component,
98+ md5, tarball, author=author, timestamp=timestamp)
99 ret.append((component, tag, revid))
100 self.branch.fetch(self.pristine_upstream_branch)
101 self.branch.tags.set_tag(tag, revid)
102@@ -887,12 +889,8 @@
103 finally:
104 shutil.rmtree(tarball_dir)
105
106- def get_branch_tip_revtree(self):
107- return self.branch.repository.revision_tree(
108- self.branch.last_revision())
109-
110 def _mark_native_config(self, native):
111- poss_native_tree = self.get_branch_tip_revtree()
112+ poss_native_tree = self.branch.basis_tree()
113 current_native = self._is_tree_native(poss_native_tree)
114 current_config = self._default_config_for_tree(poss_native_tree)
115 dirname = os.path.join(self.tree.basedir, '.bzr-builddeb')
116@@ -1292,7 +1290,7 @@
117 if self.tree:
118 root_id = self.tree.path2id('')
119 else:
120- tip = self.get_branch_tip_revtree()
121+ tip = self.branch.basis_tree()
122 tip.lock_read()
123 try:
124 root_id = tip.path2id('')
125
126=== modified file 'upstream/pristinetar.py'
127--- upstream/pristinetar.py 2011-07-18 10:01:30 +0000
128+++ upstream/pristinetar.py 2011-07-18 10:01:30 +0000
129@@ -156,9 +156,29 @@
130 self.branch.tags.set_tag(tag_name, revid)
131 return tag_name, revid
132
133- def import_component_tarball(self, package, version, tree, component=None,
134- md5=None, tarball=None, author=None, timestamp=None,
135- parent_ids=None):
136+ def import_tarballs(self, package, version, tree, parent_ids, tarballs,
137+ timestamp=None, author=None):
138+ """Import the upstream tarballs.
139+
140+ :param package: Package name
141+ :param version: Package version
142+ :param path: Path with tree to import
143+ :param parent_ids: Parent revisions
144+ :param tarballs: List of (path, component, md5)
145+ :param timestamp: Optional timestamp for new commits
146+ :param author: Optional author for new commits
147+ :return: List of tuples with (component, tag, revid)
148+ """
149+ ret = []
150+ for (tarball, component, md5) in tarballs:
151+ (tag, revid) = self.import_component_tarball(
152+ package, version, tree, parent_ids, component,
153+ md5, tarball, author=author, timestamp=timestamp)
154+ ret.append((component, tag, revid))
155+ return ret
156+
157+ def import_component_tarball(self, package, version, tree, parent_ids,
158+ component=None, md5=None, tarball=None, author=None, timestamp=None):
159 """Import a tarball.
160
161 :param package: Package name

Subscribers

People subscribed via source and target branches