scripts: replace extract_into_massagedir fun with check_prefix fun
termux_step_check_prefix checks if $PREFIX was updated by the build, and in that case returns an error. This will make it easier to update all packages to install into $TERMUX_PKG_MASSAGEDIR instead (errors are automatically caught).
This commit is contained in:
parent
1f99cdebf6
commit
e4531a0461
|
@ -295,9 +295,10 @@ source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_install_service_scripts.sh"
|
|||
# shellcheck source=scripts/build/termux_step_install_license.sh
|
||||
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_install_license.sh"
|
||||
|
||||
# Function to cp (through tar) installed files to massage dir
|
||||
# shellcheck source=scripts/build/termux_step_extract_into_massagedir.sh
|
||||
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_extract_into_massagedir.sh"
|
||||
# Check so that we have not modified $TERMUX_PREFIX, all files should
|
||||
# be installed into $TERMUX_PKG_MASSAGEDIR.
|
||||
# source=scripts/build/termux_step_check_prefix.sh
|
||||
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_check_prefix.sh"
|
||||
|
||||
# Hook function to create {pre,post}install, {pre,post}rm-scripts for subpkgs
|
||||
# shellcheck source=scripts/build/termux_step_create_subpkg_debscripts.sh
|
||||
|
@ -602,10 +603,8 @@ for ((i=0; i<${#PACKAGE_LIST[@]}; i++)); do
|
|||
termux_step_post_make_install
|
||||
termux_step_install_service_scripts
|
||||
termux_step_install_license
|
||||
if [ "$TERMUX_ON_DEVICE_BUILD" = "false" ]; then
|
||||
cd "$TERMUX_PKG_MASSAGEDIR"
|
||||
termux_step_extract_into_massagedir
|
||||
fi
|
||||
termux_step_check_prefix
|
||||
cd "$TERMUX_PKG_MASSAGEDIR"
|
||||
termux_step_massage
|
||||
cd "$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX"
|
||||
termux_step_post_massage
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
termux_step_check_prefix() {
|
||||
if [ "$TERMUX_ON_DEVICE_BUILD" = "true" ]; then
|
||||
new_files=$(find $TERMUX_PREFIX \
|
||||
-path $TERMUX_PREFIX/tmp -prune -o \
|
||||
-path $TERMUX_PREFIX/var/run -prune \
|
||||
-newer "$TERMUX_BUILD_TS_FILE" -type f)
|
||||
else
|
||||
new_files=$(find $TERMUX_PREFIX \
|
||||
-newer "$TERMUX_BUILD_TS_FILE" -type f)
|
||||
fi
|
||||
|
||||
if [ ! -z "$new_files" ]; then
|
||||
termux_error_exit "$TERMUX_PREFIX was modified:\n\n$new_files\n\nPlease change the build script so that files are installed straight into TERMUX_PKG_MASSAGEDIR instead of PREFIX."
|
||||
fi
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
termux_step_extract_into_massagedir() {
|
||||
local TARBALL_ORIG=$TERMUX_PKG_PACKAGEDIR/${TERMUX_PKG_NAME}_orig.tar.gz
|
||||
|
||||
# Build diff tar with what has changed during the build:
|
||||
cd $TERMUX_PREFIX
|
||||
tar -N "$TERMUX_BUILD_TS_FILE" \
|
||||
--exclude='tmp' \
|
||||
-czf "$TARBALL_ORIG" .
|
||||
|
||||
# Extract tar in order to massage it
|
||||
mkdir -p "$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX"
|
||||
cd "$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX"
|
||||
tar xf "$TARBALL_ORIG"
|
||||
rm "$TARBALL_ORIG"
|
||||
}
|
Loading…
Reference in New Issue