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

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=b5d87e21bb852ee7b5149d8bc821b502638e6416

commit b5d87e21bb852ee7b5149d8bc821b502638e6416
Author: Guillem Jover <[email protected]>
AuthorDate: Mon Mar 21 22:31:25 2022 +0100

    scripts: Use backport-version-regex vendor hook instead of hardcoding the 
marker
    
    The backport version markers are vendor specific, so we should not
    hardcode them in the generic part of the programs.
---
 scripts/dpkg-genchanges.pl      | 9 ++++++---
 scripts/dpkg-mergechangelogs.pl | 9 +++++++--
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/scripts/dpkg-genchanges.pl b/scripts/dpkg-genchanges.pl
index 8acd407b0..05519e2d2 100755
--- a/scripts/dpkg-genchanges.pl
+++ b/scripts/dpkg-genchanges.pl
@@ -44,6 +44,7 @@ use Dpkg::Vars;
 use Dpkg::Changelog::Parse;
 use Dpkg::Dist::Files;
 use Dpkg::Version;
+use Dpkg::Vendor qw(run_vendor_hook);
 
 textdomain('dpkg-dev');
 
@@ -216,14 +217,16 @@ $substvars->set_vendor_substvars();
 $substvars->set_arch_substvars();
 $substvars->load('debian/substvars') if -e 'debian/substvars' and not 
$substvars_loaded;
 
+my $backport_version_regex = run_vendor_hook('backport-version-regex') // 
qr/^$/;
+
+# Versions with backport markers have a lower version number by definition.
 if (defined($prev_changelog) and
+    $changelog->{'Version'} !~ /$backport_version_regex/ and
     version_compare_relation($changelog->{'Version'}, REL_LT,
                              $prev_changelog->{'Version'}))
 {
     warning(g_('the current version (%s) is earlier than the previous one 
(%s)'),
-       $changelog->{'Version'}, $prev_changelog->{'Version'})
-        # Backports have lower version number by definition.
-        unless $changelog->{'Version'} =~ /~(?:bpo|deb)/;
+            $changelog->{'Version'}, $prev_changelog->{'Version'});
 }
 
 # Scan control info of source package
diff --git a/scripts/dpkg-mergechangelogs.pl b/scripts/dpkg-mergechangelogs.pl
index ca233714d..68d6d79db 100755
--- a/scripts/dpkg-mergechangelogs.pl
+++ b/scripts/dpkg-mergechangelogs.pl
@@ -27,6 +27,7 @@ use Dpkg::Changelog::Debian;
 use Dpkg::ErrorHandling;
 use Dpkg::Gettext;
 use Dpkg::Version;
+use Dpkg::Vendor qw(run_vendor_hook);
 
 textdomain('dpkg-dev');
 
@@ -89,6 +90,8 @@ my @options_spec = (
     GetOptions(@options_spec);
 }
 
+my $backport_version_regex = run_vendor_hook('backport-version-regex');
+
 my ($old, $new_a, $new_b, $out_file) = @ARGV;
 unless (defined $old and defined $new_a and defined $new_b)
 {
@@ -196,8 +199,10 @@ sub compare_versions {
                     $b->get_distributions() eq 'UNRELEASED';
     }
     # Backports are not real prereleases.
-    $av =~ s/~(bpo|deb)/+$1/;
-    $bv =~ s/~(bpo|deb)/+$1/;
+    if (defined $backport_version_regex) {
+        $a =~ s/$backport_version_regex/+$1/;
+        $b =~ s/$backport_version_regex/+$1/;
+    }
     if ($merge_prereleases) {
         $av =~ s/~[^~]*$//;
         $bv =~ s/~[^~]*$//;

-- 
Dpkg.Org's dpkg

Reply via email to