diff mbox

make-release: misc fixes

Message ID 20100524131214.GA5872@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michael S. Tsirkin May 24, 2010, 1:12 p.m. UTC
None
diff mbox

Patch

diff --git a/kvm/scripts/make-release b/kvm/scripts/make-release
index 11d9c27..fdc402b 100755
--- a/kvm/scripts/make-release
+++ b/kvm/scripts/make-release
@@ -1,7 +1,7 @@ 
 #!/bin/bash -e
 
 usage() {
-    echo "usage: $0 [--upload] [--formal] commit [name]"
+    echo "usage: $0 [--upload] [--formal] commit [name] [tarball]"
     exit 1
 }
 
@@ -12,7 +12,7 @@  formal=
 
 releasedir=~/sf-release
 [[ -z "$TMP" ]] && TMP="/tmp"
-tmpdir="$TMP/qemu-kvm-make-release.$$"
+tmpdir=`mktemp -d --tmpdir="$TMP" qemu-kvm-make-release.XXXXXXXXXX`
 while [[ "$1" = -* ]]; do
     opt="$1"
     shift
@@ -40,9 +40,15 @@  if [[ -z "$name" ]]; then
     name="$commit"
 fi
 
-tarball="$releasedir/$name.tar"
+tarball="$3"
+if [[ -z "$tarball" ]]; then
+    tarball="$releasedir/$name.tar.gz"
+fi
+#strip trailing .gz if any
+tarball=${tarball/%.gz/}
 
 cd "$(dirname "$0")"/../..
+mkdir -p "$(dirname "$tarball")"
 git archive --prefix="$name/" --format=tar "$commit" > "$tarball"
 
 mkdir -p "$tmpdir"
@@ -59,6 +65,7 @@  if [[ -n "$formal" ]]; then
     rm -rf "$tmpdir"
 fi
 
+rm -f "$tarball.gz"
 gzip -9 "$tarball"
 tarball="$tarball.gz"