summaryrefslogtreecommitdiff
path: root/debian/build
blob: 1bd8a50e9d4136ba418e0fc37244f130fcdc01e8 (plain)
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
#!/usr/bin/perl -w

				# Adjust debian/changelog and build a new
				# Debian package of a CVS archive.

				# Written 17 November 1998 by Ben Gertzfield
				# <che@debian.org>

				# This work is released under the GNU
				# General Public License, version 2 or
				# later.

use strict;
use diagnostics;
use File::Copy;

my $maintainer = 'Ben Gertzfield <che@debian.org>';

my @date = localtime;

my $datestr = sprintf("%d%.2d%.2d", $date[5] + 1900, $date[4] + 1, $date[3]);
my $revision = '01';

open (CHANGELOG, 'debian/changelog') or die "Couldn't open debian/changelog: $!\n";

$_ = <CHANGELOG>;
chomp;

close CHANGELOG;

my ($package, $last_date, $last_revision) = /^(.*?) \((.*?)\.(.*)?\)/;

if ($last_date eq $datestr) {
  $revision = sprintf("%.2d", $last_revision + 1);
}

my $new_version = "$datestr.$revision";

copy('debian/changelog', 'debian/changelog.old') or die "Couldn't copy debian/changelog to debian/changelog.old: $!\n";

open(NEWCHANGELOG, ">debian/changelog") or die "Couldn't open debian/changelog for writing: $!\n";

print NEWCHANGELOG "$package ($new_version) unstable; urgency=low\n\n  * CVS snapshot build at " . scalar localtime() . "\n\n -- $maintainer  " . `date -R` . "\n";

open(OLDCHANGELOG, "debian/changelog.old") or die "Couldn't open debian/changelog.old: $!\n";

while (<OLDCHANGELOG>) {
  print NEWCHANGELOG;
}

close OLDCHANGELOG;
close NEWCHANGELOG;

unlink('debian/changelog.old') or die "Couldn't unlink debian/changelog.old: $!\n";

open(NEWVERSION, '>debian/version') or die "Couldn't open debian/version for writing: $!\n";
print NEWVERSION "$new_version\n";
close NEWVERSION;

system('dpkg-buildpackage -b -rfakeroot -us -uc');
unlink 'debian/version' or die "Couldn't unlink debian/version: $!\n";