Merge lp:~jelmer/bzr-builddeb/obj into lp:~bzr-builddeb-hackers/bzr-builddeb/trunk-old

Proposed by Jelmer Vernooij
Status: Merged
Merged at revision: not available
Proposed branch: lp:~jelmer/bzr-builddeb/obj
Merge into: lp:~bzr-builddeb-hackers/bzr-builddeb/trunk-old
Diff against target: None lines
To merge this branch: bzr merge lp:~jelmer/bzr-builddeb/obj
Reviewer Review Type Date Requested Status
James Westby Approve
Review via email: mp+5607@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

The attached patch adds a new class UpstreamSource (for lack of a
better name) that represents a source of upstream tarballs.
UpstreamSources currently only can retrieve specific version tarballs,
but the idea is that they'll in the future also be able to (where
possible/applicable):

 * retrieve the last upstream version string
 * retrieve the last upstream version tarball
 * return the revid matching a particular upstream version
 * list the available upstream versions

It also makes bzr-builddeb support retrieval of upstream snapshot
versions again ("1.0~bzr13").

Cheers,

Jelmer

Revision history for this message
James Westby (james-w) wrote :

Merged,

Thanks

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 2009-04-15 11:50:06 +0000
3+++ cmds.py 2009-04-16 10:42:12 +0000
4@@ -74,7 +74,11 @@
5 MergeModeDistiller,
6 NativeSourceDistiller,
7 )
8-from bzrlib.plugins.builddeb.upstream import UpstreamProvider
9+from bzrlib.plugins.builddeb.upstream import (
10+ UpstreamProvider,
11+ UpstreamBranchSource,
12+ get_upstream_sources,
13+ )
14 from bzrlib.plugins.builddeb.util import (find_changelog,
15 lookup_distribution,
16 suite_to_distribution,
17@@ -362,10 +366,11 @@
18 self._get_upstream_branch(merge, export_upstream,
19 export_upstream_revision, config)
20
21- upstream_provider = UpstreamProvider(tree, branch,
22+ upstream_provider = UpstreamProvider(
23 changelog.package, changelog.version.upstream_version,
24- orig_dir, larstiq=larstiq, upstream_branch=upstream_branch,
25- upstream_revision=upstream_revision, allow_split=split)
26+ orig_dir, get_upstream_sources(tree, branch,
27+ larstiq=larstiq, upstream_branch=upstream_branch,
28+ upstream_revision=upstream_revision, allow_split=split))
29
30 if merge:
31 distiller_cls = MergeModeDistiller
32@@ -379,8 +384,8 @@
33 is_working_tree=working_tree)
34
35 build_source_dir = os.path.join(build_dir,
36- changelog.package + "-"
37- + changelog.version.upstream_version)
38+ "%s-%s" % (changelog.package,
39+ changelog.version.upstream_version))
40
41 builder = DebBuild(distiller, build_source_dir, build_cmd,
42 use_existing=use_existing)
43@@ -565,11 +570,10 @@
44 tarball_filename = os.path.join(orig_dir, dest_name)
45
46 if upstream_branch and no_tarball:
47- info("Exporting the upstream branch to create the tarball")
48- rev_tree = upstream_branch.repository.revision_tree(
49+ upstream = UpstreamBranchSource(upstream_branch,
50 upstream_revision)
51- export(rev_tree, tarball_filename, format='tgz',
52- root="%s-%s" % (package, version.upstream_version))
53+ upstream.get_specific_version(package, version.upstream_version,
54+ orig_dir)
55 else:
56 try:
57 repack_tarball(location, dest_name, target_dir=orig_dir)
58@@ -764,9 +768,9 @@
59 orig_dir = config.orig_dir
60 if orig_dir is None:
61 orig_dir = default_orig_dir
62- upstream_provider = UpstreamProvider(t, t.branch,
63- changelog.package, changelog.version.upstream_version,
64- orig_dir, larstiq=larstiq)
65+ upstream_provider = UpstreamProvider(changelog.package,
66+ changelog.version.upstream_version, orig_dir,
67+ get_upstream_sources(t, t.branch, larstiq=larstiq))
68
69 distiller = MergeModeDistiller(t, upstream_provider,
70 larstiq=larstiq)
71
72=== modified file 'errors.py'
73--- errors.py 2009-03-02 22:36:36 +0000
74+++ errors.py 2009-04-16 09:30:49 +0000
75@@ -153,6 +153,14 @@
76 _fmt = "You did not specify a package version."
77
78
79+class PackageVersionNotPresent(BzrError):
80+ _fmt = "%(package)s %(version)s was not found in %(upstream)s."
81+
82+ def __init__(self, package, version, upstream):
83+ BzrError.__init__(self, package=package, version=version,
84+ upstream=upstream)
85+
86+
87 class UnsupportedRepackFormat(BzrError):
88 _fmt = ('Either the file extension of "%(location)s" indicates that '
89 'it is a format unsupported for repacking or it is a '
90
91=== modified file 'import_dsc.py'
92--- import_dsc.py 2009-03-11 07:23:20 +0000
93+++ import_dsc.py 2009-04-15 23:17:50 +0000
94@@ -57,6 +57,7 @@
95 )
96 from bzrlib.export import export
97 from bzrlib.osutils import file_iterator, isdir, basename, splitpath
98+from bzrlib.revisionspec import RevisionSpec
99 from bzrlib.revision import NULL_REVISION
100 from bzrlib.trace import warning, info, mutter
101 from bzrlib.transform import TreeTransform, cook_conflicts, resolve_conflicts
102@@ -73,7 +74,7 @@
103 UpstreamAlreadyImported,
104 UpstreamBranchAlreadyMerged,
105 )
106-from bzrlib.plugins.builddeb.util import get_commit_info_from_changelog
107+from bzrlib.plugins.builddeb.util import get_commit_info_from_changelog, get_snapshot_revision
108
109
110 files_to_ignore = set(['.cvsignore', '.arch-inventory', '.bzrignore',
111@@ -1534,16 +1535,23 @@
112 "Should use self.upstream_branch if set"
113 tempdir = tempfile.mkdtemp(dir=os.path.join(self.tree.basedir, '..'))
114 try:
115+ previous_upstream_revision = get_snapshot_revision(previous_version.upstream_version)
116 if previous_version is not None:
117- if not self.has_upstream_version_in_packaging_branch(
118+ if self.has_upstream_version_in_packaging_branch(
119 previous_version):
120+ upstream_tip = self._revid_of_upstream_version_from_branch(
121+ previous_version)
122+ self._extract_upstream_tree(upstream_tip, tempdir)
123+ elif (upstream_branch is not None and
124+ previous_upstream_revision is not None):
125+ upstream_tip = RevisionSpec.from_string(previous_upstream_revision).as_revision_id(upstream_branch)
126+ assert isinstance(upstream_tip, str)
127+ self._extract_upstream_tree(upstream_tip, tempdir)
128+ else:
129 raise BzrCommandError("Unable to find the tag for the "
130 "previous upstream version, %s, in the branch: "
131 "%s" % (previous_version,
132 self.upstream_tag_name(previous_version)))
133- upstream_tip = self._revid_of_upstream_version_from_branch(
134- previous_version)
135- self._extract_upstream_tree(upstream_tip, tempdir)
136 else:
137 self._create_empty_upstream_tree(tempdir)
138 if self.has_upstream_version_in_packaging_branch(version):
139
140=== modified file 'tests/test_upstream.py'
141--- tests/test_upstream.py 2009-03-08 23:18:01 +0000
142+++ tests/test_upstream.py 2009-04-16 10:42:12 +0000
143@@ -24,14 +24,21 @@
144
145 from debian_bundle.changelog import Version
146
147-from bzrlib.tests import TestCaseWithTransport
148+from bzrlib.tests import (
149+ TestCase,
150+ TestCaseWithTransport,
151+ )
152 from bzrlib.plugins.builddeb.errors import (
153 MissingUpstreamTarball,
154+ PackageVersionNotPresent,
155 )
156 from bzrlib.plugins.builddeb.upstream import (
157+ AptSource,
158+ PristineTarSource,
159+ StackedUpstreamSource,
160 UpstreamProvider,
161- get_apt_command_for_source,
162- provide_with_apt,
163+ UpstreamSource,
164+ UScanSource,
165 )
166 from bzrlib.plugins.builddeb.util import (
167 get_parent_dir,
168@@ -39,156 +46,6 @@
169 )
170
171
172-class MockProvider(object):
173-
174- def create_target(self, path):
175- parent_dir = get_parent_dir(path)
176- if parent_dir != '' and not os.path.exists(parent_dir):
177- os.makedirs(parent_dir)
178- f = open(path, "wb")
179- try:
180- f.write('')
181- finally:
182- f.close()
183-
184- def tarball_name(self, package, upstream_version):
185- return tarball_name(package, upstream_version)
186-
187-
188-class MockAptProvider(MockProvider):
189-
190- def __init__(self, find=False):
191- self.find = find
192- self.called_times = 0
193- self.package = None
194- self.upstream_version = None
195- self.target_dir = None
196-
197- def provide(self, package, upstream_version, target_dir):
198- self.called_times += 1
199- self.package = package
200- self.upstream_version = upstream_version
201- self.target_dir = target_dir
202- if self.find:
203- self.create_target(os.path.join(target_dir,
204- self.tarball_name(package, upstream_version)))
205- return self.find
206-
207-
208-class MockUscanProvider(MockProvider):
209-
210- def __init__(self, find=False):
211- self.find = find
212- self.called_times = 0
213- self.package = None
214- self.upstream_version = None
215- self.watch_file_contents = None
216- self.target_dir = None
217-
218- def provide(self, package, upstream_version, watch_file, target_dir):
219- self.called_times += 1
220- self.package = package
221- self.upstream_version = upstream_version
222- f = open(watch_file, "rb")
223- try:
224- self.watch_file_contents = f.read()
225- finally:
226- f.close()
227- self.target_dir = target_dir
228- if self.find:
229- self.create_target(os.path.join(target_dir,
230- self.tarball_name(package, upstream_version)))
231- return self.find
232-
233-
234-class MockPristineProvider(MockProvider):
235-
236- def __init__(self, find=False):
237- self.find = find
238- self.called_times = 0
239- self.tree = None
240- self.branch = None
241- self.package = None
242- self.version = None
243- self.target_filename = None
244-
245- def provide(self, tree, branch, package, version, target_filename):
246- self.called_times += 1
247- self.tree = tree
248- self.branch = branch
249- self.package = package
250- self.version = version
251- self.target_filename = target_filename
252- if self.find:
253- self.create_target(target_filename)
254- return self.find
255-
256-
257-class MockOrigSourceProvider(MockProvider):
258-
259- def __init__(self, find=False):
260- self.find = find
261- self.called_times = 0
262- self.source_dir = None
263- self.fetch_dir = None
264- self.desired_tarball_name = None
265- self.target_dir = None
266-
267- def provide(self, source_dir, fetch_dir, desired_tarball_name,
268- target_dir):
269- self.called_times += 1
270- self.source_dir = source_dir
271- self.fetch_dir = fetch_dir
272- self.desired_tarball_name = desired_tarball_name
273- self.target_dir = target_dir
274- if self.find:
275- self.create_target(os.path.join(target_dir, desired_tarball_name))
276- return self.find
277-
278-
279-class MockOtherBranchProvider(MockProvider):
280-
281- def __init__(self, find=False):
282- self.find = find
283- self.called_times = 0
284- self.upstream_branch = None
285- self.upstream_revision = None
286- self.target_filename = None
287- self.tarball_base = None
288-
289- def provide(self, upstream_branch, upstream_revision, target_filename,
290- tarball_base):
291- self.called_times += 1
292- self.upstream_branch = upstream_branch
293- self.upstream_revision = upstream_revision
294- self.target_filename = target_filename
295- self.tarball_base = tarball_base
296- if self.find:
297- self.create_target(target_filename)
298- return self.find
299-
300-
301-class MockSplitProvider(MockProvider):
302-
303- def __init__(self, find=False):
304- self.find = find
305- self.called_times = 0
306- self.tree = None
307- self.package = None
308- self.upstream_version = None
309- self.target_filename = None
310-
311- def provide(self, tree, package, upstream_version, target_filename):
312- self.called_times += 1
313- self.tree = tree
314- self.package = package
315- self.upstream_version = upstream_version
316- self.target_filename = target_filename
317- if self.find:
318- self.create_target(self.target_filename)
319- return self.find
320-
321-
322 class MockSources(object):
323
324 def __init__(self, versions):
325@@ -245,210 +102,21 @@
326 return self.work
327
328
329-class UpstreamProviderTests(TestCaseWithTransport):
330-
331- def setUp(self):
332- super(UpstreamProviderTests, self).setUp()
333- self.tree = self.make_branch_and_tree(".")
334- self.branch = self.tree.branch
335- self.package = "package"
336- self.version = Version("0.1-1")
337- self.upstream_version = self.version.upstream_version
338- self.desired_tarball_name = tarball_name(self.package,
339- self.upstream_version)
340- self.tarball_base = "%s-%s" % (self.package, self.upstream_version)
341- self.store_dir = "store"
342- self.provider = UpstreamProvider(self.tree, self.branch,
343- self.package, self.version, self.store_dir)
344- self.providers = {}
345- self.providers["apt"]= MockAptProvider()
346- self.provider._apt_provider = self.providers["apt"].provide
347- self.providers["uscan"] = MockUscanProvider()
348- self.provider._uscan_provider = self.providers["uscan"].provide
349- self.providers["pristine"] = MockPristineProvider()
350- self.provider._pristine_provider = self.providers["pristine"].provide
351- self.providers["orig"] = MockOrigSourceProvider()
352- self.provider._orig_source_provider = self.providers["orig"].provide
353- self.providers["upstream"] = MockOtherBranchProvider()
354- self.provider._upstream_branch_provider = \
355- self.providers["upstream"].provide
356- self.providers["split"] = MockSplitProvider()
357- self.provider._split_provider = self.providers["split"].provide
358- self.target_dir = "target"
359- self.target_filename = os.path.join(self.target_dir,
360- self.desired_tarball_name)
361- self.store_filename = os.path.join(self.store_dir,
362- tarball_name(self.package, self.version.upstream_version))
363-
364- def assertProvidersCalled(self, providers):
365- for provider_name, provider in self.providers.items():
366- if provider_name in providers:
367- self.assertCalledCorrectly(provider_name)
368- else:
369- self.assertEqual(provider.called_times, 0,
370- "%s wasn't expected to be called" % provider_name)
371-
372- def call_provider(self):
373- self.assertEqual(self.provider.provide(self.target_dir),
374- self.target_filename)
375-
376- def test_already_in_target(self):
377- os.makedirs(self.target_dir)
378- f = open(self.target_filename, "wb")
379- f.close()
380- self.call_provider()
381- self.failUnlessExists(self.target_filename)
382- # Should this be copied across?
383- self.failIfExists(self.store_filename)
384- self.assertProvidersCalled({})
385-
386- def test_already_in_store(self):
387- os.makedirs(self.store_dir)
388- f = open(self.store_filename, "wb")
389- f.close()
390- self.call_provider()
391- self.failUnlessExists(self.target_filename)
392- self.failUnlessExists(self.store_filename)
393- self.assertProvidersCalled({})
394-
395- def assertCalledCorrectly(self, provider_name):
396- provider = self.providers[provider_name]
397- for attr_name in provider.__dict__:
398- if attr_name in ("find", "provide", "source_dir"):
399- continue
400- if attr_name == "called_times":
401- self.assertEqual(provider.called_times, 1,
402- "%s was not called" % provider_name)
403- continue
404- if attr_name == "target_filename":
405- self.assertEqual(provider.target_filename,
406- self.store_filename)
407- continue
408- if attr_name == "target_dir":
409- self.assertEqual(provider.target_dir,
410- self.store_dir)
411- continue
412- if attr_name == "fetch_dir":
413- self.assertEqual(provider.fetch_dir,
414- os.path.dirname(provider.source_dir))
415- continue
416- attr = getattr(provider, attr_name)
417- correct_attr = getattr(self, attr_name)
418- self.assertEqual(correct_attr, attr,
419- "%s doesn't match\nexpected: %s\ngot: %s"
420- % (attr_name, correct_attr, attr))
421-
422- def assertSuccesfulCall(self, provider, other_providers):
423- self.providers[provider].find = True
424- self.call_provider()
425- self.failUnlessExists(self.target_filename)
426- self.failUnlessExists(self.store_filename)
427- self.assertProvidersCalled([provider] + other_providers)
428-
429- def test_from_pristine_tar(self):
430- self.assertSuccesfulCall("pristine", [])
431-
432- def test_from_apt(self):
433- self.assertSuccesfulCall("apt", ["pristine"])
434-
435- def test_from_uscan(self):
436- self.build_tree(["watch", "debian/", "debian/watch"])
437- self.tree.add(["watch", "debian/", "debian/watch"])
438- self.watch_file_contents = "contents of debian/watch\n"
439- self.assertSuccesfulCall("uscan", ["pristine", "apt"])
440-
441- def test_uscan_not_called_if_not_watch(self):
442- self.build_tree(["watch"])
443- self.tree.add(["watch"])
444- self.assertRaises(MissingUpstreamTarball, self.provider.provide,
445- self.target_dir)
446- self.failIfExists(self.target_filename)
447- self.failIfExists(self.store_filename)
448- self.assertProvidersCalled(["pristine", "apt"])
449-
450- def test_uscan_in_larstiq(self):
451- self.build_tree(["watch", "debian/", "debian/watch"])
452- self.tree.add(["watch", "debian/", "debian/watch"])
453- self.watch_file_contents = "contents of watch\n"
454- self.provider.larstiq = True
455- self.assertSuccesfulCall("uscan", ["pristine", "apt"])
456-
457- def test_from_get_orig_source(self):
458- self.build_tree(["rules", "debian/", "debian/rules"])
459- self.tree.add(["rules", "debian/", "debian/rules"])
460- self.watch_file_contents = "contents of debian/rules\n"
461- self.assertSuccesfulCall("orig", ["pristine", "apt"])
462-
463- def test_get_orig_source_not_called_if_no_rules(self):
464- self.build_tree(["rules"])
465- self.tree.add(["rules"])
466- self.assertRaises(MissingUpstreamTarball, self.provider.provide,
467- self.target_dir)
468- self.failIfExists(self.target_filename)
469- self.failIfExists(self.store_filename)
470- self.assertProvidersCalled(["pristine", "apt"])
471-
472- def test_get_orig_source_in_larstiq(self):
473- self.build_tree(["rules", "debian/", "debian/rules"])
474- self.tree.add(["rules", "debian/", "debian/rules"])
475- self.watch_file_contents = "contents of rules\n"
476- self.provider.larstiq = True
477- self.assertSuccesfulCall("orig", ["pristine", "apt"])
478-
479- def test_from_upstream_branch(self):
480- upstream_tree = self.make_branch_and_tree("upstream")
481- self.build_tree(["upstream/foo"])
482- upstream_tree.add(["foo"])
483- self.upstream_branch = upstream_tree.branch
484- self.upstream_revision = upstream_tree.commit("upstream one")
485- self.provider.upstream_revision = self.upstream_revision
486- self.provider.upstream_branch = self.upstream_branch
487- self.assertSuccesfulCall("upstream", ["pristine", "apt"])
488-
489- def test_from_split(self):
490- self.provider.allow_split = True
491- self.assertSuccesfulCall("split", ["pristine", "apt"])
492-
493- def test_upstream_before_orig_source(self):
494- upstream_tree = self.make_branch_and_tree("upstream")
495- self.build_tree(["upstream/foo"])
496- upstream_tree.add(["foo"])
497- self.upstream_branch = upstream_tree.branch
498- self.upstream_revision = upstream_tree.commit("upstream one")
499- self.provider.upstream_revision = self.upstream_revision
500- self.provider.upstream_branch = self.upstream_branch
501- self.build_tree(["rules", "debian/", "debian/rules"])
502- self.tree.add(["rules", "debian/", "debian/rules"])
503- self.watch_file_contents = "contents of debian/rules\n"
504- self.assertSuccesfulCall("upstream", ["pristine", "apt"])
505-
506- def test_get_orig_source_before_uscan(self):
507- self.build_tree(["rules", "debian/", "debian/rules"])
508- self.tree.add(["rules", "debian/", "debian/rules"])
509- self.watch_file_contents = "contents of debian/rules\n"
510- self.build_tree(["watch", "debian/watch"])
511- self.tree.add(["watch", "debian/watch"])
512- self.watch_file_contents = "contents of debian/watch\n"
513- self.assertSuccesfulCall("orig", ["pristine", "apt"])
514-
515- def test_uscan_before_split(self):
516- self.build_tree(["watch", "debian/", "debian/watch"])
517- self.tree.add(["watch", "debian/", "debian/watch"])
518- self.watch_file_contents = "contents of debian/watch\n"
519- self.provider.allow_split = True
520- self.assertSuccesfulCall("uscan", ["pristine", "apt"])
521+class AptSourceTests(TestCase):
522
523 def test_get_apt_command_for_source(self):
524 self.assertEqual("apt-get source -y --only-source --tar-only "
525 "apackage=someversion",
526- get_apt_command_for_source("apackage", "someversion"))
527+ AptSource()._get_command("apackage", "someversion"))
528
529 def test_apt_provider_no_package(self):
530 caller = MockAptCaller()
531 sources = MockSources([])
532 apt_pkg = MockAptPkg(sources)
533- self.assertEqual(False, provide_with_apt("apackage", "0.2",
534- "target", _apt_pkg=apt_pkg, _apt_caller=caller))
535+ src = AptSource()
536+ src._run_apt_source = caller.call
537+ self.assertRaises(PackageVersionNotPresent, src.get_specific_version,
538+ "apackage", "0.2", "target", _apt_pkg=apt_pkg)
539 self.assertEqual(1, apt_pkg.init_called_times)
540 self.assertEqual(1, apt_pkg.get_pkg_source_records_called_times)
541 self.assertEqual(1, sources.restart_called_times)
542@@ -460,8 +128,10 @@
543 caller = MockAptCaller()
544 sources = MockSources(["0.1-1"])
545 apt_pkg = MockAptPkg(sources)
546- self.assertEqual(False, provide_with_apt("apackage", "0.2",
547- "target", _apt_pkg=apt_pkg, _apt_caller=caller))
548+ src = AptSource()
549+ src._run_apt_source = caller.call
550+ self.assertRaises(PackageVersionNotPresent, src.get_specific_version,
551+ "apackage", "0.2", "target", _apt_pkg=apt_pkg)
552 self.assertEqual(1, apt_pkg.init_called_times)
553 self.assertEqual(1, apt_pkg.get_pkg_source_records_called_times)
554 self.assertEqual(1, sources.restart_called_times)
555@@ -473,8 +143,10 @@
556 caller = MockAptCaller(work=True)
557 sources = MockSources(["0.1-1", "0.2-1"])
558 apt_pkg = MockAptPkg(sources)
559- self.assertEqual(True, provide_with_apt("apackage", "0.2",
560- "target", _apt_pkg=apt_pkg, _apt_caller=caller.call))
561+ src = AptSource()
562+ src._run_apt_source = caller.call
563+ src.get_specific_version("apackage", "0.2", "target",
564+ _apt_pkg=apt_pkg)
565 self.assertEqual(1, apt_pkg.init_called_times)
566 self.assertEqual(1, apt_pkg.get_pkg_source_records_called_times)
567 self.assertEqual(1, sources.restart_called_times)
568@@ -490,8 +162,11 @@
569 caller = MockAptCaller()
570 sources = MockSources(["0.1-1", "0.2-1"])
571 apt_pkg = MockAptPkg(sources)
572- self.assertEqual(False, provide_with_apt("apackage", "0.2",
573- "target", _apt_pkg=apt_pkg, _apt_caller=caller.call))
574+ src = AptSource()
575+ src._run_apt_source = caller.call
576+ self.assertRaises(PackageVersionNotPresent, src.get_specific_version,
577+ "apackage", "0.2", "target",
578+ _apt_pkg=apt_pkg)
579 self.assertEqual(1, apt_pkg.init_called_times)
580 self.assertEqual(1, apt_pkg.get_pkg_source_records_called_times)
581 self.assertEqual(1, sources.restart_called_times)
582@@ -502,3 +177,71 @@
583 self.assertEqual("apackage", caller.package)
584 self.assertEqual("0.2-1", caller.version_str)
585 self.assertEqual("target", caller.target_dir)
586+
587+
588+class RecordingSource(object):
589+
590+ def __init__(self, succeed):
591+ self._succeed = succeed
592+ self._specific_versions = []
593+
594+ def get_specific_version(self, package, version, target_dir):
595+ self._specific_versions.append((package, version, target_dir))
596+ if not self._succeed:
597+ raise PackageVersionNotPresent(package, version, self)
598+
599+ def __repr__(self):
600+ return "%s()" % self.__class__.__name__
601+
602+
603+class StackedUpstreamSourceTests(TestCase):
604+
605+ def test_first_wins(self):
606+ a = RecordingSource(False)
607+ b = RecordingSource(True)
608+ c = RecordingSource(False)
609+ stack = StackedUpstreamSource([a, b, c])
610+ stack.get_specific_version("mypkg", "1.0", "bla")
611+ self.assertEquals([("mypkg", "1.0", "bla")], b._specific_versions)
612+ self.assertEquals([("mypkg", "1.0", "bla")], a._specific_versions)
613+ self.assertEquals([], c._specific_versions)
614+
615+ def test_repr(self):
616+ self.assertEquals("StackedUpstreamSource([])",
617+ repr(StackedUpstreamSource([])))
618+ self.assertEquals("StackedUpstreamSource([RecordingSource()])",
619+ repr(StackedUpstreamSource([RecordingSource(False)])))
620+
621+ def test_none(self):
622+ a = RecordingSource(False)
623+ b = RecordingSource(False)
624+ stack = StackedUpstreamSource([a, b])
625+ self.assertRaises(PackageVersionNotPresent,
626+ stack.get_specific_version, "pkg", "1.0", "bla")
627+ self.assertEquals([("pkg", "1.0", "bla")], b._specific_versions)
628+ self.assertEquals([("pkg", "1.0", "bla")], a._specific_versions)
629+
630+
631+class UScanSourceTests(TestCaseWithTransport):
632+
633+ def setUp(self):
634+ super(UScanSourceTests, self).setUp()
635+ self.tree = self.make_branch_and_tree('.')
636+
637+ def test_export_watchfile_none(self):
638+ src = UScanSource(self.tree, False)
639+ self.assertEquals(None, src._export_watchfile())
640+
641+ def test_export_watchfile_larstiq(self):
642+ src = UScanSource(self.tree, True)
643+ self.build_tree(['watch'])
644+ self.assertEquals(None, src._export_watchfile())
645+ self.tree.add(['watch'])
646+ self.assertTrue(src._export_watchfile() is not None)
647+
648+ def test_export_watchfile(self):
649+ src = UScanSource(self.tree, False)
650+ self.build_tree(['debian/', 'debian/watch'])
651+ self.assertEquals(None, src._export_watchfile())
652+ self.tree.smart_add(['debian/watch'])
653+ self.assertTrue(src._export_watchfile() is not None)
654
655=== modified file 'upstream.py'
656--- upstream.py 2009-03-07 23:54:46 +0000
657+++ upstream.py 2009-04-16 10:06:01 +0000
658@@ -1,5 +1,6 @@
659 # upstream.py -- Providers of upstream source
660 # Copyright (C) 2009 Canonical Ltd.
661+# Copyright (C) 2009 Jelmer Vernooij <jelmer@debian.org>
662 #
663 # This file is part of bzr-builddeb.
664 #
665@@ -26,119 +27,313 @@
666 from debian_bundle.changelog import Version
667
668 from bzrlib.export import export
669+from bzrlib.revisionspec import RevisionSpec
670 from bzrlib.trace import info
671
672-from bzrlib.plugins.builddeb.errors import MissingUpstreamTarball
673+from bzrlib.plugins.builddeb.errors import (
674+ MissingUpstreamTarball,
675+ PackageVersionNotPresent,
676+ )
677 from bzrlib.plugins.builddeb.import_dsc import DistributionBranch
678 from bzrlib.plugins.builddeb.repack_tarball import repack_tarball
679-
680-
681-def get_apt_command_for_source(package, version_str):
682- return 'apt-get source -y --only-source --tar-only %s=%s' % \
683- (package, version_str)
684-
685-
686-def call_apt_for_source(package, version_str, target_dir):
687- command = get_apt_command_for_source(package, version_str)
688- proc = subprocess.Popen(command, shell=True, cwd=target_dir)
689- proc.wait()
690- if proc.returncode != 0:
691- return False
692- return True
693-
694-
695-def provide_with_apt(package, upstream_version, target_dir, _apt_pkg=None,
696- _apt_caller=None):
697- if _apt_pkg is None:
698- import apt_pkg
699- else:
700- apt_pkg = _apt_pkg
701- if _apt_caller is None:
702- _apt_caller = call_apt_for_source
703- apt_pkg.init()
704- sources = apt_pkg.GetPkgSrcRecords()
705- sources.Restart()
706- info("Using apt to look for the upstream tarball.")
707- while sources.Lookup(package):
708- if upstream_version \
709- == Version(sources.Version).upstream_version:
710- if _apt_caller(package, sources.Version, target_dir):
711- return True
712- break
713- info("apt could not find the needed tarball.")
714- return False
715-
716-
717-def provide_with_uscan(package, upstream_version, watch_file, target_dir):
718- info("Using uscan to look for the upstream tarball.")
719- r = os.system("uscan --upstream-version %s --force-download --rename "
720- "--package %s --watchfile %s --check-dirname-level 0 "
721- "--download --repack --destdir %s" %
722- (upstream_version, package, watch_file, target_dir))
723- if r != 0:
724- info("uscan could not find the needed tarball.")
725- return False
726- return True
727-
728-
729-def provide_with_pristine_tar(tree, branch, package, version,
730- target_filename):
731- db = DistributionBranch(branch, None, tree=tree)
732- if not db.has_upstream_version_in_packaging_branch(version):
733- return False
734- revid = db._revid_of_upstream_version_from_branch(version)
735- if not db.has_pristine_tar_delta(revid):
736- return False
737- info("Using pristine-tar to reconstruct the needed tarball.")
738- db.reconstruct_pristine_tar(revid, package, version, target_filename)
739- return True
740-
741-
742-def provide_with_get_orig_source(source_dir, fetch_dir, desired_tarball_name,
743- target_dir):
744- info("Trying to use get-orig-source to retrieve needed tarball.")
745- command = ["/usr/bin/make", "-f", "debian/rules", "get-orig-source"]
746- proc = subprocess.Popen(command, cwd=source_dir)
747- ret = proc.wait()
748- if ret != 0:
749- info("Trying to run get-orig-source rule failed")
750- return False
751- fetched_tarball = os.path.join(fetch_dir, desired_tarball_name)
752- if not os.path.exists(fetched_tarball):
753- info("get-orig-source did not create %s"
754- % desired_tarball_name)
755- return False
756- repack_tarball(fetched_tarball, desired_tarball_name,
757- target_dir=target_dir)
758- return True
759-
760-
761-def provide_from_other_branch(branch, revision, target_filename,
762- tarball_base):
763- branch.lock_read()
764- try:
765- rev_tree = branch.repository.revision_tree(revision)
766- export(rev_tree, target_filename, 'tgz', tarball_base)
767- return True
768- finally:
769- branch.unlock()
770-
771-
772-def provide_by_split(tree, package, upstream_version, target_filename):
773- tmpdir = tempfile.mkdtemp(prefix="builddeb-get-orig-source-")
774- try:
775- export_dir = os.path.join(tmpdir,
776- "%s-%s" % (package, upstream_version))
777- export(tree, export_dir, format="dir")
778- shutil.rmtree(os.path.join(export_dir, "debian"))
779- tar = tarfile.open(target_filename, "w:gz")
780- try:
781- tar.add(export_dir, "%s-%s" % (package, upstream_version))
782- finally:
783- tar.close()
784- return True
785- finally:
786- shutil.rmtree(tmpdir)
787+from bzrlib.plugins.builddeb.util import (
788+ get_snapshot_revision,
789+ tarball_name,
790+ )
791+
792+
793+class UpstreamSource(object):
794+ """A source for upstream versions (uscan, get-orig-source, etc)."""
795+
796+ def get_latest_version(self, package, target_dir):
797+ """Fetch the source tarball for the latest available version.
798+
799+ :param package: Name of the package
800+ :param target_dir: Directory in which to store the tarball
801+ """
802+ raise NotImplemented(self.get_latest_version)
803+
804+ def get_specific_version(self, package, version, target_dir):
805+ """Fetch the source tarball for a particular version.
806+
807+ :param package: Name of the package
808+ :param version: Version string of the version to fetch
809+ :param target_dir: Directory in which to store the tarball
810+ """
811+ raise NotImplemented(self.get_specific_version)
812+
813+ def _tarball_path(self, package, version, target_dir):
814+ return os.path.join(target_dir, tarball_name(package, version))
815+
816+
817+class PristineTarSource(UpstreamSource):
818+ """Source that uses the pristine-tar revisions in the packaging branch."""
819+
820+ def __init__(self, tree, branch):
821+ self.branch = branch
822+ self.tree = tree
823+
824+ def get_specific_version(self, package, upstream_version, target_dir):
825+ # FIXME: Make provide_with_pristine_tar take a upstream
826+ # version string; it doesn't need the debian-specific data
827+ version = Version("%s-1" % upstream_version)
828+ target_filename = self._tarball_path(package, upstream_version,
829+ target_dir)
830+ db = DistributionBranch(self.branch, None, tree=self.tree)
831+ if not db.has_upstream_version_in_packaging_branch(version):
832+ raise PackageVersionNotPresent(package, upstream_version, self)
833+ revid = db._revid_of_upstream_version_from_branch(version)
834+ if not db.has_pristine_tar_delta(revid):
835+ raise PackageVersionNotPresent(package, upstream_version, self)
836+ info("Using pristine-tar to reconstruct the needed tarball.")
837+ db.reconstruct_pristine_tar(revid, package, version, target_filename)
838+
839+
840+class AptSource(UpstreamSource):
841+ """Upstream source that uses apt-source."""
842+
843+ def get_specific_version(self, package, upstream_version, target_dir,
844+ _apt_pkg=None):
845+ if _apt_pkg is None:
846+ import apt_pkg
847+ else:
848+ apt_pkg = _apt_pkg
849+ apt_pkg.init()
850+ sources = apt_pkg.GetPkgSrcRecords()
851+ sources.Restart()
852+ info("Using apt to look for the upstream tarball.")
853+ while sources.Lookup(package):
854+ if upstream_version \
855+ == Version(sources.Version).upstream_version:
856+ if self._run_apt_source(package, sources.Version, target_dir):
857+ return
858+ break
859+ info("apt could not find the needed tarball.")
860+ raise PackageVersionNotPresent(package, upstream_version, self)
861+
862+ def _get_command(self, package, version_str):
863+ return 'apt-get source -y --only-source --tar-only %s=%s' % \
864+ (package, version_str)
865+
866+ def _run_apt_source(self, package, version_str, target_dir):
867+ command = self._get_command(package, version_str)
868+ proc = subprocess.Popen(command, shell=True, cwd=target_dir)
869+ proc.wait()
870+ if proc.returncode != 0:
871+ return False
872+ return True
873+
874+
875+class UpstreamBranchSource(UpstreamSource):
876+ """Upstream source that uses the upstream branch."""
877+
878+ def __init__(self, upstream_branch, upstream_revision=None,
879+ fallback_revspec=None):
880+ self.upstream_branch = upstream_branch
881+ self.upstream_revision = upstream_revision
882+ self.fallback_revspec = fallback_revspec
883+
884+ def _get_revision_id(self, version):
885+ if self.upstream_revision is not None:
886+ # Explicit revision id to use set
887+ return self.upstream_revision
888+ revspec = get_snapshot_revision(version)
889+ if revspec is None:
890+ revspec = self.fallback_revspec
891+ if revspec is not None:
892+ return RevisionSpec.from_string(
893+ revspec).as_revision_id(self.upstream_branch)
894+ return self.upstream_branch.last_revision()
895+
896+ def get_specific_version(self, package, version, target_dir):
897+ self.upstream_branch.lock_read()
898+ try:
899+ revid = self._get_revision_id(version)
900+ info("Exporting upstream branch revision %s to create the tarball",
901+ revid)
902+ target_filename = self._tarball_path(package, version, target_dir)
903+ tarball_base = "%s-%s" % (package, version)
904+ rev_tree = self.upstream_branch.repository.revision_tree(revid)
905+ export(rev_tree, target_filename, 'tgz', tarball_base)
906+ finally:
907+ self.upstream_branch.unlock()
908+
909+
910+class GetOrigSourceSource(UpstreamSource):
911+ """Upstream source that uses the get-orig-source rule in debian/rules."""
912+
913+ def __init__(self, tree, larstiq):
914+ self.tree = tree
915+ self.larstiq = larstiq
916+
917+ def _get_orig_source(self, source_dir, fetch_dir, desired_tarball_name,
918+ target_dir):
919+ info("Trying to use get-orig-source to retrieve needed tarball.")
920+ command = ["/usr/bin/make", "-f", "debian/rules", "get-orig-source"]
921+ proc = subprocess.Popen(command, cwd=source_dir)
922+ ret = proc.wait()
923+ if ret != 0:
924+ info("Trying to run get-orig-source rule failed")
925+ return False
926+ fetched_tarball = os.path.join(fetch_dir, desired_tarball_name)
927+ if not os.path.exists(fetched_tarball):
928+ info("get-orig-source did not create %s", desired_tarball_name)
929+ return False
930+ repack_tarball(fetched_tarball, desired_tarball_name,
931+ target_dir=target_dir)
932+ return True
933+
934+ def get_specific_version(self, package, version, target_dir):
935+ if self.larstiq:
936+ rules_name = 'rules'
937+ else:
938+ rules_name = 'debian/rules'
939+ rules_id = self.tree.path2id(rules_name)
940+ if rules_id is not None:
941+ desired_tarball_name = tarball_name(package, version)
942+ tmpdir = tempfile.mkdtemp(prefix="builddeb-get-orig-source-")
943+ try:
944+ base_export_dir = os.path.join(tmpdir, "export")
945+ export_dir = base_export_dir
946+ if self.larstiq:
947+ os.mkdir(export_dir)
948+ export_dir = os.path.join(export_dir, "debian")
949+ export(self.tree, export_dir, format="dir")
950+ if not self._get_orig_source(base_export_dir, tmpdir,
951+ desired_tarball_name, target_dir):
952+ raise PackageVersionNotPresent(package, version, self)
953+ return
954+ finally:
955+ shutil.rmtree(tmpdir)
956+ info("No debian/rules file to try and use for a get-orig-source rule")
957+ raise PackageVersionNotPresent(package, version, self)
958+
959+
960+class UScanSource(UpstreamSource):
961+ """Upstream source that uses uscan."""
962+
963+ def __init__(self, tree, larstiq):
964+ self.tree = tree
965+ self.larstiq = larstiq
966+
967+ def _uscan(self, package, upstream_version, watch_file, target_dir):
968+ info("Using uscan to look for the upstream tarball.")
969+ r = os.system("uscan --upstream-version %s --force-download --rename "
970+ "--package %s --watchfile %s --check-dirname-level 0 "
971+ "--download --repack --destdir %s" %
972+ (upstream_version, package, watch_file, target_dir))
973+ if r != 0:
974+ info("uscan could not find the needed tarball.")
975+ return False
976+ return True
977+
978+ def _export_watchfile(self):
979+ if self.larstiq:
980+ watchfile = 'watch'
981+ else:
982+ watchfile = 'debian/watch'
983+ watch_id = self.tree.path2id(watchfile)
984+ if watch_id is None:
985+ info("No watch file to use to retrieve upstream tarball.")
986+ return None
987+ (tmp, tempfilename) = tempfile.mkstemp()
988+ try:
989+ tmp = os.fdopen(tmp, 'wb')
990+ watch = self.tree.get_file_text(watch_id)
991+ tmp.write(watch)
992+ finally:
993+ tmp.close()
994+ return tempfilename
995+
996+ def get_specific_version(self, package, version, target_dir):
997+ tempfilename = self._export_watchfile()
998+ if tempfilename is None:
999+ raise PackageVersionNotPresent(package, version, self)
1000+ try:
1001+ if not self._uscan(package, version, tempfilename,
1002+ target_dir):
1003+ raise PackageVersionNotPresent(package, version, self)
1004+ finally:
1005+ os.unlink(tempfilename)
1006+
1007+
1008+class SelfSplitSource(UpstreamSource):
1009+
1010+ def __init__(self, tree):
1011+ self.tree = tree
1012+
1013+ def _split(self, package, upstream_version, target_filename):
1014+ tmpdir = tempfile.mkdtemp(prefix="builddeb-get-orig-source-")
1015+ try:
1016+ export_dir = os.path.join(tmpdir,
1017+ "%s-%s" % (package, upstream_version))
1018+ export(self.tree, export_dir, format="dir")
1019+ shutil.rmtree(os.path.join(export_dir, "debian"))
1020+ tar = tarfile.open(target_filename, "w:gz")
1021+ try:
1022+ tar.add(export_dir, "%s-%s" % (package, upstream_version))
1023+ finally:
1024+ tar.close()
1025+ finally:
1026+ shutil.rmtree(tmpdir)
1027+
1028+ def get_specific_version(self, package, version, target_dir):
1029+ info("Using the current branch without the 'debian' directory "
1030+ "to create the tarball")
1031+ self._split(package, version,
1032+ self._tarball_path(package, version, target_dir))
1033+
1034+
1035+class StackedUpstreamSource(UpstreamSource):
1036+ """An upstream source that checks a list of other upstream sources.
1037+
1038+ The first source that can provide a tarball, wins.
1039+ """
1040+
1041+ def __init__(self, sources):
1042+ self._sources = sources
1043+
1044+ def __repr__(self):
1045+ return "%s(%r)" % (self.__class__.__name__, self._sources)
1046+
1047+ def get_specific_version(self, package, version, target_dir):
1048+ for source in self._sources:
1049+ try:
1050+ return source.get_specific_version(package, version, target_dir)
1051+ except PackageVersionNotPresent:
1052+ pass
1053+ raise PackageVersionNotPresent(package, version, self)
1054+
1055+
1056+def get_upstream_sources(tree, branch, larstiq=False, upstream_branch=None,
1057+ upstream_revision=None, allow_split=False):
1058+ """Get the list of upstream sources to retrieve upstream versions from.
1059+
1060+ :param tree: The tree that is being built from.
1061+ :param branch: The branch that is being built from.
1062+ :param larstiq: Whether the tree versions the root of ./debian.
1063+ :param upstream_branch: An upstream branch that can be exported
1064+ if needed.
1065+ :param upstream_revision: The revision to use of the upstream branch
1066+ if it is used.
1067+ :param allow_split: Whether the provider can provide the tarball
1068+ by exporting the branch and removing the "debian" dir.
1069+
1070+ """
1071+ sources = [
1072+ PristineTarSource(tree, branch),
1073+ AptSource(),
1074+ ]
1075+ if upstream_branch is not None:
1076+ sources.append(
1077+ UpstreamBranchSource(upstream_branch, upstream_revision))
1078+ sources.extend([
1079+ GetOrigSourceSource(tree, larstiq),
1080+ UScanSource(tree, larstiq),
1081+ ])
1082+ if allow_split:
1083+ sources.append(SelfSplitSource(tree))
1084+ return sources
1085
1086
1087 class UpstreamProvider(object):
1088@@ -148,40 +343,17 @@
1089 instance using pristine-tar, or using apt.
1090 """
1091
1092- def __init__(self, tree, branch, package, version, store_dir,
1093- larstiq=False, upstream_branch=None, upstream_revision=None,
1094- allow_split=False):
1095+ def __init__(self, package, version, store_dir, sources):
1096 """Create an UpstreamProvider.
1097
1098- :param tree: The tree that is being built from.
1099- :param branch: The branch that is being built from.
1100 :param package: the name of the source package that is being built.
1101 :param version: the Version of the package that is being built.
1102 :param store_dir: A directory to cache the tarballs.
1103- :param larstiq: Whether the tree versions the root of ./debian.
1104- :param upstream_branch: An upstream branch that can be exported
1105- if needed.
1106- :param upstream_revision: The revision to use of the upstream branch
1107- if it is used.
1108- :param allow_split: Whether the provider can provide the tarball
1109- by exporting the branch and removing the "debian" dir.
1110 """
1111- self.tree = tree
1112- self.branch = branch
1113 self.package = package
1114 self.version = Version(version)
1115 self.store_dir = store_dir
1116- self.larstiq = larstiq
1117- self.upstream_branch = upstream_branch
1118- self.upstream_revision = upstream_revision
1119- self.allow_split = allow_split
1120- # for testing
1121- self._apt_provider = provide_with_apt
1122- self._uscan_provider = provide_with_uscan
1123- self._pristine_provider = provide_with_pristine_tar
1124- self._orig_source_provider = provide_with_get_orig_source
1125- self._upstream_branch_provider = provide_from_other_branch
1126- self._split_provider = provide_by_split
1127+ self.source = StackedUpstreamSource(sources)
1128
1129 def provide(self, target_dir):
1130 """Provide the upstream tarball any way possible.
1131@@ -214,24 +386,16 @@
1132 if not self.already_exists_in_store():
1133 if not os.path.exists(self.store_dir):
1134 os.makedirs(self.store_dir)
1135- if self.provide_with_pristine_tar(self.store_dir):
1136- pass
1137- elif self.provide_with_apt(self.store_dir):
1138- pass
1139- elif self.provide_from_upstream_branch(self.store_dir):
1140- pass
1141- elif self.provide_with_get_orig_source(self.store_dir):
1142- pass
1143- elif self.provide_with_uscan(self.store_dir):
1144- pass
1145- elif self.provide_from_self_by_split(self.store_dir):
1146- pass
1147+ try:
1148+ self.source.get_specific_version(self.package,
1149+ self.version.upstream_version, target_dir)
1150+ except PackageVersionNotPresent:
1151+ raise MissingUpstreamTarball(self._tarball_name())
1152 else:
1153 info("Using the upstream tarball that is present in "
1154 "%s" % self.store_dir)
1155- if self.provide_from_store_dir(target_dir):
1156- return os.path.join(target_dir, self._tarball_name())
1157- raise MissingUpstreamTarball(self._tarball_name())
1158+ assert self.provide_from_store_dir(target_dir)
1159+ return os.path.join(target_dir, self._tarball_name())
1160
1161 def already_exists_in_target(self, target_dir):
1162 return os.path.exists(os.path.join(target_dir, self._tarball_name()))
1163@@ -247,83 +411,8 @@
1164 return True
1165 return False
1166
1167- def provide_with_apt(self, target_dir):
1168- return self._apt_provider(self.package, self.version.upstream_version,
1169- target_dir)
1170-
1171- def provide_with_uscan(self, target_dir):
1172- if self.larstiq:
1173- watchfile = 'watch'
1174- else:
1175- watchfile = 'debian/watch'
1176- watch_id = self.tree.path2id(watchfile)
1177- if watch_id is None:
1178- info("No watch file to use to retrieve upstream tarball.")
1179- return False
1180- (tmp, tempfilename) = tempfile.mkstemp()
1181- try:
1182- tmp = os.fdopen(tmp, 'wb')
1183- watch = self.tree.get_file_text(watch_id)
1184- tmp.write(watch)
1185- finally:
1186- tmp.close()
1187- try:
1188- return self._uscan_provider(self.package,
1189- self.version.upstream_version, tempfilename, target_dir)
1190- finally:
1191- os.unlink(tempfilename)
1192-
1193- def provide_with_pristine_tar(self, target_dir):
1194- target_filename = os.path.join(target_dir, self._tarball_name())
1195- return self._pristine_provider(self.tree, self.branch, self.package,
1196- self.version, target_filename)
1197-
1198- def provide_with_get_orig_source(self, target_dir):
1199- if self.larstiq:
1200- rules_name = 'rules'
1201- else:
1202- rules_name = 'debian/rules'
1203- rules_id = self.tree.path2id(rules_name)
1204- if rules_id is not None:
1205- desired_tarball_name = self._tarball_name()
1206- tmpdir = tempfile.mkdtemp(prefix="builddeb-get-orig-source-")
1207- try:
1208- base_export_dir = os.path.join(tmpdir, "export")
1209- export_dir = base_export_dir
1210- if self.larstiq:
1211- os.mkdir(export_dir)
1212- export_dir = os.path.join(export_dir, "debian")
1213- export(self.tree, export_dir, format="dir")
1214- return self._orig_source_provider(base_export_dir, tmpdir,
1215- desired_tarball_name, target_dir)
1216- finally:
1217- shutil.rmtree(tmpdir)
1218- info("No debian/rules file to try and use for a get-orig-source "
1219- "rule")
1220- return False
1221-
1222 def _tarball_name(self):
1223- return "%s_%s.orig.tar.gz" % (self.package,
1224- self.version.upstream_version)
1225-
1226- def provide_from_upstream_branch(self, target_dir):
1227- if self.upstream_branch is None:
1228- return False
1229- assert self.upstream_revision is not None
1230- info("Exporting the upstream branch to create the tarball")
1231- target_filename = os.path.join(target_dir, self._tarball_name())
1232- tarball_base = "%s-%s" % (self.package, self.version.upstream_version)
1233- return self._upstream_branch_provider(self.upstream_branch,
1234- self.upstream_revision, target_filename, tarball_base)
1235-
1236- def provide_from_self_by_split(self, target_dir):
1237- if not self.allow_split:
1238- return False
1239- info("Using the current branch without the 'debian' directory "
1240- "to create the tarball")
1241- target_filename = os.path.join(target_dir, self._tarball_name())
1242- return self._split_provider(self.tree, self.package,
1243- self.version.upstream_version, target_filename)
1244+ return tarball_name(self.package, self.version.upstream_version)
1245
1246
1247 class _MissingUpstreamProvider(UpstreamProvider):
1248@@ -347,6 +436,7 @@
1249 f.write("I am a tarball, honest\n")
1250 f.close()
1251
1252+
1253 class _SimpleUpstreamProvider(UpstreamProvider):
1254 """For tests"""
1255

Subscribers

People subscribed via source and target branches