Hello,

This version of the patch is simpler. It removes the awk usage and uses
an array.

Cheers,

-- 
Alexandre Viau
av...@debian.org
From fcc17f957630976a5a95a48a17b44e55472a8b4d Mon Sep 17 00:00:00 2001
From: aviau <alexan...@alexandreviau.net>
Date: Wed, 17 Jan 2018 14:54:58 -0500
Subject: [PATCH] dh_golang_autopkgtest support for several import paths

---
 script/dh_golang_autopkgtest | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/script/dh_golang_autopkgtest b/script/dh_golang_autopkgtest
index c15447a..399daef 100755
--- a/script/dh_golang_autopkgtest
+++ b/script/dh_golang_autopkgtest
@@ -57,19 +57,27 @@ 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."
     fi
-    echo "$pkg"
+
+    # Transform into a single comma-separated line.
+    # Then, replace commas by spaces.
+    # Place the result into an array.
+    pkgs=($(echo $pkgs | tr -d " \n" | tr "," " "))
+
+    # Only return the first import path.
+    echo "${pkgs[0]}"
 }
 
 add_configure_override() {
-- 
2.14.2

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to