Bug#771058: python-debian: please add an implementation for Debian architecture wildcard matching
Johannes Schauer
j.schauer at email.de
Wed Nov 26 12:02:54 UTC 2014
Package: python-debian
Version: 0.1.25
Severity: wishlist
Tags: patch
Hi,
finding out whether a given Debian architecture name matches a wildcard
is hard and not trivial. Even apt does it wrongly (#748936).
It would be great if python-apt would offer a functionality that would
offer correct architecture wildcard parsing using
/usr/share/dpkg/triplettable
There exists a python implementation for architecture wildcard matching
in dak at daklib/architecture.py but when I tried it, it would raise a
InvalidArchitecture exception for some wildcards.
Thus, I wrote my own implementation which was very close to the
libdpkg-perl implementation.
I wrote a testsuite which tests all possible architecture wildcards (all
combinations of known os and cpu values) against all known Debian
architectures (dpkg-architecture -L), resulting in 146328 testcases.
When I found that my implementation worked fine, I continued to borrow
code from the dak implementation to make it more pythonic. The result is
a solution which is very close to the dak implementation but has the
following differences:
- it does not raise an exception when an "invalid" architecture
wildcard is encountered but instead returns "no match". I find this
the more reasonable approach because the function is supposed to find
out whether a wildcard matches and not whether a wildcard is "valid".
If needed, then this can be done by another function.
- it is more conservative in the sense that:
- it does not parse architecture names using the architecture
wildcard function just as libdpkg-perl does it
- it only checks the debtriplet for the '<cpu>' string just as
libdpkg-perl does it
- it only replaces the '<cpu>' string in the first two columns just
as libdpkg-perl does it
You can find my implementation alongside the dak implementation in the
following git repository:
https://github.com/josch/debarchwildcardtest
A Python implementation of architecture wildcard matching is currently
needed by:
- dak
- qa.debian.org/dose
- botch
To minimize the amount of duplicated implementation it would make sense
to have python-debian implement this. Please feel free to add what you
think is best from above git repository to python-debian.
Thanks!
cheers, josch
More information about the pkg-python-debian-maint
mailing list