CI: Purge destination directory always on release

[why]
When the fonts or the subdirectory structure of a font is changed that
will leave some 'old' files and/or directories in the patched-fonts/
directory. The archiver will try to pack them all and bails out.

In fact on a RELEASE we can safely purge always, because the complete
structure will be regenerated anyhow. The problem with purging exists
only when working locally and patching only some font files.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2026-08-01 21:56:55 +02:00
parent b5e83982a6
commit 1372be598b
3 changed files with 15 additions and 4 deletions

View file

@ -210,7 +210,7 @@ jobs:
run: |
cd -- "$GITHUB_WORKSPACE/bin/scripts"
fontforge --script `pwd`/../../font-patcher --version
./gotta-patch-em-all-font-patcher\!.sh -j "/${{ matrix.font }}"
./gotta-patch-em-all-font-patcher\!.sh -jp "/${{ matrix.font }}"
- name: Archive font packages
run: |

View file

@ -90,7 +90,7 @@ while read -r filename; do
if [ "$expected" -ne 0 ]; then
# Should never happen, but who knows
echo "${LINE_PREFIX} Did not pack expected number of font files! Likely same font names for different paths."
echo "${LINE_PREFIX} Did not pack expected number of font files! Likely same font names for different paths. (diff: ${expected})"
exit 1
fi
(cd "${outputdir}" && tar rf "${outputdir}/${basename}.tar" "README.md")

View file

@ -59,6 +59,7 @@ function show_help {
echo
echo " OPTION:"
echo " -c, --checkfont Create the font(s) in check-fonts/ instead"
echo " -p, --purge Force purging of the destination in patched-fonts/"
echo " -t, --keeptime Try to preserve timestamp of previously patched"
echo " font in patched-fonts/ directory"
echo " -v, --verbose Show more information when running"
@ -84,7 +85,7 @@ function find_font_root {
sed -E "s|(${unpatched_parent_dir}/[^/]*).*|\1|" <<< "$1"
}
while getopts ":chijtv-:" option; do
while getopts ":chijptv-:" option; do
case "${option}" in
c)
activate_checkfont
@ -98,6 +99,9 @@ while getopts ":chijtv-:" option; do
j)
parallel=TRUE
;;
p)
force_purge=TRUE
;;
t)
activate_keeptime
;;
@ -118,6 +122,9 @@ while getopts ":chijtv-:" option; do
jobs)
parallel=TRUE
;;
purge)
force_purge=TRUE
;;
keeptime)
activate_keeptime
;;
@ -265,7 +272,7 @@ function patch_font {
then
echo "Purging patched font dir ${patched_font_dir}"
fi
rm -- "${patched_font_dir}"/*
rm -Rf -- "${patched_font_dir}"/*
fi
config_parent_dir=$( cd "$( dirname "$f" )" && cd ".." && pwd)
@ -429,6 +436,10 @@ then
then
purge_destination="TRUE"
fi
if [ -n "${force_purge}" ]
then
purge_destination="TRUE"
fi
fi
echo "$LINE_PREFIX Processing font $((i+1))/${#source_fonts[@]}"
if [ -n "${parallel}" ]