download: Use shallow clones for big projects
Downloading coreboot and U-Boot takes quite the disk space and bandwith. We don't need to download entire repos, only the revisions that we are interested in. Use the --depth=1 option to only download the files we need. Since the initial clones may not have our target revision, always try to fetch it. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
This commit is contained in:
parent
12dc2140af
commit
ec40eb8633
|
@ -152,21 +152,21 @@ downloadfor() {
|
||||||
|
|
||||||
if [ ! -d coreboot ]; then
|
if [ ! -d coreboot ]; then
|
||||||
printf "Download coreboot from upstream:\n"
|
printf "Download coreboot from upstream:\n"
|
||||||
git clone https://review.coreboot.org/coreboot || rm -Rf coreboot
|
git clone --depth=1 https://review.coreboot.org/coreboot || rm -Rf coreboot
|
||||||
if [ ! -d coreboot ]; then
|
if [ ! -d coreboot ]; then
|
||||||
printf "WARNING: Upstream failed. Trying backup github repository:\n"
|
printf "WARNING: Upstream failed. Trying backup github repository:\n"
|
||||||
git clone https://github.com/coreboot/coreboot.git || rm -Rf coreboot
|
git clone --depth=1 https://github.com/coreboot/coreboot.git || rm -Rf coreboot
|
||||||
fi
|
fi
|
||||||
if [ ! -d coreboot ]; then
|
if [ ! -d coreboot ]; then
|
||||||
printf "ERROR: download/coreboot: Problem with git-clone. Network issue?\n"
|
printf "ERROR: download/coreboot: Problem with git-clone. Network issue?\n"
|
||||||
cd ../; return 1
|
cd ../; return 1
|
||||||
fi
|
fi
|
||||||
else
|
fi
|
||||||
( cd coreboot/; git pull || touch ../build_error )
|
|
||||||
if [ -f ../build_error ]; then
|
( cd coreboot/; git fetch --depth=1 origin "${cbrevision}" || touch ../build_error )
|
||||||
printf "ERROR: download/coreboot: Problem with git-pull. Network issue?\n"
|
if [ -f ../build_error ]; then
|
||||||
cd ../; return 1
|
printf "ERROR: download/coreboot: Problem with git-fetch. Network issue?\n"
|
||||||
fi
|
cd ../; return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp -R coreboot "${cbtree}" || touch ../build_error
|
cp -R coreboot "${cbtree}" || touch ../build_error
|
||||||
|
@ -184,7 +184,7 @@ downloadfor() {
|
||||||
cd ../../; return 1
|
cd ../../; return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git submodule update --init || touch ../../build_error
|
git submodule update --init --depth=1 || touch ../../build_error
|
||||||
if [ -f ../../build_error ]; then
|
if [ -f ../../build_error ]; then
|
||||||
printf "ERROR: download/coreboot: Unable to update submodules for tree '%s'\n" "${cbtree}"
|
printf "ERROR: download/coreboot: Unable to update submodules for tree '%s'\n" "${cbtree}"
|
||||||
cd ../../; return 1
|
cd ../../; return 1
|
||||||
|
|
|
@ -125,12 +125,12 @@ downloadfor() {
|
||||||
|
|
||||||
if [ ! -d "${uboot_dir}" ]; then
|
if [ ! -d "${uboot_dir}" ]; then
|
||||||
printf "Download u-boot from upstream:\n"
|
printf "Download u-boot from upstream:\n"
|
||||||
git clone https://source.denx.de/u-boot/u-boot.git \
|
git clone --depth=1 https://source.denx.de/u-boot/u-boot.git \
|
||||||
"${uboot_dir}" || \
|
"${uboot_dir}" || \
|
||||||
rm -Rf "${uboot_dir}"
|
rm -Rf "${uboot_dir}"
|
||||||
if [ ! -d "${uboot_dir}" ]; then
|
if [ ! -d "${uboot_dir}" ]; then
|
||||||
printf "WARNING: Upstream failed. Trying backup github repository:\n"
|
printf "WARNING: Upstream failed. Trying backup github repository:\n"
|
||||||
git clone https://github.com/u-boot/u-boot.git \
|
git clone --depth=1 https://github.com/u-boot/u-boot.git \
|
||||||
"${uboot_dir}" || \
|
"${uboot_dir}" || \
|
||||||
rm -Rf coreboot
|
rm -Rf coreboot
|
||||||
fi
|
fi
|
||||||
|
@ -140,14 +140,14 @@ downloadfor() {
|
||||||
"download/u-boot"
|
"download/u-boot"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
fi
|
||||||
git -C "${uboot_dir}" pull || touch build_error
|
|
||||||
if [ -f build_error ]; then
|
git -C "${uboot_dir}" fetch --depth=1 origin "${ubrevision}" || touch build_error
|
||||||
printf \
|
if [ -f build_error ]; then
|
||||||
"ERROR: %s: Problem with git-pull. Network issue?\n" \
|
printf \
|
||||||
"download/u-boot"
|
"ERROR: %s: Problem with git-fetch. Network issue?\n" \
|
||||||
return 1
|
"download/u-boot"
|
||||||
fi
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp -R "${uboot_dir}" "${ubtree}" || touch build_error
|
cp -R "${uboot_dir}" "${ubtree}" || touch build_error
|
||||||
|
@ -167,7 +167,7 @@ downloadfor() {
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git -C "${ubtree}" submodule update --init || touch build_error
|
git -C "${ubtree}" submodule update --init --depth=1 || touch build_error
|
||||||
if [ -f build_error ]; then
|
if [ -f build_error ]; then
|
||||||
printf "ERROR: %s: Unable to update submodules for tree '%s'\n" \
|
printf "ERROR: %s: Unable to update submodules for tree '%s'\n" \
|
||||||
"${ubtree}"
|
"${ubtree}"
|
||||||
|
|
Loading…
Reference in New Issue