diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-02-07 11:45:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-02-07 11:45:55 +0000 |
commit | a8220ab2d293bb7f4b014b79d16b2fb05090fa93 (patch) | |
tree | 77f0a30f016c0925cf7ee9292e644bba183c2774 /contrib/rhel/build-netdata-rpm.sh | |
parent | Adding upstream version 1.19.0. (diff) | |
download | netdata-a8220ab2d293bb7f4b014b79d16b2fb05090fa93.tar.xz netdata-a8220ab2d293bb7f4b014b79d16b2fb05090fa93.zip |
Adding upstream version 1.29.0.upstream/1.29.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'contrib/rhel/build-netdata-rpm.sh')
-rwxr-xr-x | contrib/rhel/build-netdata-rpm.sh | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/contrib/rhel/build-netdata-rpm.sh b/contrib/rhel/build-netdata-rpm.sh index df33d8068..9ce3863b9 100755 --- a/contrib/rhel/build-netdata-rpm.sh +++ b/contrib/rhel/build-netdata-rpm.sh @@ -13,24 +13,33 @@ run autoreconf -ivf run ./configure --enable-maintainer-mode run make dist -version=$(grep PACKAGE_VERSION < config.h | cut -d '"' -f 2) -if [ -z "${version}" ] -then - echo >&2 "Cannot find netdata version." - exit 1 +typeset version="$(grep PACKAGE_VERSION < config.h | cut -d '"' -f 2)" +if [[ -z "${version}" ]]; then + run_failed "Cannot find netdata version." + exit 1 fi -tgz="netdata-${version}.tar.gz" -if [ ! -f "${tgz}" ] -then - echo >&2 "Cannot find the generated tar.gz file '${tgz}'" +if [[ "${version//-/}" != "$version" ]]; then + # Remove all -* and _* suffixes to be as close as netdata release + typeset versionfix="${version%%-*}"; versionfix="${versionfix%%_*}" + # Append the current datetime fox a 'unique' build + versionfix+="_$(date '+%m%d%H%M%S')" + # And issue hints & details on why this failed, and how to fix it + run_failed "Current version contains '-' which is fobidden by rpm. You must create a git annotated tag and rerun this script. Exemple:" + run_failed " git tag -a $versionfix -m 'Release by $(id -nu) on $(uname -n)' && $0" + exit 1 +fi + + +typeset tgz="netdata-${version}.tar.gz" +if [[ ! -f "${tgz}" ]]; then + run_failed "Cannot find the generated tar.gz file '${tgz}'" exit 1 fi -srpm=$(run rpmbuild -ts "${tgz}" | cut -d ' ' -f 2) -if [ -z "${srpm}" ] || [ ! -f "${srpm}" ] -then - echo >&2 "Cannot find the generated SRPM file '${srpm}'" +typeset srpm="$(run rpmbuild -ts "${tgz}" | cut -d ' ' -f 2)" +if [[ -z "${srpm}" ]] || ! [[ -f "${srpm}" ]]; then + run_failed "Cannot find the generated SRPM file '${srpm}'" exit 1 fi @@ -44,4 +53,4 @@ fi run rpmbuild --rebuild "${srpm}" -echo >&2 "All done!" +run_ok "All done! Packages created in '$(rpm -E '%_rpmdir/%_arch')'" |