diff options
author | Matt Jolly <kangie@gentoo.org> | 2024-11-23 15:00:48 +1000 |
---|---|---|
committer | Matt Jolly <kangie@gentoo.org> | 2024-11-25 13:39:22 +1000 |
commit | 8c365d501a904021cb0bd4b81d4bf7e4380702c5 (patch) | |
tree | cd920d01a00b86679f85508f9e48805c715bea83 /dev-lang/rust | |
parent | media-libs/libgpod: Stabilize 0.8.3-r8 ppc, #944836 (diff) | |
download | gentoo-8c365d501a904021cb0bd4b81d4bf7e4380702c5.tar.gz gentoo-8c365d501a904021cb0bd4b81d4bf7e4380702c5.tar.bz2 gentoo-8c365d501a904021cb0bd4b81d4bf7e4380702c5.zip |
dev-lang/rust: -r100: add postinst workaround for --keep-going
A bug in Portage's --keep-going option can cause it to fail to uninstall
non-slotted Rust files when resuming an interrupted upgrade. This results
in a broken Rust installation, preventing compilation and requiring manual
intervention.
We can work around this by deleting duplicate Rust libraries in postinst.
Bug: https://bugs.gentoo.org/943308
Signed-off-by: Matt Jolly <kangie@gentoo.org>
Diffstat (limited to 'dev-lang/rust')
-rw-r--r-- | dev-lang/rust/rust-1.71.1-r100.ebuild | 37 | ||||
-rw-r--r-- | dev-lang/rust/rust-1.74.1-r100.ebuild | 37 | ||||
-rw-r--r-- | dev-lang/rust/rust-1.75.0-r100.ebuild | 37 | ||||
-rw-r--r-- | dev-lang/rust/rust-1.77.1-r100.ebuild | 37 | ||||
-rw-r--r-- | dev-lang/rust/rust-1.79.0-r100.ebuild | 37 | ||||
-rw-r--r-- | dev-lang/rust/rust-1.80.1-r100.ebuild | 37 | ||||
-rw-r--r-- | dev-lang/rust/rust-1.81.0-r100.ebuild | 37 | ||||
-rw-r--r-- | dev-lang/rust/rust-1.82.0-r100.ebuild | 37 |
8 files changed, 296 insertions, 0 deletions
diff --git a/dev-lang/rust/rust-1.71.1-r100.ebuild b/dev-lang/rust/rust-1.71.1-r100.ebuild index 18b1b9fe6fc5..78f8d663cf0d 100644 --- a/dev-lang/rust/rust-1.71.1-r100.ebuild +++ b/dev-lang/rust/rust-1.71.1-r100.ebuild @@ -624,7 +624,44 @@ src_install() { fi } +pkg_preinst() { + # 943308 and friends; basically --keep-going can forget to unmerge old rust + # but the soft blocker allows us to install conflicting files. + # This results in duplicated .{rlib,so} files which confuses rustc and results in + # the need for manual intervention. + if has_version -b "dev-lang/rust:stable/$(ver_cut 1-2)"; then + # we need to find all .{rlib,so} files in the old rust lib directory + # and store them in an array for later use + readarray -d '' old_rust_libs < <( + find "${EROOT}/usr/lib/rust/${PV}/lib/rustlib" \ + -type f \( -name '*.rlib' -o -name '*.so' \) -print0) + export old_rust_libs + if [[ ${#old_rust_libs[@]} -gt 0 ]]; then + einfo "Found old .rlib and .so files in the old rust lib directory" + else + die "Found no old .rlib and .so files but old rust version is installed. Bailing!" + fi + fi +} + pkg_postinst() { + + if has_version -b "dev-lang/rust:stable/$(ver_cut 1-2)"; then + # Be _extra_ careful here as we're removing files from the live filesystem + local f + for f in "${old_rust_libs[@]}"; do + [[ -f ${f} ]] || die "old_rust_libs array contains non-existent file" + local base_name="${f%-*}" + local ext="${f##*.}" + local matching_files=("${base_name}"-*.${ext}) + if [[ ${#matching_files[@]} -ne 2 ]]; then + die "Expected exactly two files matching ${base_name}-\*.rlib, but found ${#matching_files[@]}" + fi + einfo "Removing old .rlib file ${f}" + rm "${f}" || die + done + fi + eselect rust update if has_version dev-debug/gdb || has_version dev-debug/lldb; then diff --git a/dev-lang/rust/rust-1.74.1-r100.ebuild b/dev-lang/rust/rust-1.74.1-r100.ebuild index d446b5263782..7d362a51d3ed 100644 --- a/dev-lang/rust/rust-1.74.1-r100.ebuild +++ b/dev-lang/rust/rust-1.74.1-r100.ebuild @@ -654,7 +654,44 @@ src_install() { fi } +pkg_preinst() { + # 943308 and friends; basically --keep-going can forget to unmerge old rust + # but the soft blocker allows us to install conflicting files. + # This results in duplicated .{rlib,so} files which confuses rustc and results in + # the need for manual intervention. + if has_version -b "dev-lang/rust:stable/$(ver_cut 1-2)"; then + # we need to find all .{rlib,so} files in the old rust lib directory + # and store them in an array for later use + readarray -d '' old_rust_libs < <( + find "${EROOT}/usr/lib/rust/${PV}/lib/rustlib" \ + -type f \( -name '*.rlib' -o -name '*.so' \) -print0) + export old_rust_libs + if [[ ${#old_rust_libs[@]} -gt 0 ]]; then + einfo "Found old .rlib and .so files in the old rust lib directory" + else + die "Found no old .rlib and .so files but old rust version is installed. Bailing!" + fi + fi +} + pkg_postinst() { + + if has_version -b "dev-lang/rust:stable/$(ver_cut 1-2)"; then + # Be _extra_ careful here as we're removing files from the live filesystem + local f + for f in "${old_rust_libs[@]}"; do + [[ -f ${f} ]] || die "old_rust_libs array contains non-existent file" + local base_name="${f%-*}" + local ext="${f##*.}" + local matching_files=("${base_name}"-*.${ext}) + if [[ ${#matching_files[@]} -ne 2 ]]; then + die "Expected exactly two files matching ${base_name}-\*.rlib, but found ${#matching_files[@]}" + fi + einfo "Removing old .rlib file ${f}" + rm "${f}" || die + done + fi + eselect rust update if has_version dev-debug/gdb || has_version dev-debug/lldb; then diff --git a/dev-lang/rust/rust-1.75.0-r100.ebuild b/dev-lang/rust/rust-1.75.0-r100.ebuild index 40ab20831e94..6a5b34dda65a 100644 --- a/dev-lang/rust/rust-1.75.0-r100.ebuild +++ b/dev-lang/rust/rust-1.75.0-r100.ebuild @@ -656,7 +656,44 @@ src_install() { fi } +pkg_preinst() { + # 943308 and friends; basically --keep-going can forget to unmerge old rust + # but the soft blocker allows us to install conflicting files. + # This results in duplicated .{rlib,so} files which confuses rustc and results in + # the need for manual intervention. + if has_version -b "dev-lang/rust:stable/$(ver_cut 1-2)"; then + # we need to find all .{rlib,so} files in the old rust lib directory + # and store them in an array for later use + readarray -d '' old_rust_libs < <( + find "${EROOT}/usr/lib/rust/${PV}/lib/rustlib" \ + -type f \( -name '*.rlib' -o -name '*.so' \) -print0) + export old_rust_libs + if [[ ${#old_rust_libs[@]} -gt 0 ]]; then + einfo "Found old .rlib and .so files in the old rust lib directory" + else + die "Found no old .rlib and .so files but old rust version is installed. Bailing!" + fi + fi +} + pkg_postinst() { + + if has_version -b "dev-lang/rust:stable/$(ver_cut 1-2)"; then + # Be _extra_ careful here as we're removing files from the live filesystem + local f + for f in "${old_rust_libs[@]}"; do + [[ -f ${f} ]] || die "old_rust_libs array contains non-existent file" + local base_name="${f%-*}" + local ext="${f##*.}" + local matching_files=("${base_name}"-*.${ext}) + if [[ ${#matching_files[@]} -ne 2 ]]; then + die "Expected exactly two files matching ${base_name}-\*.rlib, but found ${#matching_files[@]}" + fi + einfo "Removing old .rlib file ${f}" + rm "${f}" || die + done + fi + eselect rust update if has_version dev-debug/gdb || has_version dev-debug/lldb; then diff --git a/dev-lang/rust/rust-1.77.1-r100.ebuild b/dev-lang/rust/rust-1.77.1-r100.ebuild index 372322af3e8f..2aa9d06c5418 100644 --- a/dev-lang/rust/rust-1.77.1-r100.ebuild +++ b/dev-lang/rust/rust-1.77.1-r100.ebuild @@ -655,7 +655,44 @@ src_install() { fi } +pkg_preinst() { + # 943308 and friends; basically --keep-going can forget to unmerge old rust + # but the soft blocker allows us to install conflicting files. + # This results in duplicated .{rlib,so} files which confuses rustc and results in + # the need for manual intervention. + if has_version -b "dev-lang/rust:stable/$(ver_cut 1-2)"; then + # we need to find all .{rlib,so} files in the old rust lib directory + # and store them in an array for later use + readarray -d '' old_rust_libs < <( + find "${EROOT}/usr/lib/rust/${PV}/lib/rustlib" \ + -type f \( -name '*.rlib' -o -name '*.so' \) -print0) + export old_rust_libs + if [[ ${#old_rust_libs[@]} -gt 0 ]]; then + einfo "Found old .rlib and .so files in the old rust lib directory" + else + die "Found no old .rlib and .so files but old rust version is installed. Bailing!" + fi + fi +} + pkg_postinst() { + + if has_version -b "dev-lang/rust:stable/$(ver_cut 1-2)"; then + # Be _extra_ careful here as we're removing files from the live filesystem + local f + for f in "${old_rust_libs[@]}"; do + [[ -f ${f} ]] || die "old_rust_libs array contains non-existent file" + local base_name="${f%-*}" + local ext="${f##*.}" + local matching_files=("${base_name}"-*.${ext}) + if [[ ${#matching_files[@]} -ne 2 ]]; then + die "Expected exactly two files matching ${base_name}-\*.rlib, but found ${#matching_files[@]}" + fi + einfo "Removing old .rlib file ${f}" + rm "${f}" || die + done + fi + eselect rust update if has_version dev-debug/gdb || has_version dev-debug/lldb; then diff --git a/dev-lang/rust/rust-1.79.0-r100.ebuild b/dev-lang/rust/rust-1.79.0-r100.ebuild index e1878c76dba4..392cc8f26840 100644 --- a/dev-lang/rust/rust-1.79.0-r100.ebuild +++ b/dev-lang/rust/rust-1.79.0-r100.ebuild @@ -658,7 +658,44 @@ src_install() { fi } +pkg_preinst() { + # 943308 and friends; basically --keep-going can forget to unmerge old rust + # but the soft blocker allows us to install conflicting files. + # This results in duplicated .{rlib,so} files which confuses rustc and results in + # the need for manual intervention. + if has_version -b "dev-lang/rust:stable/$(ver_cut 1-2)"; then + # we need to find all .{rlib,so} files in the old rust lib directory + # and store them in an array for later use + readarray -d '' old_rust_libs < <( + find "${EROOT}/usr/lib/rust/${PV}/lib/rustlib" \ + -type f \( -name '*.rlib' -o -name '*.so' \) -print0) + export old_rust_libs + if [[ ${#old_rust_libs[@]} -gt 0 ]]; then + einfo "Found old .rlib and .so files in the old rust lib directory" + else + die "Found no old .rlib and .so files but old rust version is installed. Bailing!" + fi + fi +} + pkg_postinst() { + + if has_version -b "dev-lang/rust:stable/$(ver_cut 1-2)"; then + # Be _extra_ careful here as we're removing files from the live filesystem + local f + for f in "${old_rust_libs[@]}"; do + [[ -f ${f} ]] || die "old_rust_libs array contains non-existent file" + local base_name="${f%-*}" + local ext="${f##*.}" + local matching_files=("${base_name}"-*.${ext}) + if [[ ${#matching_files[@]} -ne 2 ]]; then + die "Expected exactly two files matching ${base_name}-\*.rlib, but found ${#matching_files[@]}" + fi + einfo "Removing old .rlib file ${f}" + rm "${f}" || die + done + fi + eselect rust update if has_version dev-debug/gdb || has_version dev-debug/lldb; then diff --git a/dev-lang/rust/rust-1.80.1-r100.ebuild b/dev-lang/rust/rust-1.80.1-r100.ebuild index 9dbccd98b9a6..72080e2236fe 100644 --- a/dev-lang/rust/rust-1.80.1-r100.ebuild +++ b/dev-lang/rust/rust-1.80.1-r100.ebuild @@ -655,7 +655,44 @@ src_install() { fi } +pkg_preinst() { + # 943308 and friends; basically --keep-going can forget to unmerge old rust + # but the soft blocker allows us to install conflicting files. + # This results in duplicated .{rlib,so} files which confuses rustc and results in + # the need for manual intervention. + if has_version -b "dev-lang/rust:stable/$(ver_cut 1-2)"; then + # we need to find all .{rlib,so} files in the old rust lib directory + # and store them in an array for later use + readarray -d '' old_rust_libs < <( + find "${EROOT}/usr/lib/rust/${PV}/lib/rustlib" \ + -type f \( -name '*.rlib' -o -name '*.so' \) -print0) + export old_rust_libs + if [[ ${#old_rust_libs[@]} -gt 0 ]]; then + einfo "Found old .rlib and .so files in the old rust lib directory" + else + die "Found no old .rlib and .so files but old rust version is installed. Bailing!" + fi + fi +} + pkg_postinst() { + + if has_version -b "dev-lang/rust:stable/$(ver_cut 1-2)"; then + # Be _extra_ careful here as we're removing files from the live filesystem + local f + for f in "${old_rust_libs[@]}"; do + [[ -f ${f} ]] || die "old_rust_libs array contains non-existent file" + local base_name="${f%-*}" + local ext="${f##*.}" + local matching_files=("${base_name}"-*.${ext}) + if [[ ${#matching_files[@]} -ne 2 ]]; then + die "Expected exactly two files matching ${base_name}-\*.rlib, but found ${#matching_files[@]}" + fi + einfo "Removing old .rlib file ${f}" + rm "${f}" || die + done + fi + eselect rust update if has_version dev-debug/gdb || has_version dev-debug/lldb; then diff --git a/dev-lang/rust/rust-1.81.0-r100.ebuild b/dev-lang/rust/rust-1.81.0-r100.ebuild index 8d7100d336d7..54695b7209d5 100644 --- a/dev-lang/rust/rust-1.81.0-r100.ebuild +++ b/dev-lang/rust/rust-1.81.0-r100.ebuild @@ -659,7 +659,44 @@ src_install() { fi } +pkg_preinst() { + # 943308 and friends; basically --keep-going can forget to unmerge old rust + # but the soft blocker allows us to install conflicting files. + # This results in duplicated .{rlib,so} files which confuses rustc and results in + # the need for manual intervention. + if has_version -b "dev-lang/rust:stable/$(ver_cut 1-2)"; then + # we need to find all .{rlib,so} files in the old rust lib directory + # and store them in an array for later use + readarray -d '' old_rust_libs < <( + find "${EROOT}/usr/lib/rust/${PV}/lib/rustlib" \ + -type f \( -name '*.rlib' -o -name '*.so' \) -print0) + export old_rust_libs + if [[ ${#old_rust_libs[@]} -gt 0 ]]; then + einfo "Found old .rlib and .so files in the old rust lib directory" + else + die "Found no old .rlib and .so files but old rust version is installed. Bailing!" + fi + fi +} + pkg_postinst() { + + if has_version -b "dev-lang/rust:stable/$(ver_cut 1-2)"; then + # Be _extra_ careful here as we're removing files from the live filesystem + local f + for f in "${old_rust_libs[@]}"; do + [[ -f ${f} ]] || die "old_rust_libs array contains non-existent file" + local base_name="${f%-*}" + local ext="${f##*.}" + local matching_files=("${base_name}"-*.${ext}) + if [[ ${#matching_files[@]} -ne 2 ]]; then + die "Expected exactly two files matching ${base_name}-\*.rlib, but found ${#matching_files[@]}" + fi + einfo "Removing old .rlib file ${f}" + rm "${f}" || die + done + fi + eselect rust update if has_version dev-debug/gdb || has_version dev-debug/lldb; then diff --git a/dev-lang/rust/rust-1.82.0-r100.ebuild b/dev-lang/rust/rust-1.82.0-r100.ebuild index 63c8e27e3eaa..714ff39f1a8e 100644 --- a/dev-lang/rust/rust-1.82.0-r100.ebuild +++ b/dev-lang/rust/rust-1.82.0-r100.ebuild @@ -669,7 +669,44 @@ src_install() { fi } +pkg_preinst() { + # 943308 and friends; basically --keep-going can forget to unmerge old rust + # but the soft blocker allows us to install conflicting files. + # This results in duplicated .{rlib,so} files which confuses rustc and results in + # the need for manual intervention. + if has_version -b "dev-lang/rust:stable/$(ver_cut 1-2)"; then + # we need to find all .{rlib,so} files in the old rust lib directory + # and store them in an array for later use + readarray -d '' old_rust_libs < <( + find "${EROOT}/usr/lib/rust/${PV}/lib/rustlib" \ + -type f \( -name '*.rlib' -o -name '*.so' \) -print0) + export old_rust_libs + if [[ ${#old_rust_libs[@]} -gt 0 ]]; then + einfo "Found old .rlib and .so files in the old rust lib directory" + else + die "Found no old .rlib and .so files but old rust version is installed. Bailing!" + fi + fi +} + pkg_postinst() { + + if has_version -b "dev-lang/rust:stable/$(ver_cut 1-2)"; then + # Be _extra_ careful here as we're removing files from the live filesystem + local f + for f in "${old_rust_libs[@]}"; do + [[ -f ${f} ]] || die "old_rust_libs array contains non-existent file" + local base_name="${f%-*}" + local ext="${f##*.}" + local matching_files=("${base_name}"-*.${ext}) + if [[ ${#matching_files[@]} -ne 2 ]]; then + die "Expected exactly two files matching ${base_name}-\*.rlib, but found ${#matching_files[@]}" + fi + einfo "Removing old .rlib file ${f}" + rm "${f}" || die + done + fi + eselect rust update if has_version dev-debug/gdb || has_version dev-debug/lldb; then |