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

[Git][lintian/lintian][salsa-debug] Make "lintian --version" emit versions unique per commit



Title: GitLab

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:

Changes:

  • lib/Lintian/Version.pm
    ... ... @@ -83,15 +83,20 @@ sub version_from_git {
    83 83
         return $EMPTY
    
    84 84
           unless -d $git_path;
    
    85 85
     
    
    86
    +    # Example outputs:
    
    87
    +    # 2.115.3-49-g086a9a113
    
    88
    +    # 2.115.3-49-g086a9a113-dirty
    
    86 89
         my $describe
    
    87
    -      = decode_utf8(safe_qx('git', "--git-dir=$git_path", 'describe'));
    
    90
    +      = decode_utf8(safe_qx('git', "--git-dir=$git_path", 'describe', '--dirty'));
    
    88 91
         chomp $describe;
    
    89 92
     
    
    90
    -    my ($guess, $step, $commit) = split(/-/, $describe);
    
    91
    -    return $EMPTY
    
    92
    -      unless defined $step;
    
    93
    -
    
    94
    -    $guess =~ s/ [.] 0 $/.$step/sx;
    
    93
    +    # Modify it to make it a valid native version number and make it
    
    94
    +    # look more debianish like these:
    
    95
    +    # 2.115.3+49commits+git086a9a113
    
    96
    +    # 2.115.3+49commits+git086a9a113+dirty
    
    97
    +    my $guess = $describe;
    
    98
    +    $guess =~ s/ - ( \d+ ) -g /+${1}commits+git/sx;
    
    99
    +    $guess =~ s/ - /+/sxg;
    
    95 100
     
    
    96 101
         return ($guess // $EMPTY);
    
    97 102
     }
    


  • Reply to: