unify caching of files into cache/
hash/ becomes cache/hash/ repo/ becomes cache/repo/ Signed-off-by: Leah Rowe <leah@libreboot.org>audit2
parent
8bb3730e7b
commit
0cf0fdcfc3
|
@ -37,7 +37,8 @@ fetch_project()
|
||||||
|
|
||||||
clone_project()
|
clone_project()
|
||||||
{
|
{
|
||||||
loc="repo/$project" && singletree "$project" && loc="src/$project"
|
loc="cache/repo/$project" && singletree "$project" && \
|
||||||
|
loc="src/$project"
|
||||||
|
|
||||||
printf "Downloading project '%s' to '%s'\n" "$project" "$loc"
|
printf "Downloading project '%s' to '%s'\n" "$project" "$loc"
|
||||||
e "$loc" d && return 0
|
e "$loc" d && return 0
|
||||||
|
@ -61,7 +62,7 @@ git_prep()
|
||||||
[ "$project" = "coreboot" ] && [ -n "$xtree" ] && [ $# -gt 2 ] && \
|
[ "$project" = "coreboot" ] && [ -n "$xtree" ] && [ $# -gt 2 ] && \
|
||||||
[ "$xtree" != "$tree" ] && link_crossgcc "$_loc"
|
[ "$xtree" != "$tree" ] && link_crossgcc "$_loc"
|
||||||
|
|
||||||
[ "$XBMK_RELEASE" = "y" ] && [ "$_loc" != "repo/$project" ] \
|
[ "$XBMK_RELEASE" = "y" ] && [ "$_loc" != "cache/repo/$project" ] \
|
||||||
&& rmgit "$tmpgit"
|
&& rmgit "$tmpgit"
|
||||||
|
|
||||||
move_repo "$_loc"
|
move_repo "$_loc"
|
||||||
|
@ -101,8 +102,8 @@ fetch_submodule()
|
||||||
tmpclone()
|
tmpclone()
|
||||||
{
|
{
|
||||||
[ $# -lt 6 ] || rm -Rf "$3" || $err "git retry: !rm $3 ($1)"
|
[ $# -lt 6 ] || rm -Rf "$3" || $err "git retry: !rm $3 ($1)"
|
||||||
repodir="repo/${1##*/}" && [ $# -gt 5 ] && repodir="$3"
|
repodir="cache/repo/${1##*/}" && [ $# -gt 5 ] && repodir="$3"
|
||||||
x_ mkdir -p "repo"
|
x_ mkdir -p "cache/repo"
|
||||||
if [ -d "$repodir" ] && [ $# -lt 6 ]; then
|
if [ -d "$repodir" ] && [ $# -lt 6 ]; then
|
||||||
git -C "$repodir" pull || sleep 3 || git -C "$repodir" pull \
|
git -C "$repodir" pull || sleep 3 || git -C "$repodir" pull \
|
||||||
|| sleep 3 || git -C "$repodir" pull :
|
|| sleep 3 || git -C "$repodir" pull :
|
||||||
|
|
14
script/trees
14
script/trees
|
@ -38,7 +38,7 @@ main()
|
||||||
[ -z "$_f" ] && $err "missing flag (-m/-u/-b/-c/-x/-f/-s/-l/-n)"
|
[ -z "$_f" ] && $err "missing flag (-m/-u/-b/-c/-x/-f/-s/-l/-n)"
|
||||||
[ -z "$project" ] && for p in $(ls -1 config/git); do
|
[ -z "$project" ] && for p in $(ls -1 config/git); do
|
||||||
./update trees $_f "$p" || $err "!./update trees $_f $p"
|
./update trees $_f "$p" || $err "!./update trees $_f $p"
|
||||||
[ "$XBMK_RELEASE" != "y" ] || x_ rm -Rf "repo/$p"; continue
|
[ "$XBMK_RELEASE" != "y" ] || x_ rm -Rf "cache/repo/$p"; :
|
||||||
done && return 1
|
done && return 1
|
||||||
|
|
||||||
[ -f "config/git/$project/pkg.cfg" ] || $err "'$project' not defined"
|
[ -f "config/git/$project/pkg.cfg" ] || $err "'$project' not defined"
|
||||||
|
@ -166,11 +166,11 @@ build_dependencies()
|
||||||
|
|
||||||
check_project_hashes()
|
check_project_hashes()
|
||||||
{
|
{
|
||||||
x_ mkdir -p hash
|
x_ mkdir -p cache/hash
|
||||||
|
|
||||||
old_pjhash=""
|
old_pjhash=""
|
||||||
[ ! -f "hash/$project$tree" ] || \
|
[ ! -f "cache/hash/$project$tree" ] || \
|
||||||
read -r old_pjhash < "hash/$project$tree"
|
read -r old_pjhash < "cache/hash/$project$tree"
|
||||||
|
|
||||||
x_ rm -f "$TMPDIR/project.list" "$TMPDIR/project.hash" \
|
x_ rm -f "$TMPDIR/project.list" "$TMPDIR/project.hash" \
|
||||||
"$TMPDIR/project.tmp"; x_ touch "$TMPDIR/project.tmp"
|
"$TMPDIR/project.tmp"; x_ touch "$TMPDIR/project.tmp"
|
||||||
|
@ -193,10 +193,10 @@ check_project_hashes()
|
||||||
|
|
||||||
pjhash="$(sha512sum "$TMPDIR/project.hash" | awk '{print $1}')" || :
|
pjhash="$(sha512sum "$TMPDIR/project.hash" | awk '{print $1}')" || :
|
||||||
badhash="y" && [ "$pjhash" = "$old_pjhash" ] && badhash="n"
|
badhash="y" && [ "$pjhash" = "$old_pjhash" ] && badhash="n"
|
||||||
[ -f "hash/$project$tree" ] || badhash="y"
|
[ -f "cache/hash/$project$tree" ] || badhash="y"
|
||||||
|
|
||||||
printf "%s\n" "$pjhash" > "hash/$project$tree" || \
|
printf "%s\n" "$pjhash" > "cache/hash/$project$tree" || \
|
||||||
$err "!mk hash/$project$tree"
|
$err "!mk cache/hash/$project$tree"
|
||||||
|
|
||||||
[ "$badhash" = "n" ] || rm -Rf "src/$project/$tree" \
|
[ "$badhash" = "n" ] || rm -Rf "src/$project/$tree" \
|
||||||
"elf/$project/$tree" "elf/$project/$target" || \
|
"elf/$project/$tree" "elf/$project/$target" || \
|
||||||
|
|
Loading…
Reference in New Issue