diff --git a/hdf5.changes b/hdf5.changes index 05ccb41..abed9cc 100644 --- a/hdf5.changes +++ b/hdf5.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Jan 29 22:05:44 UTC 2021 - Egbert Eich + +- Fix update_so_version.sh, write so versions to file being included. + ------------------------------------------------------------------- Fri Nov 6 10:41:02 UTC 2020 - Ana Guerrero Lopez diff --git a/hdf5.spec b/hdf5.spec index 2dbe751..1fc6a27 100644 --- a/hdf5.spec +++ b/hdf5.spec @@ -1,7 +1,7 @@ # # spec file for package hdf5 # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -412,14 +412,8 @@ ExclusiveArch: do_not_build %define vname %{pname} %endif -# TODO: The so numbers autodetected by update_so_version.sh -# do not match the so numbers that are actually built. -%define sonum 103 -%define sonum_CXX 103 -%define sonum_F 102 -%define sonum_HL 100 -%define sonum_HL_CXX 100 -%define sonum_HL_F 100 +# Run 'sh ./update_so_version.sh' when updating hdf5! +%include %{_sourcedir}/so_versions Name: %{package_name} Version: %vers @@ -429,7 +423,7 @@ License: BSD-3-Clause Group: Productivity/Scientific/Other URL: https://www.hdfgroup.org/HDF5/ Source0: https://www.hdfgroup.org/ftp/HDF5/releases/%{pname}-%{short_ver}/%{pname}-%{src_ver}/src/%{pname}-%{src_ver}.tar.bz2 -Source100: _multibuild +Source100: so_versions Source1000: update_so_version.sh Patch0: hdf5-LD_LIBRARY_PATH.patch # not really needed but we want to get noticed if hdf5 doesn' t know our host diff --git a/so_versions b/so_versions new file mode 100644 index 0000000..7717fb4 --- /dev/null +++ b/so_versions @@ -0,0 +1,6 @@ +%define sonum 103 +%define sonum_CXX 103 +%define sonum_F 102 +%define sonum_HL 100 +%define sonum_HL_CXX 100 +%define sonum_HL_F 100 diff --git a/update_so_version.sh b/update_so_version.sh index 4d94ae5..3148129 100644 --- a/update_so_version.sh +++ b/update_so_version.sh @@ -6,15 +6,10 @@ exit_error() exit 1 } -dbg() -{ - echo "dbg: $@" >&2 -} - cleanup() { - rm -f lt_vers.sh sonum_spec.sed - rm -f hdf5.spec.tmp + rm -f ${spectmp} + rm -f ${shtmp} } ## We are going to parse these variables from tarball: @@ -24,47 +19,46 @@ cleanup() # LT_HL_VERS_INTERFACE # LT_HL_CXX_VERS_INTERFACE # LT_HL_F_VERS_INTERFACE -# LT_TOOLS_VERS_INTERFACE cleanup -VER="$(grep -m1 "^Version:" hdf5.spec)" || exit_error "can't grep version" +spectmp=$(mktemp hdf-XXXX.spec) +shtmp=$(mktemp lt-XXXX.sh) +outtmp=$(mktemp so-XXXX) +sed -e "s/@BUILD_FLAVOR@/standard/" hdf5.spec > ${spectmp} +VER="$(rpmspec --define "_sourcedir $(pwd)" -P ${spectmp} | grep -m1 "^Version:")" || \ + exit_error "can't grep version" read x VER <<<$VER -SRC="$(grep -m1 "^Source0:" hdf5.spec)" || exit_error "can't grep source" +SRC="$(rpmspec --define "_sourcedir $(pwd)" -P ${spectmp} | grep -m1 "^Source0:")" || \ + exit_error "can't grep source" read x SRC <<<$SRC SRC=$(basename "$SRC" | sed "s/%{version}/$VER/") test -f "$SRC" || exit_error "tarball '$SRC' does not exist" -dbg "inspecting $SRC" tar --wildcards -x -O -f "$SRC" "*/config/lt_vers.am" \ | tr -d ' \t' \ - | grep "^LT_.*INTERFACE=" \ - > lt_vers.sh \ + | grep -E "^LT_.*INTERFACE=|^LT_.*AGE=" \ + > ${shtmp} \ || exit_error "can't grep interface versions" -# we expect exactly 7 variables -. lt_vers.sh || exit_error "can't source lt_vers.sh" -test $(wc -l < lt_vers.sh) -le "7" \ - || exit_error "more than 7 vars found, update this script!" +source ./${shtmp} || exit_error "can't source ${shtmp}" -for infix in "" _CXX _F _HL _HL_CXX _HL_F _TOOLS; do - var="LT${infix}_VERS_INTERFACE" - test "${!var}" -gt 0 || exit_error "$var='${!var}' bad or undefined" - dbg "update $var=${!var}" - def_sonum="sonum${infix}" - # create sed scripts for spec file - echo "s/^%define $def_sonum .*/%define $def_sonum ${!var}/" >> sonum_spec.sed +for infix in "" _CXX _F _HL _HL_CXX _HL_F; do + current="LT${infix}_VERS_INTERFACE" + age="LT${infix}_VERS_AGE" + currv=$(eval "echo \$$current") + agev=$(eval "echo \$$age") + if [ -n "$currv" -a -n "$agev" ]; then + echo %define sonum${infix} $((currv - agev)) >> ${outtmp} + else + rm -f ${outtmp} + cleanup + exit 1 + fi done -# update spec file if needed -sed -f sonum_spec.sed hdf5.spec > hdf5.spec.tmp -if diff -q hdf5.spec.tmp hdf5.spec &>/dev/null; then - dbg "hdf5.spec was up-to-date" -else - mv hdf5.spec.tmp hdf5.spec - echo "hdf5.spec updated" >&2 -fi - +[ -e ${outtmp} ] && mv ${outtmp} so_versions + cleanup