summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYifeng Li <tomli@tomli.me>2023-04-23 16:43:02 +0000
committerSam James <sam@gentoo.org>2023-04-23 20:12:59 +0100
commitef1e3dad5e18f887a56ae06c02eff74ab5c33a40 (patch)
tree816c168e2cacab141f6dbe17a67e1a53e3709495 /app-arch/tar
parentdev-libs/elfutils: fix tests w/ clang 16 (diff)
downloadgentoo-ef1e3dad5e18f887a56ae06c02eff74ab5c33a40.tar.gz
gentoo-ef1e3dad5e18f887a56ae06c02eff74ab5c33a40.tar.bz2
gentoo-ef1e3dad5e18f887a56ae06c02eff74ab5c33a40.zip
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@gentoo.org> Signed-off-by: Yifeng Li <tomli@tomli.me> Closes: https://github.com/gentoo/gentoo/pull/30723 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-arch/tar')
-rw-r--r--app-arch/tar/tar-1.34-r2.ebuild7
-rw-r--r--app-arch/tar/tar-1.34-r3.ebuild7
2 files changed, 14 insertions, 0 deletions
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
}