[PATCH] Auto-localversion doesn't detect tags correctly

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

 



The first version of scripts/setlocalversion failed to notice tags
correctly, and such would always append the -gXXXXXXXX version
identifier.  This converts it to use git-rev-parse and the magic
notation to reduce a tag to the commit it refers to ("$tag^0").

Signed-off-by: Ryan Anderson <[email protected]>

Index: linux-git/scripts/setlocalversion
===================================================================
--- linux-git.orig/scripts/setlocalversion	2005-09-13 04:03:19.000000000 -0400
+++ linux-git/scripts/setlocalversion	2005-09-13 04:17:28.000000000 -0400
@@ -36,13 +36,38 @@ sub do_git_checks {
 	chomp $head;
 	close(H);
 
-	opendir(D,".git/refs/tags") or return;
+	unless (opendir(D,".git/refs/tags")) {
+		warn "Failed to open .git/refs/tags : " . $!;
+		return;
+	}
 	foreach my $tagfile (grep !/^\.{1,2}$/, readdir(D)) {
-		open(F,"<.git/refs/tags/" . $tagfile) or return;
+		unless (open(F,"<",".git/refs/tags/" . $tagfile)) {
+			warn "Failed to open .git/refs/tags/$tagfile : " . $!;
+			return;
+		}
 		my $tag = <F>;
 		chomp $tag;
 		close(F);
-		return if ($tag eq $head);
+
+		local(*oldstderr) = *STDERR;
+		open(STDERR,">","/dev/null")
+			or die "Failed to reopen stderr: $!";
+
+		unless (open(P,"-|","git-rev-parse",sprintf("%s^0",$tag))) {
+			*STDERR = *oldstderr;
+			die "Failed to open pipe from git-rev-parse: $!";
+		}
+
+		*STDERR = *oldstderr;
+
+		my $commit = <P>;
+		chomp $commit;
+
+		if ($tag eq $head) {
+			warn "$tagfile refers to commit $head (maybe indirectly)";
+			return;
+		}
+		#return if ($tag eq $head);
 	}
 	closedir(D);
 
-- 

Ryan Anderson
  sometimes Pug Majere
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux