Axel Beckert pushed to branch salsa-debug at lintian / lintian


Commits:
287d4230 by Axel Beckert at 2023-01-02T14:23:18+01:00
Make "lintian --version" emit versions unique per commit

It previously only added the amount of commits since last release to
the patch version if it was at zero. Which is anything but the claimed
"Semantic Versioning".

- - - - -


1 changed file:

- lib/Lintian/Version.pm


Changes:

=====================================
lib/Lintian/Version.pm
=====================================
@@ -83,15 +83,20 @@ sub version_from_git {
     return $EMPTY
       unless -d $git_path;
 
+    # Example outputs:
+    # 2.115.3-49-g086a9a113
+    # 2.115.3-49-g086a9a113-dirty
     my $describe
-      = decode_utf8(safe_qx('git', "--git-dir=$git_path", 'describe'));
+      = decode_utf8(safe_qx('git', "--git-dir=$git_path", 'describe', 
'--dirty'));
     chomp $describe;
 
-    my ($guess, $step, $commit) = split(/-/, $describe);
-    return $EMPTY
-      unless defined $step;
-
-    $guess =~ s/ [.] 0 $/.$step/sx;
+    # Modify it to make it a valid native version number and make it
+    # look more debianish like these:
+    # 2.115.3+49commits+git086a9a113
+    # 2.115.3+49commits+git086a9a113+dirty
+    my $guess = $describe;
+    $guess =~ s/ - ( \d+ ) -g /+${1}commits+git/sx;
+    $guess =~ s/ - /+/sxg;
 
     return ($guess // $EMPTY);
 }



View it on GitLab: 
https://salsa.debian.org/lintian/lintian/-/commit/287d4230e7f234afcb2a814efbf0cff01f58f61a

-- 
View it on GitLab: 
https://salsa.debian.org/lintian/lintian/-/commit/287d4230e7f234afcb2a814efbf0cff01f58f61a
You're receiving this email because of your account on salsa.debian.org.


Reply via email to