new: support for building specific packages with mp-pool
This commit is contained in:
parent
3b0b5f2f5a
commit
2d828e0164
@ -115,7 +115,7 @@ EOF
|
|||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
|
|
||||||
info "Syncing repositories"
|
info "Syncing repositories"
|
||||||
matt sync --root "${target}" --yes
|
matt sync --root "${target}"
|
||||||
check_ret "matt command failed"
|
check_ret "matt command failed"
|
||||||
|
|
||||||
info "Installing base system packages"
|
info "Installing base system packages"
|
||||||
@ -186,9 +186,11 @@ check_ret "Failed to run make-ca, install certs manually"
|
|||||||
rm -f "${target}/certdata.txt"
|
rm -f "${target}/certdata.txt"
|
||||||
|
|
||||||
info "Running install scripts"
|
info "Running install scripts"
|
||||||
matter-chroot "${target}" bash -c "bash /var/lib/matt/data/scripts/*" > /dev/null
|
echo 'bash /var/lib/matt/data/scripts/*' > "${target}/install_scripts"
|
||||||
|
matter-chroot "${target}" bash /install_scripts > /dev/null
|
||||||
check_ret "Failed to run install scripts"
|
check_ret "Failed to run install scripts"
|
||||||
rm -r "${target}/var/lib/matt/data/scripts"
|
rm -r "${target}/var/lib/matt/data/scripts"
|
||||||
|
rm "${target}/install_scripts"
|
||||||
|
|
||||||
info "Setup complete, now creating the archive..."
|
info "Setup complete, now creating the archive..."
|
||||||
pushd "${target}" > /dev/null
|
pushd "${target}" > /dev/null
|
||||||
|
@ -36,7 +36,7 @@ fi
|
|||||||
# prints the help info
|
# prints the help info
|
||||||
help_cmd() {
|
help_cmd() {
|
||||||
info "MatterLinux pool build script"
|
info "MatterLinux pool build script"
|
||||||
info "Usage: ${0} <options> [pool directory]"
|
info "Usage: ${0} <options> [pool directory] <packages>"
|
||||||
info "Options:"
|
info "Options:"
|
||||||
echo_color " $BOLD--skip-fail$RESET: skip if a package build fails"
|
echo_color " $BOLD--skip-fail$RESET: skip if a package build fails"
|
||||||
echo_color " $BOLD--no-depend$RESET: don't check depends"
|
echo_color " $BOLD--no-depend$RESET: don't check depends"
|
||||||
@ -100,6 +100,8 @@ OPT_NO_CACHE=0 # cache is ENABLED
|
|||||||
OPT_NO_OPTS=0 # showing/listing options is ENABLED
|
OPT_NO_OPTS=0 # showing/listing options is ENABLED
|
||||||
OPT_NO_SIGN=0 # sign all the built packages
|
OPT_NO_SIGN=0 # sign all the built packages
|
||||||
OPT_CORES=$(nproc) # use ALL CPU cores
|
OPT_CORES=$(nproc) # use ALL CPU cores
|
||||||
|
OPT_POOLDIR="" # target pool directory (no default)
|
||||||
|
OPT_PACKAGES=() # target packages (all by default)
|
||||||
|
|
||||||
# parses all the options
|
# parses all the options
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
@ -126,23 +128,22 @@ for arg in "$@"; do
|
|||||||
error "Unknown option: ${arg}"
|
error "Unknown option: ${arg}"
|
||||||
exit 1 ;;
|
exit 1 ;;
|
||||||
*)
|
*)
|
||||||
if [ -z "${TARGET}" ]; then
|
if [ -z "${OPT_POOLDIR}" ]; then
|
||||||
TARGET="${arg}"
|
OPT_POOLDIR="${arg}"
|
||||||
else
|
else
|
||||||
error "Unknown argument: ${arg}"
|
OPT_PACKAGES+=("${arg}")
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z "${TARGET}" ]; then
|
if [ -z "${OPT_POOLDIR}" ]; then
|
||||||
error "Pool directory is not specified, run with \"--help\" for more information"
|
error "Pool directory is not specified, run with \"--help\" for more information"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "${TARGET}" ]; then
|
if [ ! -d "${OPT_POOLDIR}" ]; then
|
||||||
error "Pool directory \"${TARGET}\" does not exist"
|
error "Pool directory \"${OPT_POOLDIR}\" does not exist"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -166,8 +167,8 @@ if [ $OPT_NO_OPTS -eq 0 ]; then
|
|||||||
print " $BOLD CORES = $OPT_CORES"
|
print " $BOLD CORES = $OPT_CORES"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "${TARGET}"
|
cd "${OPT_POOLDIR}"
|
||||||
check_ret "Failed to change directory into \"${TARGET}\""
|
check_ret "Failed to change directory into \"${OPT_POOLDIR}\""
|
||||||
|
|
||||||
if [ ! -f "pool.sh" ]; then
|
if [ ! -f "pool.sh" ]; then
|
||||||
error "Package directory does not contain a pool script (pool.sh)"
|
error "Package directory does not contain a pool script (pool.sh)"
|
||||||
@ -194,24 +195,38 @@ if [ ! -d "${srcpath}" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# obtain every package if no package is specified
|
||||||
|
if [ -z "${OPT_PACKAGES}" ]; then
|
||||||
|
for pkg in "${srcpath}/"*; do
|
||||||
|
pkg_name=$(basename "${pkg}")
|
||||||
|
OPT_PACKAGES+=("${pkg_name}")
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# build every package
|
# build every package
|
||||||
pc="$(ls -1q "${srcpath}" | wc -l)"
|
pc=${#OPT_PACKAGES[@]}
|
||||||
pi=1
|
pi=1
|
||||||
|
|
||||||
for pkg in "${srcpath}/"*; do
|
for pkg_name in "${OPT_PACKAGES[@]}"; do
|
||||||
package=$(basename "${pkg}")
|
pkg="${srcpath}/${pkg_name}"
|
||||||
info "(${pi}/${pc}) Building \"${package}\""
|
|
||||||
|
if [ ! -d "${pkg}" ]; then
|
||||||
|
error "Package not found: \"${pkg_name}\""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
info "(${pi}/${pc}) Building \"${pkg_name}\""
|
||||||
|
|
||||||
if [ $OPT_SKIP_FAIL -eq 1 ]; then
|
if [ $OPT_SKIP_FAIL -eq 1 ]; then
|
||||||
mp_build_opts "${pkg}" "${distpath}"
|
mp_build_opts "${pkg}" "${distpath}"
|
||||||
if [ $? -ne "0" ]; then
|
if [ $? -ne "0" ]; then
|
||||||
error "(${pi}/${pc}) Build failed for \"${package}\", skipping"
|
error "(${pi}/${pc}) Build failed for \"${pkg_name}\", skipping"
|
||||||
pi=$((pi+1))
|
pi=$((pi+1))
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
mp_build_opts "${pkg}" "${distpath}"
|
mp_build_opts "${pkg}" "${distpath}"
|
||||||
check_ret "(${pi}/${pc}) Build failed for \"${package}\""
|
check_ret "(${pi}/${pc}) Build failed for \"${pkg_name}\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
archive="$(find "${pkg}/dist" -name "*.mpf" | tail -n1)"
|
archive="$(find "${pkg}/dist" -name "*.mpf" | tail -n1)"
|
||||||
@ -220,10 +235,10 @@ for pkg in "${srcpath}/"*; do
|
|||||||
if [ ! -z "${archive}" ]; then
|
if [ ! -z "${archive}" ]; then
|
||||||
rm -f "${distpath}/${name}_"*
|
rm -f "${distpath}/${name}_"*
|
||||||
mv "${archive}" "${distpath}"
|
mv "${archive}" "${distpath}"
|
||||||
check_ret "(${pi}/${pc}) Moving package archive failed for \"${package}\""
|
check_ret "(${pi}/${pc}) Moving package archive failed for \"${pkg_name}\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
success "(${pi}/${pc}) Build was successful for \"${package}\""
|
success "(${pi}/${pc}) Build was successful for \"${pkg_name}\""
|
||||||
pi=$((pi+1))
|
pi=$((pi+1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user