summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2019-01-15 08:00:57 (GMT)
committerGitHub <noreply@github.com>2019-01-15 08:00:57 (GMT)
commit0a5107dd421cb9b1629924abed1c7f0cfbe42c46 (patch)
treebb09f297e8a90189063114baf4cbc6db13cffde6
parente215e3aea88a667f5270b2d818c4bce6381f8921 (diff)
parentb6c5ae2f1740dc4bba02e3f2b4a1c3e5534e7e1f (diff)
Merge pull request #1126 from stilor/prefix-with-symlinks
Handle a setup where CT_PREFIX_DIR has symlinks
-rw-r--r--scripts/build/cc/gcc.sh19
-rw-r--r--scripts/functions6
-rw-r--r--testing/docker/archlinux/Dockerfile4
3 files changed, 22 insertions, 7 deletions
diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh
index 64755ab..c6b068c 100644
--- a/scripts/build/cc/gcc.sh
+++ b/scripts/build/cc/gcc.sh
@@ -765,15 +765,24 @@ do_cc_for_build() {
CT_EndStep
}
-gcc_movelibs() {
+gcc_movelibs()
+{
local multi_flags multi_dir multi_os_dir multi_os_dir_gcc multi_root multi_index multi_count
- local gcc_dir dst_dir
+ local gcc_dir dst_dir canon_root canon_prefix
local rel
for arg in "$@"; do
eval "${arg// /\\ }"
done
+ # GCC prints the sysroot in canonicalized form, which may be different if there
+ # is a symlink in the path. Since we need textual match to obtain a relative
+ # subdirectory path, canonicalize the prefix directory. Since GCC's behavior
+ # is not documented and hence may change at any time, canonicalize it too just
+ # for the good measure.
+ canon_root=$( cd "${multi_root}" && pwd -P )
+ canon_prefix=$( cd "${CT_PREFIX_DIR}" && pwd -P )
+
# Move only files, directories are for other multilibs. We're looking inside
# GCC's directory structure, thus use unmangled multi_os_dir that GCC reports.
gcc_dir="${CT_PREFIX_DIR}/${CT_TARGET}/lib/${multi_os_dir_gcc}"
@@ -784,9 +793,9 @@ gcc_movelibs() {
# Depending on the selected libc, we may or may not have the ${multi_os_dir_gcc}
# created by libc installation. If we do, use it. If we don't, use ${multi_os_dir}
# to avoid creating an otherwise empty directory.
- dst_dir="${multi_root}/lib/${multi_os_dir_gcc}"
+ dst_dir="${canon_root}/lib/${multi_os_dir_gcc}"
if [ ! -d "${dst_dir}" ]; then
- dst_dir="${multi_root}/lib/${multi_os_dir}"
+ dst_dir="${canon_root}/lib/${multi_os_dir}"
fi
CT_SanitizeVarDir dst_dir gcc_dir
rel=$( echo "${gcc_dir#${CT_PREFIX_DIR}/}" | sed 's#[^/]\{1,\}#..#g' )
@@ -802,7 +811,7 @@ gcc_movelibs() {
if [ -f "${gcc_dir}/${f}" ]; then
CT_DoExecLog ALL mkdir -p "${dst_dir}"
CT_DoExecLog ALL mv "${gcc_dir}/${f}" "${dst_dir}/${f}"
- CT_DoExecLog ALL ln -sf "${rel}/${dst_dir#${CT_PREFIX_DIR}/}/${f}" "${gcc_dir}/${f}"
+ CT_DoExecLog ALL ln -sf "${rel}/${dst_dir#${canon_prefix}/}/${f}" "${gcc_dir}/${f}"
fi
done
}
diff --git a/scripts/functions b/scripts/functions
index 764477b..c97b9f4 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -1456,6 +1456,7 @@ CT_IterateMultilibs() {
local multi_dir multi_os_dir multi_os_dir_gcc multi_root multi_flags multi_index multi_target
local root_suffix
local dir_postfix
+ local v
# Name used internally below
if [ "${prefix}" = "sysroot-check" ]; then
@@ -1547,6 +1548,11 @@ CT_IterateMultilibs() {
dir_postfix=_${multi_dir//\//_}
dir_postfix=${dir_postfix%_.}
CT_mkdir_pushd "${prefix}${dir_postfix}"
+ CT_DoLog DEBUG "Multilib iterator: call function '${func}' in '${prefix}${dir_postfix}'"
+ for v in multi_dir multi_os_dir multi_os_dir_gcc multi_flags multi_root multi_target multi_index; do
+ CT_DoLog DEBUG " ${v}=${!v}"
+ done
+
$func multi_dir="${multi_dir}" \
multi_os_dir="${multi_os_dir}" \
multi_os_dir_gcc="${multi_os_dir_gcc}" \
diff --git a/testing/docker/archlinux/Dockerfile b/testing/docker/archlinux/Dockerfile
index 5f2b717..c32402a 100644
--- a/testing/docker/archlinux/Dockerfile
+++ b/testing/docker/archlinux/Dockerfile
@@ -1,10 +1,10 @@
FROM base/archlinux:latest
ARG CTNG_UID
ARG CTNG_GID
+RUN pacman -Syu --noconfirm
+RUN pacman -S --noconfirm base-devel git help2man python unzip wget audit
RUN groupadd -g $CTNG_GID ctng
RUN useradd -d /home/ctng -m -g $CTNG_GID -u $CTNG_UID -s /bin/bash ctng
-RUN pacman -Syu --noconfirm
-RUN pacman -S --noconfirm base-devel git help2man python unzip wget
RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64
RUN chmod a+x /sbin/dumb-init
RUN echo 'export PATH=/opt/ctng/bin:$PATH' >> /etc/profile