Bug#771058: python-debian: please add an implementation for Debian architecture wildcard matching

2017-10-25 Thread Colin Watson
On Wed, Mar 29, 2017 at 05:53:59PM +0200, Johannes Schauer wrote:
> since I reported the bug in 2014 I long left github for my own self-hosted
> solution. The up-to-date version of the code can be found here:
> 
> https://gitlab.mister-muffin.de/josch/debarchwildcardtest
> 
> In contrast to the older version on github, this version:
> 
>  - generate 17591105 test cases instead of just 106692 (all possible
>architecture wildcard permutations) to make sure that the implementation is
>compliant with the one from dpkg
>  - pep8 compliance
>  - support for the new debtuples

I see that the daklib implementation had triplettable compatibility, but
this one doesn't.  I don't suppose it would be possible to restore that
to debarch.py?

The reason I ask is that we'd like to be able to use this in Launchpad,
probably for somewhat similar reasons as dak; at the moment we're
forking dpkg-architecture, but that's prohibitively slow in some cases
where we need to perform lots of matches
(https://bugs.launchpad.net/launchpad/+bug/1062638).  However, Launchpad
is currently deployed on Ubuntu 16.04 LTS which has triplettable rather
than tupletable, and that isn't likely to change for some time.
Deploying a backport of python-debian (or perhaps even a temporary copy
of this code) is doable; deploying a dpkg backport decidedly isn't.

If you want a patch for this, I can certainly try, but I thought I'd ask
first in case it was a simple matter of reverting a simplification patch
or something.

Thanks,

-- 
Colin Watson   [cjwat...@debian.org]



Bug#771058: python-debian: please add an implementation for Debian architecture wildcard matching

2017-09-10 Thread Stuart Prescott
Hi josch,

>  - generate 17591105 test cases instead of just 106692 (all possible
>architecture wildcard permutations) to make sure that the implementation
> is compliant with the one from dpkg
>  - pep8 compliance
>  - support for the new debtuples

This looks like something quite sensible to include in python-debian. I think 
architecture information probably lives inside debian_support.py along with 
types for versions and version comparison.

Could you please put this code and a (standalone) test suite in a form that 
can be merged? 

many thanks
Stuart

-- 
Stuart Prescotthttp://www.nanonanonano.net/   stu...@nanonanonano.net
Debian Developer   http://www.debian.org/ stu...@debian.org
GPG fingerprint90E2 D2C1 AD14 6A1B 7EBB 891D BBC1 7EBB 1396 F2F7



Bug#771058: python-debian: please add an implementation for Debian architecture wildcard matching

2017-03-29 Thread Johannes Schauer
On Wed, 26 Nov 2014 13:02:54 +0100 Johannes Schauer  wrote:
> You can find my implementation alongside the dak implementation in the
> following git repository:
> 
> https://github.com/josch/debarchwildcardtest

since I reported the bug in 2014 I long left github for my own self-hosted
solution. The up-to-date version of the code can be found here:

https://gitlab.mister-muffin.de/josch/debarchwildcardtest

In contrast to the older version on github, this version:

 - generate 17591105 test cases instead of just 106692 (all possible
   architecture wildcard permutations) to make sure that the implementation is
   compliant with the one from dpkg
 - pep8 compliance
 - support for the new debtuples

Thanks!

cheers, josch


signature.asc
Description: signature


Bug#771058: python-debian: please add an implementation for Debian architecture wildcard matching

2014-11-26 Thread Johannes Schauer
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


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org