[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 01/01: Check for manual parsing of dpkg-parsechangelog output now that we have pkg-info.mk.



This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository lintian.

commit 43ced31ac69d63beaf20967b42dd9581ca3dfa1a
Author: Chris Lamb <lamby@debian.org>
Date:   Sat May 20 09:28:51 2017 +0200

    Check for manual parsing of dpkg-parsechangelog output now that we have pkg-info.mk.
    
    Signed-off-by: Chris Lamb <lamby@debian.org>
---
 checks/rules.desc                                            | 10 ++++++++++
 checks/rules.pm                                              |  4 ++++
 debian/changelog                                             |  2 ++
 t/tests/rules-parses-dpkg-parsechangelog/debian/debian/rules | 11 +++++++++++
 t/tests/rules-parses-dpkg-parsechangelog/desc                |  6 ++++++
 t/tests/rules-parses-dpkg-parsechangelog/tags                |  6 ++++++
 6 files changed, 39 insertions(+)

diff --git a/checks/rules.desc b/checks/rules.desc
index f04d40d..4b75505 100644
--- a/checks/rules.desc
+++ b/checks/rules.desc
@@ -237,3 +237,13 @@ Info: The rules file use the make variable $(_).
  If the rules file uses $(dir $(_)) to discover the directory containing
  the source package (presumably in order to implement the get-orig-source
  target), please replace it by $(dir $(firstword $(MAKEFILE_LIST))).
+
+Tag: debian-rules-parses-dpkg-parsechangelog
+Severity: wishlist
+Certainty: possible
+Info: The rules file appears to be parsing the output of dpkg-parsechangelog to
+ determine the current package version name, version, timestamp, etc.
+ .
+ Since dpkg 1.16.1, this may be able to be replaced by including the
+ /usr/share/dpkg/pkg-info.mk file and using the DEB_{SOURCE,VERSION} or
+ SOURCE_DATE_EPOCH variables.
diff --git a/checks/rules.pm b/checks/rules.pm
index e3facc1..9e52c8d 100644
--- a/checks/rules.pm
+++ b/checks/rules.pm
@@ -276,6 +276,10 @@ sub run {
             next; #.PHONY implies the rest will not match
         }
 
+        if (!$includes && m/dpkg-parsechangelog.*(Source|Version|Date|Timestamp)/s) {
+                tag 'debian-rules-parses-dpkg-parsechangelog', "(line $.)";
+        }
+
         if (!/^ifn?(?:eq|def)\s/ && m/^([^\s:][^:]*):+(.*)/s) {
             my ($target_names, $target_dependencies) = ($1, $2);
             @current_targets = split ' ', $target_names;
diff --git a/debian/changelog b/debian/changelog
index 981b099..f41b161 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -64,6 +64,8 @@ lintian (2.5.51) UNRELEASED; urgency=medium
       dpkg-buildpackage refuses to build packages that trigger this tag.
       Also, the tag implies two other "W" tags so contributors are still
       notified of a potential problem.
+    + [CL] Check for manual parsing of dpkg-parsechangelog output now that we
+      have /usr/share/dpkg/pkg-info.mk.
   * checks/scripts.pm:
     + [NT] Apply patch from Christopher Hoskin to except -doc packages
       from the "new-package-should-not-package-python2-module" tag.
diff --git a/t/tests/rules-parses-dpkg-parsechangelog/debian/debian/rules b/t/tests/rules-parses-dpkg-parsechangelog/debian/debian/rules
new file mode 100644
index 0000000..9ea710e
--- /dev/null
+++ b/t/tests/rules-parses-dpkg-parsechangelog/debian/debian/rules
@@ -0,0 +1,11 @@
+#!/usr/bin/make -f
+
+DATE = $(shell dpkg-parsechangelog -SDate)
+SOURCE = $(shell dpkg-parsechangelog -SSource)
+SOURCE2 = $(shell dpkg-parsechangelog | grep ^Source | cut -d" " -f2)
+VERSION = $(shell dpkg-parsechangelog -SVersion)
+VERSION2 = $(shell dpkg-parsechangelog | sed -ne 's,^Version: *\(.*\)$$,\1,p')
+TIMESTAMP = $(shell dpkg-parsechangelog -STimestamp)
+
+%:
+	dh $@
diff --git a/t/tests/rules-parses-dpkg-parsechangelog/desc b/t/tests/rules-parses-dpkg-parsechangelog/desc
new file mode 100644
index 0000000..2419aca
--- /dev/null
+++ b/t/tests/rules-parses-dpkg-parsechangelog/desc
@@ -0,0 +1,6 @@
+Testname: rules-parses-dpkg-parsechangelog
+Sequence: 6000
+Version: 1.0
+Description: Test for debian/rules manually parsing dpkg-parsechangelog
+Test-For:
+ debian-rules-parses-dpkg-parsechangelog
diff --git a/t/tests/rules-parses-dpkg-parsechangelog/tags b/t/tests/rules-parses-dpkg-parsechangelog/tags
new file mode 100644
index 0000000..3696e56
--- /dev/null
+++ b/t/tests/rules-parses-dpkg-parsechangelog/tags
@@ -0,0 +1,6 @@
+I: rules-parses-dpkg-parsechangelog source: debian-rules-parses-dpkg-parsechangelog (line 3)
+I: rules-parses-dpkg-parsechangelog source: debian-rules-parses-dpkg-parsechangelog (line 4)
+I: rules-parses-dpkg-parsechangelog source: debian-rules-parses-dpkg-parsechangelog (line 5)
+I: rules-parses-dpkg-parsechangelog source: debian-rules-parses-dpkg-parsechangelog (line 6)
+I: rules-parses-dpkg-parsechangelog source: debian-rules-parses-dpkg-parsechangelog (line 7)
+I: rules-parses-dpkg-parsechangelog source: debian-rules-parses-dpkg-parsechangelog (line 8)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: