Skip to content

Commit

Permalink
Merge pull request #3342 from MilhouseVH/le92_fixup_mysql
Browse files Browse the repository at this point in the history
scripts/build: fix broken sym link after #3328
  • Loading branch information
CvH committed Mar 6, 2019
2 parents 7cc13d7 + a857284 commit f14df92
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 32 deletions.
26 changes: 10 additions & 16 deletions config/functions
Original file line number Diff line number Diff line change
Expand Up @@ -495,30 +495,24 @@ debug_strip() {
}

init_package_cache() {
local _ANCHOR="@?+?@" DIR
local _ANCHOR="@?+?@"
local temp_global temp_local

# If the package caches are unset, then populate them
if [ -z "${_CACHE_PACKAGE_LOCAL}" -o -z "${_CACHE_PACKAGE_GLOBAL}" ]; then
temp_global="$(mktemp)"
temp_local="$(mktemp)"

# cache project/device folder for a package
if [ -n $DEVICE ]; then
for DIR in $(find $ROOT/projects/$PROJECT/devices/$DEVICE/packages -type d 2>/dev/null); do
[ -r "$DIR/package.mk" ] && echo "${DIR}${_ANCHOR}" >> "${temp_local}"
done
# cache project/device folder for packages
if [ -n "${DEVICE}" ]; then
find "${ROOT}/projects/${PROJECT}/devices/${DEVICE}/packages" -type f -name package.mk 2>/dev/null | sed "s#/package\.mk\$#${_ANCHOR}#" >> "${temp_local}"
fi

# cache project folder for a package
for DIR in $(find $ROOT/projects/$PROJECT/packages -type d 2>/dev/null); do
[ -r "$DIR/package.mk" ] && echo "${DIR}${_ANCHOR}" >> "${temp_local}"
done
# cache project folder for packages
find "${ROOT}/projects/${PROJECT}/packages" -type f -name package.mk 2>/dev/null | sed "s#/package\.mk\$#${_ANCHOR}#" >> "${temp_local}"

# cache packages folder
for DIR in $(find $ROOT/$PACKAGES -type d 2>/dev/null); do
[ -r "$DIR/package.mk" ] && echo "${DIR}${_ANCHOR}" >> "${temp_global}"
done
find "${ROOT}/${PACKAGES}" -type f -name package.mk 2>/dev/null | sed "s#/package\.mk\$#${_ANCHOR}#" >> "${temp_global}"

_CACHE_PACKAGE_LOCAL="${BUILD}/.cache_package_local"
_CACHE_PACKAGE_GLOBAL="${BUILD}/.cache_package_global"
Expand Down Expand Up @@ -621,14 +615,14 @@ check_device() {

check_arch() {
local dashes="===========================" arch_err_msg linux_config_dir
if [ -d ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/linux ]; then
if [ -d "${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/linux" ]; then
linux_config_dir="${PROJECT_DIR}/${PROJECT}/devices/$DEVICE/linux"
else
linux_config_dir="${PROJECT_DIR}/${PROJECT}/linux"
fi

if [ ! -e $linux_config_dir/linux.${TARGET_PATCH_ARCH:-$TARGET_ARCH}.conf ] &&
! ls $linux_config_dir/*/linux.${TARGET_PATCH_ARCH:-$TARGET_ARCH}.conf &>/dev/null; then
if [ ! -e "$linux_config_dir/linux.${TARGET_PATCH_ARCH:-$TARGET_ARCH}.conf" ] &&
! ls "$linux_config_dir/"*/linux.${TARGET_PATCH_ARCH:-$TARGET_ARCH}.conf &>/dev/null; then
arch_err_msg="\n $dashes$dashes$dashes"
arch_err_msg="${arch_err_msg}\n ERROR: Architecture not found, use a valid Architecture"
arch_err_msg="${arch_err_msg}\n for your project or create a new config"
Expand Down
25 changes: 13 additions & 12 deletions config/multithread
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ json_worker() {

[[ ${pkgpath} =~ ^${ROOT}/${PACKAGES}/ ]] && hierarchy="global" || hierarchy="local"

if [ -n "$PKG_ARCH" ]; then
listcontains "$PKG_ARCH" "!$TARGET_ARCH" && continue
listcontains "$PKG_ARCH" "$TARGET_ARCH" || listcontains "$PKG_ARCH" "any" || continue
fi

cat <<EOF
{
"name": "${PKG_NAME}",
Expand Down Expand Up @@ -61,7 +56,7 @@ package_worker() {

. config/options "${pkgname}"

[ ! -f "${THREAD_CONTROL}/pid" ] && echo "${PARALLEL_PID}" >"${THREAD_CONTROL}/pid"
[ ! -f "${THREAD_CONTROL}/parallel.pid" ] && echo "${PARALLEL_PID}" >"${THREAD_CONTROL}/parallel.pid"

${SCRIPTS}/${task} ${pkgname} 2>&1 && result=0 || result=1

Expand Down Expand Up @@ -141,7 +136,7 @@ EOF
export -f package_worker

start_multithread_build() {
local singlethread buildopts
local singlethread buildopts result=0

# init thread control folder
rm -rf "${THREAD_CONTROL}"
Expand Down Expand Up @@ -174,12 +169,18 @@ start_multithread_build() {

cat ${_CACHE_PACKAGE_GLOBAL} ${_CACHE_PACKAGE_LOCAL} | \
${TOOLCHAIN}/bin/parallel --plain --no-notice --max-args 30 --halt now,fail=1 json_worker | \
${SCRIPTS}/genbuildplan.py --no-reorder --show-wants --build ${@} > "${THREAD_CONTROL}"/plan || return
${SCRIPTS}/genbuildplan.py --no-reorder --show-wants --build ${@} > "${THREAD_CONTROL}"/plan || result=1

cat "${THREAD_CONTROL}"/plan | awk '{print $1 " " $2}' | \
MTBUILDSTART=$(date +%s) MTWITHLOCKS=yes ${TOOLCHAIN}/bin/parallel \
--plain --no-notice --max-procs ${THREADCOUNT} --joblog="${THREAD_CONTROL}/joblog" --plus ${buildopts} \
package_worker {%} {#} {##} {} || return
if [ ${result} -eq 0 ]; then
cat "${THREAD_CONTROL}"/plan | awk '{print $1 " " $2}' | \
MTBUILDSTART=$(date +%s) MTWITHLOCKS=yes ${TOOLCHAIN}/bin/parallel \
--plain --no-notice --max-procs ${THREADCOUNT} --joblog="${THREAD_CONTROL}/joblog" --plus ${buildopts} \
package_worker {%} {#} {##} {} || result=1

rm -f "${THREAD_CONTROL}/parallel.pid"
fi

set +o pipefail

return ${result}
}
2 changes: 1 addition & 1 deletion packages/databases/mysql/package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ post_makeinstall_target() {
sed -i "s|pkgincludedir=.*|pkgincludedir=\'$SYSROOT_PREFIX/usr/include/mysql\'|" scripts/mysql_config
sed -i "s|pkglibdir=.*|pkglibdir=\'$SYSROOT_PREFIX/usr/lib/mysql\'|" scripts/mysql_config
cp scripts/mysql_config $SYSROOT_PREFIX/usr/bin
ln -sf $SYSROOT_PREFIX/usr/bin/mysql_config $TOOLCHAIN/bin/mysql_config
cp scripts/mysql_config $TOOLCHAIN/bin/mysql_config

rm -rf $INSTALL
}
6 changes: 6 additions & 0 deletions scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,12 @@ done
for i in $(find "${SYSROOT_PREFIX}/usr"/{lib,share} -type f -name "*.cmake" 2>/dev/null); do
sed -e "s#${SYSROOT_PREFIX}/usr#${PKG_ORIG_SYSROOT_PREFIX}/usr#g" -i "${i}"
done
for i in $(find "${SYSROOT_PREFIX}" -type l 2>/dev/null); do
_tmp="$(readlink -m "${i}")"
if [[ ${_tmp} =~ ^${SYSROOT_PREFIX}/ ]]; then
ln -sf "${_tmp/${SYSROOT_PREFIX}\//${PKG_ORIG_SYSROOT_PREFIX}\/}" "${i}"
fi
done

# Transfer the new sysroot content to the shared sysroot
mkdir -p "${PKG_ORIG_SYSROOT_PREFIX}"
Expand Down
2 changes: 2 additions & 0 deletions scripts/build_mt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
. config/options ""
. config/multithread

${SCRIPTS}/checkdeps

# Setup both toolchain cmake configs to avoid potentially racy behaviour later.
# Use a fork for host to isolate any variable modifications.
( setup_toolchain host )
Expand Down
9 changes: 7 additions & 2 deletions tools/dashboard
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ if [ -n "${PROJECT}" -a "$1" != "auto" ]; then
fi

_find_latest_tcdir() {
local IFS=$'\n'

if [ -n "${THREAD_CONTROL}" ]; then
echo "${THREAD_CONTROL}"
else
ls -1tdr "${PWD}"/build.*/.threads 2>/dev/null | tail -1
for dir in $(ls -1td "${PWD}"/build.*/.threads 2>/dev/null); do
[ -f "${dir}/parallel.pid" ] && echo "${dir}" && break
done
fi
return 0
}

while [ : ]; do
Expand All @@ -24,7 +29,7 @@ while [ : ]; do
tcdir="$(_find_latest_tcdir)"

if [ -n "${tcdir}" ]; then
pid="$(cat "${tcdir}/pid" 2>/dev/null || true)"
pid="$(cat "${tcdir}/parallel.pid" 2>/dev/null || true)"
[ -n "${pid}" ] && ps -p ${pid} &>/dev/null && break
fi

Expand Down
2 changes: 1 addition & 1 deletion tools/viewplan
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ command -v ${PARALLEL_BIN} >/dev/null || PARALLEL_BIN=fake_parallel
set -o pipefail

cat ${_CACHE_PACKAGE_GLOBAL} ${_CACHE_PACKAGE_LOCAL} | \
${PARALLEL_BIN} --plain --no-notice --max-args 30 json_worker --halt now,fail=1 | \
${PARALLEL_BIN} --plain --no-notice --max-args 30 --halt now,fail=1 json_worker | \
${SCRIPTS}/genbuildplan.py --no-reorder --show-wants --build ${@:-image} --warn-invalid ${GENFLAGS} || \
die "FAILURE: Unable to generate plan"

0 comments on commit f14df92

Please sign in to comment.