summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2017-06-12 19:55:20 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2017-06-21 09:34:50 +0200
commitb2ab2eb421f308c29961730037472e6e40ffa1fb (patch)
treee1cf2e7f1338e17ebd9b99abc694734b9c6a6464 /scripts
parent457fd335ccbea618895cbdd21cfd9b426bd09368 (diff)
downloadptxdist-b2ab2eb421f308c29961730037472e6e40ffa1fb.tar.gz
ptxdist-b2ab2eb421f308c29961730037472e6e40ffa1fb.tar.xz
pkg-config-wrapper: only allow packages that are selected
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/ptxd_make_world_common.sh6
-rw-r--r--scripts/lib/ptxd_make_world_install.sh7
-rwxr-xr-xscripts/pkg-config-wrapper8
3 files changed, 21 insertions, 0 deletions
diff --git a/scripts/lib/ptxd_make_world_common.sh b/scripts/lib/ptxd_make_world_common.sh
index b366dc80c..10ad0c714 100644
--- a/scripts/lib/ptxd_make_world_common.sh
+++ b/scripts/lib/ptxd_make_world_common.sh
@@ -329,6 +329,12 @@ ptxd_make_world_init() {
;;
*) ;;
esac
+ local pkgconfig_whitelist
+ pkgconfig_whitelist="$(echo $(
+ for dep in ${pkg_build_deps}; do
+ cat "${ptx_state_dir}/${dep}.pkgconfig" 2>/dev/null;
+ done))"
+ pkg_env="PKGCONFIG_WHITELIST='${pkgconfig_whitelist}' PKGCONFIG_WHITELIST_SRC='${pkg_label}' ${pkg_env}"
# DESTDIR
if [[ "${pkg_conf_tool}" =~ "python" ]]; then
diff --git a/scripts/lib/ptxd_make_world_install.sh b/scripts/lib/ptxd_make_world_install.sh
index a63661eb0..47681bd3e 100644
--- a/scripts/lib/ptxd_make_world_install.sh
+++ b/scripts/lib/ptxd_make_world_install.sh
@@ -213,6 +213,13 @@ export -f ptxd_make_world_install_pack
#
ptxd_make_world_install_post() {
ptxd_make_world_init &&
+ (
+ find "${pkg_pkg_dir}"/usr/{lib,share}/pkgconfig -name *.pc \
+ -printf "%f\n" 2>/dev/null | sed 's/\.pc$//'
+ for dep in ${pkg_build_deps}; do
+ cat "${ptx_state_dir}/${dep}.pkgconfig" 2>/dev/null;
+ done
+ ) | sort -u > "${ptx_state_dir}/${pkg_label}.pkgconfig"
# do nothing if pkg_pkg_dir does not exist
if [ \! -d "${pkg_pkg_dir}" ]; then
return
diff --git a/scripts/pkg-config-wrapper b/scripts/pkg-config-wrapper
index b19a845d0..e3f1638cc 100755
--- a/scripts/pkg-config-wrapper
+++ b/scripts/pkg-config-wrapper
@@ -54,6 +54,14 @@ else
args=( ${args[@]} ${sysroot_prefix[@]/#/-e s~-I} -e "s~\s\+~ ~g" -e "s~^\s\+$~~")
fi
+if [ -n "${PKGCONFIG_WHITELIST_SRC}" ]; then
+ for pkg in $("${PKG_CONFIG}" --print-provides "${@}" 2>/dev/null | awk '{print $1}'); do
+ if [[ ! " ${PKGCONFIG_WHITELIST} " =~ " ${pkg} " && ! "${pkg}" =~ '-uninstalled' ]]; then
+ echo "$(basename ${0}): warning: blocking '${pkg}': not selected by '${PKGCONFIG_WHITELIST_SRC}'" >&${PTXDIST_FD_LOGERR}
+ exit 1
+ fi
+ done
+fi
"${PKG_CONFIG}" "${@}" | sed "${args[@]}"
for _pipe_status in "${PIPESTATUS[@]}"; do
if [ ${_pipe_status} -ne 0 ]; then