markusb / pdf-create

Perl module to create PDF files

This URL has Read+Write access

pdf-create / Changes.PL
100755 55 lines (48 sloc) 1.272 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/perl -w
#
# Changes.PL
#
# Create the 'Changes' file automatically from git commit messages
# and versioning tags in the repository.
#
# This script is designed to be run only on the PDF::Create maintainers
# workstation and is not needed to install PDF::Create.
#
 
use strict;
 
#
# Bail out with non-alarming error message if git or the correct repository
# is missing.
#
 
my $user;
my $git=`which git`;
chomp $git;
if (! (-f $git)) {
  printf "Skipping... (git not found/installed)\n";
  exit (0);
}
 
if (! ($user=`git config --get user.name 2>/dev/null`)) {
  printf "Skipping... (git not found/installed)\n";
  exit (0);
}
chop $user;
if ("$user" ne "Markus Baertschi") {
  printf "Skipping... (not on maintainers workstation)\n";
  exit (0);
}
 
open(OUT,">Changes") or die "Can not open 'Changes' for writing\n";
open(IN,"git log --abbrev-commit --pretty |") or die "Problem running git log\n";
while(<IN>){
  # read the change log
  if (/^commit /) {
    chop;
    # for each commit get the version from git
    my $sha=(split(/ /,$_,2))[1];
       $sha =~ s/\.\.\.$//;
    my $vers = `git name-rev --tags $sha 2>/dev/null`;
       $vers =~ s/^.*\///;
       $vers =~ s/~.*$//;
    print "commit $sha... PDF::Create $vers";
  } else {
    print;
  }
}