Merge lp://staging/~jelmer/bzr-builddeb/gather-orig-files-non-utf8 into lp://staging/bzr-builddeb
Proposed by
Jelmer Vernooij
Status: | Merged |
---|---|
Approved by: | Jelmer Vernooij |
Approved revision: | 652 |
Merged at revision: | 651 |
Proposed branch: | lp://staging/~jelmer/bzr-builddeb/gather-orig-files-non-utf8 |
Merge into: | lp://staging/bzr-builddeb |
Prerequisite: | lp://staging/~jelmer/bzr-builddeb/location-alias-upstream |
Diff against target: |
60 lines (+28/-2) 3 files modified
debian/changelog (+3/-1) tests/test_upstream.py (+18/-0) upstream/__init__.py (+7/-1) |
To merge this branch: | bzr merge lp://staging/~jelmer/bzr-builddeb/gather-orig-files-non-utf8 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martin Packman (community) | Approve | ||
Bzr-builddeb-hackers | Pending | ||
Review via email: mp+83967@code.staging.launchpad.net |
This proposal supersedes 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.
The feature you want is BytestringNamed Filesystem which boils down to is-posix-system and yes, will always be true for bzr-builddeb.
+ prefix = "%s_%s.orig" % (osutils. safe_utf8( package) , safe_utf8( version) )
+ osutils.
The alternative name of 'safe_utf8' is 'break_ things_ randomly' , don't use it. You need to actually know the input types to the function and handle them appropriately. Here, it's dead easy, both package names and versions must be ascii:
<http:// www.debian. org/doc/ debian- policy/ ch-controlfield s.html# s-f-Source> www.debian. org/doc/ debian- policy/ ch-controlfield s.html# s-f-Version>
<http://
So, the correct spelling is just `.encode("ascii")` as python-debian gives us unicode (and will work regardless).
I think that GetOrigSourceSource also suffers from this problem, as it has nearly the same code. It needs a test as well, and either the same fix or to share the core code between the two.