Home | History | Annotate | Download | only in debian
      1 #!/usr/bin/perl -w
      2 
      3 				# Adjust debian/changelog and build a new
      4 				# Debian package of a CVS archive.
      5 
      6 				# Written 17 November 1998 by Ben Gertzfield
      7 				# <che (at] debian.org>
      8 
      9 				# This work is released under the GNU
     10 				# General Public License, version 2 or
     11 				# later.
     12 
     13 use strict;
     14 use diagnostics;
     15 use File::Copy;
     16 
     17 my $maintainer = 'Ben Gertzfield <che (at] debian.org>';
     18 
     19 my @date = localtime;
     20 
     21 my $datestr = sprintf("%d%.2d%.2d", $date[5] + 1900, $date[4] + 1, $date[3]);
     22 my $revision = '01';
     23 
     24 open (CHANGELOG, 'debian/changelog') or die "Couldn't open debian/changelog: $!\n";
     25 
     26 $_ = <CHANGELOG>;
     27 chomp;
     28 
     29 close CHANGELOG;
     30 
     31 my ($package, $last_date, $last_revision) = /^(.*?) \((.*?)\.(.*)?\)/;
     32 
     33 if ($last_date eq $datestr) {
     34   $revision = sprintf("%.2d", $last_revision + 1);
     35 }
     36 
     37 my $new_version = "$datestr.$revision";
     38 
     39 copy('debian/changelog', 'debian/changelog.old') or die "Couldn't copy debian/changelog to debian/changelog.old: $!\n";
     40 
     41 open(NEWCHANGELOG, ">debian/changelog") or die "Couldn't open debian/changelog for writing: $!\n";
     42 
     43 print NEWCHANGELOG "$package ($new_version) unstable; urgency=low\n\n  * CVS snapshot build at " . scalar localtime() . "\n\n -- $maintainer  " . `date -R` . "\n";
     44 
     45 open(OLDCHANGELOG, "debian/changelog.old") or die "Couldn't open debian/changelog.old: $!\n";
     46 
     47 while (<OLDCHANGELOG>) {
     48   print NEWCHANGELOG;
     49 }
     50 
     51 close OLDCHANGELOG;
     52 close NEWCHANGELOG;
     53 
     54 unlink('debian/changelog.old') or die "Couldn't unlink debian/changelog.old: $!\n";
     55 
     56 open(NEWVERSION, '>debian/version') or die "Couldn't open debian/version for writing: $!\n";
     57 print NEWVERSION "$new_version\n";
     58 close NEWVERSION;
     59 
     60 system('dpkg-buildpackage -b -rfakeroot -us -uc');
     61 unlink 'debian/version' or die "Couldn't unlink debian/version: $!\n";
     62 
     63