From ae8fcea8097a7609eebb6bdd551ccc03c5ac0745 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Mon, 31 May 2010 19:33:50 -0300 Subject: [PATCH 1/2] make-release: misc fixes RH-Author: Eduardo Habkost Message-id: <20100531193350.GW14354@blackpad.lan.raisama.net> Patchwork-id: 9632 O-Subject: [RHEL6 qemu-kvm PATCH] make-release: misc fixes Bugzilla: This will be applied to the git tree to allow us to generate a clean RPM directly from git. I won't ask for 3 ACKs because it does not affect the binaries we build. Upstream status: submitted (and got a "will apply" from Marcelo on IRC) ----------- From: "Michael S. Tsirkin" This fixes /tmp usage in make-release script for security. Also, create output directory if it does not exist. This also adds a 'tarball' optin to specify output file name. Finally, remote output file before gzip to avoid prompt 'do you want to overwrite'. Signed-off-by: Michael S. Tsirkin --- kvm/scripts/make-release | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) Signed-off-by: Eduardo Habkost --- kvm/scripts/make-release | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) 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" -- 1.7.0.3