Package: cvs-autoreleasedeb Version: 0.12-1 Attached patch number 4: Safer changelog parsing: - Look only at the first line. - Do not depend on the exact package name (svn package name may be different than what listed in changelog.) - If version field is not parsable, use 'UNKNOWN' - Also chomp new lines when reading state file.
-- Oron Peled Voice: +972-4-8228492 o...@actcom.co.il http://users.actcom.co.il/~oron "In theory, it's practical. In practice - it's only a theory".
Index: trunk/debian/changelog =================================================================== --- trunk/debian/changelog (revision 299) +++ trunk/debian/changelog (revision 300) @@ -1,3 +1,15 @@ +cvs-autoreleasedeb (0.12-1.4) unstable; urgency=low + + * Non-maintainer upload. + * Safer changelog parsing: + - Look only at the first line. + - Do not depend on the exact package name (svn package name + may be different than what listed in changelog. E.g: kernel) + - If version field is not parsable, use 'UNKNOWN' + * Also chomp new lines when reading state file. + + -- Oron Peled <o...@actcom.co.il> Tue, 15 Dec 2009 19:34:01 +0200 + cvs-autoreleasedeb (0.12-1.3) unstable; urgency=low * Non-maintainer upload. Index: trunk/svn-autoreleasedeb =================================================================== --- trunk/svn-autoreleasedeb (revision 299) +++ trunk/svn-autoreleasedeb (revision 300) @@ -347,6 +347,7 @@ _exit 3; } while (<STATE>) { + chomp; my ($s,$p,$v,$buildstate) = split(/;/, $_); $state_struct->{$s}{$p} = $v; $prev_build_state{$s}{$p} = (defined $buildstate) ? $buildstate : 'UNKONWN'; @@ -408,7 +409,14 @@ print $cmd."\n"; my $changelog = `$cmd`; my $version; - ($version = $changelog) =~ s/^$p \((.+?)\).+$/$1/s; + my $pkgname; + ($changelog) = split(/\n/, $changelog); + ($pkgname, $version, undef) = split(/\s+/, $changelog); + if(defined($version) && $version =~ /^\((.*)\)$/) { + $version = $1; + } else { + $version = 'UNKNOWN'; + } my $prev_build_state = $prev_build_state{$s}{$p}; print "Package $p in version $version (prev_build=$prev_build_state)\n"; $newstate_struct->{$s}{$p} = $version;