[U-Boot-Users] [patch] nicer version handling
Mike Frysinger
vapier at gentoo.org
Fri Jun 22 10:14:07 CEST 2007
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 at 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
More information about the U-Boot
mailing list