#!/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' /dev/stderr exit 2 fi