[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Understanding versioning.



On Sun, Nov 6, 2011 at 11:09 PM, Harry Putnam <reader@newsguy.com> wrote:
> Camaleón <noelamac@gmail.com> writes:
>> http://www.debian.org/doc/debian-policy/ch-controlfields.html
>
>  > epoch
>
>> This is a single (generally small) unsigned integer. It may be omitted,
>> in which case zero is assumed. If it is omitted then the upstream_version
>> may not contain any colons.
>>
>> It is provided to allow mistakes in the version numbers of older versions
>> of a package, and also a package's previous version numbering schemes, to
>> be left behind.
>
> What does that non-sensical sounding explanation mean?  Its not as if
> it is explained at the URL cited.
>
> I'm sure its perfectly reasonable if you know enough about debian
> generally, but if not it sounds kind of off the wall.
>
> Can you show an example of how it works?
Hi,

bash-completion has a clear example of use:
See /usr/share/doc/bash-completion/changelog.Debian.gz
After bash-completion (20080705) version the next version is 1.0, so
epoch had to be used

busybox has another example (developper simply upload an package with
incorrect version):
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=97290

You can have fun time investigating which packages you have installed
has epoch in their version and why they have it, running attached perl
script ( I was boring this night ...)

Regards
#!/usr/bin/perl -w
use strict;

if ( not -e "/usr/bin/dpkg-parsechangelog" )
{
	printf "You need dpkg-parsechangelog (in dpkg-dev package)";
	exit 1;
}

my @packages_version=`aptitude search --disable-columns "?and(?version(:),?installed)" -F"%p"`;
my %revised;
chomp @packages_version;
my $tmpfile = "/tmp/changelog.tmp";
foreach my $package (sort @packages_version)
{
	my $found=0;
	if ( -e "/usr/share/doc/$package/changelog.Debian.gz" )
	{
		my $md5sum=`md5sum /usr/share/doc/$package/changelog.Debian.gz`;
		chomp $md5sum; $md5sum=~s/\s+.*//;
		if (defined ($revised{$md5sum})) 
		{
			printf "Skipping $package, shared changelog\n"; next;
		}
		$revised{$md5sum}=1;
		`zcat /usr/share/doc/$package/changelog.Debian.gz >	$tmpfile`;
	}
	elsif ( -f "/usr/share/doc/$package/changelog.gz" )
	{
		my $md5sum=`md5sum /usr/share/doc/$package/changelog.gz`;
		chomp $md5sum; $md5sum=~s/\s+.*//;
		if (defined ($revised{$md5sum})) 
		{
			printf "Skipping $package, shared changelog\n"; next;
		}
		$revised{$md5sum}=1;
		`zcat /usr/share/doc/$package/changelog.gz > $tmpfile`
	}
	else
	{
		printf "Didn't find $package changelog\n";
		next;
	}
	printf "Examining $package changelog \n";
	open my $changelog,"$tmpfile" or die ;

	my $new_version="";
	my $version="";
	while  (<$changelog>)
	{
		if (/ \((\d[^)]*)\) .*urgency=/)
		{
			$new_version=$version;
			$version=$1;
			if ($new_version =~ /:/ and	$version !~ /:/)
			{
				system (qq(dpkg-parsechangelog --from "$version" --to "$new_version" -l$tmpfile));
				$found=1;
				last;
			}
		}
	}
	if ($found == 0)
	{
		print "Didn't find version with epoch in $package changelog, maybe source package is different ...\n";
	}
}
unlink "$tmpfile";

Reply to: