mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-29 17:41:05 +02:00
Merge pull request #565 from flatcar/krnowak/weekly
common: Extend liblto link fixup function
This commit is contained in:
commit
703b58770f
@ -189,7 +189,7 @@ emerge_to_image() {
|
|||||||
# Make sure profile.env has been generated
|
# Make sure profile.env has been generated
|
||||||
sudo -E ROOT="${root_fs_dir}" env-update --no-ldconfig
|
sudo -E ROOT="${root_fs_dir}" env-update --no-ldconfig
|
||||||
|
|
||||||
fixup_liblto_softlinks "$root_fs_dir"
|
fixup_gcc_config_softlinks "${root_fs_dir}"
|
||||||
|
|
||||||
# TODO(marineam): just call ${BUILD_LIBRARY_DIR}/check_root directly once
|
# TODO(marineam): just call ${BUILD_LIBRARY_DIR}/check_root directly once
|
||||||
# all tests are fatal, for now let the old function skip soname errors.
|
# all tests are fatal, for now let the old function skip soname errors.
|
||||||
|
@ -295,7 +295,7 @@ fi
|
|||||||
|
|
||||||
eclean-$BOARD -d packages
|
eclean-$BOARD -d packages
|
||||||
|
|
||||||
fixup_liblto_softlinks "${BOARD_ROOT}"
|
fixup_gcc_config_softlinks "${BOARD_ROOT}"
|
||||||
|
|
||||||
info "Checking build root"
|
info "Checking build root"
|
||||||
test_image_content "${BOARD_ROOT}"
|
test_image_content "${BOARD_ROOT}"
|
||||||
|
47
common.sh
47
common.sh
@ -976,22 +976,37 @@ clean_qemu_static() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# Fix up liblto softlink created by gcc-config
|
# Fix up various softlinks created by gcc-config
|
||||||
fixup_liblto_softlinks() {
|
fixup_gcc_config_softlinks() {
|
||||||
local root="$1"
|
# root without trailing slashes, for / it will be empty
|
||||||
|
local root="${1%%*(/)}"
|
||||||
|
|
||||||
info "fixup_liblto_softlinks: Looking for broken softlinks in '${root}'"
|
info "fixup_gcc_config_softlinks: Looking for broken softlinks in '${root}/'"
|
||||||
|
|
||||||
local link
|
(
|
||||||
local target
|
shopt -s nullglob
|
||||||
# check both native (/usr/CHOST/) as well as cross compile (/usr/CHOST/CTARGET) paths
|
local files=(
|
||||||
{ ls -l "${root}/"usr/*/binutils-bin/lib/bfd-plugins/liblto_plugin.so 2>/dev/null || :;
|
"${root}"/usr/*/binutils-bin/lib/bfd-plugins/liblto_plugin.so
|
||||||
ls -l "${root}/"usr/*/*/binutils-bin/lib/bfd-plugins/liblto_plugin.so 2>/dev/null || :; } \
|
"${root}"/usr/*/*/binutils-bin/lib/bfd-plugins/liblto_plugin.so
|
||||||
| sed 's:.* \([^[:space:]]\+\) -> \([^[:space:]]\+\):\1 \2:' \
|
"${root}"/usr/bin/*-cc
|
||||||
| while read link target; do
|
)
|
||||||
local newtarget=$(echo "$target" | sed "s:${root}:/:")
|
local file
|
||||||
info " Fixing up broken $link -> $target"
|
local target
|
||||||
info " sudo ln -sf $newtarget $link"
|
local new_target
|
||||||
sudo ln -sf $newtarget $link
|
for file in "${files[@]}"; do
|
||||||
done
|
if [[ ! -L "${file}" ]]; then
|
||||||
|
# not a symlink, ignore
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
target=$(readlink "${file}")
|
||||||
|
new_target=${target/#${root}}
|
||||||
|
if [[ "${target}" == "${new_target}" ]]; then
|
||||||
|
# nothing to fix, ignore
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
info " Fixing up broken symlink '${file}' -> '${target}'"
|
||||||
|
info " sudo ln -sf '${new_target}' '${file}'"
|
||||||
|
sudo ln -sf "${new_target}" "${file}"
|
||||||
|
done
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user