summaryrefslogtreecommitdiff
path: root/dev-lang/rust/rust-1.75.0-r100.ebuild
diff options
context:
space:
mode:
authorMatt Jolly <kangie@gentoo.org>2024-12-02 15:18:43 +1000
committerMatt Jolly <kangie@gentoo.org>2024-12-02 17:54:12 +1000
commitaa28c9e374ad3ef2e647f56ffc97352e7667494d (patch)
tree79bf448df1afa806a657c7345e439c72954ff405 /dev-lang/rust/rust-1.75.0-r100.ebuild
parent68f7d7904b8a47ec5cc0cd922c0c4b5fe50344fa (diff)
downloadgentoo-aa28c9e374ad3ef2e647f56ffc97352e7667494d.tar.gz
gentoo-aa28c9e374ad3ef2e647f56ffc97352e7667494d.tar.bz2
gentoo-aa28c9e374ad3ef2e647f56ffc97352e7667494d.zip
dev-lang/rust: update non-slotted rust library tidyup
We would previously `die` if there was only one file found matching libraries in ${old_rust_libs} after the fingerprint was stripped. It turns out that it's not uncommon for fingerprints to match, and it is entirely possible for one (or most!) libraries to actually be overridden. Keep the existing duplicate handling but log the `expected 2 but found 1` case just in case we need to track this down. Since all -r100 ebuild are having `pkg_postinst` updated, be consistent about `optfeature` usage. Signed-off-by: Matt Jolly <kangie@gentoo.org>
Diffstat (limited to 'dev-lang/rust/rust-1.75.0-r100.ebuild')
-rw-r--r--dev-lang/rust/rust-1.75.0-r100.ebuild48
1 files changed, 33 insertions, 15 deletions
diff --git a/dev-lang/rust/rust-1.75.0-r100.ebuild b/dev-lang/rust/rust-1.75.0-r100.ebuild
index 6a5b34dda65a..e3beb23ab729 100644
--- a/dev-lang/rust/rust-1.75.0-r100.ebuild
+++ b/dev-lang/rust/rust-1.75.0-r100.ebuild
@@ -9,8 +9,8 @@ PYTHON_COMPAT=( python3_{10..12} )
RUST_MAX_VER=${PV}
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
-inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing \
- multilib multilib-build python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
+inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing multilib multilib-build \
+ optfeature python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
if [[ ${PV} = *beta* ]]; then
betaver=${PV//*beta}
@@ -678,20 +678,43 @@ pkg_preinst() {
pkg_postinst() {
- if has_version -b "dev-lang/rust:stable/$(ver_cut 1-2)"; then
+ local old_rust="dev-lang/rust:stable/$(ver_cut 1-2)"
+ if has_version -b ${old_rust}; then
# Be _extra_ careful here as we're removing files from the live filesystem
local f
+ local only_one_file=()
+ einfo "Tidying up libraries files from non-slotted \`${old_rust}\`."
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
+ case ${#matching_files[@]} in
+ 2)
+ einfo "Removing old .${ext}: ${f}"
+ rm "${f}" || die
+ ;;
+ 1)
+ # Turns out fingerprints are not as unique as we'd thought, _sometimes_ they collide,
+ # so we may have already installed over the old file.
+ # We'll warn about this just in case, but it's probably fine.
+ only_one_file+=( "${matching_files[0]}" )
+ ;;
+ *)
+ die "Expected one or two files matching ${base_name}-\*.rlib, but found ${#matching_files[@]}"
+ ;;
+ esac
done
+ if [[ ${#only_one_file} -gt 0 ]]; then
+ einfo "While tidying up non-slotted rust libraries for \`${old_rust}\`,"
+ einfo "the following file(s) did not have a duplicate where one was expected:"
+ for f in "${only_one_file[@]}"; do
+ einfo " * ${f}"
+ done
+ einfo ""
+ einfo "This is unlikely to cause problems; the fingerprint for the library ended up being the same."
+ einfo "However, if you encounter any issues please report them to the Gentoo Rust Team."
+ fi
fi
eselect rust update
@@ -701,13 +724,8 @@ pkg_postinst() {
elog "for convenience they are installed under /usr/bin/rust-{gdb,lldb}-${PV}."
fi
- if has_version app-editors/emacs; then
- elog "install app-emacs/rust-mode to get emacs support for rust."
- fi
-
- if has_version app-editors/gvim || has_version app-editors/vim; then
- elog "install app-vim/rust-vim to get vim support for rust."
- fi
+ optfeature "Emacs support" "app-emacs/rust-mode"
+ optfeature "Vim support" "app-vim/rust-vim"
}
pkg_postrm() {