File: extend-changelog

package info (click to toggle)
derivations 0.53.20120414-1.2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,208 kB
  • ctags: 486
  • sloc: cpp: 1,634; perl: 600; makefile: 153; sh: 116
file content (86 lines) | stat: -rw-r--r-- 1,705 bytes parent folder | download | duplicates (6)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#! /usr/bin/perl
use warnings;
use strict;
use integer;
use FindBin;
use lib $FindBin::RealBin;
use Def;

# This script adds empty new entries at the changelogs' tops.

our $usage = <<END;
usage: $0 [-dmh]
    -d add only to the Debian changelog
    -m add only to the main changelog
    -h print this usage message
END
our $verdate       = '19700101';
our $date          = 'Thu, 01 Jan 1970 00:00:00 +0000';

our $debian        = "${FindBin::RealBin}/../debian";
our $changelog     = "${FindBin::RealBin}/../doc/changelog";
our $changelog_deb = "${debian}/changelog";

# Read command-line arguments and options.
my @arg;
my %opt;
for ( @ARGV ) {
  if ( my($o) = /^-(\S+)/ ) {
    $opt{$_} = 1 for split //, $o;
  }
  else { push @arg, $_ }
}
if ( $opt{h} || $opt{'?'} ) {
  print $usage;
  exit 0;
}

# Determine which changelogs to add to.
my $do_cl  =                 $opt{m} || !$opt{d}  ;
my $do_cld = -e $debian && ( $opt{d} || !$opt{m} );

# Read the changelogs in.
my( @cl, @cld );
if ( $do_cl  ) {
  open CL, '<', $changelog;
    @cl  = <CL>;
  close CL;
}
if ( $do_cld ) {
  open CL, '<', $changelog_deb;
    @cld = <CL>;
  close CL;
}

# Add changelog entries.
my $ver     = "${Def::basever}.$verdate";
my $ver_deb = "${ver}-1";
unshift @cl , <<END;
${Def::out} ($ver)

  * ${Def::cl_entry_dflt}

 -- ${Def::author} <${Def::email}>  $date

END
unshift @cld, <<END;
${Def::out} ($ver_deb) ${Def::dist}; urgency=${Def::urgency}

  * ${Def::cl_entry_dflt}

 -- ${Def::author} <${Def::email_deb}>  $date

END

# Write the changelogs out.
if ( $do_cl  ) {
  open CL, '>', $changelog;
    print CL @cl;
  close CL;
}
if ( $do_cld ) {
  open CL, '>', $changelog_deb;
    print CL @cld;
  close CL;
}