sys-fs/eudev: ensure REPLACING_VERSIONS is processed as a list
authorIan Stakenvicius <axs@gentoo.org>
Mon, 25 Jul 2016 16:15:27 +0000 (12:15 -0400)
committerIan Stakenvicius <axs@gentoo.org>
Mon, 25 Jul 2016 16:21:27 +0000 (12:21 -0400)
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

sys-fs/eudev/eudev-1.10-r2.ebuild
sys-fs/eudev/eudev-1.9-r2.ebuild
sys-fs/eudev/eudev-3.1.2.ebuild
sys-fs/eudev/eudev-3.1.5.ebuild
sys-fs/eudev/eudev-3.2.ebuild
sys-fs/eudev/eudev-4.9999.ebuild
sys-fs/eudev/eudev-9999.ebuild

index 83d33b82ec99a8a9b29133f6146533ce754fc341..122087f5a1155303d766dc771c5f9ba8416534b2 100644 (file)
@@ -248,22 +248,41 @@ 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
 
        if use rule-generator && use openrc && \
        [[ -x $(type -P rc-update) ]] && rc-update show | grep udev-postmount | grep -qsv 'boot\|default\|sysinit'; then
@@ -279,22 +298,4 @@ pkg_postinst() {
        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
 }
index 23f027b2b29d354714a1a5465ca46c052156dc18..1f7705244f2a7942f348b957932d181959ad6758 100644 (file)
@@ -250,22 +250,41 @@ 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
 
        if use rule-generator && use openrc && \
        [[ -x $(type -P rc-update) ]] && rc-update show | grep udev-postmount | grep -qsv 'boot\|default\|sysinit'; then
@@ -281,22 +300,4 @@ pkg_postinst() {
        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
 }
index e061076b418e53fd252a9379148cacc985460d05..f17bcba6d01531ba2a82b391544e984020831c75 100644 (file)
@@ -230,44 +230,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
 }
index 0cb702536bf0ecad959869a860f0db1a49d78f79..a36ee54d2e62dc8ffd5de53e1d53ac83b1e2a2aa 100644 (file)
@@ -190,22 +190,41 @@ 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
 
        if use rule-generator && \
        [[ -x $(type -P rc-update) ]] && rc-update show | grep udev-postmount | grep -qsv 'boot\|default\|sysinit'; then
@@ -221,22 +240,4 @@ pkg_postinst() {
        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
 }
index 52c351cd0f206abb6da44c20f194549af0fcaf8e..e70d95411c643162ebe2aad993ee7ea2e08fb412 100644 (file)
@@ -190,22 +190,41 @@ 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
 
        if use rule-generator && \
        [[ -x $(type -P rc-update) ]] && rc-update show | grep udev-postmount | grep -qsv 'boot\|default\|sysinit'; then
@@ -221,22 +240,4 @@ pkg_postinst() {
        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
 }
index 57d3d7624eb2190818fd0b99dfab3beb9c285acd..2d2964029fba414babaa5538d72503075f14cf87 100644 (file)
@@ -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
 }
index 52c351cd0f206abb6da44c20f194549af0fcaf8e..e70d95411c643162ebe2aad993ee7ea2e08fb412 100644 (file)
@@ -190,22 +190,41 @@ 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
 
        if use rule-generator && \
        [[ -x $(type -P rc-update) ]] && rc-update show | grep udev-postmount | grep -qsv 'boot\|default\|sysinit'; then
@@ -221,22 +240,4 @@ pkg_postinst() {
        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
 }