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

Bug#717633: [lintian] patch



Package: lintian
Version: 2.5.13
control: tag -1 + patch

The patch 
From 11a689cb9302587fbbc7f1c266d8944e8cbafdb2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <roucaries.bastien@gmail.com>
Date: Sun, 28 Jul 2013 17:43:47 +0200
Subject: [PATCH] Detect templated text on quilt patch

Detect patch that are templated and tag it.
---
 checks/patch-systems.desc                             |   16 ++++++++++++++++
 checks/patch-systems.pm                               |    5 +++++
 .../debian/debian/patches/04_template_description     |   17 +++++++++++++++++
 .../debian/debian/patches/series                      |    1 +
 t/tests/patch-systems-quilt-description/desc          |    1 +
 t/tests/patch-systems-quilt-description/tags          |    1 +
 6 files changed, 41 insertions(+)
 create mode 100644 t/tests/patch-systems-quilt-description/debian/debian/patches/04_template_description

diff --git a/checks/patch-systems.desc b/checks/patch-systems.desc
index b3df514..7e9ab5a 100644
--- a/checks/patch-systems.desc
+++ b/checks/patch-systems.desc
@@ -38,6 +38,22 @@ Info: dpatch files should carry a description of the included patch.
  this information.
 Ref: http://dep.debian.net/deps/dep3/
 
+Tag: quilt-patch-using-template-description
+Severity: wishlist
+Certainty: certain
+Info: patch contains a standard template included by debhelpers
+ Please edit the patch by using correct description and not template.
+ You can edit the description with <tt>quilt header -e</tt>
+ when the patch is at the top of the stack.
+ .
+ As well as a description of the purpose and function of the patch, the
+ description should ideally contain author information, a URL for the bug
+ report (if any), Debian or upstream bugs fixed by it, upstream status,
+ the Debian version and date the patch was first included, and any other
+ information that would be useful if someone were investigating the
+ patch and underlying problem.
+Ref: http://dep.debian.net/deps/dep3/
+
 Tag: quilt-build-dep-but-no-series-file
 Severity: normal
 Certainty: certain
diff --git a/checks/patch-systems.pm b/checks/patch-systems.pm
index cca55a2..3ca5b90 100644
--- a/checks/patch-systems.pm
+++ b/checks/patch-systems.pm
@@ -165,6 +165,7 @@ sub run {
                     }
                     if (-f "$dpdir/$patch_file") {
                         my $has_description = 0;
+                        my $has_template_description = 0;
                         open(my $patch_fd, '<', "$dpdir/$patch_file");
                         while (<$patch_fd>) {
                             # stop if something looking like a patch starts:
@@ -172,11 +173,15 @@ sub run {
                             next if /^\s*$/;
                             # Skip common "lead-in" lines
                             $has_description = 1 unless m{^(?:Index: |=+$|diff .+|index )};
+                            $has_template_description = 1 if /TODO: Put a short summary on the line above and replace this paragraph/;
                         }
                         close($patch_fd);
                         unless ($has_description) {
                             tag 'quilt-patch-missing-description', $patch_file;
                         }
+                        if ($has_template_description) {
+                            tag 'quilt-patch-using-template-description', $patch_file;
+                        }
                     }
                     check_patch($dpdir, $patch_file);
                 }
diff --git a/t/tests/patch-systems-quilt-description/debian/debian/patches/04_template_description b/t/tests/patch-systems-quilt-description/debian/debian/patches/04_template_description
new file mode 100644
index 0000000..09bfd88
--- /dev/null
+++ b/t/tests/patch-systems-quilt-description/debian/debian/patches/04_template_description
@@ -0,0 +1,17 @@
+Description: <short summary of the patch>
+ This patch include a templated text for description
+ TODO: Put a short summary on the line above and replace this paragraph
+ with a longer explanation of this change. Complete the meta-information
+ with other relevant fields (see below for details). To make it easier, the
+ information below has been extracted from the changelog. Adjust it or drop
+ it.
+      .
+diff --git a/a b/a
+index eb39593..7258d2f 100644
+--- a	2008-11-11 19:38:12.000000000 +0000
++++ a	2008-11-11 19:38:26.000000000 +0000
+@@ -1 +1,4 @@
+ sample text
+ and some more sample text
+ and yet another line
++and so on
diff --git a/t/tests/patch-systems-quilt-description/debian/debian/patches/series b/t/tests/patch-systems-quilt-description/debian/debian/patches/series
index 5117566..5b013e7 100644
--- a/t/tests/patch-systems-quilt-description/debian/debian/patches/series
+++ b/t/tests/patch-systems-quilt-description/debian/debian/patches/series
@@ -1,3 +1,4 @@
 01_this_patch_is_ok
 02_this_one_has_no_description
 03_a_git_patch
+04_template_description
\ No newline at end of file
diff --git a/t/tests/patch-systems-quilt-description/desc b/t/tests/patch-systems-quilt-description/desc
index c027224..635ba24 100644
--- a/t/tests/patch-systems-quilt-description/desc
+++ b/t/tests/patch-systems-quilt-description/desc
@@ -3,4 +3,5 @@ Sequence: 6000
 Version: 1.0
 Description: Test for quilt patches which do not have accompanying descriptions
 Test-For: quilt-patch-missing-description
+          quilt-patch-using-template-description
 References: Debian Bug #498892
diff --git a/t/tests/patch-systems-quilt-description/tags b/t/tests/patch-systems-quilt-description/tags
index aa22e9e..ea5171c 100644
--- a/t/tests/patch-systems-quilt-description/tags
+++ b/t/tests/patch-systems-quilt-description/tags
@@ -1,2 +1,3 @@
 I: patch-systems-quilt-description source: quilt-patch-missing-description 02_this_one_has_no_description
 I: patch-systems-quilt-description source: quilt-patch-missing-description 03_a_git_patch
+I: patch-systems-quilt-description source: quilt-patch-using-template-description 04_template_description
-- 
1.7.10.4


Reply to: