[Git][debian-gis-team/hdf5][master] hdf5-mpi.pc as slave of mpi alternatives
Gilles Filippini
gitlab at salsa.debian.org
Thu Mar 19 12:44:05 GMT 2020
Gilles Filippini pushed to branch master at Debian GIS Project / hdf5
Commits:
523da19a by Gilles Filippini at 2020-03-18T12:45:40+01:00
hdf5-mpi.pc as slave of mpi alternatives
- - - - -
9 changed files:
- debian/changelog
- debian/control
- debian/control.in
- debian/libhdf5-flavor-dev.postinst.in
- debian/libhdf5-flavor-dev.prerm.in
- − debian/libhdf5-mpi-dev.links.in
- − debian/libhdf5-mpi-dev.postinst.in
- − debian/libhdf5-mpi-dev.prerm.in
- debian/rules
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,13 @@
+hdf5 (1.10.6+repack-1~exp5) experimental; urgency=medium
+
+ * libhdf5-mpi-dev: drop the hdf5-mpi.pc link to the related pkgconfig
+ file for the architectures's default mpi implementation
+ * libhdf5-<mpi-flavor>-dev: provide hdf5-mpi.pc link to the related
+ pkgconfig file via update-alternative as a slave of the mpi alternative
+ (closes: #953021)
+
+ -- Gilles Filippini <pini at debian.org> Wed, 18 Mar 2020 12:43:10 +0100
+
hdf5 (1.10.6+repack-1~exp4) experimental; urgency=medium
* libhdf5-mpi-dev: add hdf5-mpi.pc link to the pkg-config file of the
=====================================
debian/control
=====================================
@@ -272,6 +272,7 @@ Depends: libhdf5-openmpi-103-1 (= ${binary:Version}),
libopenmpi-dev,
${misc:Depends}
Suggests: libhdf5-doc
+Breaks: libhdf5-mpi-dev (= 1.10.6+repack-1~exp4)
Description: HDF5 - development files - OpenMPI version
Hierarchical Data Format 5 (HDF5) is a file format and library for
storing scientific data. HDF5 was designed and implemented to address
@@ -402,6 +403,7 @@ Depends: libhdf5-mpich-103-1 (= ${binary:Version}),
libmpich-dev,
${misc:Depends}
Suggests: libhdf5-doc
+Breaks: libhdf5-mpi-dev (= 1.10.6+repack-1~exp4)
Description: HDF5 - development files - MPICH2 version
Hierarchical Data Format 5 (HDF5) is a file format and library for
storing scientific data. HDF5 was designed and implemented to address
=====================================
debian/control.in
=====================================
@@ -272,6 +272,7 @@ Depends: libhdf5-openmpi- at SONAME@@EXT@ (= ${binary:Version}),
libopenmpi-dev,
${misc:Depends}
Suggests: libhdf5-doc
+Breaks: libhdf5-mpi-dev (= 1.10.6+repack-1~exp4)
Description: HDF5 - development files - OpenMPI version
Hierarchical Data Format 5 (HDF5) is a file format and library for
storing scientific data. HDF5 was designed and implemented to address
@@ -402,6 +403,7 @@ Depends: libhdf5-mpich- at SONAME@@EXT@ (= ${binary:Version}),
libmpich-dev,
${misc:Depends}
Suggests: libhdf5-doc
+Breaks: libhdf5-mpi-dev (= 1.10.6+repack-1~exp4)
Description: HDF5 - development files - MPICH2 version
Hierarchical Data Format 5 (HDF5) is a file format and library for
storing scientific data. HDF5 was designed and implemented to address
=====================================
debian/libhdf5-flavor-dev.postinst.in
=====================================
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
set -e
@@ -12,6 +12,51 @@ fi
update-alternatives \
--install /usr/lib/@MULTIARCH@/pkgconfig/hdf5.pc hdf5.pc /usr/lib/@MULTIARCH@/pkgconfig/hdf5- at FLAVOR@.pc @UA_PRIORITY_FLAVOR@ \
+# Install hdf5-mpi.pc as a new slave of the 'mpi' alternatives
+# See #953021
+# There is no way to simply add a new slave. We must parse the existing
+# mpi alternatives, then reinstall the whole related alternative plus the
+# wanted --slave part
+if [ "@FLAVOR@" != "serial" ]; then
+ # Parse existing mpi alternatives
+ mpi_alt=$(update-alternatives --query mpi)
+ mpi_alt_sig=$(echo "$mpi_alt" | sed '/^$/q')
+ mpi_alt_impl=$(echo "$mpi_alt" | sed -n -e '\!^Alternative: /usr/bin/mpicc. at FLAVOR@!p' -e '0,\!^Alternative: /usr/bin/mpicc. at FLAVOR@!d' -e '/^$/q' -e 'p')
+ mpi_impl_priority=$(echo "$mpi_alt_impl" | sed -n '/^Priority: /{s/Priority: \(.*\)$/\1/;p}')
+ declare -A slave_links
+ while read slave; do
+ slave_links[${slave%% *}]="${slave#* }"
+ done < <(echo "$mpi_alt_sig" | sed -n '/Slaves:/{: while;n;s/^ //;T end;p;b while;: end;q}')
+ declare -A slave_targets
+ while read slave; do
+ slave_targets[${slave%% *}]="${slave#* }"
+ done < <(echo "$mpi_alt_impl" | sed -n '/Slaves:/{: while;n;s/^ //;T end;p;b while;: end;q}')
+ # At this point:
+ # * slave_links holds all the slaves name,link pairs
+ # * slave_targets holds all the slaves name,target pairs for our mpi flavor
+ # Construct the slaves related part of the update-alternatives command
+ current_slaves=
+ for key in "${!slave_targets[@]}"; do
+ # Do not keep the 'hdf5-mpi.pc' slave for idempotency
+ if [ "$key" = "hdf5-mpi.pc" ]; then
+ continue
+ fi
+ current_slaves="$current_slaves --slave ${slave_links[$key]} $key ${slave_targets[$key]}"
+ done
+ # Re-install the whole alternative plus our 'hdf5-mpi.pc' slave
+ update-alternatives --install /usr/bin/mpicc mpi /usr/bin/mpicc. at FLAVOR@ "$mpi_impl_priority" $current_slaves --slave /usr/lib/@MULTIARCH@/pkgconfig/hdf5-mpi.pc hdf5-mpi.pc /usr/lib/@MULTIARCH@/pkgconfig/hdf5- at FLAVOR@.pc
+ # Corner case:
+ # When we have no installed libhdf5-<mpi>-dev for the currently configured mpi alternative
+ # we have to provide a dummy hdf5-mpi.pc to enable installing this choice into the hdf5.pc alternatives
+ if [ ! -h /usr/lib/@MULTIARCH@/pkgconfig/hdf5-mpi.pc ]; then
+ ln -s /dev/null /usr/lib/@MULTIARCH@/pkgconfig/hdf5-mpi.pc
+ fi
+ # Install the hdf5-mpi.pc choice into the hdf5.pc alternatives
+ update-alternatives --install /usr/lib/@MULTIARCH@/pkgconfig/hdf5.pc hdf5.pc /usr/lib/@MULTIARCH@/pkgconfig/hdf5-mpi.pc @UA_PRIORITY_MPI@
+fi
+
#DEBHELPER#
exit 0
+
+
=====================================
debian/libhdf5-flavor-dev.prerm.in
=====================================
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
set -e
@@ -9,6 +9,54 @@ if [ "$1" != "upgrade" ]; then
fi
update-alternatives \
--remove hdf5.pc /usr/lib/@MULTIARCH@/pkgconfig/hdf5- at FLAVOR@.pc
+
+ # Remove the slave hdf5-mpi.pc from the related 'mpi' flavor alternative
+ # See #953021
+ # There is no way to simply remove slave. We must parse the existing
+ # mpi alternatives, then reinstall the whole related alternative minus
+ # the unwanted --slave part
+ if [ "@FLAVOR@" != "serial" ]; then
+ # Parse existing mpi alternatives
+ mpi_alt=$(update-alternatives --query mpi)
+ mpi_alt_sig=$(echo "$mpi_alt" | sed '/^$/q')
+ mpi_alt_impl=$(echo "$mpi_alt" | sed -n -e '\!^Alternative: /usr/bin/mpicc. at FLAVOR@!p' -e '0,\!^Alternative: /usr/bin/mpicc. at FLAVOR@!d' -e '/^$/q' -e 'p')
+ mpi_impl_priority=$(echo "$mpi_alt_impl" | sed -n '/^Priority: /{s/Priority: \(.*\)$/\1/;p}')
+ declare -A slave_links
+ while read slave; do
+ slave_links[${slave%% *}]="${slave#* }"
+ done < <(echo "$mpi_alt_sig" | sed -n '/Slaves:/{: while;n;s/^ //;T end;p;b while;: end;q}')
+ declare -A slave_targets
+ while read slave; do
+ slave_targets[${slave%% *}]="${slave#* }"
+ done < <(echo "$mpi_alt_impl" | sed -n '/Slaves:/{: while;n;s/^ //;T end;p;b while;: end;q}')
+ # At this point:
+ # * slave_links holds all the slaves name,link pairs
+ # * slave_targets holds all the slaves name,target pairs for our mpi flavor
+ # Construct the slaves related part of the update-alternatives command
+ current_slaves=
+ for key in "${!slave_targets[@]}"; do
+ # Do not keep the 'hdf5-mpi.pc' slave (we want it removed)
+ if [ "$key" = "hdf5-mpi.pc" ]; then
+ continue
+ fi
+ current_slaves="$current_slaves --slave ${slave_links[$key]} $key ${slave_targets[$key]}"
+ done
+ # Re-install the whole alternative minus our 'hdf5-mpi.pc' slave
+ update-alternatives --install /usr/bin/mpicc mpi /usr/bin/mpicc. at FLAVOR@ "$mpi_impl_priority" $current_slaves
+
+ # Finally, re-parse the mpi alternatives
+ # If there is no 'hdf5-mpi.pc' slave left we have to remove this choice from
+ # the hdf5.pc alternatives
+ mpi_alt=$(update-alternatives --query mpi)
+ mpi_alt_sig=$(echo "$mpi_alt" | sed '/^$/q')
+ declare -A slave_links_left
+ while read slave; do
+ slave_links_left[${slave%% *}]="${slave#* }"
+ done < <(echo "$mpi_alt_sig" | sed -n '/Slaves:/{: while;n;s/^ //;T end;p;b while;: end;q}')
+ if [ -z "${slave_links_left[hdf5-mpi.pc]}" ]; then
+ update-alternatives --remove hdf5.pc /usr/lib/@MULTIARCH@/pkgconfig/hdf5-mpi.pc
+ fi
+ fi
fi
#DEBHELPER#
=====================================
debian/libhdf5-mpi-dev.links.in deleted
=====================================
@@ -1 +0,0 @@
-usr/lib/@MULTIARCH@/pkgconfig/hdf5- at DEFAULT_MPI@.pc usr/lib/@MULTIARCH@/pkgconfig/hdf5-mpi.pc
=====================================
debian/libhdf5-mpi-dev.postinst.in deleted
=====================================
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-set -e
-
-update-alternatives \
- --install /usr/lib/@MULTIARCH@/pkgconfig/hdf5.pc hdf5.pc /usr/lib/@MULTIARCH@/pkgconfig/hdf5-mpi.pc @UA_PRIORITY_MPI@ \
-
-#DEBHELPER#
-
-exit 0
=====================================
debian/libhdf5-mpi-dev.prerm.in deleted
=====================================
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-set -e
-
-if [ "$1" != "upgrade" ]; then
- update-alternatives \
- --remove hdf5.pc /usr/lib/@MULTIARCH@/pkgconfig/hdf5-mpi.pc
-fi
-
-#DEBHELPER#
-
-exit 0
=====================================
debian/rules
=====================================
@@ -186,7 +186,7 @@ sonames:
info: VARIABLES := package pkgversion upstreamversion libversion $(foreach interface,$(INTERFACES),SONAME$(istr))
info: VARIABLES += FLAVORS DH_OPTIONS DEBIAN_OUT
info: VARIABLES += $(foreach flavor,serial openmpi mpich,PACKAGES_$(flavor))
-info: VARIABLES += UA_PRIORITY_SERIAL UA_PRIORITY_MPI UA_PRIORITY_OPENMPI UA_PRIORITY_MPICH
+info: VARIABLES += UA_PRIORITY_serial UA_PRIORITY_mpi UA_PRIORITY_openmpi UA_PRIORITY_mpich
info:
@$(foreach var,$(VARIABLES), echo "$(shell printf "%30s" "$(var)") = $($(var))" &&) true
View it on GitLab: https://salsa.debian.org/debian-gis-team/hdf5/-/commit/523da19a64f483ccf76fa2c4ffb88b65bd44641d
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/hdf5/-/commit/523da19a64f483ccf76fa2c4ffb88b65bd44641d
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20200319/e63bb49d/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list