File: version.pl

package info (click to toggle)
colorize 0.67-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 804 kB
  • sloc: ansic: 1,828; perl: 764; makefile: 31; sh: 7
file content (24 lines) | stat: -rwxr-xr-x 432 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl

use strict;
use warnings;

my $version = '';

# git repository
if (system('which git >/dev/null 2>&1') == 0
and system('git ls-files colorize.c --error-unmatch >/dev/null 2>&1') == 0) {
    $version = `git describe --tags --dirty`;
    $version =~ s/\n$//g;
}

if (length $version) {
    print <<"EOT";
const char *const version = "$version";
EOT
}
else {
    print <<'EOT';
const char *const version = NULL;
EOT
}