[arch-projects] [mkinitcpio][PATCH 26/26] harden version generation

Dave Reisner d at falconindy.com
Mon Sep 26 21:22:27 EDT 2011


From: Florian Pritz <bluewind at xinu.at>

If you run make dist, extract that tarball somewhere else and try to run
makepkg it will fail because it can't find the git tree anymore.

[Dave: removed --dirty flag, as this breaks makepkg]

Signed-off-by: Florian Pritz <bluewind at xinu.at>
---
 Makefile |    7 +++++--
 PKGBUILD |    4 +---
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 18df47f..1a3a815 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 # Makefile for mkinitcpio
 
-VERSION = $(shell if test -f VERSION; then cat VERSION; else git describe; fi)
+VERSION = $(shell if test -f VERSION; then cat VERSION; else git describe | sed 's/-/./g'; fi)
 
 DIRS = \
 	/bin \
@@ -68,4 +68,7 @@ dist: clean doc
 		${RM} -r mkinitcpio-${VERSION}
 	gzip -9 mkinitcpio-${VERSION}.tar
 
-.PHONY: clean dist install tarball
+version:
+	@echo ${VERSION}
+
+.PHONY: clean dist install tarball version
diff --git a/PKGBUILD b/PKGBUILD
index 2cb6a6d..b5a3217 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,5 @@
-IFS='-' read -r major minor _ < <(git describe)
-
 pkgname=mkinitcpio-git
-pkgver=$major.$minor
+pkgver=$(make version)
 pkgrel=1
 pkgdesc="Modular initramfs image creation utility"
 arch=(any)
-- 
1.7.6.4



More information about the arch-projects mailing list