Package: dh-golang
Version: 1.28
Severity: normal
Tags: patch

Hello,

I have noticed that autopkgtests for packages with comma-separated
import paths are failing.

Here is a patch.

Would you please review and/or apply it?

Cheers,

-- 
Alexandre Viau
av...@debian.org
From 923f325dc9e7617814f43d28e898c7d8c48bb058 Mon Sep 17 00:00:00 2001
From: aviau <av...@debian.org>
Date: Wed, 17 Jan 2018 00:49:10 -0500
Subject: [PATCH] dh_golang_autopkgtest support for several import paths

---
 script/dh_golang_autopkgtest | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/script/dh_golang_autopkgtest b/script/dh_golang_autopkgtest
index c15447a..ee3f125 100755
--- a/script/dh_golang_autopkgtest
+++ b/script/dh_golang_autopkgtest
@@ -57,18 +57,26 @@ call_rules() {
 }
 
 get_import_path() {
-    # Find package's import path from debian/rules or debian/control.
-    pkg=$(call_rules apt-print-DH_GOPKG)
+    # Find package's main import path from debian/rules or debian/control.
+    pkgs=$(call_rules apt-print-DH_GOPKG)
 
-    if [ -z "$pkg" ]; then
+    if [ -z "$pkgs" ]; then
         # DH_GOPKG not set, find it in control file.
-        pkg=$(perl -w -MDpkg::Control::Info -e '
+        pkgs=$(perl -w -MDpkg::Control::Info -e '
             my $s = Dpkg::Control::Info->new()->get_source();
             print $s->{"XS-Go-Import-Path"} || "";')
     fi
-    if [ -z "$pkg" ]; then
-        error "Can't find import path."
+
+    if [ -z "$pkgs" ]; then
+        error "Can't find import paths."
+    else
+        # One import path per line. Commas and empty lines removed.
+        pkgs=$(echo $pkgs | tr -d " " | tr "," "\n" | awk "NF")
     fi
+
+    # Only return the first import path.
+    pkg=$(echo "$pkgs" | head -n 1)
+
     echo "$pkg"
 }
 
-- 
2.14.2

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Pkg-go-maintainers mailing list
Pkg-go-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-go-maintainers

Reply via email to