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

[lintian] 01/01: Check for unnecessary SOURCE_DATE_EPOCH assignments; it is either exported by dpkg >= 1.18.8 or one can include pkg-info.pk, etc. (Closes: #832099)



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

lamby pushed a commit to branch master
in repository lintian.

commit d46ed44144b71558fc4288da13f276c38e4ec1ba
Author: Chris Lamb <lamby@debian.org>
Date:   Sun Feb 18 15:25:22 2018 +0000

    Check for unnecessary SOURCE_DATE_EPOCH assignments; it is either exported by dpkg >= 1.18.8 or one can include pkg-info.pk, etc. (Closes: #832099)
---
 checks/rules.desc                                             | 11 +++++++++++
 checks/rules.pm                                               |  2 ++
 debian/changelog                                              |  5 ++++-
 .../rules-unnecessary-source-date-epoch/debian/debian/rules   |  8 ++++++++
 t/tests/rules-unnecessary-source-date-epoch/desc              |  6 ++++++
 t/tests/rules-unnecessary-source-date-epoch/tags              |  3 +++
 6 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/checks/rules.desc b/checks/rules.desc
index 0e8c2cd..747c613 100644
--- a/checks/rules.desc
+++ b/checks/rules.desc
@@ -374,3 +374,14 @@ Info: The <tt>debian/rules</tt> file for this package has an
   mkdir foo/
   ENV=var dh_auto_test -- ARG=value
 Ref: policy 4.9.1, https://wiki.debian.org/BuildProfileSpec#Registered_profile_names
+
+Tag: unnecessary-source-date-epoch-assignment
+Severity: wishlist
+Certainty: certain
+Info: There is an assignment to a <tt>SOURCE_DATE_EPOCH</tt> variable in the
+ <tt>debian/rules</tt> file.
+ .
+ As of dpkg 1.18.8, this is no longer necessary as dpkg exports this
+ variable if it is not already set. However, you can also include
+ <tt>/usr/share/dpkg/pkg-info.mk</tt> or <tt>/usr/share/dpkg/default.pk</tt>
+ to ensure it is exported.
diff --git a/checks/rules.pm b/checks/rules.pm
index fd8792e..3638f57 100644
--- a/checks/rules.pm
+++ b/checks/rules.pm
@@ -251,6 +251,8 @@ sub run {
             # rather well.
             my ($var, $value) = ($1, $2);
             $variables{$var} = $value;
+            tag 'unnecessary-source-date-epoch-assignment', "(line $.)"
+              if $var eq 'SOURCE_DATE_EPOCH';
         }
 
         # Keep track of whether this portion of debian/rules may be optional
diff --git a/debian/changelog b/debian/changelog
index af884ca..d651854 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,7 +13,7 @@ lintian (2.5.76) UNRELEASED; urgency=medium
     + [CL] Correct a grammatical error and tighten up the language of the
       "binary-package-depends-on-toolchain-package" tag's description.
       Thanks to Gregor Herrmann for the report.  (Closes: #890530)
-  * checks/rules.pm:
+  * checks/rules.{desc,pm}:
     + [CL] Update override_dh_auto_test-does-not-check-DEB_BUILD_OPTIONS
       to fix a number of false positives. Thanks to Gregor Herrmann for
       the report.  (Closes: #890537)
@@ -23,6 +23,9 @@ lintian (2.5.76) UNRELEASED; urgency=medium
     + [CL] Prevent a large number of false-positives when checking the
       debian-rules-is-dh_make-template tag.  Thanks to Evgeni Golov for
       the report.  (Closes: #890660)
+    + [CL] Check for unnecessary SOURCE_DATE_EPOCH assignments; it is
+      either exported by dpkg >= 1.18.8 or one can include pkg-info.pk,
+      etc.  (Closes: #832099)
   * checks/scripts.pm:
     + [CL] Prevent some false-positives in udevadm-called-without-guard.
   * checks/watch-file.pm:
diff --git a/t/tests/rules-unnecessary-source-date-epoch/debian/debian/rules b/t/tests/rules-unnecessary-source-date-epoch/debian/debian/rules
new file mode 100755
index 0000000..ec2dec6
--- /dev/null
+++ b/t/tests/rules-unnecessary-source-date-epoch/debian/debian/rules
@@ -0,0 +1,8 @@
+#!/usr/bin/make -f
+
+SOURCE_DATE_EPOCH = $(shell date -d "$$(dpkg-parsechangelog -SDate)" +%s)
+
+export SOURCE_DATE_EPOCH = $(shell date +%s)
+
+%:
+	dh $@
diff --git a/t/tests/rules-unnecessary-source-date-epoch/desc b/t/tests/rules-unnecessary-source-date-epoch/desc
new file mode 100644
index 0000000..16ced59
--- /dev/null
+++ b/t/tests/rules-unnecessary-source-date-epoch/desc
@@ -0,0 +1,6 @@
+Testname: rules-unnecessary-source-date-epoch
+Version: 1.0
+Description: Test for unnecessary SOURCE_DATE_EPOCH assignments
+Test-For:
+ debian-rules-parses-dpkg-parsechangelog
+ unnecessary-source-date-epoch-assignment
diff --git a/t/tests/rules-unnecessary-source-date-epoch/tags b/t/tests/rules-unnecessary-source-date-epoch/tags
new file mode 100644
index 0000000..f7a1d9d
--- /dev/null
+++ b/t/tests/rules-unnecessary-source-date-epoch/tags
@@ -0,0 +1,3 @@
+I: rules-unnecessary-source-date-epoch source: debian-rules-parses-dpkg-parsechangelog (line 3)
+I: rules-unnecessary-source-date-epoch source: unnecessary-source-date-epoch-assignment (line 3)
+I: rules-unnecessary-source-date-epoch source: unnecessary-source-date-epoch-assignment (line 5)

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


Reply to: