summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild1
-rw-r--r--config/u-boot/default/nuke.list1
-rwxr-xr-xinclude/git.sh37
-rwxr-xr-xinclude/vendor.sh1
4 files changed, 35 insertions, 5 deletions
diff --git a/build b/build
index 2877a8fb..28d8be08 100755
--- a/build
+++ b/build
@@ -139,7 +139,6 @@ fetch_trees()
[ ! -f "$x" ] || [ -L "$xp" ] || x_ rm -Rf "src/$xp/$xp"
done
rmgit .
- rm -Rf tmp .git src/u-boot/*/test/lib/strlcat.c || $err "$_xm !rm"
}
fail()
diff --git a/config/u-boot/default/nuke.list b/config/u-boot/default/nuke.list
new file mode 100644
index 00000000..f3a3fcc3
--- /dev/null
+++ b/config/u-boot/default/nuke.list
@@ -0,0 +1 @@
+test/lib/strlcat.c
diff --git a/include/git.sh b/include/git.sh
index f5aa34eb..e7fe28b5 100755
--- a/include/git.sh
+++ b/include/git.sh
@@ -46,6 +46,7 @@ prepare_new_tree()
cp -R "src/$project/$project" "$tmpgit" || \
$err "prepare_new_tree $project/$tree: can't make tmpclone"
git_prep "$PWD/$cfgsdir/$tree/patches" "src/$project/$tree" "update"
+ nuke "$project/$tree" "$project/$tree"
}
fetch_project_repo()
@@ -61,6 +62,10 @@ fetch_project_repo()
x_ ./update trees -f $d
done
rm -Rf "$tmpgit" || $err "fetch_repo: !rm -Rf $tmpgit"
+
+ for x in config/git/*; do
+ [ -f "$x" ] && nuke "${x##*/}" "src/${x##*/}"; continue
+ done
}
clone_project()
@@ -115,9 +120,6 @@ prep_submodules()
fetch_submodule "$msrcdir"
patch_submodule "$msrcdir"
done < "$tmpdir/modules"
-
- # some build systems may download more (we want to control it)
- rm -f "$tmpgit/.gitmodules" || $err "!rm .gitmodules as per: $mdir"
}
fetch_submodule()
@@ -181,3 +183,32 @@ move_repo()
[ -n "$xtree" ] && [ ! -d "src/coreboot/$xtree" ] && \
x_ ./update trees -f coreboot "$xtree"; return 0
}
+
+# can delete from multi- and single-tree projects.
+# called from script/trees when downloading sources.
+nuke()
+{
+ del="n"
+ pjcfgdir="${1%/}"
+ pjsrcdir="${2%/}"
+ pjsrcdir="${pjsrcdir#src/}"
+ [ ! -f "config/$pjcfgdir/nuke.list" ] && return 0
+
+ while read -r nukefile; do
+ rmf="$(realpath "src/$pjsrcdir/$nukefile" 2>/dev/null)" || \
+ continue
+ [ -L "$rmf" ] && continue # we will delete the actual file
+ [ "${rmf#"$PWD/src/$pjsrcdir"}" = "$rmf" ] && continue
+ [ "${rmf#"$PWD/src/"}" = "$pjsrcdir" ] && continue
+ rmf="${rmf#"$PWD/"}"
+ [ -e "$rmf" ] || continue
+ del="y"
+ rm -Rf "$rmf" || $err "$nuke pjcfgdir: can't rm \"$nukefile\""
+ printf "nuke %s: deleted \"%s\"\n" "$pjcfgdir" "$rmf"
+ done < "config/$pjcfgdir/nuke.list"
+
+ [ "${del}" = "y" ] && return 0
+ printf "nuke %s: no defined files exist in dir, src/%s\n" 1>&2 \
+ "$pjcfgdir" "$pjsrcdir"
+ printf "(this is not an error)\n" 1>&2
+}
diff --git a/include/vendor.sh b/include/vendor.sh
index f307fcbd..53f8e9c6 100755
--- a/include/vendor.sh
+++ b/include/vendor.sh
@@ -113,7 +113,6 @@ fetch()
[ "${5#/}" = "$5" ] || $err "fetch: absolute path not allowed: '$5'"
_dest="${5##*../}"
_dl="$vendir/cache/$dlsum"
- dl_fail="n"
x_ mkdir -p "${_dl%/*}"