Skip to contentSkip to conversation

improve scripts/make-release

PATCH In review Gerd Hoffmann 2 participants 2 messages Jul 18, 2012 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 improve scripts/make-release

'make dist' creates a tarball for the current checkout.
'make qemu-${version}.tar.bz2' creates a tarball for git tag v${version}.

---
 Makefile             |    5 ++---
 scripts/make-release |    8 +++++++-
 2 files changed, 9 insertions(+), 4 deletions(-)
Makefile +2 -3
index ab82ef3..4a5f399 100644
@@ -233,9 +233,8 @@ clean:
 	rm -f $$d/qemu-options.def; \
         done
 
-VERSION ?= $(shell cat VERSION)
-
-dist: qemu-$(VERSION).tar.bz2
+dist:
+	$(SRC_PATH)/scripts/make-release "$(SRC_PATH)"
 
 qemu-%.tar.bz2:
 	$(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
scripts/make-release +7 -1
index 196c755..181ca77 100755
@@ -12,11 +12,17 @@
 
 src="$1"
 version="$2"
+if test "$version" = ""; then
+	commit=$(git describe --long)
+	version="${commit#v}"
+else
+	commit="v${version}"
+fi
 destination=qemu-${version}
 
 git clone "${src}" ${destination}
 pushd ${destination}
-git checkout "v${version}"
+git checkout "${commit}"
 git submodule update --init
 rm -rf .git roms/*/.git
 popd
Signature · 1 line
1.7.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Gerd Hoffmann

'make dist' creates a tarball for the current checkout.
'make qemu-${version}.tar.bz2' creates a tarball for git tag v${version}.

---
 Makefile             |    5 ++---
 scripts/make-release |    8 +++++++-
 2 files changed, 9 insertions(+), 4 deletions(-)

+++ b/scripts/make-release

scripts/make-release line 15

Quoted 4 lines
scripts/make-release +1 -0
@@ -12,11 +12,17 @@
 
 src="$1"
 version="$2"
+if test "$version" = ""; then

test ! "$version"

is less typing, and still POSIX compliant.

scripts/make-release line 17

Quoted 2 lines
scripts/make-release +2 -0
+	commit=$(git describe --long)
+	version="${commit#v}"

Sticking with my earlier theme started against Anthony's original implementation of this script, in complaining about inconsistent shell quoting styles, it might look nicer to favor minimal quoting:

commit=$(git describe --long)
version=${commit#v}

or maximal quoting:

commit="$(git describe --long)"
version="${commit#v}"

rather than an ad hoc mix. But as that is cosmetic, and does not impact functionality, you have my:

Signature · 2 lines
Eric Blake   [email protected]    +1-919-301-3266
Libvirt virtualization library http://libvirt.org