Re: Versioning of tree

Ryan Anderson
2004-10-26T01:50:14Z

On Wed, Oct 20, 2004 at 07:33:47AM -0700, Linus Torvalds wrote:
> Personally, I much rather go the way we have gone, because I don't care
> about module versioning nearly as much as I care about bug-report
> versioning. And if I hear about a bug with 2.6.10-rc1, I want to know that
> it really is at _least_ 2.6.10-rc1, if you see what I mean..

Well, here's a patch that adds -BKxxxxxxxx to LOCALVERSION when a
top-level BitKeeper tree is detected.

Signed-off-by: Ryan Anderson <ryan@michonline.com>

diff -Nru a/Makefile b/Makefile
--- a/Makefile 2004-10-25 19:45:55 -04:00
+++ b/Makefile 2004-10-25 19:45:55 -04:00
@@ -149,6 +149,12 @@
# careful not to include files twice if building in the source
# directory. LOCALVERSION from the command line override all of this

+ifeq ($(shell ls -d $(srctree)/BitKeeper 2>/dev/null),$(srctree)/BitKeeper)
+localversion-bk := $(shell perl $(srctree)/scripts/setlocalversion $(srctree) $(objtree))
+else
+localversion-bk :=
+endif
+
ifeq ($(objtree),$(srctree))
localversion-files := $(wildcard $(srctree)/localversion*)
else
@@ -157,6 +163,7 @@

LOCALVERSION = $(subst $(space),, \
$(shell cat /dev/null $(localversion-files)) \
+ $(subst ",,$(localversion-bk)) \
$(subst ",,$(CONFIG_LOCALVERSION)))

KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)$(LOCALVERSION)
diff -Nru a/scripts/setlocalversion b/scripts/setlocalversion
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/scripts/setlocalversion 2004-10-25 19:45:55 -04:00
@@ -0,0 +1,62 @@
+#!/usr/bin/perl
+# Copyright 2004 - Ryan Anderson <ryan@michonline.com> GPL v2
+
+use strict;
+use warnings;
+use Digest::MD5;
+require 5.006;
+
+if (@ARGV != 2) {
+ print <<EOT;
+Usage: setlocalversion <srctree> <objtree>
+EOT
+ exit(1);
+}
+
+my $debug = 0;
+
+my ($srctree,$objtree) = @ARGV;
+
+my @LOCALVERSIONS = ();
+
+# BitKeeper Version Checks
+
+# We are going to use the following commands to try and determine if
+# this repository is at a Version boundary (i.e, 2.6.10 vs 2.6.10 + some patches)
+# We currently assume that all meaningful version boundaries are marked by a tag.
+# We don't care what the tag is, just that something exists.
+
+#ryan@mythryan2 ~/dev/linux/local$ T=`bk changes -r+ -k`
+#ryan@mythryan2 ~/dev/linux/local$ bk prs -h -d':TAG:\n' -r$T
+
+sub do_bk_checks {
+ chdir($srctree);
+ my $changeset = `bk changes -r+ -k`;
+ chomp $changeset;
+ my $tag = `bk prs -h -d':TAG:' -r'$changeset'`;
+
+ printf("ChangeSet Key = '%s'\nTAG = '%s'\n", $changeset, $tag) if ($debug > 0);
+
+ if (length($tag) == 0) {
+ # We do not have a tag at the Top of Tree, so we need to generate a localversion file
+ # We'll use the given $changeset as input into this.
+ my $localversion = Digest::MD5::md5_hex($changeset);
+ $localversion = substr($localversion,0,8);
+
+ printf("localversion = '%s'\n",$localversion) if ($debug > 0);
+
+ push @LOCALVERSIONS, "BK" . $localversion;
+
+ }
+}
+
+
+if ( -d "BitKeeper" ) {
+ my $bk = `which bk`;
+ chomp $bk;
+ if (length($bk) != 0) {
+ do_bk_checks();
+ }
+}
+
+printf "-%s\n", join("-",@LOCALVERSIONS) if (scalar @LOCALVERSIONS > 0);

--

Ryan Anderson
sometimes Pug Majere