Bug#655975: [PATCH] Support :any architecture qualifiers for multiarch

2013-09-18 Thread Adam D. Barratt

On 2013-09-18 6:33, Niels Thykier wrote:

I think we should take this opportunity to get rid of the empty
PREDEPENDS slot (i.e. have the MULTIARCH field replace PREDEPENDS).
There is no point in having the empty slot for PREDEPENDS; yours 
truly
was just too lazy to figure out how to remove it from the C code when 
I

merged PREDEPENDS into DEPENDS.


Seems reasonable; attached is a diff on top of the earlier patch that 
does that, and passes the testsuite (including live-data).


I've also attached a squashed diff showing the cumulative changes 
relative to the live code. I've left the depends array as-is because 
it's part of the underlying abstraction; I assume the four elements are 
intended to correspond to the fields which dpkg/apt consider as 
dependency relations, i.e. pre-depends, depends, recommends and 
suggests. If we don't care about maintaining that in the abstraction 
then we could probably flatten depends from a deplistlist to a deplist.


Regards,

Adamdiff --git a/britney.py b/britney.py
index 037645f..d2bcbd6 100755
--- a/britney.py
+++ b/britney.py
@@ -525,7 +525,6 @@ class Britney(object):
 version,
 get_field('Architecture'),
 get_field('Multi-Arch'),
-None, # Pre-depends - leave as None for the C-code
 deps,
 ', '.join(final_conflicts_list) or None,
 get_field('Provides'),
diff --git a/consts.py b/consts.py
index eba22d2..827e7d4 100644
--- a/consts.py
+++ b/consts.py
@@ -30,11 +30,8 @@ SOURCE = 2
 SOURCEVER = 3
 ARCHITECTURE = 4
 MULTIARCH = 5
-# PREDEPENDS = 6 - No longer used by the python code
-#  - The C-code needs it for alignment reasons and still check it
-#but ignore it if it is None (so keep it None).
-DEPENDS = 7
-CONFLICTS = 8
-PROVIDES = 9
-RDEPENDS = 10
-RCONFLICTS = 11
+DEPENDS = 6
+CONFLICTS = 7
+PROVIDES = 8
+RDEPENDS = 9
+RCONFLICTS = 10
diff --git a/lib/britney-py.c b/lib/britney-py.c
index 28ace3c..94833cf 100644
--- a/lib/britney-py.c
+++ b/lib/britney-py.c
@@ -85,6 +85,7 @@ static PyObject *dpkgpackages_add_binary(dpkgpackages *self, 
PyObject *args) {
 pkg-package = strdup(pkg_name);
 pkg-priority = 0;
 pkg-details= NULL;
+pkg-depends[1] = NULL;
 pkg-depends[2] = NULL;
 pkg-depends[3] = NULL;
 
@@ -119,16 +120,10 @@ static PyObject *dpkgpackages_add_binary(dpkgpackages 
*self, PyObject *args) {
 pyString = PyList_GetItem(value, 7);
 if (pyString == NULL) return NULL;
 if (pyString != Py_None) {
-pkg-depends[1] = read_dep_andor(PyString_AsString(pyString));
-} else pkg-depends[1] = NULL;
-
-pyString = PyList_GetItem(value, 8);
-if (pyString == NULL) return NULL;
-if (pyString != Py_None) {
 pkg-conflicts = read_dep_and(PyString_AsString(pyString));
 } else pkg-conflicts = NULL;
 
-pyString = PyList_GetItem(value, 9);
+pyString = PyList_GetItem(value, 8);
 if (pyString == NULL) return NULL;
 if (pyString != Py_None) {
 pkg-provides = read_packagenames(PyString_AsString(pyString));
@@ -211,12 +206,11 @@ static PyObject *build_system(PyObject *self, PyObject 
*args) {
# SOURCEVER = 3
# ARCHITECTURE = 4
# MULTIARCH = 5
-   # PREDEPENDS = 6
-   # DEPENDS = 7
-   # CONFLICTS = 8
-   # PROVIDES = 9
-   # RDEPENDS = 10
-   # RCONFLICTS = 11
+   # DEPENDS = 6
+   # CONFLICTS = 7
+   # PROVIDES = 8
+   # RDEPENDS = 9
+   # RCONFLICTS = 10
 */
 
 dpkg_packages *dpkg_pkgs = new_packages(arch);
@@ -230,6 +224,7 @@ static PyObject *build_system(PyObject *self, PyObject 
*args) {
 pkg-package = strdup(PyString_AsString(key));
 pkg-priority = 0;
 pkg-details= NULL;
+pkg-depends[1] = NULL;
 pkg-depends[2] = NULL;
 pkg-depends[3] = NULL;
 
@@ -264,16 +259,10 @@ static PyObject *build_system(PyObject *self, PyObject 
*args) {
 pyString = PyList_GetItem(value, 7);
 if (pyString == NULL) continue;
 if (pyString != Py_None) {
-pkg-depends[1] = read_dep_andor(PyString_AsString(pyString));
-} else pkg-depends[1] = NULL;
-
-pyString = PyList_GetItem(value, 8);
-if (pyString == NULL) continue;
-if (pyString != Py_None) {
 pkg-conflicts = read_dep_and(PyString_AsString(pyString));
 } else pkg-conflicts = NULL;
 
-pyString = PyList_GetItem(value, 9);
+pyString = PyList_GetItem(value, 8);
 if (pyString == NULL) continue;
 if (pyString != Py_None) {
 pkg-provides = read_packagenames(PyString_AsString(pyString));
--- /srv/release.debian.org/britney/code/b2/lib/britney-py.c2013-07-07 
13:42:04.0 +
+++ lib/britney-py.c2013-09-18 07:09:03.0 +
@@ -85,6 +85,7 @@
 pkg-package = strdup(pkg_name);
 pkg-priority = 0;
 pkg-details= NULL;
+pkg-depends[1] = 

Bug#655975: [PATCH] Support :any architecture qualifiers for multiarch

2013-09-18 Thread Niels Thykier
On 2013-09-18 09:17, Adam D. Barratt wrote:
 On 2013-09-18 6:33, Niels Thykier wrote:
 I think we should take this opportunity to get rid of the empty
 PREDEPENDS slot (i.e. have the MULTIARCH field replace PREDEPENDS).
 There is no point in having the empty slot for PREDEPENDS; yours truly
 was just too lazy to figure out how to remove it from the C code when I
 merged PREDEPENDS into DEPENDS.
 
 Seems reasonable; attached is a diff on top of the earlier patch that
 does that, and passes the testsuite (including live-data).
 

Thanks,

 I've also attached a squashed diff showing the cumulative changes
 relative to the live code. I've left the depends array as-is because
 it's part of the underlying abstraction; I assume the four elements are
 intended to correspond to the fields which dpkg/apt consider as
 dependency relations, i.e. pre-depends, depends, recommends and
 suggests. If we don't care about maintaining that in the abstraction
 then we could probably flatten depends from a deplistlist to a deplist.
 
 Regards,
 
 Adam

I would probably go with the squashed diff (of the two approaches).
Personally, I wouldn't bother with flattening deplistlist to deplist.  I
would rather see us get rid of that C-module entirely instead.

~Niels


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



Bug#655975: [PATCH] Support :any architecture qualifiers for multiarch

2013-09-17 Thread Adam D. Barratt
[Dropped -python CC; replaced -release with an existing bug relating to
britney and multi-arch]

On Mon, 2013-09-16 at 15:02 +0100, Colin Watson wrote:
   i18nspector/i386 unsatisfiable Depends: python3:any (= 3.2.3-3~)
 
 I've fixed this for Ubuntu's britney instance with the following patch.

Thanks very much!

 I'm afraid I haven't had a chance to rebase it on top of Debian or to
 test it there, but that should hopefully not be very much work, and
 certainly easier than recreating all this from scratch ...

Indeed. I've done the rebasing (which was mostly handling the fact that
Debian has a consts module) and attached the result.

The resulting britney successfully passes our test-suite, including the
four live-data datasets. Admittedly none of those tests involve
multi-arch dependencies, but it does at least demonstrate a lack of
regressions.

Regards,

Adam
commit b9f6417351021f88a71970deea1312ab0940b9a2
Author: Colin Watson cjwat...@ubuntu.com
Date:   Mon Sep 16 15:02:55 2013 +0100

Support :any architecture qualifiers for multiarch

Multiarch adds a Depends: foo:any syntax, permitted only if the
target of the dependency is Multi-Arch: allowed.  This has
been supported by dpkg and apt for some time and is now safe to
use in unstable.

[Adam D. Barratt: adjusted to use consts.py]

Signed-off-by: Adam D. Barratt a...@adam-barratt.org.uk

diff --git a/britney.py b/britney.py
index 25eb6ba..037645f 100755
--- a/britney.py
+++ b/britney.py
@@ -218,7 +218,7 @@ from britney_util import (old_libraries_format, same_source, undo_changes,
   eval_uninst, newly_uninst, make_migrationitem)
 from consts import (VERSION, SECTION, BINARIES, MAINTAINER, FAKESRC,
SOURCE, SOURCEVER, ARCHITECTURE, DEPENDS, CONFLICTS,
-   PROVIDES, RDEPENDS, RCONFLICTS)
+   PROVIDES, RDEPENDS, RCONFLICTS, MULTIARCH)
 
 __author__ = 'Fabio Tranchitella and the Debian Release Team'
 __version__ = '2.0'
@@ -524,6 +524,7 @@ class Britney(object):
 pkg, 
 version,
 get_field('Architecture'),
+get_field('Multi-Arch'),
 None, # Pre-depends - leave as None for the C-code
 deps,
 ', '.join(final_conflicts_list) or None,
@@ -824,7 +825,7 @@ class Britney(object):
 binaries = self.binaries[suite][arch][0]
 for pkg in binaries:
 output = Package: %s\n % pkg
-for key, k in ((SECTION, 'Section'), (ARCHITECTURE, 'Architecture'), (SOURCE, 'Source'), (VERSION, 'Version'), 
+for key, k in ((SECTION, 'Section'), (ARCHITECTURE, 'Architecture'), (MULTIARCH, 'Multi-Arch'), (SOURCE, 'Source'), (VERSION, 'Version'), 
   (DEPENDS, 'Depends'), (PROVIDES, 'Provides'), (CONFLICTS, 'Conflicts')):
 if not binaries[pkg][key]: continue
 if key == SOURCE:
@@ -880,12 +881,19 @@ class Britney(object):
 
 # for every package, version and operation in the block
 for name, version, op in block:
+if : in name:
+name, archqual = name.split(:, 1)
+else:
+archqual = None
+
 # look for the package in unstable
 if name in binaries[0]:
 package = binaries[0][name]
-# check the versioned dependency (if present)
+# check the versioned dependency and architecture qualifier
+# (if present)
 if op == '' and version == '' or apt_pkg.check_dep(package[VERSION], op, version):
-packages.append(name)
+if archqual is None or (archqual == 'any' and package[MULTIARCH] == 'allowed'):
+packages.append(name)
 
 # look for the package in the virtual packages list and loop on them
 for prov in binaries[1].get(name, []):
@@ -893,7 +901,9 @@ class Britney(object):
 package = binaries[0][prov]
 # A provides only satisfies an unversioned dependency
 # (per Policy Manual ยง7.5)
-if op == '' and version == '':
+# A provides only satisfies a dependency without an
+# architecture qualifier (per analysis of apt code)
+if op == '' and version == '' and archqual is None:
 packages.append(prov)
 
 return (len(packages)  0, packages)
diff --git a/consts.py b/consts.py
index 47670b2..eba22d2 100644
--- a/consts.py
+++ b/consts.py
@@ -29,11 +29,12 @@ FAKESRC = 4
 SOURCE = 2
 SOURCEVER = 3
 ARCHITECTURE = 4
-# PREDEPENDS = 5 - No longer used by the python code
+MULTIARCH = 5
+# PREDEPENDS = 6 - No longer used by the python code
 #  - The C-code needs it for alignment reasons and still check it
 #but ignore it if it is None (so 

Bug#655975: [PATCH] Support :any architecture qualifiers for multiarch

2013-09-17 Thread Niels Thykier
On 2013-09-17 22:34, Adam D. Barratt wrote:
 [Dropped -python CC; replaced -release with an existing bug relating to
 britney and multi-arch]
 
 On Mon, 2013-09-16 at 15:02 +0100, Colin Watson wrote:
   i18nspector/i386 unsatisfiable Depends: python3:any (= 3.2.3-3~)

 I've fixed this for Ubuntu's britney instance with the following patch.
 
 Thanks very much!
 

Thanks indeed,

 I'm afraid I haven't had a chance to rebase it on top of Debian or to
 test it there, but that should hopefully not be very much work, and
 certainly easier than recreating all this from scratch ...
 
 Indeed. I've done the rebasing (which was mostly handling the fact that
 Debian has a consts module) and attached the result.
 
 The resulting britney successfully passes our test-suite, including the
 four live-data datasets. Admittedly none of those tests involve
 multi-arch dependencies, but it does at least demonstrate a lack of
 regressions.
 
 Regards,
 
 Adam
 

I think we should take this opportunity to get rid of the empty
PREDEPENDS slot (i.e. have the MULTIARCH field replace PREDEPENDS).
There is no point in having the empty slot for PREDEPENDS; yours truly
was just too lazy to figure out how to remove it from the C code when I
merged PREDEPENDS into DEPENDS.

~Niels


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