commit: ef1e3dad5e18f887a56ae06c02eff74ab5c33a40
Author: Yifeng Li <tomli <AT> tomli <DOT> me>
AuthorDate: Sun Apr 23 16:43:02 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Apr 23 19:12:59 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ef1e3dad
app-arch/tar: adapt pkg_postinst for prefix bootstrapping
This commit allows Portage to overwrite the binary executable
"tar" with a symbolic link, this situation is encountered during
Gentoo prefix bootstrap. If left unhandled, it causes the bootstrap
to fail with the error message:
ln: failed to create symbolic link '/Users/ec2-user/gentoo/tmp/bin/tar':
File exists
The original binary is renamed to tar.bak.
[sam: This is analogous to sys-devel/bison's hack too.]
Bug: https://bugs.gentoo.org/886123
Closes: https://bugs.gentoo.org/904887
Suggested-by: Sam James <sam <AT> gentoo.org>
Signed-off-by: Yifeng Li <tomli <AT> tomli.me>
Closes: https://github.com/gentoo/gentoo/pull/30723
Signed-off-by: Sam James <sam <AT> gentoo.org>
app-arch/tar/tar-1.34-r2.ebuild | 7 +++++++
app-arch/tar/tar-1.34-r3.ebuild | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/app-arch/tar/tar-1.34-r2.ebuild b/app-arch/tar/tar-1.34-r2.ebuild
index 86fdc8e05e20..805941b1f61c 100644
--- a/app-arch/tar/tar-1.34-r2.ebuild
+++ b/app-arch/tar/tar-1.34-r2.ebuild
@@ -90,6 +90,13 @@ pkg_postinst() {
# ensure to preserve the symlink before app-alternatives/tar
# is installed
if [[ ! -h ${EROOT}/bin/tar ]]; then
+ if [[ -e ${EROOT}/usr/bin/tar ]] ; then
+ # bug #904887
+ ewarn "${EROOT}/usr/bin/tar exists but is not a
symlink."
+ ewarn "This is expected during Prefix bootstrap and
unsual otherwise."
+ ewarn "Moving away unexpected ${EROOT}/usr/bin/tar to
.bak."
+ mv "${EROOT}/usr/bin/tar" "${EROOT}/usr/bin/tar.bak" ||
die
+ fi
ln -s gtar "${EROOT}/bin/tar" || die
fi
}
diff --git a/app-arch/tar/tar-1.34-r3.ebuild b/app-arch/tar/tar-1.34-r3.ebuild
index f92891dceff1..da958a84470e 100644
--- a/app-arch/tar/tar-1.34-r3.ebuild
+++ b/app-arch/tar/tar-1.34-r3.ebuild
@@ -94,6 +94,13 @@ pkg_postinst() {
# ensure to preserve the symlink before app-alternatives/tar
# is installed
if [[ ! -h ${EROOT}/bin/tar ]]; then
+ if [[ -e ${EROOT}/usr/bin/tar ]] ; then
+ # bug #904887
+ ewarn "${EROOT}/usr/bin/tar exists but is not a
symlink."
+ ewarn "This is expected during Prefix bootstrap and
unsual otherwise."
+ ewarn "Moving away unexpected ${EROOT}/usr/bin/tar to
.bak."
+ mv "${EROOT}/usr/bin/tar" "${EROOT}/usr/bin/tar.bak" ||
die
+ fi
ln -s gtar "${EROOT}/bin/tar" || die
fi
}