aboutsummaryrefslogtreecommitdiff
path: root/hack
diff options
context:
space:
mode:
authorChris Evich <cevich@redhat.com>2021-09-16 16:15:28 -0400
committerChris Evich <cevich@redhat.com>2021-09-21 12:29:26 -0400
commit34043bd81d3c7a84e8be0a69a6b1c3f55d752a21 (patch)
treeec1302c30273a6e9928d4c0097af3750fbaba0e4 /hack
parentd8d494994aba312b21582a4820268ef5f5c15db0 (diff)
downloadpodman-34043bd81d3c7a84e8be0a69a6b1c3f55d752a21.tar.gz
podman-34043bd81d3c7a84e8be0a69a6b1c3f55d752a21.tar.bz2
podman-34043bd81d3c7a84e8be0a69a6b1c3f55d752a21.zip
Fix Error, empty output for info: 'VERSION'
When building releases, the definitive canonical version of podman (or podman-remote) is needed. Previously this was accomplished by scraping `version/version.go`. However, due to tooling differences across platforms, this has proven problematic, unreliable, and hard to maintain. Fix this by building and caching a small golang binary who's only purpose is to print the version number to stdout. This not only provides a quick and reliable way to determine the current version, it also acts as a check on the version API vs tooling that relies on it. Lastly, remove several `RELEASE_*` Makefile definitions which aren't actually used anywhere. These were originally added a very long time ago to serve as part of a long since retired release process. The remaining items, were updated to make use of the new `.podmanversion` binary on an as-required basis (i.e. not every time `make` is run). Signed-off-by: Chris Evich <cevich@redhat.com>
Diffstat (limited to 'hack')
-rwxr-xr-xhack/get_release_info.sh70
1 files changed, 0 insertions, 70 deletions
diff --git a/hack/get_release_info.sh b/hack/get_release_info.sh
deleted file mode 100755
index e1020e677..000000000
--- a/hack/get_release_info.sh
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/env 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 -euo pipefail
-
-cd "${GOSRC:-$(dirname $0)/../}"
-
-valid_args() {
- REGEX='^\s+[[:upper:]]+\*[)]'
- egrep --text --no-filename --group-separator=' ' --only-matching "$REGEX" "$0" | \
- cut -d '*' -f 1
-}
-
-# `git describe` will never produce a useful version number under all
-# branches. This is because the podman release process (see `RELEASE_PROCESS.md`)
-# tags release versions only on release-branches (i.e. never on main).
-# Scraping the version number directly from the source, is the only way
-# to reliably obtain the number from all the various contexts supported by
-# the `Makefile`.
-scrape_version() {
- local v
- # extract the value of 'var Version'
- v=$(sed -ne 's/^var\s\+Version\s\+=\s.*("\(.*\)").*/\1/p' <version/version.go)
- # If it's empty, something has changed in version.go, that would be bad!
- test -n "$v"
- # Value consumed literally, must not have any embedded newlines
- echo -n "$v"
-}
-
-unset OUTPUT
-case "$1" in
- # Wild-card suffix needed by valid_args() e.g. possible bad grep of "$(echo $FOO)"
- VERSION*)
- OUTPUT="${CIRRUS_TAG:-$(scrape_version)}"
- ;;
- 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="podman"
- ;;
- 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