summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2019-09-06 16:18:11 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2019-09-06 16:24:59 +0200
commitd5ee00c09b826bbafe9bec2227d5aca7bf3a24bd (patch)
tree157e635015df48b8b0fa92dd2aabb7733cbc9771 /scripts
parent16ceb35012f5b85969b8774d21ac89784208168e (diff)
downloadptxdist-d5ee00c09b826bbafe9bec2227d5aca7bf3a24bd.tar.gz
ptxdist-d5ee00c09b826bbafe9bec2227d5aca7bf3a24bd.tar.xz
ptxd_make_world_prepare/install/clean: sanitize sysroot
After a version bump or package configuration changes, files from the previous version may still be in sysroot. This can cause all kinds of problems. Also, some packages fail to build if sysroot contains the files from the same packages but with a different configuration. To avoid this, do the following: - remember <PKG>_PKGDIR in a way to find the old path after a version bump - remove all files of a packages from sysroot at the beginning of the prepare stage and the install stage Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/ptxd_make_world_clean.sh31
-rw-r--r--scripts/lib/ptxd_make_world_install.sh4
-rw-r--r--scripts/lib/ptxd_make_world_prepare.sh5
3 files changed, 31 insertions, 9 deletions
diff --git a/scripts/lib/ptxd_make_world_clean.sh b/scripts/lib/ptxd_make_world_clean.sh
index b96b782c4..997422de0 100644
--- a/scripts/lib/ptxd_make_world_clean.sh
+++ b/scripts/lib/ptxd_make_world_clean.sh
@@ -5,6 +5,29 @@
# see the README file.
#
+ptxd_make_world_clean_sysroot() {
+ local link source
+ link="${ptx_pkg_dir}/.${pkg_label}"
+ if [ -d "${link}" ]; then
+ path="${link}"
+ else
+ path="${pkg_pkg_dir}"
+ fi
+ if [ -d "${path}" ]; then
+ echo "Removing files from sysroot..."
+ echo
+ cd "${path}" && find . ! -type d -print0 | \
+ { cd "${pkg_sysroot_dir}" && xargs -0 rm -f; }
+ cd "${path}" && find . -mindepth 1 -depth -type d -print0 | \
+ { cd "${pkg_sysroot_dir}" && \
+ xargs -0 rmdir --ignore-fail-on-non-empty 2> /dev/null; }
+ fi
+ if [ -h "${link}" ]; then
+ rm "${link}"
+ fi
+}
+export -f ptxd_make_world_clean_sysroot
+
#
# clean
#
@@ -43,14 +66,8 @@ ptxd_make_world_clean() {
rm -rf "${pkg_build_dir}"
echo
fi
+ ptxd_make_world_clean_sysroot
if [ -d "${pkg_pkg_dir}" ]; then
- echo "Removing files from sysroot..."
- echo
- cd "${pkg_pkg_dir}" && find . ! -type d -print0 | \
- { cd "${pkg_sysroot_dir}" && xargs -0 rm -f; }
- cd "${pkg_pkg_dir}" && find . -mindepth 1 -depth -type d -print0 | \
- { cd "${pkg_sysroot_dir}" && \
- xargs -0 rmdir --ignore-fail-on-non-empty 2> /dev/null; }
echo "Deleting pkg dir:"
echo "${pkg_pkg_dir}"
rm -rf "${pkg_pkg_dir}"
diff --git a/scripts/lib/ptxd_make_world_install.sh b/scripts/lib/ptxd_make_world_install.sh
index e78ceb02f..04a610d3d 100644
--- a/scripts/lib/ptxd_make_world_install.sh
+++ b/scripts/lib/ptxd_make_world_install.sh
@@ -14,6 +14,7 @@ ptxd_make_world_install_prepare() {
if [ -z "${pkg_pkg_dir}" ]; then
return
fi &&
+ ptxd_make_world_clean_sysroot &&
rm -rf -- "${pkg_pkg_dir}" &&
mkdir -p -- "${pkg_pkg_dir}"/{etc,{,usr/}{lib,{,s}bin,include,{,share/}{man/man{1,2,3,4,5,6,7,8,9},misc}}} &&
if [ "${pkg_type}" != "target" ]; then
@@ -256,6 +257,9 @@ ptxd_make_world_install_post() {
fi
done &&
+ if [ ! -e "${ptx_pkg_dir}/${pkg_label}" -o -h "${ptx_pkg_dir}/${pkg_label}" ]; then
+ ln -sfT $(basename "${pkg_pkg_dir}") "${ptx_pkg_dir}/.${pkg_label}"
+ fi &&
# avoid writing to sysroot in parallel with -jeX/-jX
flock "${pkg_sysroot_dir}" \
cp -dpr --link --remove-destination -- "${pkg_pkg_dir}"/* "${pkg_sysroot_dir}" &&
diff --git a/scripts/lib/ptxd_make_world_prepare.sh b/scripts/lib/ptxd_make_world_prepare.sh
index 8e1304730..be3471a46 100644
--- a/scripts/lib/ptxd_make_world_prepare.sh
+++ b/scripts/lib/ptxd_make_world_prepare.sh
@@ -160,8 +160,9 @@ ptxd_make_world_prepare_init() {
if [ -n "${pkg_build_oot}" ]; then
rm -rf -- "${pkg_build_dir}" &&
mkdir -p -- "${pkg_build_dir}"
- fi
-
+ fi &&
+ # remove files from sysroot from the last build
+ ptxd_make_world_clean_sysroot
}
export -f ptxd_make_world_prepare_init