termux-packages/scripts/build/get_source/termux_git_clone_src.sh
Henrik Grimler 4e902a41a5 building packages: create termux_step_get_source function
Calls termux_git_clone_src if TERMUX_PKG_SRCURL ends with .git, and
termux_download_src_archive and termux_extract_src_archive otherwise.
termux_step_extract_package has been split up into the latter two
functions.

termux_step_post_extract_package has been renamed to
termux_step_post_get_source to reflect these changes.
2020-07-21 10:14:00 +02:00

28 lines
792 B
Bash

termux_git_clone_src() {
local CHECKED_OUT_FOLDER=$TERMUX_PKG_TMPDIR/checkout-$TERMUX_PKG_VERSION
local TMP_CHECKOUT=$TERMUX_PKG_CACHEDIR/tmp-checkout
# If user aborts git clone step here the folder needs to be removed
# manually. IMO this is better than git cloning the src everytime
if [ ! -d $CHECKED_OUT_FOLDER ] && [ ! -d $TMP_CHECKOUT ]; then
if [ "$TERMUX_PKG_GIT_BRANCH" == "" ]; then
TERMUX_PKG_GIT_BRANCH=v$TERMUX_PKG_VERSION
fi
git clone --depth 1 \
--branch $TERMUX_PKG_GIT_BRANCH \
$TERMUX_PKG_SRCURL \
$TMP_CHECKOUT
cd $TMP_CHECKOUT
git submodule update --init --recursive
cd ..
fi
if [ ! -d $CHECKED_OUT_FOLDER ]; then
cp -Rf $TMP_CHECKOUT $CHECKED_OUT_FOLDER
fi
rm -rf $TERMUX_PKG_SRCDIR
cp -Rf $CHECKED_OUT_FOLDER $TERMUX_PKG_SRCDIR
}