3 # Adjust debian/changelog and build a new
4 # Debian package of a CVS archive.
6 # Written 17 November 1998 by Ben Gertzfield
9 # This work is released under the GNU
10 # General Public License, version 2 or
17 my $maintainer = 'Ben Gertzfield <che@debian.org>';
21 my $datestr = sprintf("%d%.2d%.2d", $date[5] + 1900, $date[4] + 1, $date[3]);
24 open (CHANGELOG, 'debian/changelog') or die "Couldn't open debian/changelog: $!\n";
31 my ($package, $last_date, $last_revision) = /^(.*?) \((.*?)\.(.*)?\)/;
33 if ($last_date eq $datestr) {
34 $revision = sprintf("%.2d", $last_revision + 1);
37 my $new_version = "$datestr.$revision";
39 copy('debian/changelog', 'debian/changelog.old') or die "Couldn't copy debian/changelog to debian/changelog.old: $!\n";
41 open(NEWCHANGELOG, ">debian/changelog") or die "Couldn't open debian/changelog for writing: $!\n";
43 print NEWCHANGELOG "$package ($new_version) unstable; urgency=low\n\n * CVS snapshot build at " . scalar localtime() . "\n\n -- $maintainer " . `date -R` . "\n";
45 open(OLDCHANGELOG, "debian/changelog.old") or die "Couldn't open debian/changelog.old: $!\n";
47 while (<OLDCHANGELOG>) {
54 unlink('debian/changelog.old') or die "Couldn't unlink debian/changelog.old: $!\n";
56 open(NEWVERSION, '>debian/version') or die "Couldn't open debian/version for writing: $!\n";
57 print NEWVERSION "$new_version\n";
60 system('dpkg-buildpackage -b -rfakeroot -us -uc');
61 unlink 'debian/version' or die "Couldn't unlink debian/version: $!\n";