mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-03-25 13:29:03 +02:00
unified cache file handling for vendorfile/subfile
lib.sh download() is used by subfile handling in git.sh, e.g. crossgcc tarballs, and also the vendor scripts. vendor files are cached, but not subfiles for repos. cache both, under cache/file/, saved with the name equal to the checksum, so: cache/file/CHECKSUM also move vendorfiles/app/ to cache/app/ in this change. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,6 @@
|
||||
*~
|
||||
*.o
|
||||
/cache/
|
||||
/lbmk.err.log
|
||||
/repo/
|
||||
/docs/
|
||||
|
||||
@@ -180,18 +180,19 @@ singletree()
|
||||
|
||||
download()
|
||||
{
|
||||
dl_fail="y" # 1 url, 2 url backup, 3 destination, 4 checksum
|
||||
vendor_checksum "$4" "$3" 2>/dev/null || dl_fail="n"
|
||||
cached="cache/file/$4"
|
||||
dl_fail="n" # 1 url, 2 url backup, 3 destination, 4 checksum
|
||||
vendor_checksum "$4" "$cached" 2>/dev/null && dl_fail="y"
|
||||
[ "$dl_fail" = "n" ] && e "$3" f && return 0
|
||||
x_ mkdir -p "${3%/*}" && for url in "$1" "$2"; do
|
||||
x_ mkdir -p "${3%/*}" cache/file && for url in "$1" "$2"; do
|
||||
[ "$dl_fail" = "n" ] && break
|
||||
[ -z "$url" ] && continue
|
||||
x_ rm -f "$3"
|
||||
curl --location --retry 3 -A "$_ua" "$url" -o "$3" || \
|
||||
wget --tries 3 -U "$_ua" "$url" -O "$3" || continue
|
||||
vendor_checksum "$4" "$3" || dl_fail="n"
|
||||
done;
|
||||
[ "$dl_fail" = "y" ] && $err "$1 $2 $3 $4: not downloaded"; return 0
|
||||
x_ rm -f "$cached"
|
||||
curl --location --retry 3 -A "$_ua" "$url" -o "$cached" || \
|
||||
wget --tries 3 -U "$_ua" "$url" -O "$cached" || continue
|
||||
vendor_checksum "$4" "$cached" || dl_fail="n"
|
||||
done; [ "$dl_fail" = "y" ] && $err "$1 $2 $3 $4: not downloaded"
|
||||
[ "$cached" = "$3" ] || cp "$cached" "$3" || $err "!d cp $cached $3"; :
|
||||
}
|
||||
|
||||
vendor_checksum()
|
||||
|
||||
@@ -8,7 +8,7 @@ me7updateparser="$PWD/util/me7_update_parser/me7_update_parser.py"
|
||||
pfs_extract="$PWD/src/biosutilities/Dell_PFS_Extract.py"
|
||||
uefiextract="$PWD/elf/uefitool/uefiextract"
|
||||
vendir="vendorfiles"
|
||||
appdir="$vendir/app"
|
||||
appdir="cache/app"
|
||||
cbcfgsdir="config/coreboot"
|
||||
|
||||
eval `setvars "" EC_url_bkup EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \
|
||||
@@ -78,7 +78,7 @@ getfiles()
|
||||
fetch()
|
||||
{
|
||||
dl_type="$1"; dl="$2"; dl_bkup="$3"; dlsum="$4"; _dest="${5##*../}"
|
||||
[ "$5" = "/dev/null" ] && return 0; _dl="$vendir/cache/$dlsum"
|
||||
[ "$5" = "/dev/null" ] && return 0; _dl="cache/file/$dlsum"
|
||||
|
||||
download "$dl" "$dl_bkup" "$_dl" "$dlsum"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user