summaryrefslogtreecommitdiff
path: root/hack/get_release_info.sh
diff options
context:
space:
mode:
authorChris Evich <cevich@redhat.com>2021-04-08 08:55:56 -0400
committerChris Evich <cevich@redhat.com>2021-04-12 10:19:51 -0400
commit0e83851f080f67a7008f43136e46195a0a658819 (patch)
treea25c828d5f179399c78390ff7d4bb37e59afa737 /hack/get_release_info.sh
parent5a703bbf7a73ef4ab3ee99db885c206abf773a49 (diff)
downloadpodman-0e83851f080f67a7008f43136e46195a0a658819.tar.gz
podman-0e83851f080f67a7008f43136e46195a0a658819.tar.bz2
podman-0e83851f080f67a7008f43136e46195a0a658819.zip
Simplify Makefile help target
An in-line Python script, while flexible, is arguably more complex and less stable than the long-lived `grep`, `awk`, and `printf`. Make use of these simple tools to display a column-aligned table of target and description help output. Also, the first target that appears in a Makefile is considered the default (when no target is specified on the command-line). However, despite it's name, the `default` target was not listed first. Fix this, and redefine "default" target to "all" as intended, instead of "help". Lastly, add a small workaround for a vim syntax-hilighting bug. Signed-off-by: Chris Evich <cevich@redhat.com>
Diffstat (limited to 'hack/get_release_info.sh')
-rwxr-xr-xhack/get_release_info.sh18
1 files changed, 13 insertions, 5 deletions
diff --git a/hack/get_release_info.sh b/hack/get_release_info.sh
index 40c473246..b3e208ac9 100755
--- a/hack/get_release_info.sh
+++ b/hack/get_release_info.sh
@@ -14,12 +14,20 @@ valid_args() {
cut -d '*' -f 1
}
-# `git describe` does not reliably produce a useful version number.
+# `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 master).
+# 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 versionfile='version/version.go'
- local version_line=$(grep -m 1 'var Version =' $versionfile)
- local version_string=$(cut -d '"' -f 2 <<<"$version_line")
- echo "$version_string" | tr -d '[:space:]'
+ 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