diff options
Diffstat (limited to 'include/git.sh')
-rw-r--r-- | include/git.sh | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/include/git.sh b/include/git.sh index 21a1f3b7..a30d3aa4 100644 --- a/include/git.sh +++ b/include/git.sh @@ -5,6 +5,8 @@ eval "`setvars "" loc url bkup_url subfile subhash subrepo subrepo_bkup \ depend subfile_bkup repofail`" +tmpgit="$xbmkpwd/tmp/gitclone" + fetch_targets() { [ -n "$tree_depend" ] && [ "$tree_depend" != "$tree" ] && \ @@ -12,8 +14,9 @@ fetch_targets() e "src/$project/$tree" d && return 0 printf "Creating %s tree %s\n" "$project" "$tree" - git_prep "$loc" "$loc" "$PWD/$configdir/$tree/patches" \ - "src/$project/$tree" u; nuke "$project/$tree" "$project/$tree" + git_prep "$loc" "$loc" "$xbmkpwd/$configdir/$tree/patches" \ + "src/$project/$tree" u + nuke "$project/$tree" "$project/$tree" } fetch_project() @@ -31,8 +34,8 @@ fetch_project() clone_project for x in config/git/*; do - [ -d "$x" ] && nuke "${x##*/}" "src/${x##*/}" 2>/dev/null - done; return 0 + [ -d "$x" ] && nuke "${x##*/}" "src/${x##*/}" 2>/dev/null; : + done; : } clone_project() @@ -42,21 +45,24 @@ clone_project() printf "Downloading project '%s' to '%s'\n" "$project" "$loc" e "$loc" d missing && remkdir "${tmpgit%/*}" && git_prep \ - "$url" "$bkup_url" "$PWD/config/$project/patches" "$loc"; : + "$url" "$bkup_url" "$xbmkpwd/config/$project/patches" "$loc"; : } git_prep() { - _patchdir="$3"; _loc="$4" # $1 and $2 are gitrepo and gitrepo_backup + _patchdir="$3" + _loc="$4" # $1 and $2 are gitrepo and gitrepo_backup - chkvars rev; tmpclone "$1" "$2" "$tmpgit" "$rev" "$_patchdir" + chkvars rev + tmpclone "$1" "$2" "$tmpgit" "$rev" "$_patchdir" if singletree "$project" || [ $# -gt 4 ]; then - prep_submodules "$_loc"; fi + prep_submodules "$_loc" + fi [ "$project" = "coreboot" ] && [ -n "$xtree" ] && [ $# -gt 2 ] && \ [ "$xtree" != "$tree" ] && link_crossgcc "$_loc" - [ "$XBMK_RELEASE" = "y" ] && \ - [ "$_loc" != "$XBMK_CACHE/repo/$project" ] && rmgit "$tmpgit" + [ "$_loc" != "$XBMK_CACHE/repo/$project" ] && \ + [ "$XBMK_RELEASE" = "y" ] && rmgit "$tmpgit" move_repo "$_loc" } @@ -65,14 +71,13 @@ prep_submodules() { [ -f "$mdir/module.list" ] && while read -r msrcdir; do fetch_submodule "$msrcdir" - done < "$mdir/module.list"; return 0 + done < "$mdir/module.list"; : } fetch_submodule() { - mcfgdir="$mdir/${1##*/}" - eval "`setvars "" subhash subrepo subrepo_bkup subfile subfile_bkup \ - st`" + mcfgdir="$mdir/${1##*/}"; eval \ + "`setvars "" subhash subrepo subrepo_bkup subfile subfile_bkup st`" [ ! -f "$mcfgdir/module.cfg" ] || . "$mcfgdir/module.cfg" || \ $err "! . $mcfgdir/module.cfg" @@ -123,10 +128,11 @@ tmpclone() git_am_patches() { for p in "$2/"*; do - [ -L "$p" ] && continue; [ -e "$p" ] || continue + [ -L "$p" ] && continue + [ -e "$p" ] || continue [ -d "$p" ] && git_am_patches "$1" "$p" && continue [ ! -f "$p" ] || git -C "$1" am "$p" || $err "$1 $2: !am $p" - done; return 0 + done; : } link_crossgcc() @@ -134,7 +140,7 @@ link_crossgcc() ( x_ cd "$tmpgit/util" && x_ rm -Rf crossgcc ln -s "../../$xtree/util/crossgcc" crossgcc || $err "$1: !xgcc link" - ) || $err "$1: !xgcc link" + ) || $err "$1: !xgcc link"; : } move_repo() @@ -150,5 +156,5 @@ nuke() e "config/${1%/}/nuke.list" f missing || while read -r nukefile; do rmf="src/${2%/}/$nukefile" && [ -L "$rmf" ] && continue e "$rmf" e missing || rm -Rf "$rmf" || $err "!rm $rmf, ${2%/}" - done < "config/${1%/}/nuke.list"; return 0 + done < "config/${1%/}/nuke.list"; : } |