Nilesh Patra pushed to branch master at lintian / lintian


Commits:
4e9bd2fd by Nilesh Patra at 2026-08-05T06:07:06+02:00
Lintian::Check::Debian::Changelog - Use distroinfo instead of hard-coding 
distro names (Closes: #1040138)

This ends the cycle of having to hard-code stable distribution name on every 
backport
as we directly use the name of stable distribution that we get from 
`distro-info`
and consequently `distro-info-data`

See the commit message in
https://salsa.debian.org/lintian/lintian/-/commit/2dc42ac0dc2073d6537203cbb4fb82d82460d7ef
for more information.

Only drawback with this implementation is that we are now depending on the 
system time for
getting the stable distro name via the `->stable()` call, as we do not pass any 
date here to
avoid hard-coding it once again.

- - - - -


1 changed file:

- lib/Lintian/Check/Debian/Changelog.pm


Changes:

=====================================
lib/Lintian/Check/Debian/Changelog.pm
=====================================
@@ -41,6 +41,7 @@ use Lintian::Changelog::Version;
 use Lintian::IPC::Run3 qw(safe_qx);
 use Lintian::Relation::Version qw(versions_gt);
 use Lintian::Spelling qw(check_spelling);
+use Debian::DistroInfo;
 
 const my $EMPTY => q{};
 const my $DOUBLE_QUOTE => q{"};
@@ -137,14 +138,17 @@ sub source {
         # NMUs get a free pass because they need to work with the
         # version number that was already there.
         unless (length $latest_version->source_nmu) {
+            my @all_distro_series
+              = Debian::DistroInfo::get_all_series('debian');
+            @all_distro_series
+              = grep { $_ ne 'sid' && $_ ne 'rc-buggy' } @all_distro_series;
+            my $all_distro_regex = join(q{|}, @all_distro_series);
             $self->pointed_hint('version-refers-to-distribution',
                 $latest_pointer,$latest_version->literal)
               if ($revision =~ /testing|(?:un)?stable/i)
               || (
                 ($distribution eq 'unstable'|| $distribution eq 'experimental')
-                && $revision
-                =~ 
/woody|sarge|etch|lenny|squeeze|stretch|buster|bookworm|bullseye|trixie/
-              );
+                && $revision=~ /$all_distro_regex/);
         }
 
         my $examine = $latest_version->maintainer_revision;
@@ -246,6 +250,13 @@ sub source {
             # start with a reasonable default
             my $expected_previous = $previous_version->literal;
 
+            # use distroinfo to get current stable
+            my $deb = DebianDistroInfo->new();
+
+            # this is going to use current system time, as date is not passed
+            # this is a reasonable compromise to avoid hard-coding dates.
+            my $current_stable = $deb->stable();
+
             $expected_previous = $latest_version->without_backport
               if $latest_version->backport_release
               && $latest_version->backport_revision
@@ -268,8 +279,8 @@ sub source {
                 $latest_version->literal
               )
               unless $previous_version->literal eq $expected_previous
-              || $latest_entry->Distribution eq 'bullseye'
-              || $previous_entry->Distribution eq 'bullseye'
+              || $latest_entry->Distribution eq $current_stable
+              || $previous_entry->Distribution eq $current_stable
               || $latest_entry->Distribution =~ /-security$/i;
 
             if (   $latest_version->epoch eq $previous_version->epoch



View it on GitLab: 
https://salsa.debian.org/lintian/lintian/-/commit/4e9bd2fdde3205d873c8df479a2217526c9b5455

-- 
View it on GitLab: 
https://salsa.debian.org/lintian/lintian/-/commit/4e9bd2fdde3205d873c8df479a2217526c9b5455
You're receiving this email because of your account on salsa.debian.org. Manage 
all notifications: https://salsa.debian.org/-/profile/notifications | Help: 
https://salsa.debian.org/help


Reply via email to