summaryrefslogtreecommitdiff
path: root/hack/get_release_info.sh
diff options
context:
space:
mode:
authorChris Evich <cevich@redhat.com>2019-08-01 07:31:04 -0400
committerChris Evich <cevich@redhat.com>2019-08-28 11:54:06 -0400
commit370b1a887cbf6db8ac893c39118cf8c6c2fd663c (patch)
tree33fb752adc3957916890103fcc8ff68a57b8a1a5 /hack/get_release_info.sh
parent8e46106f420dfc6125750c12e13c5ae39be9d6f1 (diff)
downloadpodman-370b1a887cbf6db8ac893c39118cf8c6c2fd663c.tar.gz
podman-370b1a887cbf6db8ac893c39118cf8c6c2fd663c.tar.bz2
podman-370b1a887cbf6db8ac893c39118cf8c6c2fd663c.zip
Cirrus: Reimplement release archive + upload
The initial implementation was far more complicated than necessary. Strip out the complexities in favor of a simpler and more direct approach. Signed-off-by: Chris Evich <cevich@redhat.com>
Diffstat (limited to 'hack/get_release_info.sh')
-rwxr-xr-xhack/get_release_info.sh54
1 files changed, 54 insertions, 0 deletions
diff --git a/hack/get_release_info.sh b/hack/get_release_info.sh
new file mode 100755
index 000000000..29b4237b4
--- /dev/null
+++ b/hack/get_release_info.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+# This script produces various bits of metadata needed by Makefile. Using
+# a script allows uniform behavior across multiple environments and
+# distributions. The script expects a single argument, as reflected below.
+
+set -e
+
+cd "${GOSRC:-$(dirname $0)/../}"
+
+valid_args() {
+ REGEX='^\s+[[:upper:]]+\*[)]'
+ egrep --text --no-filename --group-separator=' ' --only-matching "$REGEX" "$0" | \
+ cut -d '*' -f 1
+}
+
+unset OUTPUT
+case "$1" in
+ # Wild-card suffix needed by valid_args() e.g. possible bad grep of "$(echo $FOO)"
+ VERSION*)
+ OUTPUT="${CIRRUS_TAG:-$(git fetch --tags && git describe HEAD 2> /dev/null)}"
+ ;;
+ NUMBER*)
+ OUTPUT="$($0 VERSION | sed 's/-.*//')"
+ ;;
+ DIST_VER*)
+ OUTPUT="$(source /etc/os-release; echo $VERSION_ID | cut -d '.' -f 1)"
+ ;;
+ DIST*)
+ OUTPUT="$(source /etc/os-release; echo $ID)"
+ ;;
+ ARCH*)
+ OUTPUT="${GOARCH:-$(go env GOARCH 2> /dev/null)}"
+ ;;
+ BASENAME*)
+ OUTPUT="${CIRRUS_REPO_NAME:-$(basename $(git rev-parse --show-toplevel))}"
+ ;;
+ REMOTENAME*)
+ OUTPUT="$($0 BASENAME)-remote"
+ ;;
+ *)
+ echo "Error, unknown/unsupported argument '$1', valid arguments:"
+ valid_args
+ exit 1
+ ;;
+esac
+
+if [[ -n "$OUTPUT" ]]
+then
+ echo -n "$OUTPUT"
+else
+ echo "Error, empty output for info: '$1'" > /dev/stderr
+ exit 2
+fi