summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Stakenvicius <axs@gentoo.org>2016-07-25 12:15:27 -0400
committerIan Stakenvicius <axs@gentoo.org>2016-07-25 12:21:27 -0400
commit739172f697490fcb8eff44e3d94ff94b867cfaa2 (patch)
tree09ecc047b610c4ad4bea9c3db9e29208a06ea3a7 /sys-fs/eudev/eudev-4.9999.ebuild
parentsys-fs/dmraid: ensure REPLACING_VERSIONS is handled when it is a list (diff)
downloadgentoo-739172f697490fcb8eff44e3d94ff94b867cfaa2.tar.gz
gentoo-739172f697490fcb8eff44e3d94ff94b867cfaa2.tar.bz2
gentoo-739172f697490fcb8eff44e3d94ff94b867cfaa2.zip
sys-fs/eudev: ensure REPLACING_VERSIONS is processed as a list
REPLACING_VERSIONS is used in eudev ebuilds during pkg_postinst to determine when udevadm control --reload should be called: - when it is a new installation of udev - when it is a re-emerge of the same version (or a revision-only upgrade) REPLACING_VERSIONS *should* only ever have zero or one values, but it is theoretically possible for it to have more than that if, for instance, a previous upgrade failed to complete during qmerge. If this is the case, and only one of the multiple versions match the version of the ebuild, then we also abort as we don't know which one is the "good" one. Also removed duplicate code that reloads the hwdb (looks like it was a copy-paste from sys-fs/udev) Bug: http://bugs.gentoo.org/589530 Package-Manager: portage-2.2.28
Diffstat (limited to 'sys-fs/eudev/eudev-4.9999.ebuild')
-rw-r--r--sys-fs/eudev/eudev-4.9999.ebuild51
1 files changed, 26 insertions, 25 deletions
diff --git a/sys-fs/eudev/eudev-4.9999.ebuild b/sys-fs/eudev/eudev-4.9999.ebuild
index 57d3d7624eb2..2d2964029fba 100644
--- a/sys-fs/eudev/eudev-4.9999.ebuild
+++ b/sys-fs/eudev/eudev-4.9999.ebuild
@@ -184,44 +184,45 @@ pkg_postinst() {
ewarn "else losetup may be confused when looking for unused devices."
fi
+ # https://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
+ # https://bugs.gentoo.org/246847
+ # https://bugs.gentoo.org/514174
+ enewgroup input
+
+ # REPLACING_VERSIONS should only ever have zero or 1 values but in case it doesn't,
+ # process it as a list. We only care about the zero case (new install) or the case where
+ # the same version is being re-emerged. If there is a second version, allow it to abort.
+ local rv rvres=doitnew
+ for rv in ${REPLACING_VERSIONS} ; do
+ if [[ ${rvres} == doit* ]]; then
+ if [[ ${rv%-r*} == ${PV} ]]; then
+ rvres=doit
+ else
+ rvres=${rv}
+ fi
+ fi
+ done
+
if use hwdb && has_version 'sys-apps/hwids[udev]'; then
udevadm hwdb --update --root="${ROOT%/}"
# https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
# reload database after it has be rebuilt, but only if we are not upgrading
# also pass if we are -9999 since who knows what hwdb related changes there might be
- if [[ ${REPLACING_VERSIONS%-r*} == ${PV} || -z ${REPLACING_VERSIONS} ]] && \
- [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
+ if [[ ${rvres} == doit* ]] && [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
udevadm control --reload
fi
fi
-
- ewarn
- ewarn "You need to restart eudev as soon as possible to make the"
- ewarn "upgrade go into effect:"
- ewarn "\t/etc/init.d/udev --nodeps restart"
+ if [[ ${rvres} != doitnew ]]; then
+ ewarn
+ ewarn "You need to restart eudev as soon as possible to make the"
+ ewarn "upgrade go into effect:"
+ ewarn "\t/etc/init.d/udev --nodeps restart"
+ fi
elog
elog "For more information on eudev on Gentoo, writing udev rules, and"
elog "fixing known issues visit:"
elog " https://www.gentoo.org/doc/en/udev-guide.xml"
elog
-
- # https://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
- # https://bugs.gentoo.org/246847
- # https://bugs.gentoo.org/514174
- enewgroup input
-
- # Update hwdb database in case the format is changed by udev version.
- if has_version 'sys-apps/hwids[udev]'; then
- udevadm hwdb --update --root="${ROOT%/}"
- # Only reload when we are not upgrading to avoid potential race w/ incompatible hwdb.bin and the running udevd
- if [[ -z ${REPLACING_VERSIONS} ]]; then
- # https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
- if [[ ${ROOT} != "" ]] && [[ ${ROOT} != "/" ]]; then
- return 0
- fi
- udevadm control --reload
- fi
- fi
}