build: bootstrap missing sources even with IGNORE_UPDATES
- If IGNORE_UPDATES=yes, still fetch kernel/u-boot/ATF once when local trees are missing\n- fetch_from_repo: fallback to upstream GitHub when mirror lacks requested ref; disable partial-clone settings
This commit is contained in:
parent
96ff85af55
commit
33771550cf
|
|
@ -500,6 +500,7 @@ fetch_from_repo()
|
||||||
local dir=$2
|
local dir=$2
|
||||||
local ref=$3
|
local ref=$3
|
||||||
local ref_subdir=$4
|
local ref_subdir=$4
|
||||||
|
local upstream_url=$1
|
||||||
|
|
||||||
# Set GitHub mirror before anything else touches $url
|
# Set GitHub mirror before anything else touches $url
|
||||||
url=${url//'https://github.com/'/$GITHUB_SOURCE'/'}
|
url=${url//'https://github.com/'/$GITHUB_SOURCE'/'}
|
||||||
|
|
@ -555,6 +556,18 @@ fetch_from_repo()
|
||||||
offline=false
|
offline=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If this repo was left in a partial-clone state (e.g. filter=blob:none),
|
||||||
|
# checkouts can degrade into extremely slow per-blob fetches.
|
||||||
|
# Disable it to ensure reliable, reasonably fast builds.
|
||||||
|
if [[ "$(git config --bool --get remote.origin.promisor 2>/dev/null)" == "true" || \
|
||||||
|
-n "$(git config --get remote.origin.partialclonefilter 2>/dev/null)" || \
|
||||||
|
-n "$(git config --get extensions.partialclone 2>/dev/null)" ]]; then
|
||||||
|
display_alert "Disabling partial clone settings" "${workdir}" "wrn"
|
||||||
|
git config --unset-all remote.origin.promisor >/dev/null 2>&1 || true
|
||||||
|
git config --unset-all remote.origin.partialclonefilter >/dev/null 2>&1 || true
|
||||||
|
git config --unset-all extensions.partialclone >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
|
|
||||||
local changed=false
|
local changed=false
|
||||||
|
|
||||||
# when we work offline we simply return the sources to their original state
|
# when we work offline we simply return the sources to their original state
|
||||||
|
|
@ -567,14 +580,32 @@ fetch_from_repo()
|
||||||
# TODO: grep refs/heads/$name
|
# TODO: grep refs/heads/$name
|
||||||
local remote_hash
|
local remote_hash
|
||||||
remote_hash=$(improved_git ls-remote -h "${url}" "$ref_name" | head -1 | cut -f1)
|
remote_hash=$(improved_git ls-remote -h "${url}" "$ref_name" | head -1 | cut -f1)
|
||||||
|
if [[ -z $remote_hash && $url != "$upstream_url" ]]; then
|
||||||
|
display_alert "Mirror missing ref; falling back" "$ref_name" "wrn"
|
||||||
|
url="$upstream_url"
|
||||||
|
git remote set-url origin "${url}" >/dev/null 2>&1 || true
|
||||||
|
remote_hash=$(improved_git ls-remote -h "${url}" "$ref_name" | head -1 | cut -f1)
|
||||||
|
fi
|
||||||
[[ -z $local_hash || "${local_hash}" != "${remote_hash}" ]] && changed=true
|
[[ -z $local_hash || "${local_hash}" != "${remote_hash}" ]] && changed=true
|
||||||
;;
|
;;
|
||||||
|
|
||||||
tag)
|
tag)
|
||||||
local remote_hash
|
local remote_hash
|
||||||
remote_hash=$(improved_git ls-remote -t "${url}" "$ref_name" | cut -f1)
|
remote_hash=$(improved_git ls-remote -t "${url}" "$ref_name" | cut -f1)
|
||||||
|
if [[ -z $remote_hash && $url != "$upstream_url" ]]; then
|
||||||
|
display_alert "Mirror missing tag; falling back" "$ref_name" "wrn"
|
||||||
|
url="$upstream_url"
|
||||||
|
git remote set-url origin "${url}" >/dev/null 2>&1 || true
|
||||||
|
remote_hash=$(improved_git ls-remote -t "${url}" "$ref_name" | cut -f1)
|
||||||
|
fi
|
||||||
if [[ -z $local_hash || "${local_hash}" != "${remote_hash}" ]]; then
|
if [[ -z $local_hash || "${local_hash}" != "${remote_hash}" ]]; then
|
||||||
remote_hash=$(improved_git ls-remote -t "${url}" "$ref_name^{}" | cut -f1)
|
remote_hash=$(improved_git ls-remote -t "${url}" "$ref_name^{}" | cut -f1)
|
||||||
|
if [[ -z $remote_hash && $url != "$upstream_url" ]]; then
|
||||||
|
display_alert "Mirror missing tag deref; falling back" "$ref_name" "wrn"
|
||||||
|
url="$upstream_url"
|
||||||
|
git remote set-url origin "${url}" >/dev/null 2>&1 || true
|
||||||
|
remote_hash=$(improved_git ls-remote -t "${url}" "$ref_name^{}" | cut -f1)
|
||||||
|
fi
|
||||||
[[ -z $remote_hash || "${local_hash}" != "${remote_hash}" ]] && changed=true
|
[[ -z $remote_hash || "${local_hash}" != "${remote_hash}" ]] && changed=true
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
@ -582,6 +613,12 @@ fetch_from_repo()
|
||||||
head)
|
head)
|
||||||
local remote_hash
|
local remote_hash
|
||||||
remote_hash=$(improved_git ls-remote "${url}" HEAD | cut -f1)
|
remote_hash=$(improved_git ls-remote "${url}" HEAD | cut -f1)
|
||||||
|
if [[ -z $remote_hash && $url != "$upstream_url" ]]; then
|
||||||
|
display_alert "Mirror missing HEAD; falling back" "HEAD" "wrn"
|
||||||
|
url="$upstream_url"
|
||||||
|
git remote set-url origin "${url}" >/dev/null 2>&1 || true
|
||||||
|
remote_hash=$(improved_git ls-remote "${url}" HEAD | cut -f1)
|
||||||
|
fi
|
||||||
[[ -z $local_hash || "${local_hash}" != "${remote_hash}" ]] && changed=true
|
[[ -z $local_hash || "${local_hash}" != "${remote_hash}" ]] && changed=true
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -446,7 +446,9 @@ prepare_host
|
||||||
|
|
||||||
# fetch_from_repo <url> <dir> <ref> <subdir_flag>
|
# fetch_from_repo <url> <dir> <ref> <subdir_flag>
|
||||||
|
|
||||||
|
|
||||||
# ignore updates help on building all images - for internal purposes
|
# ignore updates help on building all images - for internal purposes
|
||||||
|
# When IGNORE_UPDATES=yes, still fetch once if required sources are missing.
|
||||||
if [[ ${IGNORE_UPDATES} != yes ]]; then
|
if [[ ${IGNORE_UPDATES} != yes ]]; then
|
||||||
|
|
||||||
display_alert "Downloading sources" "" "info"
|
display_alert "Downloading sources" "" "info"
|
||||||
|
|
@ -583,6 +585,27 @@ if [[ $BUILD_OPT == u-boot || $BUILD_OPT == image ]]; then
|
||||||
display_alert "File name" "${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb" "info"
|
display_alert "File name" "${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb" "info"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
# IGNORE_UPDATES=yes: prefer local trees, but bootstrap missing sources to avoid hard failures.
|
||||||
|
# Kernel: if the tree isn't populated, it will be missing the top-level Makefile.
|
||||||
|
if [[ $BUILD_OPT =~ kernel|image && ! -f "${LINUXSOURCEDIR}/Makefile" ]]; then
|
||||||
|
display_alert "Kernel sources missing; downloading once" "(IGNORE_UPDATES=yes)" "wrn"
|
||||||
|
fetch_from_repo "$KERNELSOURCE" "$KERNELDIR" "$KERNELBRANCH" "yes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# U-Boot/ATF are required for image builds; fetch once if missing.
|
||||||
|
if [[ $BOARDFAMILY != "cix" && $BUILD_OPT =~ u-boot|image && ! -f "${BOOTSOURCEDIR}/Makefile" ]]; then
|
||||||
|
display_alert "U-Boot sources missing; downloading once" "(IGNORE_UPDATES=yes)" "wrn"
|
||||||
|
fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n ${ATFSOURCE} && $BUILD_OPT =~ u-boot|image && ! -f "${EXTER}/cache/sources/${ATFSOURCEDIR}/Makefile" ]]; then
|
||||||
|
display_alert "ATF sources missing; downloading once" "(IGNORE_UPDATES=yes)" "wrn"
|
||||||
|
fetch_from_repo "$ATFSOURCE" "${EXTER}/cache/sources/$ATFDIR" "$ATFBRANCH" "yes"
|
||||||
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Compile kernel if packed .deb does not exist or use the one from Orange Pi
|
# Compile kernel if packed .deb does not exist or use the one from Orange Pi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue