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

[lintian] 01/15: Use Lintian::Data for ancient date



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

broucaries-guest pushed a commit to branch master
in repository lintian.

commit c251b7f81547d65c9d8d20a1eb5b98c65ddf2503
Author: Bastien ROUCARIÈS <roucaries.bastien@gmail.com>
Date:   Sat Dec 14 11:34:04 2013 +0100

    Use Lintian::Data for ancient date
    
    Change test to check Lintian::Data.
    
    Signed-off-by: <roucaries.bastien+debian@gmail.com>
---
 checks/standards-version.pm         | 12 ++++++++++--
 data/standards-version/ancient-date |  5 +++++
 debian/changelog                    |  4 ++++
 t/scripts/ancient-sv-date.t         |  8 ++++----
 4 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/checks/standards-version.pm b/checks/standards-version.pm
index 030dcd9..7e5ee80 100644
--- a/checks/standards-version.pm
+++ b/checks/standards-version.pm
@@ -34,8 +34,16 @@ use Lintian::Tags qw(tag);
 use Lintian::Util qw(fail);
 
 # Any Standards Version released before this day is "ancient"
-my $ANCIENT_DATE = str2time('20 Oct 2011')
-  or fail "Cannot parse ANCIENT_DATE: $!";
+my $ANCIENT_DATE_DATA = Lintian::Data->new(
+    'standards-version/ancient-date',
+    qr{\s*<\s*},
+    sub {
+        my $date =  str2time($_[1]) or fail "Cannot parse ANCIENT_DATE: $!";
+        return $date;
+    });
+
+my $ANCIENT_DATE = $ANCIENT_DATE_DATA->value('ANCIENT')
+  or fail 'Cannot get ANCIENT_DATE';
 
 my $STANDARDS= Lintian::Data->new('standards-version/release-dates', qr/\s+/o);
 
diff --git a/data/standards-version/ancient-date b/data/standards-version/ancient-date
new file mode 100644
index 0000000..3b2ee84
--- /dev/null
+++ b/data/standards-version/ancient-date
@@ -0,0 +1,5 @@
+# Any Standards Version released before this day is "ancient"
+# That date has to be within 22 and 24 months in the past
+# at release time
+# Format is ANCIENT < Date
+ANCIENT < 14 Jan 2012
\ No newline at end of file
diff --git a/debian/changelog b/debian/changelog
index 5f30a36..f09529c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -38,6 +38,8 @@ lintian (2.5.20) UNRELEASED; urgency=low
       --home inside /home.  (Closes: #730456).
     + [BR] install-sgmlcatalog is deprecated for a long time.  Warn
       now in all use case.
+  * checks/standards-version:
+    + [BR] Use Lintian::Data for ancient date check.
   * checks/watch.{desc,pm}:
     + [BR] Detect lack of uscan support for gpg signature.
       (Closes: #711553).
@@ -58,6 +60,8 @@ lintian (2.5.20) UNRELEASED; urgency=low
   * data/spelling/corrections:
     + [RG] Detect some typos of "establishment" and "contains".
     + [SL] Detect some typos of "suppress".
+  * data/standards-version/ancient-date:
+    + [BR] Set ancient date to 14 Jan 2012.
   * data/standards-version/release-dates:
     + [NT] Add release date for 3.9.5.
 
diff --git a/t/scripts/ancient-sv-date.t b/t/scripts/ancient-sv-date.t
index b1dba55..3f47a99 100755
--- a/t/scripts/ancient-sv-date.t
+++ b/t/scripts/ancient-sv-date.t
@@ -31,16 +31,16 @@ plan tests => 2;
 
 $ENV{'LINTIAN_TEST_ROOT'} //= '.';
 
-my $check = "$ENV{'LINTIAN_TEST_ROOT'}/checks/standards-version.pm";
+my $check = "$ENV{'LINTIAN_TEST_ROOT'}/data/standards-version/ancient-date";
 my $found = 0;
 open(my $fd, '<', $check);
 while (my $line = <$fd>) {
     # We are looking for:
-    #   my $ANCIENT_DATE = str2time('20 Aug 2009')
+    #   my $ANCIENT_DATE < '20 Aug 2009')
     $line =~ s,\#.*+,,o;
     if (
-        $line =~ m/ANCIENT_DATE \s* = \s* str2time\s*\(\s*
-                  [\'\"]([^\'\"]+)[\'\"]/ox
+        $line =~ m/ANCIENT \s* < \s*
+                  ([\s\w]+)/ox
       ) {
         my $date = $1;
         my $and = str2time($date)

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


Reply to: