[Pkg-mozext-maintainers] Bug#909527: mozilla-devscripts: dh_webext breaks on non-ascii debian/control when building with LANG=C
Carsten Schoenert
c.schoenert at t-online.de
Tue Sep 25 19:47:15 BST 2018
Hi,
On Mon, Sep 24, 2018 at 08:35:34PM +0200, Christoph Biedl wrote:
...
> | dh binary --with webext
> | dh_testroot
> | dh_prep
> | dh_install
> | dh_webext
> | Traceback (most recent call last):
> | File "/usr/bin/dh_webext", line 217, in <module>
> | sys.exit(install_webext(*sys.argv[1:]))
> | File "/usr/bin/dh_webext", line 144, in install_webext
> | packages = args.packages or get_all_packages()
> | File "/usr/bin/dh_webext", line 73, in get_all_packages
> | lines = open("debian/control").readlines()
> | File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
> | return codecs.ascii_decode(input, self.errors)[0]
> | UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 210: ordinal not in range(128)
> | make: *** [debian/rules:4: binary] Error 1
> | dpkg-buildpackage: error: fakeroot debian/rules binary subprocess returned exit status 2
>
> Turns out that package's debian/control contains utf-8 sequences but
> dh_webext cannot deal with it with when LANG is set to e.g. "C". As far
> as I can tell, sbuild does this by default.
>
> Trivial reproducer using the mozilla-noscript source (version 10.1.9.6-1):
>
> ( export LANG=C ; dpkg-buildpackage -uc -us -sa -rfakeroot )
>
> Using "en_US.UTF-8" instead makes the build succeed.
>
> The patch below, mostly taken from reportbug, solved the issue but my
> Python foo isn't good enough yet to judge its quality.
it seems some more fencing is needed.
Even with the fix Christoph is suggesting I get some error like the one
above.
If I add the following additions it works better. Note, I'm not a Python
programmer so this might done in a better way. :)
@@ -70,7 +71,7 @@ def run(cmdline, verbose=False):
subprocess.check_call(cmdline)
def get_all_packages():
- lines = open("debian/control").readlines()
+ lines = open("debian/control", encoding='utf8').readlines()
package_lines = [x for x in lines if x.find("Package:") >= 0]
packages = [p[p.find(":")+1:].strip() for p in package_lines]
packages = [p for p in packages if p.startswith("webext-")]
@@ -143,7 +144,7 @@ def install_webext(*args):
args, unknown = parser.parse_known_args(args)
if unknown:
log("Ignored some command-line arguments: %r" % unknown)
- packages = args.packages or get_all_packages()
+ packages = [x.decode('UTF8') for x in args.packages] or [x.decode('UTF8') for x in get_all_packages()]
home = args.home
name = args.name
Regards
Carsten
More information about the Pkg-mozext-maintainers
mailing list