commit: d4c96a45f9e0c5401a6d4df4867dc85348fd7989 Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Mon Dec 5 15:17:13 2022 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Tue Dec 6 09:15:49 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d4c96a45
app-alternatives/awk: Clean up stale manpages from eselect-awk Closes: https://bugs.gentoo.org/884427 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> Closes: https://github.com/gentoo/gentoo/pull/28551 Signed-off-by: Sam James <sam <AT> gentoo.org> app-alternatives/awk/{awk-2.ebuild => awk-3.ebuild} | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app-alternatives/awk/awk-2.ebuild b/app-alternatives/awk/awk-3.ebuild similarity index 72% rename from app-alternatives/awk/awk-2.ebuild rename to app-alternatives/awk/awk-3.ebuild index c20aa0953478..d722129ee333 100644 --- a/app-alternatives/awk/awk-2.ebuild +++ b/app-alternatives/awk/awk-3.ebuild @@ -44,6 +44,27 @@ src_install() { fi } +pkg_preinst() { + local v + for v in ${REPLACING_VERSIONS}; do + # if we are upgrading from a new enough version, leftover manpage + # symlink cleanup was done already + if ver_test "${v}" -ge 3; then + return + fi + done + + # otherwise, remove leftover files/symlinks created by eselect-awk (sic!) + shopt -s nullglob + local files=( "${EROOT}"/usr/share/man/man1/awk.1* ) + shopt -u nullglob + + if [[ ${files[@]} ]]; then + einfo "Cleaning up leftover manpage symlinks from eselect-awk ..." + rm -v "${files[@]}" || die + fi +} + pkg_postrm() { # make sure we don't leave the user without the symlinks, since # they've not been owned by any other package