tag 539340 +patch
thanks

Here is a small patch for ignoring :any (and other arch specifications)
in the package names of dependencies. The correct solution would be to
track and compare the architecture in the pkg_version structure.

This should also fix #1001751 which I believe happenes because debfoster
ignores python3.10:any dependencies.

The second patch is a testcase. Although they don't seem to get run on
building the package.

    Ingo
-- 
 ╭─╮  Kennedy's Lemma:
╭│───╮  If you can parse Perl, you can solve the Halting Problem.
│╰─│─╯
╰──╯  http://www.perlmonks.org/?node_id=663393
>From 616b638fbf4b2a006c90d9954cce0956d7871eb9 Mon Sep 17 00:00:00 2001
From: Ingo Saitz <i...@hannover.ccc.de>
Date: Wed, 11 May 2022 08:44:36 +0200
Subject: [PATCH 1/2] skip arch part of package, multiarch workaround

---
 src/vercmp.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/vercmp.c b/src/vercmp.c
index 76bd94e..3fba5ca 100644
--- a/src/vercmp.c
+++ b/src/vercmp.c
@@ -168,7 +168,7 @@ const char *parsedependency(const char *string, struct pkg_version *pv, enum dep
     /* Extract package name. */
     {
       const char *namestart = p;
-      while (*p && !cisspace(*p) && *p != '(' && *p != ',' && *p != '|') {
+      while (*p && !cisspace(*p) && *p != '(' && *p != ',' && *p != '|' && *p != ':') {
         p++;
       }
 
@@ -179,6 +179,14 @@ const char *parsedependency(const char *string, struct pkg_version *pv, enum dep
         pv->name = NULL;
     }
 
+    /* skip arch part */
+    if (*p == ':') {
+      p++;
+      while (*p && !cisspace(*p) && *p != '(' && *p != ',' && *p != '|') {
+        p++;
+      }
+    }
+
     /* skip whitespace after packagename */
     while (cisspace(*p)) p++;
     if (*p == '(') {                  /* if we have a versioned relation */
-- 
2.36.1

>From c40ed30af0f92522c4a6162d05b0e025a6ad4673 Mon Sep 17 00:00:00 2001
From: Ingo Saitz <i...@hannover.ccc.de>
Date: Wed, 11 May 2022 09:06:27 +0200
Subject: [PATCH 2/2] simple multiarch testcase

does not test dependency on wrong arch
---
 tests/002/available |  0
 tests/002/exp       |  0
 tests/002/keepers   |  1 +
 tests/002/status    | 21 +++++++++++++++++++++
 4 files changed, 22 insertions(+)
 create mode 100644 tests/002/available
 create mode 100644 tests/002/exp
 create mode 100644 tests/002/keepers
 create mode 100644 tests/002/status

diff --git a/tests/002/available b/tests/002/available
new file mode 100644
index 0000000..e69de29
diff --git a/tests/002/exp b/tests/002/exp
new file mode 100644
index 0000000..e69de29
diff --git a/tests/002/keepers b/tests/002/keepers
new file mode 100644
index 0000000..e542435
--- /dev/null
+++ b/tests/002/keepers
@@ -0,0 +1 @@
+depends_arch_any
diff --git a/tests/002/status b/tests/002/status
new file mode 100644
index 0000000..b4f5680
--- /dev/null
+++ b/tests/002/status
@@ -0,0 +1,21 @@
+Package: depends_arch_any
+Architecture: amd64
+Version: 1
+Depends: libc6 (>= 2.33), perl:any, ruby:any
+Status: install ok installed
+
+Package: libc6
+Architecture: amd64
+Version: 2.33-7
+Status: install ok installed
+
+Package: perl
+Architecture: i386
+Version: 5.34.0-4
+Status: install ok installed
+
+Package: ruby
+Architecture: amd64
+Version: 1:3.0+1
+Status: install ok installed
+
-- 
2.36.1

Reply via email to