From 29adcec565c5c9919a69eff9d399e9bc61063e55 Mon Sep 17 00:00:00 2001 From: Alex Demidoff Date: Fri, 22 Nov 2024 16:59:58 +0300 Subject: [PATCH] PMM-13487 Use full_commit for the hash as well --- build/packages/rpm/server/SPECS/pmm-ui.spec | 4 ---- build/scripts/build-server-rpm | 15 ++++++++------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/build/packages/rpm/server/SPECS/pmm-ui.spec b/build/packages/rpm/server/SPECS/pmm-ui.spec index ea9991190f..c8fd25eecf 100644 --- a/build/packages/rpm/server/SPECS/pmm-ui.spec +++ b/build/packages/rpm/server/SPECS/pmm-ui.spec @@ -28,10 +28,6 @@ pmm-ui is the frontend application for pmm-managed. %setup -q -n %{repo}-%{commit} %build -export PMM_RELEASE_VERSION=%{full_pmm_version} -export PMM_RELEASE_FULLCOMMIT=%{commit} -export PMM_RELEASE_BRANCH="" - make -C ui release %install diff --git a/build/scripts/build-server-rpm b/build/scripts/build-server-rpm index 3c66d0a690..ba409fee08 100755 --- a/build/scripts/build-server-rpm +++ b/build/scripts/build-server-rpm @@ -53,6 +53,7 @@ prepare_spec() { local spec_name=$1 local repo_name=$2 local spec_file=${rpmbuild_dir}/${spec_name}.spec + local full_commit= mkdir -p ${rpms_dir} ${rpmbuild_dir} 2>/dev/null || : cp ${rpmspec_dir}/${spec_name}.spec ${spec_file} @@ -66,7 +67,12 @@ prepare_spec() { fi local git_dir=$(dirname $(find "${root_dir}/sources/${repo_name}" -name .git | head -1)) - local full_commit=$(git -C "${git_dir}" rev-parse HEAD) + if [ "${spec_name}" = "pmm-ui" ]; then + full_commit=$(get_shasum256 "${git_dir}/ui") + else + full_commit=$(git -C "${git_dir}" rev-parse HEAD) + fi + local short_commit=${full_commit:0:7} local tar_archive=${rpmbuild_dir}/${repo_name}-${short_commit}.tar.gz @@ -75,12 +81,7 @@ prepare_spec() { exit 1 fi - if [ "${spec_name}" = "pmm-ui" ]; then - local hash=$(get_shasum256 "${git_dir}/ui") - sed -i -e "s/global commit.*/global commit ${hash:0:7}/" ${spec_file} - else - sed -i -e "s/global commit.*/global commit ${full_commit}/" ${spec_file} - fi + sed -i -e "s/global commit.*/global commit ${full_commit}/" ${spec_file} if [ "${spec_name}" != "grafana" ]; then sed -i -e "s/Version:.*/Version: ${pmm_version}/" ${spec_file}