Skip the download if PREFIX env variables are defined

This commit is contained in:
Radu Tutueanu 2016-11-11 14:46:16 +01:00
parent d229cd6130
commit 900827d72f
1 changed files with 45 additions and 37 deletions

View File

@ -94,50 +94,58 @@ check_release_notes() {
grep -Fqi "$REALM_CORE_VERSION RELEASE NOTES" "$@"
}
if [ ! -e "vendor/$CORE_DIR" ]; then
download_core $CORE_DIR $REALM_CORE_VERSION $CORE_DOWNLOAD_FILE core "tar -xzf" core
elif [ -d "vendor/$CORE_DIR" -a -d ../realm-core -a ! -L "vendor/$CORE_DIR" ]; then
# Allow newer versions than expected for local builds as testing
# with unreleased versions is one of the reasons to use a local build
if ! check_release_notes "vendor/$CORE_DIR/CHANGELOG.txt"; then
die "Local build of core is out of date."
else
echo "The core library seems to be up to date."
fi
elif [ ! -L "vendor/$CORE_DIR" ]; then
echo "vendor/$CORE_DIR is not a symlink. Deleting..."
rm -rf "vendor/$CORE_DIR"
download_core $CORE_DIR $REALM_CORE_VERSION $CORE_DOWNLOAD_FILE core "tar -xzf" core
# With a prebuilt version we only want to check the first non-empty
# line so that checking out an older commit will download the
# appropriate version of core if the already-present version is too new
elif ! grep -m 1 . "vendor/$CORE_DIR/CHANGELOG.txt" | check_release_notes; then
download_core $CORE_DIR $REALM_CORE_VERSION $CORE_DOWNLOAD_FILE core "tar -xzf" core
else
echo "The core library seems to be up to date."
fi
if [ -n "$SYNC_DOWNLOAD_FILE" ];then
if [ ! -e "vendor/$SYNC_DIR" ]; then
download_core $SYNC_DIR $REALM_SYNC_VERSION $SYNC_DOWNLOAD_FILE sync "$SYNC_EXTRACT" $EXTRACTED_DIR
elif [ -d "vendor/$SYNC_DIR" -a -d ../realm-sync -a ! -L "vendor/$SYNC_DIR" ]; then
if [ -z "$REALM_CORE_PREFIX" ]; then
if [ ! -e "vendor/$CORE_DIR" ]; then
download_core $CORE_DIR $REALM_CORE_VERSION $CORE_DOWNLOAD_FILE core "tar -xzf" core
elif [ -d "vendor/$CORE_DIR" -a -d ../realm-core -a ! -L "vendor/$CORE_DIR" ]; then
# Allow newer versions than expected for local builds as testing
# with unreleased versions is one of the reasons to use a local build
if ! check_release_notes "vendor/$SYNC_DIR/version.txt"; then
die "Local build of sync is out of date."
if ! check_release_notes "vendor/$CORE_DIR/CHANGELOG.txt"; then
die "Local build of core is out of date."
else
echo "The sync library seems to be up to date."
echo "The core library seems to be up to date."
fi
elif [ ! -L "vendor/$SYNC_DIR" ]; then
echo "vendor/$SYNC_DIR is not a symlink. Deleting..."
rm -rf "vendor/$SYNC_DIR"
download_core $SYNC_DIR $REALM_SYNC_VERSION $SYNC_DOWNLOAD_FILE sync "$SYNC_EXTRACT" $EXTRACTED_DIR
elif [ ! -L "vendor/$CORE_DIR" ]; then
echo "vendor/$CORE_DIR is not a symlink. Deleting..."
rm -rf "vendor/$CORE_DIR"
download_core $CORE_DIR $REALM_CORE_VERSION $CORE_DOWNLOAD_FILE core "tar -xzf" core
# With a prebuilt version we only want to check the first non-empty
# line so that checking out an older commit will download the
# appropriate version of core if the already-present version is too new
elif ! grep -m 1 . "vendor/$SYNC_DIR/version.txt"; then
download_core $SYNC_DIR $REALM_SYNC_VERSION $SYNC_DOWNLOAD_FILE sync "$SYNC_EXTRACT" $EXTRACTED_DIR
elif ! grep -m 1 . "vendor/$CORE_DIR/CHANGELOG.txt" | check_release_notes; then
download_core $CORE_DIR $REALM_CORE_VERSION $CORE_DOWNLOAD_FILE core "tar -xzf" core
else
echo "The sync library seems to be up to date."
echo "The core library seems to be up to date."
fi
else
echo "Skipping core the download because REALM_CORE_PREFIX is defined."
fi
if [ -z "$REALM_SYNC_PREFIX" ]; then
if [ -n "$SYNC_DOWNLOAD_FILE" ];then
if [ ! -e "vendor/$SYNC_DIR" ]; then
download_core $SYNC_DIR $REALM_SYNC_VERSION $SYNC_DOWNLOAD_FILE sync "$SYNC_EXTRACT" $EXTRACTED_DIR
elif [ -d "vendor/$SYNC_DIR" -a -d ../realm-sync -a ! -L "vendor/$SYNC_DIR" ]; then
# Allow newer versions than expected for local builds as testing
# with unreleased versions is one of the reasons to use a local build
if ! check_release_notes "vendor/$SYNC_DIR/version.txt"; then
die "Local build of sync is out of date."
else
echo "The sync library seems to be up to date."
fi
elif [ ! -L "vendor/$SYNC_DIR" ]; then
echo "vendor/$SYNC_DIR is not a symlink. Deleting..."
rm -rf "vendor/$SYNC_DIR"
download_core $SYNC_DIR $REALM_SYNC_VERSION $SYNC_DOWNLOAD_FILE sync "$SYNC_EXTRACT" $EXTRACTED_DIR
# With a prebuilt version we only want to check the first non-empty
# line so that checking out an older commit will download the
# appropriate version of core if the already-present version is too new
elif ! grep -m 1 . "vendor/$SYNC_DIR/version.txt"; then
download_core $SYNC_DIR $REALM_SYNC_VERSION $SYNC_DOWNLOAD_FILE sync "$SYNC_EXTRACT" $EXTRACTED_DIR
else
echo "The sync library seems to be up to date."
fi
fi
else
echo "Skipping the sync download because REALM_SYNC_PREFIX is defined."
fi