File fix-purge-kernel-with-git-versioning.patch of Package mkinitrd.openSUSE_13.1_Update

@@ -, +, @@ 
---
 sbin/purge-kernels | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
--- a/sbin/purge-kernels	
+++ a/sbin/purge-kernels	
@@ -144,11 +144,15 @@ sub sort_versions {
 	return @versions;
 }
 
-# return true if VER1 is a prefix of VER2 (to handle the .x rebuild counter)
+# return true if VER1 == VER2 or VER1 == (VER2 minus rebuild counter)
 sub version_match {
 	my ($ver1, $ver2) = @_;
 
-	return ($ver1 eq substr($ver2, 0, length($ver1)));
+	return 1 if $ver1 eq $ver2;
+
+	# copied from kernel-source/rpm/kernel-spec-macros
+	$ver2 =~ s/\.[0-9]+($|\.[^.]*[^.0-9][^.]*$)/$1/;
+	return $ver1 eq $ver2;
 }
 
 sub list_old_versions {
-- 
openSUSE Build Service is sponsored by