Merge lp:~jelmer/bzr-builddeb/gather-orig-files-non-utf8 into lp:bzr-builddeb

Proposed by Jelmer Vernooij
Status: Superseded
Proposed branch: lp:~jelmer/bzr-builddeb/gather-orig-files-non-utf8
Merge into: lp:bzr-builddeb
Diff against target: 98 lines (+47/-3)
4 files modified
__init__.py (+18/-1)
debian/changelog (+3/-1)
tests/test_upstream.py (+18/-0)
upstream/__init__.py (+8/-1)
To merge this branch: bzr merge lp:~jelmer/bzr-builddeb/gather-orig-files-non-utf8
Reviewer Review Type Date Requested Status
Bzr-builddeb-hackers Pending
Review via email: mp+83964@code.launchpad.net

This proposal has been superseded by a proposal from 2011-11-30.

Description of the change

In gather_orig_files() we scan a directory for relevant orig tarballs. Cope with filenames that are not valid in the current file system locale - we are only interested in files with a particular prefix anyway.

The test isn't protected by a Feature. I'm not aware of a relevant feature, and bzr-builddeb is only used on POSIX-based systems anyway, which allow arbitrary byte filenames.

To post a comment you must log in.
652. By Jelmer Vernooij

Encode package/version as ascii rather than utf8.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '__init__.py'
--- __init__.py 2011-11-22 14:05:25 +0000
+++ __init__.py 2011-11-30 15:41:24 +0000
@@ -27,7 +27,10 @@
2727
28import bzrlib28import bzrlib
29from bzrlib.commands import plugin_cmds29from bzrlib.commands import plugin_cmds
30from bzrlib.directory_service import directories30from bzrlib.directory_service import (
31 AliasDirectory,
32 directories,
33 )
3134
32from info import (35from info import (
33 bzr_plugin_version as version_info,36 bzr_plugin_version as version_info,
@@ -69,6 +72,20 @@
69 'VcsDirectory',72 'VcsDirectory',
70 "Directory that uses Debian Vcs-* control fields to look up branches")73 "Directory that uses Debian Vcs-* control fields to look up branches")
7174
75branch_aliases = getattr(AliasDirectory, "branch_aliases", None)
76if branch_aliases is not None:
77 def upstream_branch_alias(b):
78 from bzrlib.plugins.builddeb.util import debuild_config
79 b.lock_read()
80 try:
81 tree = b.basis_tree()
82 config = debuild_config(tree, False)
83 return directories.dereference(config.upstream_branch)
84 finally:
85 b.unlock()
86 branch_aliases.register("upstream", upstream_branch_alias,
87 help="upstream branch (for packaging branches)")
88
7289
73def debian_changelog_commit_message(commit, start_message):90def debian_changelog_commit_message(commit, start_message):
74 if start_message is not None:91 if start_message is not None:
7592
=== modified file 'debian/changelog'
--- debian/changelog 2011-11-29 14:39:05 +0000
+++ debian/changelog 2011-11-30 15:41:24 +0000
@@ -25,8 +25,10 @@
25 unless 'commit-message-from-changelog' is explicitly set to True. LP: #81274925 unless 'commit-message-from-changelog' is explicitly set to True. LP: #812749
26 * Support running dep3-patch against remote repositories, and with26 * Support running dep3-patch against remote repositories, and with
27 open-ended revision ranges. LP: #89360827 open-ended revision ranges. LP: #893608
28 * Fix finding orig tarballs in directories also containing filenames
29 with non-utf8 characters. LP: #865753
2830
29 -- Jelmer Vernooij <jelmer@debian.org> Sat, 26 Nov 2011 16:01:16 +010031 -- Jelmer Vernooij <jelmer@debian.org> Wed, 30 Nov 2011 16:32:05 +0100
3032
31bzr-builddeb (2.7.9) unstable; urgency=low33bzr-builddeb (2.7.9) unstable; urgency=low
3234
3335
=== modified file 'tests/test_upstream.py'
--- tests/test_upstream.py 2011-11-08 10:10:05 +0000
+++ tests/test_upstream.py 2011-11-30 15:41:24 +0000
@@ -1010,3 +1010,21 @@
1010 self.assertEquals(1010 self.assertEquals(
1011 [os.path.join(self.test_dir, "mypkg_1.0.orig.tar.gz")],1011 [os.path.join(self.test_dir, "mypkg_1.0.orig.tar.gz")],
1012 gather_orig_files("mypkg", "1.0", "."))1012 gather_orig_files("mypkg", "1.0", "."))
1013
1014 def test_multiple(self):
1015 self.build_tree(["mypkg_1.0.orig.tar.gz", "mypkg_1.0.orig-foo.tar.gz"])
1016 self.assertEquals(
1017 set([os.path.join(self.test_dir, "mypkg_1.0.orig.tar.gz"),
1018 os.path.join(self.test_dir, "mypkg_1.0.orig-foo.tar.gz")]),
1019 set(gather_orig_files("mypkg", "1.0", ".")))
1020
1021 def test_utf8_invalid_file(self):
1022 f = open("\xf6o.tar.gz", "w")
1023 try:
1024 f.write("foo")
1025 finally:
1026 f.close()
1027 self.build_tree(["mypkg_1.0.orig.tar.gz"])
1028 self.assertEquals(
1029 [os.path.join(self.test_dir, "mypkg_1.0.orig.tar.gz")],
1030 gather_orig_files(u"mypkg", "1.0", "."))
10131031
=== modified file 'upstream/__init__.py'
--- upstream/__init__.py 2011-11-08 10:10:05 +0000
+++ upstream/__init__.py 2011-11-30 15:41:24 +0000
@@ -372,7 +372,14 @@
372372
373373
374def gather_orig_files(package, version, path):374def gather_orig_files(package, version, path):
375 prefix = "%s_%s.orig" % (package, version)375 """Grab the orig files for a particular package.
376
377 :param package: package name
378 :param version: package upstream version string
379 :return: List of orig tarfile paths, or None if none were found
380 """
381 prefix = "%s_%s.orig" % (osutils.safe_utf8(package),
382 osutils.safe_utf8(version))
376 ret = []383 ret = []
377 path = os.path.abspath(path)384 path = os.path.abspath(path)
378 if not os.path.isdir(path):385 if not os.path.isdir(path):

Subscribers

People subscribed via source and target branches