diff options
Diffstat (limited to 'include')
-rwxr-xr-x | include/git.sh | 38 | ||||
-rwxr-xr-x | include/option.sh | 8 |
2 files changed, 31 insertions, 15 deletions
diff --git a/include/git.sh b/include/git.sh index bc818b19..934976eb 100755 --- a/include/git.sh +++ b/include/git.sh @@ -7,7 +7,8 @@ eval "$(setvars "" _target rev _xm loc url bkup_url depend tree_depend xtree)" fetch_project_trees() { _target="${target}" - [ -d "src/${project}/${project}" ] || fetch_from_upstream + [ ! -d "src/${project}/${project}" ] && x_ mkdir -p "src/${project}" \ + && fetch_project_repo "${project}" fetch_config if [ -d "src/${project}/${tree}" ]; then printf "download/%s %s (%s): exists\n" \ @@ -17,14 +18,6 @@ fetch_project_trees() prepare_new_tree } -fetch_from_upstream() -{ - [ -d "src/${project}/${project}" ] && return 0 - - x_ mkdir -p "src/${project}" - fetch_project_repo "${project}" -} - fetch_config() { rm -f "${cfgsdir}/"*/seen || $err "fetch_config ${cfgsdir}: !rm seen" @@ -100,6 +93,9 @@ git_prep() if [ "$project" != "coreboot" ] || [ $# -gt 2 ]; then [ ! -f "$tmpgit/.gitmodules" ] || git -C "$tmpgit" submodule \ update --init --checkout || $err "git_prep $_loc: !submod" + + patch_submodules + if [ "$project" = "coreboot" ] && [ -n "$xtree" ] && \ [ "$xtree" != "$tree" ]; then ( @@ -111,12 +107,32 @@ git_prep() fi fi - [ "$xbmk_release" = "y" ] && rmgit "$tmpgit" + [ "$xbmk_release" = "y" ] && [ "$_loc" != "src/$project/$project" ] \ + && rmgit "$tmpgit" + [ "$_loc" = "${_loc%/*}" ] || x_ mkdir -p "${_loc%/*}" mv "$tmpgit" "$_loc" || $err "git_prep: !mv $tmpgit $_loc" [ -n "$xtree" ] && [ ! -d "src/coreboot/$xtree" ] && \ - x_ ./update project trees -f coreboot "$xtree"; return 0 + x_ ./update trees -f coreboot "$xtree"; return 0 +} + +patch_submodules() +{ + moddir="${PWD}/config/submodule/$project" + [ -n "$tree" ] && moddir="$moddir/$tree" + [ -d "$moddir" ] || return 0 + + git -C "$tmpgit" submodule status | awk '{print $2}' > \ + "$tmpdir/modules" || $err "$moddir: cannot list submodules" + + while read -r modsrcdir; do + modname="${modsrcdir##*/}" + modpatchdir="$moddir/$modname/patches" + [ -d "$modpatchdir" ] || continue + + git_am_patches "$tmpgit/$modsrcdir" "$modpatchdir" + done < "$tmpdir/modules" } git_am_patches() diff --git a/include/option.sh b/include/option.sh index 45066166..bfeb9eb3 100755 --- a/include/option.sh +++ b/include/option.sh @@ -151,11 +151,11 @@ git_err() $err "Git name/email not configured" } -mktar_release() +mkrom_tarball() { - printf "%s\n" "${version}" > "${1}/version" || return 1 - printf "%s\n" "${versiondate}" > "${1}/versiondate" || return 1 - printf "%s\n" "${projectname}" > "${1}/projectname" || return 1 + printf "%s\n" "${version}" > "${1}/version" || $err "$1 !version" + printf "%s\n" "${versiondate}" > "${1}/versiondate" || $err "$1 !vdate" + printf "%s\n" "${projectname}" > "${1}/projectname" || $err "$1 !pname" mktarball "$1" "${1%/*}/${relname}_${1##*/}.tar.xz" x_ rm -Rf "$1" |