move deblob function to new file "deblob.sh"
i'm importing some changes from lbmk and they go at the end of git.sh, in the diffs. moving the deblob function to its own file will allow me to cherry-pick with fewer merge conflicts. Signed-off-by: Leah Rowe <info@minifree.org>audit2-merge1
parent
1300f09e67
commit
0d7c249c9b
|
@ -0,0 +1,32 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# SPDX-FileCopyrightText: 2020,2021,2023,2024 Leah Rowe <leah@libreboot.org>
|
||||
|
||||
# can delete from multi- and single-tree projects.
|
||||
# called from build_projects() and handle_src_tree() on script/update/trees
|
||||
nukeblobs()
|
||||
{
|
||||
del="n"
|
||||
pjcfgdir="${1%/}"
|
||||
pjsrcdir="${2%/}"
|
||||
pjsrcdir="${pjsrcdir#src/}"
|
||||
[ ! -f "config/${pjcfgdir}/blobs.list" ] && return 0
|
||||
|
||||
while read -r blobfile; do
|
||||
rmf="$(realpath "src/${pjsrcdir}/${blobfile}" 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 "nukeblobs ${pjcfgdir}/blobs: can't rm \"${blobfile}\""
|
||||
printf "nukeblobs %s: deleted \"%s\"\n" "${pjcfgdir}" "${rmf}"
|
||||
done < "config/${pjcfgdir}/blobs.list"
|
||||
|
||||
[ "${del}" = "y" ] && return 0
|
||||
printf "nukeblobs %s: no defined blobs exist in dir, src/%s\n" 1>&2 \
|
||||
"${pjcfgdir}" "${pjsrcdir}"
|
||||
printf "(this is not an error)\n"
|
||||
}
|
|
@ -147,33 +147,3 @@ git_am_patches()
|
|||
git_am_patches "$1" "$_patches"; continue
|
||||
done
|
||||
}
|
||||
|
||||
# can delete from multi- and single-tree projects.
|
||||
# called from build_projects() and handle_src_tree() on script/update/trees
|
||||
nukeblobs()
|
||||
{
|
||||
del="n"
|
||||
pjcfgdir="${1%/}"
|
||||
pjsrcdir="${2%/}"
|
||||
pjsrcdir="${pjsrcdir#src/}"
|
||||
[ ! -f "config/${pjcfgdir}/blobs.list" ] && return 0
|
||||
|
||||
while read -r blobfile; do
|
||||
rmf="$(realpath "src/${pjsrcdir}/${blobfile}" 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 "nukeblobs ${pjcfgdir}/blobs: can't rm \"${blobfile}\""
|
||||
printf "nukeblobs %s: deleted \"%s\"\n" "${pjcfgdir}" "${rmf}"
|
||||
done < "config/${pjcfgdir}/blobs.list"
|
||||
|
||||
[ "${del}" = "y" ] && return 0
|
||||
printf "nukeblobs %s: no defined blobs exist in dir, src/%s\n" 1>&2 \
|
||||
"${pjcfgdir}" "${pjsrcdir}"
|
||||
printf "(this is not an error)\n"
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ set -u -e
|
|||
|
||||
. "include/option.sh"
|
||||
. "include/git.sh"
|
||||
. "include/deblob.sh"
|
||||
|
||||
eval "$(setvars "" xarch cfgsdir codedir config config_name xlang mode \
|
||||
elfdir listfile project target target_dir targets tree _f target1 \
|
||||
|
|
Loading…
Reference in New Issue