-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get-linux-source: fixup for prepare-incremental-build
- Loading branch information
Showing
2 changed files
with
28 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,8 @@ source $(cd $(dirname $0) && pwd)/../helpers.sh | |
|
||
CWD=$(pwd) | ||
|
||
FETCH_GIT_REPO=${FETCH_GIT_REPO:-} | ||
# 0 means just download a snapshot | ||
FETCH_DEPTH=${FETCH_DEPTH:-0} | ||
|
||
echo KERNEL_ORIGIN = ${KERNEL_ORIGIN} | ||
echo KERNEL_BRANCH = ${KERNEL_BRANCH} | ||
|
@@ -31,28 +32,27 @@ if [ ! -d "${REPO_PATH}" ]; then | |
mkdir -p $(dirname "${REPO_PATH}") | ||
cd $(dirname "${REPO_PATH}") | ||
# attempt to fetch desired bpf-next repo snapshot | ||
if [ -n "${SNAPSHOT_URL}" ] && [ -z "${FETCH_GIT_REPO}" ] && \ | ||
if [ -n "${SNAPSHOT_URL}" ] && [ "${FETCH_DEPTH}" -eq 0 ] && \ | ||
wget -U 'BPFCIBot/1.0 ([email protected])' -nv ${SNAPSHOT_URL} && \ | ||
tar xf bpf-next-${LINUX_SHA}.tar.gz --totals ; then | ||
mv bpf-next-${LINUX_SHA} $(basename ${REPO_PATH}) | ||
else | ||
# but fallback to git fetch approach if that fails | ||
mkdir -p $(basename ${REPO_PATH}) | ||
cd $(basename ${REPO_PATH}) | ||
git init | ||
git remote add bpf-next ${KERNEL_ORIGIN} | ||
# try shallow clone first | ||
git fetch --depth 32 bpf-next | ||
# check if desired SHA exists | ||
if ! git cat-file -e ${LINUX_SHA}^{commit} ; then | ||
# if not, fetch all of bpf-next; slow and painful | ||
git fetch bpf-next | ||
fi | ||
git reset --hard ${LINUX_SHA} | ||
# but fallback to git fetch approach if that fails | ||
git clone --depth ${FETCH_DEPTH} ${KERNEL_ORIGIN} ${REPO_PATH} | ||
cd "${REPO_PATH}" | ||
# check if desired SHA exists | ||
if ! git cat-file -e ${LINUX_SHA}^{commit} ; then | ||
# if not, fetch all of bpf-next; slow and painful | ||
git fetch origin | ||
fi | ||
git reset --hard ${LINUX_SHA} | ||
cd - | ||
fi | ||
if [ -z "${FETCH_GIT_REPO}" ]; then | ||
if [ "${FETCH_DEPTH}" -eq 0 ]; then | ||
rm -rf ${REPO_PATH}/.git || true | ||
fi | ||
|
||
foldable end pull_kernel_srcs | ||
else | ||
echo "${REPO_PATH} directory already exists, will not download kernel sources" | ||
fi |