rev 8637 - in trunk/packages/kdebase/debian: . patches

Fathi Boudra fabo at alioth.debian.org
Sat Dec 29 16:59:30 UTC 2007


Author: fabo
Date: 2007-12-29 16:59:30 +0000 (Sat, 29 Dec 2007)
New Revision: 8637

Added:
   trunk/packages/kdebase/debian/patches/00_detect-autoconf.diff
Modified:
   trunk/packages/kdebase/debian/changelog
Log:
Add patch to fix detect-autoconf.pl script: compare versions properly.


Modified: trunk/packages/kdebase/debian/changelog
===================================================================
--- trunk/packages/kdebase/debian/changelog	2007-12-29 16:48:38 UTC (rev 8636)
+++ trunk/packages/kdebase/debian/changelog	2007-12-29 16:59:30 UTC (rev 8637)
@@ -1,11 +1,18 @@
-kdebase (4:3.5.8.dfsg.1-5) unstable; urgency=low
+kdebase (4:3.5.8.dfsg.1-5) UNRELEASED; urgency=low
 
-   * Cut old changelog lines shorter to shut up lintian.
-   * Replace full gfdl license text in debian/copyright with
-     a pointer to /usr/share/common-licenses
-   * Add and update lintian overrides
-   * Remove Homepage from kdeprint and konqueror descriptions
+  +++ Changes by Sune Vuorela:
 
+  * Cut old changelog lines shorter to shut up lintian.
+  * Replace full gfdl license text in debian/copyright with a pointer to
+    /usr/share/common-licenses.
+  * Add and update lintian overrides.
+  * Remove Homepage from kdeprint and konqueror descriptions.
+
+  +++ Changes by Fathi Boudra:
+
+  * Add patch to fix detect-autoconf.pl script: compare automake version
+    properly.
+
  -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Fri, 28 Dec 2007 23:29:33 +0100
 
 kdebase (4:3.5.8.dfsg.1-4) unstable; urgency=low

Added: trunk/packages/kdebase/debian/patches/00_detect-autoconf.diff
===================================================================
--- trunk/packages/kdebase/debian/patches/00_detect-autoconf.diff	                        (rev 0)
+++ trunk/packages/kdebase/debian/patches/00_detect-autoconf.diff	2007-12-29 16:59:30 UTC (rev 8637)
@@ -0,0 +1,150 @@
+--- a/admin/detect-autoconf.pl
++++ b/admin/detect-autoconf.pl
+@@ -21,6 +21,73 @@
+     return "";
+ }
+ 
++# Subroutine to lexicographically compare two version strings, a and b.
++# If a > b, 1 is returned.
++# If a == b, 0 is returned.
++# If a < b, -1 is returned.
++#
++# If the strings are of uneven number length then the shorter string is
++# prepended by enough zeroes to make the two string lengths equal in order to
++# allow an accurate comparison.  Note that the zero-padding only occurs in
++# between version separators (i.e. 1.6 and 1.10, results in 1.06 vs. 1.10).
++# Parts of the version ending in -foo (or any other text) are not considered
++# when doing the compare. (i.e. 2.53a vs 2.53 doesn't end up in 2.53a vs.
++# 2.053)
++sub compareVersions
++{
++    my ($a, $b) = @_;
++
++    # Split the strings up by '.' (version separator) and start comparing digit
++    # length.
++
++    my @aParts = split(/\./, $a);
++    my @bParts = split(/\./, $b);
++
++    # Make the arrays equal in length by adding missing zeroes to the end of the
++    # version.
++    push @aParts, '0' while scalar @aParts < scalar @bParts;
++    push @bParts, '0' while scalar @bParts < scalar @aParts;
++
++    # Now compare each individual portion.
++    for (my $i = 0; $i < scalar @aParts; ++$i)
++    {
++	# Make sure that any portion that has numbers is contiguous.  I'm sure
++	# there's a technique for saving stuff like 2.52a2 but I don't feel
++	# like implementing it.
++	if ($aParts[$i] !~ /^[^\d]*\d+[^\d]*$/ or
++	    $bParts[$i] !~ /^[^\d]*\d+[^\d]*$/)
++	{
++	    die "Not able to compare $a to $b!\n";
++	}
++
++	my ($aDigits) = ($aParts[$i] =~ /(\d+)/);
++	my ($bDigits) = ($bParts[$i] =~ /(\d+)/);
++
++	# Perl is $MODERATELY_INSULTING_TERM, don't remove the parentheses in
++	# the delta calculation below.
++	my $delta = (length $aDigits) - (length $bDigits);
++	if ($delta < 0) # b is longer
++	{
++	    my $replacement = ('0' x (-$delta)) . $aDigits;
++	    $aParts[$i] =~ s/$aDigits/$replacement/;
++	}
++	elsif ($delta > 0) # a is longer
++	{
++	    my $replacement = ('0' x $delta) . $bDigits;
++	    $bParts[$i] =~ s/$bDigits/$replacement/;
++	}
++    }
++
++    # Arrays now have standardized version components, let's re-merge them
++    # to strings to do the compare.
++    my $newA = join('.', @aParts);
++    my $newB = join('.', @bParts);
++
++    return 1 if ($newA gt $newB);
++    return -1 if ($newA lt $newB);
++    return 0;
++}
++
+ # Subroutine to determine the highest installed version of the given program,
+ # searching from the given paths.
+ sub findBest
+@@ -29,9 +96,10 @@
+     my $best_version_found = '0'; # Deliberately a string.
+     my %versions;
+     my %minimumVersions = (
+- 	'autoconf' => '2.5',
++	'autoconf' => '2.5',
+ 	'automake' => '1.6',
+     );
++    my $sgn; # Used for compareVersions results.
+ 
+     # Allow user to use environment variable to override search.
+     return $ENV{uc $program} if $ENV{uc $program};
+@@ -45,9 +113,11 @@
+ 	    next unless -x $file;
+ 
+ 	    ($version) = $file =~ /$prefix\/$program-?(.*)$/;
+-	    $version =~ s/-|\.//g;
+-	    # Don't check the -wrapper ones
+-	    next if $version eq "wrapper";
++
++	    # Don't check the -wrapper ones (or any other non program one).
++	    # The real deal should start with a version number, or have no
++	    # suffix at all.
++	    next if $version =~ /^[^\d]/;
+ 
+ 	    # Special case some programs to make sure it has a minimum version.
+ 	    if (not $version and exists $minimumVersions{$program})
+@@ -56,15 +126,20 @@
+ 		my $versionOutput = `$program --version 2>/dev/null | head -n 1`;
+ 
+ 		# If we can't run the script to get the version it likely won't work later.
+-		next unless $versionOutput; 
++		next unless $versionOutput;
+ 
+ 		# Use number.number for version (we don't need the excess in general).
+-		($versionOutput) = ($versionOutput =~ /(\d\.\d)/);
++		($versionOutput) = ($versionOutput =~ /(\d+\.\d+)/);
++
++		# compareVersions returns -1 if the left argument is less than
++		# the right argument.  It can also die for invalid input so
++		# wrap with eval.
++		eval {
++		    $sgn = compareVersions($versionOutput, $min_version);
++		};
+ 
+-		# Use lt to do lexicographical comparison of strings (which should be
+-		# equivalent and doesn't involve issues with floating point conversions).
+-		if (not $versionOutput or $versionOutput lt $min_version)
+-		{
++		# $@ would be set if an error was encountered.
++		if ($@ or not $versionOutput or $sgn == -1) {
+ 		    next;
+ 		}
+ 	    }
+@@ -80,7 +155,12 @@
+ 	    $versions{$version} = $file;
+ 
+ 	    # Use string comparison so that e.g. 253a will be > 253 but < 254.
+-	    if ($version gt $best_version_found)
++	    # See above about the need for eval.
++	    eval {
++		$sgn = compareVersions($version, $best_version_found);
++	    };
++
++	    if (not $@ and $sgn == 1)
+ 	    {
+ 		$best_version_found = $version;
+ 	    }
+@@ -173,3 +253,5 @@
+ EOF
+ 
+ exit 0;
++
++# vim: set noet ts=8 sw=4:




More information about the pkg-kde-commits mailing list