public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [patch] nicer version handling
Date: Fri, 22 Jun 2007 04:14:07 -0400	[thread overview]
Message-ID: <200706220414.07990.vapier@gentoo.org> (raw)

this patch adds support to the setlocalversion script for u-boot in subversion
repos and for 'localversion-' version files like the kernel

ive also fixed up the version target in the toplevel Makefile so that it only
updates the $(VERSION_FILE) as needed so that it wont wrongly trigger rebuilds
in files that include version.h

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
diff --git a/Makefile b/Makefile
index 2d8cff3..41661e3 100644
--- a/Makefile
+++ b/Makefile
@@ -290,11 +290,15 @@ $(U_BOOT_NAND):	$(NAND_SPL) $(obj)u-boot.bin
 		cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
 
 version:
-		@echo -n "#define U_BOOT_VERSION \"U-Boot " > $(VERSION_FILE); \
-		echo -n "$(U_BOOT_VERSION)" >> $(VERSION_FILE); \
-		echo -n $(shell $(CONFIG_SHELL) $(TOPDIR)/tools/setlocalversion \
-			 $(TOPDIR)) >> $(VERSION_FILE); \
-		echo "\"" >> $(VERSION_FILE)
+		@echo -n "#define U_BOOT_VERSION \"U-Boot " > $(VERSION_FILE).tmp; \
+		echo -n "$(U_BOOT_VERSION)" >> $(VERSION_FILE).tmp; \
+		echo -n "$(shell $(CONFIG_SHELL) $(TOPDIR)/tools/setlocalversion $(TOPDIR))" >> $(VERSION_FILE).tmp; \
+		echo "\"" >> $(VERSION_FILE).tmp
+		@if ! cmp -s $(VERSION_FILE) $(VERSION_FILE).tmp; then \
+			mv -f $(VERSION_FILE).tmp $(VERSION_FILE); \
+		else \
+			rm -f $(VERSION_FILE).tmp; \
+		fi
 
 gdbtools:
 		$(MAKE) -C tools/gdb all || exit 1
diff --git a/tools/setlocalversion b/tools/setlocalversion
index 9a23825..25072fd 100755
--- a/tools/setlocalversion
+++ b/tools/setlocalversion
@@ -20,3 +20,11 @@ if head=`git rev-parse --verify HEAD 2>/dev/null`; then
 		printf '%s' -dirty
 	fi
 fi
+
+# Check for svn and a svn repo.
+if rev=`svn info 2>/dev/null | grep '^Revision' | awk '{print $NF}'` ; then
+	printf -- '-svn%s' $rev
+fi
+
+# Check for any localversion-* files
+printf '%s' "`cat localversion-* 2>/dev/null`"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20070622/0dba35b0/attachment.pgp 

             reply	other threads:[~2007-06-22  8:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-22  8:14 Mike Frysinger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-01-12  5:50 [U-Boot-Users] [patch] nicer version handling Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200706220414.07990.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox