#!/usr/bin/perl
# Usage
# Accepts a debian/changelog file as input
# Example
#  $0 libcompress-raw-zlib-perl/libcompress-raw-zlib-perl-2.012/debian/changelog
	
$/="\n\nl";
my $begin=1;
my $date=`date -R`;

while (<>) {
if (/^(\S+)\s+\((\S+)\)\s+([^;]+)(.*)$/s && $begin) { 
   my $name = $1;
   my $version = $2;
   
   $version =~ s/\+lenny//;
   $version =~ s/lenny//;
   $version =~ s/~debian.*//;
   print <<EOF;
$name (${version}maemo1) fremantle; urgency=low

  * New Maemo packaging

EOF
   print " -- Nito Martinez <Nito\@Qindel.ES>  $date\n\nl";
   print "$_";
  $begin=0;
} else {
  print "$_" ;
}
}
