diff --git a/make_deb b/make_deb index 94d42ad11..19d79e64c 100755 --- a/make_deb +++ b/make_deb @@ -124,6 +124,7 @@ echo -n "Populating the package and updating version file..." cd "${package_name}" cp -R ${GIT_ROOT}/packages/Debian/* . sed -i "s/Version: 0.0.0/Version: ${version}/g" DEBIAN/control +if [[ ${branch_name} = "main" ]] || [[ ${branch_name} =~ ^[0-9]+\.[0-9]+\.[0-9]+RC ]]; then echo "Build: ${git_tag_info:1}" >> DEBIAN/control; fi echo "Done." diff --git a/make_rpm b/make_rpm index 2065bf1a6..c1188b198 100755 --- a/make_rpm +++ b/make_rpm @@ -87,9 +87,11 @@ fi version=`cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[" ,]//g'` BUILD_ROOT="${GIT_ROOT}/packages/build" - +git_tag_info=$(git describe --tags | sed 's/-/_/g') && commit_count=$(echo ${git_tag_info} | cut -d_ -f2) || { commit_count=$(git rev-list --count HEAD); git_tag_info="v$version_$commit_count_$(git rev-parse --short HEAD)"; } +branch_name=$(git rev-parse --abbrev-ref HEAD) +if [[ ${branch_name} = "main" ]] || [[ ${branch_name} =~ ^[0-9]+\.[0-9]+\.[0-9]+RC ]]; then commit_count=1; fi # Final package name -package_name="fledge-gui-${version}" +package_name="fledge-gui-${version}-${commit_count}" arch=`arch` @@ -129,12 +131,14 @@ cd "${package_name}" cp -R ${GIT_ROOT}/packages/RPM/* . sed -i "s/__VERSION__/${version}/g" SPECS/fledge-gui.spec sed -i "s/__ARCH__/${arch}/g" SPECS/fledge-gui.spec +sed -i "s/__RELEASE__/${commit_count}/g" SPECS/fledge-gui.spec +sed -i "s/__VCS__/${git_tag_info:1}/g" SPECS/fledge-gui.spec echo "Done." mkdir BUILDROOT cd BUILDROOT -mkdir -p ${package_name}-1.${arch} -cd ${package_name}-1.${arch} +mkdir -p ${package_name}.${arch} +cd ${package_name}.${arch} # sed -i 's/dist/\/usr\/share\/nginx\/html/g' ${GIT_ROOT}/dist/nginx.conf diff --git a/packages/RPM/SPECS/fledge-gui.spec b/packages/RPM/SPECS/fledge-gui.spec index 30efadd41..97d890ac3 100644 --- a/packages/RPM/SPECS/fledge-gui.spec +++ b/packages/RPM/SPECS/fledge-gui.spec @@ -1,13 +1,14 @@ Name: fledge-gui Vendor: Dianomic Systems Inc. Version: __VERSION__ -Release: 1 +Release: __RELEASE__ BuildArch: __ARCH__ Summary: Fledge GUI License: Apache License Group: IoT URL: http://www.dianomic.com Requires: nginx +VCS: __VCS__ %description Fledge GUI