From: Johannes Schauer <josch@debian.org>
Date: Sat, 28 Jan 2017 10:26:13 +0100
X-Dgit-Generated: 0.21-3 e3fbc643e6af55da3b9b547e41d6189a7fed4c7e
Subject: Add patch to fix FTBFS due to API breakage introduced by src:dose3 5.0.1-8 (closes: #852917)


---

--- botch-0.21.orig/bin2src.ml
+++ botch-0.21/bin2src.ml
@@ -49,7 +49,7 @@ module Options = struct
   StdOptions.OutputOptions.add_options ~default options;;
 
   include StdOptions.DistribOptions;;
-  let default = List.filter (fun e -> not (List.mem e ["deb-drop-b-d-indep"; "deb-profiles"; "deb-ignore-essential"; "deb-builds-from"])) StdOptions.DistribOptions.default_options in
+  let default = List.filter (fun e -> not (List.mem e ["deb-drop-b-d-indep"; "deb-drop-b-d-arch"; "deb-profiles"; "deb-ignore-essential"; "deb-builds-from"])) StdOptions.DistribOptions.default_options in
   StdOptions.DistribOptions.add_debian_options ~default options ;;
 end
 
--- botch-0.21.orig/buildcheck-more-problems.ml
+++ botch-0.21/buildcheck-more-problems.ml
@@ -32,7 +32,7 @@ module Options = struct
   let dump = StdOpt.str_option ()
   let maforeign = StdOpt.store_true ()
   let includextra = StdOpt.store_true ()
-  let triplettable = StdOpt.str_option ()
+  let tupletable = StdOpt.str_option ()
   let cputable = StdOpt.str_option ()
   let dropalternatives = StdOpt.store_true ()
 
@@ -54,8 +54,8 @@ module Options = struct
   include StdOptions.DistribOptions ;;
   StdOptions.DistribOptions.add_debian_options options ;;
   let group = StdOptions.DistribOptions.deb_group options in
-  StdOptions.DistribOptions.add_option options ~group ~long_name:"deb-triplettable"
-    ~help:"Path to an architecture triplet table like /usr/share/dpkg/triplettable" triplettable;
+  StdOptions.DistribOptions.add_option options ~group ~long_name:"deb-tupletable"
+    ~help:"Path to an architecture tuple table like /usr/share/dpkg/tupletable" tupletable;
   StdOptions.DistribOptions.add_option options ~group ~long_name:"deb-cputable"
     ~help:"Path to a cpu table like /usr/share/dpkg/cputable" cputable;
   StdOptions.DistribOptions.add_option options ~group ~long_name:"deb-defaulted-m-a-foreign"
@@ -110,15 +110,15 @@ let main () =
       with Not_found -> true
   in
 
-  if (OptParse.Opt.is_set Options.triplettable)
+  if (OptParse.Opt.is_set Options.tupletable)
   || OptParse.Opt.is_set Options.cputable then begin
-    let ttfile = if OptParse.Opt.is_set Options.triplettable then
-        Some (OptParse.Opt.get Options.triplettable)
+    let ttfile = if OptParse.Opt.is_set Options.tupletable then
+        Some (OptParse.Opt.get Options.tupletable)
       else None in
     let ctfile = if OptParse.Opt.is_set Options.cputable then
         Some (OptParse.Opt.get Options.cputable)
       else None in
-    Architecture.read_triplettable ~ttfile ~ctfile ()
+    Architecture.read_tupletable ~ttfile ~ctfile ()
   end;
 
   let pkglist, srclist =
--- botch-0.21.orig/doc/man/botch-annotate-strong.pod
+++ botch-0.21/doc/man/botch-annotate-strong.pod
@@ -40,6 +40,10 @@ do not print any messages
 
 Drop Build-Depends-Indep dependencies
 
+=item B<--deb-drop-b-d-arch>
+
+Drop Build-Depends-Arch dependencies
+
 =item B<--deb-native-arch=>I<arch>
 
 Native architecture I<arch>.
--- botch-0.21.orig/doc/man/botch-build-fixpoint.pod
+++ botch-0.21/doc/man/botch-build-fixpoint.pod
@@ -49,6 +49,10 @@ I<Packages>.
 
 Drop Build-Depends-Indep dependencies
 
+=item B<--deb-drop-b-d-arch>
+
+Drop Build-Depends-Arch dependencies
+
 =item B<--allowsrcmismatch>
 
 If a binary package is without a source package but there is a source package
--- botch-0.21.orig/doc/man/botch-buildgraph2srcgraph.pod
+++ botch-0.21/doc/man/botch-buildgraph2srcgraph.pod
@@ -39,6 +39,10 @@ do no print any messages
 
 Drop Build-Depends-Indep dependencies
 
+=item B<--deb-drop-b-d-arch>
+
+Drop Build-Depends-Arch dependencies
+
 =item B<--fg=>I<PKGS>
 
 Additional Packages lists that are checked and used for resolving dependencies
--- botch-0.21.orig/doc/man/botch-calculate-fas.pod
+++ botch-0.21/doc/man/botch-calculate-fas.pod
@@ -43,6 +43,10 @@ maximum length of found cycles for fas s
 
 Drop Build-Depends-Indep dependencies
 
+=item B<--deb-drop-b-d-arch>
+
+Drop Build-Depends-Arch dependencies
+
 =item B<--fg=>I<PKGS>
 
 Additional Packages lists that are checked and used for resolving dependencies
--- botch-0.21.orig/doc/man/botch-clean-repository.pod
+++ botch-0.21/doc/man/botch-clean-repository.pod
@@ -51,6 +51,10 @@ add source packages which only build arc
 
 Drop Build-Depends-Indep dependencies
 
+=item B<--deb-drop-b-d-arch>
+
+Drop Build-Depends-Arch dependencies
+
 =item B<--allowsrcmismatch>
 
 If a binary package is without a source package but there is a source package
--- botch-0.21.orig/doc/man/botch-collapse-srcgraph.pod
+++ botch-0.21/doc/man/botch-collapse-srcgraph.pod
@@ -38,6 +38,10 @@ do no print any messages
 
 Drop Build-Depends-Indep dependencies
 
+=item B<--deb-drop-b-d-arch>
+
+Drop Build-Depends-Arch dependencies
+
 =item B<--fg=>I<PKGS>
 
 Additional Packages lists that are checked and used for resolving dependencies
--- botch-0.21.orig/doc/man/botch-create-graph.pod
+++ botch-0.21/doc/man/botch-create-graph.pod
@@ -47,6 +47,10 @@ list of files with dependencies that sho
 
 Drop Build-Depends-Indep dependencies
 
+=item B<--deb-drop-b-d-arch>
+
+Drop Build-Depends-Arch dependencies
+
 =item B<--allowsrcmismatch>
 
 If a binary package is without a source package but there is a source package
--- botch-0.21.orig/doc/man/botch-find-fvs.pod
+++ botch-0.21/doc/man/botch-find-fvs.pod
@@ -39,6 +39,10 @@ do no print any messages
 
 Drop Build-Depends-Indep dependencies
 
+=item B<--deb-drop-b-d-arch>
+
+Drop Build-Depends-Arch dependencies
+
 =item B<--max-length-fvs=>I<INT>
 
 maximum length of found cycles for fvs search (default=4)
--- botch-0.21.orig/doc/man/botch-optuniv.pod
+++ botch-0.21/doc/man/botch-optuniv.pod
@@ -53,6 +53,10 @@ also add source packages for Architectur
 
 Drop Build-Depends-Indep dependencies
 
+=item B<--deb-drop-b-d-arch>
+
+Drop Build-Depends-Arch dependencies
+
 =item B<--allowsrcmismatch>
 
 If a binary package is without a source package but there is a source package
--- botch-0.21.orig/doc/man/botch-partial-order.pod
+++ botch-0.21/doc/man/botch-partial-order.pod
@@ -38,6 +38,10 @@ do no print any messages
 
 Drop Build-Depends-Indep dependencies
 
+=item B<--deb-drop-b-d-arch>
+
+Drop Build-Depends-Arch dependencies
+
 =item B<--fg=>I<PKGS>
 
 Additional Packages lists that are checked and used for resolving dependencies
--- botch-0.21.orig/doc/man/botch-print-stats.pod
+++ botch-0.21/doc/man/botch-print-stats.pod
@@ -63,6 +63,10 @@ List of available packages (arch:all, cr
 
 Drop Build-Depends-Indep dependencies
 
+=item B<--deb-drop-b-d-arch>
+
+Drop Build-Depends-Arch dependencies
+
 =item B<--allowsrcmismatch>
 
 If a binary package is without a source package but there is a source package
--- botch-0.21.orig/src2bin.ml
+++ botch-0.21/src2bin.ml
@@ -55,7 +55,7 @@ module Options = struct
   StdOptions.OutputOptions.add_options ~default options;;
 
   include StdOptions.DistribOptions;;
-  let default = List.filter (fun e -> not (List.mem e ["deb-drop-b-d-indep"; "deb-profiles"; "deb-ignore-essential"; "deb-builds-from"])) StdOptions.DistribOptions.default_options in
+  let default = List.filter (fun e -> not (List.mem e ["deb-drop-b-d-indep"; "deb-drop-b-d-arch"; "deb-profiles"; "deb-ignore-essential"; "deb-builds-from"])) StdOptions.DistribOptions.default_options in
   StdOptions.DistribOptions.add_debian_options ~default options;;
 end
 
--- botch-0.21.orig/tools/debarch.py
+++ botch-0.21/tools/debarch.py
@@ -1,7 +1,7 @@
 """architecture matching
 
 @copyright: 2014, Ansgar Burchardt <ansgar@debian.org>
-@copyright: 2014, Johannes Schauer <j.schauer@email.de>
+@copyright: 2014-2017, Johannes Schauer <j.schauer@email.de>
 @license: GPL-2+
 """
 
@@ -22,8 +22,8 @@
 # FIXME: this should be integrated into python-debian
 #        see: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=771058
 
-_cached_arch2triplet = None
-_cached_triplet2arch = None
+_cached_arch2tuple = None
+_cached_tuple2arch = None
 _cached_cputable = None
 
 
@@ -44,66 +44,68 @@ def _read_cputable():
     return _cached_cputable
 
 
-def _read_triplettable():
-    global _cached_arch2triplet, _cached_triplet2arch
-    if _cached_arch2triplet is None or _cached_triplet2arch is None:
-        table = _load_table('/usr/share/dpkg/triplettable')
-        arch2triplet = dict()
-        triplet2arch = dict()
+def _read_tupletable():
+    global _cached_arch2tuple, _cached_tuple2arch
+    if _cached_arch2tuple is None or _cached_tuple2arch is None:
+        table = _load_table('/usr/share/dpkg/tupletable')
+        arch2tuple = dict()
+        tuple2arch = dict()
         for row in table:
-            debtriplet = row[0]
+            debtuple = row[0]
             debarch = row[1]
-            if '<cpu>' in debtriplet:
+            if '<cpu>' in debtuple:
                 for r in _read_cputable():
                     cpu = r[0]
-                    dt = debtriplet.replace('<cpu>', cpu)
+                    dt = debtuple.replace('<cpu>', cpu)
                     da = debarch.replace('<cpu>', cpu)
-                    arch2triplet[da] = dt
-                    triplet2arch[dt] = da
+                    arch2tuple[da] = dt
+                    tuple2arch[dt] = da
             else:
-                arch2triplet[debarch] = debtriplet
-                triplet2arch[debtriplet] = debarch
-        _cached_arch2triplet = arch2triplet
-        _cached_triplet2arch = triplet2arch
-    return _cached_triplet2arch, _cached_arch2triplet
+                arch2tuple[debarch] = debtuple
+                tuple2arch[debtuple] = debarch
+        _cached_arch2tuple = arch2tuple
+        _cached_tuple2arch = tuple2arch
+    return _cached_tuple2arch, _cached_arch2tuple
 
 
-def debwildcard_to_debtriplet(arch):
-    arch_tuple = arch.split('-', 2)
+def debwildcard_to_debtuple(arch):
+    arch_tuple = arch.split('-', 3)
 
     if 'any' in arch_tuple:
-        if len(arch_tuple) == 3:
+        if len(arch_tuple) == 4:
             return arch_tuple
+        elif len(arch_tuple) == 3:
+            return ('any', arch_tuple[0], arch_tuple[1], arch_tuple[2])
         elif len(arch_tuple) == 2:
-            return ('any', arch_tuple[0], arch_tuple[1])
+            return ('any', 'any', arch_tuple[0], arch_tuple[1])
         else:
-            return ('any', 'any', 'any')
+            return ('any', 'any', 'any', 'any')
     else:
-        return debarch_to_debtriplet(arch)
+        return debarch_to_debtuple(arch)
 
 
-def debarch_to_debtriplet(arch):
+def debarch_to_debtuple(arch):
     if (arch.startswith("linux-")):
         arch = arch[6:]
 
-    triplet = _read_triplettable()[1].get(arch)
+    tuple = _read_tupletable()[1].get(arch)
 
-    if triplet is None:
+    if tuple is None:
         return
-    return triplet.split('-', 2)
+    return tuple.split('-', 3)
 
 
 def match_architecture(real, alias):
     if alias == real or alias == "any":
         return True
 
-    real = debarch_to_debtriplet(real)
-    alias = debwildcard_to_debtriplet(alias)
+    real = debarch_to_debtuple(real)
+    alias = debwildcard_to_debtuple(alias)
 
-    if real is None or len(real) != 3 or alias is None or len(alias) != 3:
+    if real is None or len(real) != 4 or alias is None or len(alias) != 4:
         return False
 
-    for i in range(0, 3):
+    for i in range(0, 4):
         if (alias[i] != real[i] and alias[i] != "any"):
             return False
     return True
