Axel Beckert pushed to branch master at lintian / lintian


Commits:
9b6ce500 by Axel Beckert at 2023-01-02T21:15:13+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".

- - - - -
e45c1668 by Axel Beckert at 2023-01-02T21:15:13+01:00
Make lib/Lintian/Version.pm perltidy again

Gbp-Dch: Ignore

- - - - -


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;
 
-    my $describe
-      = decode_utf8(safe_qx('git', "--git-dir=$git_path", 'describe'));
+    # 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', '--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/-/compare/37770b159e9cb222c8357fcb645456507445f3ca...e45c166839b78dbbe8f1b30d3c64d1fe7f504ce0

-- 
View it on GitLab: 
https://salsa.debian.org/lintian/lintian/-/compare/37770b159e9cb222c8357fcb645456507445f3ca...e45c166839b78dbbe8f1b30d3c64d1fe7f504ce0
You're receiving this email because of your account on salsa.debian.org.


Reply via email to