diff mbox

improve scripts/make-release

Message ID 1342621904-25303-1-git-send-email-kraxel@redhat.com
State New
Headers show

Commit Message

Gerd Hoffmann July 18, 2012, 2:31 p.m. UTC
'make dist' creates a tarball for the current checkout.
'make qemu-${version}.tar.bz2' creates a tarball for git tag v${version}.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 Makefile             |    5 ++---
 scripts/make-release |    8 +++++++-
 2 files changed, 9 insertions(+), 4 deletions(-)

Comments

Eric Blake July 18, 2012, 2:41 p.m. UTC | #1
On 07/18/2012 08:31 AM, Gerd Hoffmann wrote:
> 'make dist' creates a tarball for the current checkout.
> 'make qemu-${version}.tar.bz2' creates a tarball for git tag v${version}.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  Makefile             |    5 ++---
>  scripts/make-release |    8 +++++++-
>  2 files changed, 9 insertions(+), 4 deletions(-)

> +++ b/scripts/make-release
> @@ -12,11 +12,17 @@
>  
>  src="$1"
>  version="$2"
> +if test "$version" = ""; then

test ! "$version"

is less typing, and still POSIX compliant.

> +	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:

Reviewed-by: Eric Blake <eblake@redhat.com>
diff mbox

Patch

diff --git a/Makefile b/Makefile
index ab82ef3..4a5f399 100644
--- a/Makefile
+++ b/Makefile
@@ -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,%,$@)"
diff --git a/scripts/make-release b/scripts/make-release
index 196c755..181ca77 100755
--- a/scripts/make-release
+++ b/scripts/make-release
@@ -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