[lintian] 01/01: Apply patch from Michael Stapelberg to warn when packages do not specify a XS-Go-Import-Path. (Closes: #891184)
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository lintian.
commit f66750173d3a7cf51421cf10113e1e6eb1dae36c
Author: Michael Stapelberg <stapelberg@debian.org>
Date: Fri Feb 23 09:10:44 2018 +0000
Apply patch from Michael Stapelberg to warn when packages do not specify a XS-Go-Import-Path. (Closes: #891184)
Signed-off-by: Chris Lamb <lamby@debian.org>
---
checks/control-file.desc | 24 +++++++++++++
checks/control-file.pm | 7 ++--
debian/changelog | 2 ++
t/tests/binaries-golang/desc | 4 ++-
t/tests/binaries-golang/tags | 1 +
.../debian/Makefile | 16 +++++++++
.../debian/basic.c | 12 +++++++
.../debian/debian/control.in | 40 ++++++++++++++++++++++
t/tests/control-file-golang-xs-go-import-path/desc | 5 +++
t/tests/control-file-golang-xs-go-import-path/tags | 0
10 files changed, 108 insertions(+), 3 deletions(-)
diff --git a/checks/control-file.desc b/checks/control-file.desc
index 3e6485f..18b3d8c 100644
--- a/checks/control-file.desc
+++ b/checks/control-file.desc
@@ -374,3 +374,27 @@ Info: This package builds a binary arch:all package which incorrectly
.
Please remove the <tt>Built-Using</tt> line from your package
definition.
+
+Tag: missing-xs-go-import-path-for-golang-package
+Severity: wishlist
+Certainty: certain
+Info: This source package does not specify a <tt>XS-Go-Import-Path</tt>
+ control field.
+ .
+ The <tt>XS-Go-Import-Path</tt> exposes the import path of the Go
+ package to the Debian archive in an easily machine-readable form which
+ is then used by tools such as <tt>dh-make-golang(1)</tt> to resolve
+ dependencies, avoid accidental duplication in the archive, or in
+ https://pkg-go.alioth.debian.org/ci.html.
+ .
+ For packages using <tt>dh-golang</tt>, the field should be set to the same
+ value as the <tt>DH_GOPKG</tt> variable in <tt>debian/rules</tt>.
+ <tt>dh-golang</tt> will automatically set <tt>DH_GOPKG</tt> to the
+ <tt>XS-Go-Import-Path</tt> value.
+ .
+ For packages which do not use <tt>dh-golang</tt> (or where upstream does
+ not publish the source in a way that is compatible with <tt>go get</tt>
+ and hence does not have a canonical import path) it is preferred to
+ set a fake import path. Please contact the pkg-go team at
+ https://pkg-go.alioth.debian.org/ for more specific advice in this
+ situation.
diff --git a/checks/control-file.pm b/checks/control-file.pm
index 84a82bd..392bbf6 100644
--- a/checks/control-file.pm
+++ b/checks/control-file.pm
@@ -427,9 +427,9 @@ sub run {
unless $relation->implies('${gir:Depends}');
}
- # Verify that golang binary packages set Built-Using (except for arch:all
- # library packages).
if ($info->relation('build-depends')->implies('golang-go | golang-any')) {
+ # Verify that golang binary packages set Built-Using (except for
+ # arch:all library packages).
foreach my $bin (@package_names) {
my $bu = $info->binary_field($bin, 'built-using');
my $arch = $info->binary_field($bin, 'architecture');
@@ -442,6 +442,9 @@ sub run {
}
}
}
+
+ tag 'missing-xs-go-import-path-for-golang-package'
+ unless $info->source_field('xs-go-import-path', '');
}
return;
diff --git a/debian/changelog b/debian/changelog
index bd0631c..b0c476f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,8 @@ lintian (2.5.77) UNRELEASED; urgency=medium
* checks/control-file.{desc,pm}:
+ [CL] Apply a patch from Michael Stapelberg to detect Golang packages
with invalid or missing Built-Using headers. (Closes: #891072)
+ + [CL] Apply patch from Michael Stapelberg to warn when packages do not
+ specify a XS-Go-Import-Path. (Closes: #891184)
* checks/version-substvars.pm:
+ [CL] Fix a bug in version-substvar-for-external-package parsing to
prevent false-positives when the LHS of the binary relation contains
diff --git a/t/tests/binaries-golang/desc b/t/tests/binaries-golang/desc
index 8c34704..22caa4c 100644
--- a/t/tests/binaries-golang/desc
+++ b/t/tests/binaries-golang/desc
@@ -4,4 +4,6 @@ Extra-Build-Depends: golang-go (>= 2:1.1.1-4)
Description: Misc errors related to golang binaries
Architecture: any
Test-Against: statically-linked-binary
-Test-For: missing-built-using-field-for-golang-package
+Test-For:
+ missing-built-using-field-for-golang-package
+ missing-xs-go-import-path-for-golang-package
diff --git a/t/tests/binaries-golang/tags b/t/tests/binaries-golang/tags
index 9c49736..f2de898 100644
--- a/t/tests/binaries-golang/tags
+++ b/t/tests/binaries-golang/tags
@@ -1 +1,2 @@
I: binaries-golang source: missing-built-using-field-for-golang-package binaries-golang
+I: binaries-golang source: missing-xs-go-import-path-for-golang-package
diff --git a/t/tests/control-file-golang-xs-go-import-path/debian/Makefile b/t/tests/control-file-golang-xs-go-import-path/debian/Makefile
new file mode 100644
index 0000000..f04b342
--- /dev/null
+++ b/t/tests/control-file-golang-xs-go-import-path/debian/Makefile
@@ -0,0 +1,16 @@
+NOPIE_CFLAGS = $(filter-out -fPIE,$(CFLAGS))
+NOPIE_LDFLAGS = $(filter-out -fPIE -pie,$(LDFLAGS))
+COMPILE:= $(CC) $(NOPIE_CFLAGS) $(CPPFLAGS) $(NOPIE_LDFLAGS)
+
+all:
+ # static version
+ $(COMPILE) -static -o basic.static basic.c
+
+install:
+ install -d $(DESTDIR)/usr/lib/foo/
+ install -m 755 basic.static $(DESTDIR)/usr/lib/foo/static
+
+clean distclean:
+ rm -f basic
+
+check test:
diff --git a/t/tests/control-file-golang-xs-go-import-path/debian/basic.c b/t/tests/control-file-golang-xs-go-import-path/debian/basic.c
new file mode 100644
index 0000000..7dea5a0
--- /dev/null
+++ b/t/tests/control-file-golang-xs-go-import-path/debian/basic.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+
+int
+main(void)
+{
+ char t[10];
+ printf("Hello world!\n");
+ /* Bad choice for reading from stdin, but it forces a stack
+ protector, so meh.
+ */
+ gets (t);
+}
diff --git a/t/tests/control-file-golang-xs-go-import-path/debian/debian/control.in b/t/tests/control-file-golang-xs-go-import-path/debian/debian/control.in
new file mode 100644
index 0000000..b4a9a7c
--- /dev/null
+++ b/t/tests/control-file-golang-xs-go-import-path/debian/debian/control.in
@@ -0,0 +1,40 @@
+Source: {$source}
+Section: net
+Priority: optional
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: {$build_depends},
+ golang-go (>= 2:1.1.1-4)
+XS-Go-Import-Path: github.com/Debian/lintian-test-package
+
+Package: {$source}
+Architecture: {$architecture}
+Depends: $\{misc:Depends\}
+Built-Using: $\{misc:Built-Using\}
+Description: {$description}
+ This is a test package designed to exercise some feature or tag of
+ Lintian. It is part of the Lintian test suite and may do very odd
+ things. It should not be installed like a regular package. It may
+ be an empty package.
+
+Package: {$source}-dev
+Architecture: all
+Depends: $\{misc:Depends\}
+Description: {$description} (dev)
+ This is a test package designed to exercise some feature or tag of
+ Lintian. It is part of the Lintian test suite and may do very odd
+ things. It should not be installed like a regular package. It may
+ be an empty package.
+ .
+ This package contains the source.
+
+Package: {$source}-clean-dev
+Architecture: all
+Depends: $\{misc:Depends\}
+Description: {$description} (clean dev)
+ This is a test package designed to exercise some feature or tag of
+ Lintian. It is part of the Lintian test suite and may do very odd
+ things. It should not be installed like a regular package. It may
+ be an empty package.
+ .
+ This package contains the source, without a built-using tag.
diff --git a/t/tests/control-file-golang-xs-go-import-path/desc b/t/tests/control-file-golang-xs-go-import-path/desc
new file mode 100644
index 0000000..c3bf965
--- /dev/null
+++ b/t/tests/control-file-golang-xs-go-import-path/desc
@@ -0,0 +1,5 @@
+Testname: control-file-golang-xs-go-import-path
+Version: 1.0
+Description: False-positive test for XS-Go-Import field
+Architecture: any
+Test-Against: missing-xs-go-import-path-for-golang-package
diff --git a/t/tests/control-file-golang-xs-go-import-path/tags b/t/tests/control-file-golang-xs-go-import-path/tags
new file mode 100644
index 0000000..e69de29
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: