get_snapshot: Set the application and modules versions for snapshots
This commit is contained in:
parent
0eb59e7efb
commit
c7c245e1a9
36
get_snapshot
36
get_snapshot
|
@ -27,8 +27,6 @@ done
|
|||
: ${UPSTREAM_GIT_URL:=https://github.com/Icinga/$PROJECT.git}
|
||||
: ${UPSTREAM_GIT_BRANCH:=master}
|
||||
|
||||
workdir=`pwd`
|
||||
|
||||
set -x
|
||||
|
||||
if [ -z "$UPSTREAM_GIT_NOREPO" ]; then
|
||||
|
@ -58,13 +56,41 @@ fi
|
|||
|
||||
git_version=$(git describe --tags "${UPSTREAM_GIT_BRANCH}")
|
||||
package_version=$(echo "$git_version" | sed -e 's/^v//' -e 's/-/./g')
|
||||
tarball="${workdir}/${PROJECT}-${package_version}.tar"
|
||||
prefix="${PROJECT}-${package_version}"
|
||||
tarball="${prefix}.orig.tar"
|
||||
|
||||
git archive --format=tar --prefix="${PROJECT}-${package_version}/" -o "${tarball}" "${UPSTREAM_GIT_BRANCH}"
|
||||
git archive --format=tar --prefix="${prefix}/" -o "../${tarball}" "${UPSTREAM_GIT_BRANCH}"
|
||||
|
||||
cd ../
|
||||
|
||||
# create files with the properly set versions for snapshot
|
||||
rm -rf "${prefix:?}/"
|
||||
|
||||
mkdir -p "${prefix}"/library/Icinga/Application
|
||||
sed -e "s~const VERSION.*~const VERSION = '${package_version}';~" \
|
||||
"${PROJECT}.git"/library/Icinga/Application/Version.php \
|
||||
> "${prefix}"/library/Icinga/Application/Version.php
|
||||
|
||||
for module in $(cd "${PROJECT}.git/modules"; ls); do
|
||||
test -e "${PROJECT}.git/modules/${module}/module.info" || continue
|
||||
mkdir -p "${prefix}/modules/${module}"
|
||||
sed -e "s~^Version:.*~Version: ${package_version}~" \
|
||||
"${PROJECT}.git/modules/${module}/module.info" \
|
||||
> "${prefix}/modules/${module}/module.info"
|
||||
done
|
||||
|
||||
# add to tarball and remove tmpdir
|
||||
tar --append -f "${tarball}" "${prefix}"/
|
||||
rm -rf "${prefix:?}/"
|
||||
|
||||
# pack tarball
|
||||
gzip -vf9 "${tarball}"
|
||||
sha256sum "${tarball}.gz"
|
||||
|
||||
# store package version for build scripts
|
||||
echo -e "${package_version}\t$(git rev-parse "${UPSTREAM_GIT_BRANCH}")\t$(basename "${tarball}.gz")\t${UPSTREAM_GIT_BRANCH}" > "${workdir}/${PROJECT}.version"
|
||||
printf '%s\t%s\t%s\t%s' \
|
||||
"${package_version}" \
|
||||
"$(git rev-parse "${UPSTREAM_GIT_BRANCH}")" \
|
||||
"$(basename "${tarball}.gz")" \
|
||||
"${UPSTREAM_GIT_BRANCH}" \
|
||||
> "${PROJECT}.version"
|
||||
|
|
Loading…
Reference in New Issue