mirror of https://gerrit.osmocom.org/libosmocore
osmo-release.sh: Check LIBVERSION matches rpm *.spec.in
Change-Id: I7b8d56cc255167407370c888647255d8992f4202
This commit is contained in:
parent
01312215fa
commit
e6230eff90
106
osmo-release.sh
106
osmo-release.sh
|
@ -9,10 +9,11 @@ fi
|
||||||
|
|
||||||
ALLOW_NO_LIBVERSION_CHANGE="${ALLOW_NO_LIBVERSION_CHANGE:-0}"
|
ALLOW_NO_LIBVERSION_CHANGE="${ALLOW_NO_LIBVERSION_CHANGE:-0}"
|
||||||
ALLOW_NO_LIBVERSION_DEB_MATCH="${ALLOW_NO_LIBVERSION_DEB_MATCH:-0}"
|
ALLOW_NO_LIBVERSION_DEB_MATCH="${ALLOW_NO_LIBVERSION_DEB_MATCH:-0}"
|
||||||
|
ALLOW_NO_LIBVERSION_RPM_MATCH="${ALLOW_NO_LIBVERSION_RPM_MATCH:-0}"
|
||||||
# Test stuff but don't modify stuff:
|
# Test stuff but don't modify stuff:
|
||||||
DRY_RUN="${DRY_RUN:-0}"
|
DRY_RUN="${DRY_RUN:-0}"
|
||||||
|
|
||||||
libversion_to_deb_major() {
|
libversion_to_lib_major() {
|
||||||
libversion="$1"
|
libversion="$1"
|
||||||
current="$(echo "$libversion" | cut -d ":" -f 1)"
|
current="$(echo "$libversion" | cut -d ":" -f 1)"
|
||||||
#revision="$(echo "$libversion" | cut -d ":" -f 2)"
|
#revision="$(echo "$libversion" | cut -d ":" -f 2)"
|
||||||
|
@ -124,40 +125,10 @@ check_debian_patch_apply() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
BUMPVER=`command -v bumpversion`
|
libversion_deb_match() {
|
||||||
GIT_TOPDIR="$(git rev-parse --show-toplevel)"
|
|
||||||
NEW_VER=`bumpversion --list --current-version $VERSION $REL --allow-dirty | awk -F '=' '{ print $2 }'`
|
|
||||||
LIBVERS=`git grep -n LIBVERSION | grep '=' | grep am | grep -v LDFLAGS`
|
|
||||||
MAKEMOD=`git diff --cached -GLIBVERSION --stat | grep Makefile.am`
|
|
||||||
ISODATE=`date -I`
|
|
||||||
|
|
||||||
if [ "z$BUMPVER" = "z" ]; then
|
|
||||||
echo Unable to find 'bumpversion' command.
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "z$NEW_VER" = "z" ]; then
|
|
||||||
echo "Please fix versioning to match http://semver.org/ spec (current is $VERSION) before proceeding."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Releasing $VERSION -> $NEW_VER..."
|
|
||||||
|
|
||||||
check_configureac_debctrl_deps_match
|
|
||||||
check_configureac_rpmspecin_deps_match
|
|
||||||
check_debian_patch_apply
|
|
||||||
|
|
||||||
if [ "z$LIBVERS" != "z" ]; then
|
|
||||||
if [ "z$MAKEMOD" = "z" ] && [ "z$ALLOW_NO_LIBVERSION_CHANGE" = "z0" ]; then
|
|
||||||
echo "ERROR: Before releasing, please modify some of the libversions: $LIBVERS"
|
|
||||||
echo "You should NOT be doing this unless you've read and understood following article:"
|
|
||||||
echo "https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ "z$ALLOW_NO_LIBVERSION_DEB_MATCH" = "z0" ]; then
|
|
||||||
echo "$LIBVERS" | while read -r line; do
|
echo "$LIBVERS" | while read -r line; do
|
||||||
libversion=$(echo "$line" | cut -d "=" -f 2 | tr -d "[:space:]")
|
libversion=$(echo "$line" | cut -d "=" -f 2 | tr -d "[:space:]")
|
||||||
major="$(libversion_to_deb_major "$libversion")"
|
major="$(libversion_to_lib_major "$libversion")"
|
||||||
file_matches="$(find "${GIT_TOPDIR}/debian" -name "lib*${major}.install" | wc -l)"
|
file_matches="$(find "${GIT_TOPDIR}/debian" -name "lib*${major}.install" | wc -l)"
|
||||||
if [ "z$file_matches" = "z0" ]; then
|
if [ "z$file_matches" = "z0" ]; then
|
||||||
echo "ERROR: Found no matching debian/lib*$major.install file for LIBVERSION=$libversion"
|
echo "ERROR: Found no matching debian/lib*$major.install file for LIBVERSION=$libversion"
|
||||||
|
@ -195,6 +166,75 @@ if [ "z$LIBVERS" != "z" ]; then
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
libversion_rpmspecin_match() {
|
||||||
|
echo "$LIBVERS" | while read -r line; do
|
||||||
|
libversion=$(echo "$line" | cut -d "=" -f 2 | tr -d "[:space:]")
|
||||||
|
major="$(libversion_to_lib_major "$libversion")"
|
||||||
|
|
||||||
|
control_matches="$(grep -e "%files" "${GIT_TOPDIR}/contrib/"*.spec.in | grep "lib" | grep "$major$" | wc -l)"
|
||||||
|
if [ "z$control_matches" = "z0" ]; then
|
||||||
|
echo "ERROR: Found no matching '%files -n lib*$major' in contrib/*.spec.in for LIBVERSION=$libversion"
|
||||||
|
exit 1
|
||||||
|
elif [ "z$control_matches" = "z1" ]; then
|
||||||
|
echo "OK: Found '%files -n lib*$major' in contrib/*.spec.in for LIBVERSION=$libversion"
|
||||||
|
else
|
||||||
|
echo "WARN: Found $file_matches files matching '%files -n lib*$major' in contrib/*.spec.in for LIBVERSION=$libversion, manual check required!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
control_matches="$(grep -e "_libdir" "${GIT_TOPDIR}/contrib/"*.spec.in | grep "/lib" | grep "so.$major" | wc -l)"
|
||||||
|
if [ "z$control_matches" = "z0" ]; then
|
||||||
|
echo "ERROR: Found no matching '%_libdir/lib*.so.$major*' in contrib/*.spec.in for LIBVERSION=$libversion"
|
||||||
|
exit 1
|
||||||
|
elif [ "z$control_matches" = "z1" ]; then
|
||||||
|
echo "OK: Found '%_libdir/lib*.so.$major*' in contrib/*.spec.in for LIBVERSION=$libversion"
|
||||||
|
else
|
||||||
|
echo "WARN: Found $file_matches files matching '%_libdir/lib*.so.$major*' in contrib/*.spec.in for LIBVERSION=$libversion, manual check required!"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# catch and forward exit from pipe subshell "while read":
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BUMPVER=`command -v bumpversion`
|
||||||
|
GIT_TOPDIR="$(git rev-parse --show-toplevel)"
|
||||||
|
NEW_VER=`bumpversion --list --current-version $VERSION $REL --allow-dirty | awk -F '=' '{ print $2 }'`
|
||||||
|
LIBVERS=`git grep -n LIBVERSION | grep '=' | grep am | grep -v LDFLAGS`
|
||||||
|
MAKEMOD=`git diff --cached -GLIBVERSION --stat | grep Makefile.am`
|
||||||
|
ISODATE=`date -I`
|
||||||
|
|
||||||
|
if [ "z$BUMPVER" = "z" ]; then
|
||||||
|
echo Unable to find 'bumpversion' command.
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "z$NEW_VER" = "z" ]; then
|
||||||
|
echo "Please fix versioning to match http://semver.org/ spec (current is $VERSION) before proceeding."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Releasing $VERSION -> $NEW_VER..."
|
||||||
|
|
||||||
|
check_configureac_debctrl_deps_match
|
||||||
|
check_configureac_rpmspecin_deps_match
|
||||||
|
check_debian_patch_apply
|
||||||
|
|
||||||
|
if [ "z$LIBVERS" != "z" ]; then
|
||||||
|
if [ "z$MAKEMOD" = "z" ] && [ "z$ALLOW_NO_LIBVERSION_CHANGE" = "z0" ]; then
|
||||||
|
echo "ERROR: Before releasing, please modify some of the libversions: $LIBVERS"
|
||||||
|
echo "You should NOT be doing this unless you've read and understood following article:"
|
||||||
|
echo "https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ "z$ALLOW_NO_LIBVERSION_DEB_MATCH" = "z0" ]; then
|
||||||
|
libversion_deb_match
|
||||||
|
fi
|
||||||
|
if [ "z$ALLOW_NO_LIBVERSION_RPM_MATCH" = "z0" ]; then
|
||||||
|
libversion_rpmspecin_match
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue