1
0
mirror of https://github.com/ryanoasis/nerd-fonts.git synced 2024-12-25 20:18:01 +02:00

patch-em-all: Fix missing licenses

[why]
If the license file is not in the same folder as the font file or its
parent directory it will not be copied.

Example:

├── AUTHORS.txt
├── config.cfg
├── copyall.sh
├── Ligatures
│   ├── Bold
│   │   └── JetBrainsMono-Bold.ttf
│   ├── BoldItalic
│   │   └── JetBrainsMono-BoldItalic.ttf
├── OFL.txt
└── README.md

When processing one font file (.ttf) the OFL.txt is neither in the same
nor in the parent directory (but rather in the parent's parent.

[how]
Collect all license-ish files for a complete font set and copy them all
over each other into all appropriate destinations in patched-fonts.o

Note that in situations like this:

├── fonts.dir
├── fonts.scale
├── L
│   ├── Bold
│   │   └── Meslo LG L Bold for Powerline.ttf
│   ├── config.cfg
│   └── LICENSE.txt
├── LICENSE.txt
└── README.rst

All LICENSE.txt files will be copied, but only the last one will 'win'.
So make sure all license files are identical.

Fixes: #1068

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2023-01-24 13:22:18 +01:00
parent 00752430e3
commit 8a749ab210

View File

@ -77,6 +77,11 @@ function show_help {
echo " Process all font files that are in directory \"iosevka\""
}
function find_font_root {
# e.g. /a/b/c/nerd-fonts/src/unpatched-fonts/Meslo
sed -E "s|(${unpatched_parent_dir}/[^/]*).*|\1|" <<< "$1"
}
while getopts ":chijtv-:" option; do
case "${option}" in
c)
@ -335,15 +340,10 @@ function generate_info {
generate_readme "$patched_font_dir" 0
echo "$LINE_PREFIX * Copying license files"
if [ $is_unpatched_fonts_root == "0" ];
then
# if we are not at the unpatched fonts root, copy all license from config parent dir
copy_license "$config_parent_dir" "$patched_font_dir"
else
# otherwise we nedd to copy files from the config dir itself
copy_license "$config_dir" "$patched_font_dir"
fi
# Copy 'all' license files found in the complete font's source tree
# into the destination. This will overwrite all same-names files
# so make sure all licenses of one fontface are identical
copy_license "$(find_font_root $config_dir)" "$patched_font_dir"
last_parent_dir=$config_parent_dir
total_variation_count=$((total_variation_count+combination_count))