Compare commits

..

7 Commits
f38 ... f41

Author SHA1 Message Date
Fedora Release Engineering 9bfed6063f Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
5 months ago
Akira TAGOH 0d51a62ef4 ci: Migrate CI to tmt based
6 months ago
Akira TAGOH 0300cc1878 Correct package replacement of linux-libertine-fonts-common.
7 months ago
Fedora Release Engineering 4f3ca32076 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
11 months ago
Fedora Release Engineering c778fd0ac0 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
11 months ago
Fedora Release Engineering 6b1f3db048 Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
1 year ago
Akira TAGOH 91e0591372 Revise the spec file for new packaging guidelines.
2 years ago

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "../fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig> <fontconfig>
<!-- Font substitution --> <!-- Font substitution -->
<alias binding="same"> <alias binding="same">

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "../fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig> <fontconfig>
<match target="scan"> <match target="scan">
<test name="family" ignore-blanks="yes"> <test name="family" ignore-blanks="true">
<string>Linux Libertine Display O</string> <string>Linux Libertine Display O</string>
</test> </test>
<edit name="family" mode="append"> <edit name="family" mode="append">
@ -10,7 +10,7 @@
</edit> </edit>
</match> </match>
<match target="scan"> <match target="scan">
<test name="family" ignore-blanks="yes"> <test name="family" ignore-blanks="true">
<string>Linux Libertine Initials O</string> <string>Linux Libertine Initials O</string>
</test> </test>
<edit name="family" mode="append"> <edit name="family" mode="append">
@ -18,15 +18,7 @@
</edit> </edit>
</match> </match>
<match target="scan"> <match target="scan">
<test name="family" ignore-blanks="yes"> <test name="family" ignore-blanks="true">
<string>Linux Libertine Mono O</string>
</test>
<edit name="family" mode="append">
<string>Linux Libertine Mono</string>
</edit>
</match>
<match target="scan">
<test name="family" ignore-blanks="yes">
<string>Linux Libertine O</string> <string>Linux Libertine O</string>
</test> </test>
<edit name="family" mode="append"> <edit name="family" mode="append">
@ -59,12 +51,6 @@
<family>Linux Libertine Initials</family> <family>Linux Libertine Initials</family>
</accept> </accept>
</alias> </alias>
<alias binding="same">
<family>Linux Libertine Mono G</family>
<accept>
<family>Linux Libertine Mono</family>
</accept>
</alias>
<alias binding="same"> <alias binding="same">
<family>Linux Libertine G</family> <family>Linux Libertine G</family>
<accept> <accept>

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "../fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig> <fontconfig>
<match target="scan"> <match target="scan">
<test name="family" ignore-blanks="yes"> <test name="family" ignore-blanks="true">
<string>Linux Biolinum Keyboard O</string> <string>Linux Biolinum Keyboard O</string>
</test> </test>
<edit name="family" mode="append"> <edit name="family" mode="append">
@ -10,7 +10,7 @@
</edit> </edit>
</match> </match>
<match target="scan"> <match target="scan">
<test name="family" ignore-blanks="yes"> <test name="family" ignore-blanks="true">
<string>Linux Biolinum O</string> <string>Linux Biolinum O</string>
</test> </test>
<edit name="family" mode="append"> <edit name="family" mode="append">

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<match target="scan">
<test name="family" ignore-blanks="true">
<string>Linux Libertine Mono O</string>
</test>
<edit name="family" mode="append">
<string>Linux Libertine Mono</string>
</edit>
</match>
<!-- Generic names -->
<alias>
<family>Linux Libertine Mono</family>
<default>
<family>monospace</family>
</default>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Linux Libertine Mono</family>
</prefer>
</alias>
<!-- Font substitution -->
<alias binding="same">
<family>Linux Libertine Mono G</family>
<accept>
<family>Linux Libertine Mono</family>
</accept>
</alias>
</fontconfig>

@ -1,113 +1,165 @@
%global fontname linux-libertine # Packaging template: multi-family fonts packaging.
%global prio_libertine 60 #
%global prio_biolinum 61 # SPDX-License-Identifier: MIT
%global fontconf_libertine %{prio_libertine}-%{fontname}-libertine.conf #
%global fontconf_biolinum %{prio_biolinum}-%{fontname}-biolinum.conf # This template documents spec declarations, used when packaging multiple font
%global fontconf_metrics 29-%{fontname}-metrics-alias.conf # families, from a single dedicated source archive. The source rpm is named
%global archivename LinLibertine # after the first (main) font family). Look up “fonts-3-sub” when the source
%global posttag 2012_07_02 # rpm needs to be named some other way.
#
%define common_desc \ # It is part of the following set of packaging templates:
The Linux Libertine Open Fonts are a TrueType font family for practical \ # “fonts-0-simple”: basic single-family fonts packaging
use in documents. They were created to provide a free alternative to \ # “fonts-1-full”: less common patterns for single-family fonts packaging
proprietary standard fonts. # “fonts-2-multi”: multi-family fonts packaging
# “fonts-3-sub”: packaging fonts, released as part of something else
Name: %{fontname}-fonts #
Version: 5.3.0 %global posttag 2012_07_02
Release: 24.%{posttag}%{?dist}
Summary: Linux Libertine Open Fonts Version: 5.3.0
Release: 30.%{posttag}%{?dist}
License: GPL-2.0-or-later WITH Font-exception-2.0 OR OFL-1.1 URL: http://linuxlibertine.sf.net
URL: http://linuxlibertine.sf.net BuildRequires: fonts-rpm-macros >= 1:2.0.5-9
Source0: http://download.sourceforge.net/sourceforge/linuxlibertine/LinLibertineOTF_%{version}_%{posttag}.tgz
Source1: %{name}-libertine-fontconfig.conf
Source2: %{name}-biolinum-fontconfig.conf # The following declarations will be aliased to [variable]0 and reused for all
Source3: %{name}-libertine-metrics-alias-fontconfig.conf # generated *-fonts packages unless overriden by a specific [variable][number]
Source4: libertine.metainfo.xml # declaration.
Source5: biolinum.metainfo.xml %global foundry linux-libertine
%global fontlicense GPL-2.0-or-later WITH Font-exception-2.0 OR OFL-1.1
BuildArch: noarch %global fontlicenses OFL-1.1.txt GPL.txt LICENCE.txt
BuildRequires: fontpackages-devel libappstream-glib %global fontdocs ToDo.txt Readme-TEX.txt README ChangeLog.txt Bugs.txt
#BuildRequires: fontforge %global fontdocsex %{fontlicenses}
Requires: %{name}-common = %{version}-%{release}
# A text block that can be reused as part of the description of each generated
%description # subpackage.
%common_desc %global common_description %{expand:
The Linux Libertine Open Fonts are a TrueType font family for practical use in documents. They were created to provide a free alternative to proprietary standard fonts.
}
# Declaration for the subpackage containing the first font family. Also used as
# source rpm info. All the [variable]0 declarations are equivalent and aliased
# to [variable].
%global fontfamily0 Linux Libertine
%global fontsummary0 Linux Libertine Open Fonts
%global fontpkgheader0 %{expand:
Obsoletes: linux-libertine-fonts-common < 5.3.0-25
Provides: linux-libertine-fonts-common = %{version}-%{release}
}
%global fonts0 LinLibertine_RZ.otf LinLibertine_RZI.otf LinLibertine_R.otf LinLibertine_RI.otf LinLibertine_RB.otf LinLibertine_RBI.otf LinLibertine_DR.otf LinLibertine_I.otf
%global fontsex0 %{nil}
%global fontconfs0 %{SOURCE10} %{SOURCE13}
%global fontconfsex0 %{nil}
%global fontdescription0 %{expand:
%{common_description}
This package contains Serif fonts. This package contains Serif fonts.
}
%package -n %{fontname}-biolinum-fonts
Summary: Sans-serif fonts from Linux Libertine Open Fonts %global fontfamily1 Linux Biolinum
Requires: %{name}-common = %{version}-%{release} %global fontsummary1 Sans-serif fonts from Linux Libertine Open Fonts
%global fontpkgheader1 %{expand:
%description -n %{fontname}-biolinum-fonts Obsoletes: linux-libertine-fonts-common < 5.3.0-25
%common_desc Provides: linux-libertine-fonts-common = %{version}-%{release}
}
%global fonts1 LinBiolinum_R.otf LinBiolinum_RI.otf LinBiolinum_RB.otf LinBiolinum_K.otf
%global fontsex1 %{nil}
%global fontconfs1 %{SOURCE11}
%global fontconfsex1 %{nil}
%global fontdescription1 %{expand:
%{common_description}
This package contains Sans fonts. This package contains Sans fonts.
}
%package common
Summary: Common files for Linux Libertine Open Fonts %global fontfamily2 Linux Libertine Mono
Requires: fontpackages-filesystem %global fontsummary2 Monospace font from Linux Libertine Open Fonts
%global fontpkgheader2 %{expand:
%description common Obsoletes: linux-libertine-fonts < 5.3.0-25
%common_desc Obsoletes: linux-libertine-fonts-common < 5.3.0-25
Provides: linux-libertine-fonts-common = %{version}-%{release}
This package consists of files used by other %{name} packages. }
%global fonts2 LinLibertine_M.otf
%global fontsex2 %{nil}
%global fontconfs2 %{SOURCE12}
%global fontconfsex2 %{nil}
%global fontdescription2 %{expand:
%{common_description}
This package contains Monospace font.
}
Source0: http://download.sourceforge.net/sourceforge/linuxlibertine/LinLibertineOTF_%{version}_%{posttag}.tgz
Source10: 60-linux-libertine-fonts.conf
Source11: 61-linux-libertine-biolinum-fonts.conf
Source12: 61-linux-libertine-mono-fonts.conf
Source13: 29-linux-libertine-fonts-metrics-alias.conf
# “fontpkg” will generate the font subpackage headers corresponding to the
# elements declared above.
# “fontpkg” accepts the following selection arguments:
# “-a” process everything
# “-z [number]” process a specific declaration block
# If no flag is specified it will only process the zero/nosuffix block.
%fontpkg -a
# “fontmetapkg” will generate a font meta(sub)package header for all the font
# subpackages generated in this spec. Optional arguments:
# “-n [name]” use [name] as metapackage name
# “-s [variable]” use the content of [variable] as metapackage summary
# “-d [variable]” use the content of [variable] as metapackage description
# “-z [numbers]” restrict metapackaging to [numbers] comma-separated list
# of font package suffixes
%fontmetapkg
%prep %prep
%setup -q -c %setup -q -c
sed -i -e 's/\r//' OFL-1.1.txt
%build %build
#for i in $(find -name '*.sfd'); do # “fontbuild” accepts the usual selection arguments:
# (cd scripts; # “-a” process everything
# ./bailly-2.sh "../$i" ttf # “-z [number]” process a specific declaration block
# ) # If no flag is specified it will only process the zero/nosuffix block.
#done %fontbuild -a
#mv scripts/*.ttf .
%install %install
install -m 0755 -d %{buildroot}%{_fontdir} # “fontinstall” accepts the usual selection arguments:
install -m 0644 -p *.otf %{buildroot}%{_fontdir} # “-a” process everything
# “-z [number]” process a specific declaration block
install -m 0755 -d %{buildroot}%{_fontconfig_templatedir} \ # If no flag is specified it will only process the zero/nosuffix block.
%{buildroot}%{_fontconfig_confdir} %fontinstall -a
install -m 0644 -p %{SOURCE1} \
%{buildroot}%{_fontconfig_templatedir}/%{fontconf_libertine}
install -m 0644 -p %{SOURCE2} \
%{buildroot}%{_fontconfig_templatedir}/%{fontconf_biolinum}
install -m 0644 -p %{SOURCE3} \
%{buildroot}%{_fontconfig_templatedir}/%{fontconf_metrics}
for fconf in %{fontconf_libertine} %{fontconf_metrics} %{fontconf_biolinum}; do
ln -s %{_fontconfig_templatedir}/$fconf \
%{buildroot}%{_fontconfig_confdir}/$fconf
done
# Add AppStream metadata
install -Dm 0644 -p %{SOURCE4} \
%{buildroot}%{_metainfodir}/libertine.metainfo.xml
install -Dm 0644 -p %{SOURCE5} \
%{buildroot}%{_metainfodir}/biolinum.metainfo.xml
%check %check
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/*.metainfo.xml # “fontcheck” accepts the usual selection arguments:
# “-a” process everything
# “-z [number]” process a specific declaration block
# If no flag is specified it will only process the zero/nosuffix block.
%fontcheck -a
# “fontfiles” accepts the usual selection arguments:
# “-a” process everything
# “-z [number]” process a specific declaration block
# If no flag is specified it will only process the zero/nosuffix block
%fontfiles -a
%files common %changelog
%license GPL.txt LICENCE.txt OFL-1.1.txt * Thu Jul 18 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.3.0-30.2012_07_02
%doc Bugs.txt ChangeLog.txt Readme-TEX.txt README - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
%_font_pkg -f %{fontconf_libertine} LinLibertine*.otf * Mon Jun 10 2024 Akira TAGOH <tagoh@redhat.com> - 5.3.0-29.2012_07_02
%{_metainfodir}/libertine.metainfo.xml - Correct package replacement of linux-libertine-fonts-common.
Resolves: rhbz#2282595
%{_fontconfig_templatedir}/%{fontconf_metrics} * Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.3.0-28.2012_07_02
%{_fontconfig_confdir}/%{fontconf_metrics} - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
%_font_pkg -n biolinum -f %{fontconf_biolinum} LinBiolinum*.otf * Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.3.0-27.2012_07_02
%{_metainfodir}/biolinum.metainfo.xml - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 5.3.0-26.2012_07_02
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Mon Feb 13 2023 Akira TAGOH <tagoh@redhat.com> - 5.3.0-24.2012_07_02
- Revise the spec file for new packaging guidelines.
- Add linux-libertine-mono-fonts sub-package.
%changelog
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 5.3.0-24.2012_07_02 * Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 5.3.0-24.2012_07_02
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

@ -0,0 +1,11 @@
summary: Fonts related tests
discover:
how: fmf
url: https://src.fedoraproject.org/tests/fonts
execute:
how: tmt
environment:
PACKAGE: linux-libertine-biolinum-fonts
FONT_ALIAS: sans-serif
FONT_FAMILY: Linux Biolinum
FONT_LANG: en

@ -0,0 +1,12 @@
summary: Fonts related tests
discover:
how: fmf
url: https://src.fedoraproject.org/tests/fonts
execute:
how: tmt
environment:
PACKAGE: linux-libertine-fonts
FONT_ALIAS: serif
FONT_FAMILY: Linux Libertine
FONT_LANG: en
FONT_LANG_EXCLUDE_FILES: Libertine_I

@ -0,0 +1,11 @@
summary: Fonts related tests
discover:
how: fmf
url: https://src.fedoraproject.org/tests/fonts
execute:
how: tmt
environment:
PACKAGE: linux-libertine-mono-fonts
FONT_ALIAS: monospace
FONT_FAMILY: Linux Libertine Mono
FONT_LANG: en

@ -1,7 +0,0 @@
---
role_pkgs_req:
- fontconfig
- fontconfig-devel
- pkg-config
- rsync

@ -1,162 +0,0 @@
#! /bin/bash -efu
debug() {
if [ -n "$DEBUG" ]; then
echo "$*" >&2
fi
}
msg_usage() {
cat <<_EOF_
Run family test.
Usage:
$PROG <options>
Options:
-h, --help Display this help and exit
-v, --verbose Turn on debug
-l, --lang=LANG Test LANG language coverage (default: en)
-f, --family=FILE Set a family name supposed to be assigned for alias.
-g, --alias=STR Set an alias name. (default: sans-serif)
-a, --artifactsdir=DIR Set environment dir to store artifacts
-k, --package=NAME Set a package name for fonts.
_EOF_
}
PROG="${PROG:-${0##*/}}"
DEBUG="${DEBUG:-}"
OPT_LANG="${OPT_LANG:-en}"
OPT_FAMILY="${OPT_FAMILY:-}"
OPT_ARTIFACTS_DIR="${OPT_ARTIFACTS_DIR:-}"
OPT_ALIAS="${OPT_ALIAS:-sans-serif}"
OPT_PACKAGE="${OPT_PACKAGE:-}"
opt=$(getopt -n "$0" --options "hvl:f:t:a:g:k:" --longoptions "help,verbose,lang:,family:,test:,artifactsdir:,alias:,package:" -- "$@")
eval set -- "$opt"
while [[ $# -gt 0 ]]; do
case "$1" in
-k|--package)
OPT_PACKAGE="$2"
shift 2
;;
-g|--alias)
OPT_ALIAS="$2"
shift 2
;;
-a|--artifactsdir)
OPT_ARTIFACTS_DIR="$2"
shift 2
;;
-f|--family)
OPT_FAMILY="$2"
shift 2
;;
-l|--lang)
OPT_LANG="$2"
shift 2
;;
-v|--verbose)
DEBUG="-v"
shift
;;
-h|--help)
msg_usage
exit 0
;;
--)
shift
;;
*)
msg_usage
exit 1
esac
done
if [ -z "$OPT_ARTIFACTS_DIR" ] || [ -z "$OPT_LANG" ] || [ -z "$OPT_FAMILY" ]; then
echo "Use: $PROG -h for help."
exit 0
fi
debug "Alias: $OPT_ALIAS"
debug "Family: $OPT_FAMILY"
debug "Lang: $OPT_LANG"
debug "Artifacts dir: $OPT_ARTIFACTS_DIR"
debug "Package name: $OPT_PACKAGE"
STR_TEST_DASHED=$(echo "${OPT_PACKAGE}_${OPT_ALIAS}_${OPT_LANG}" | sed -e 's/\//-/g' -e 's/ /-/g')
debug "Log file: $STR_TEST_DASHED.log"
clean_exit() {
rc=$?;
trap - SIGINT SIGTERM SIGABRT EXIT
echo "Run test $OPT_ALIAS: done. Test's exit code: $rc"
for pid in $(ps -o pid --no-headers --ppid $$); do
if [ -n "$(ps -p $pid -o pid=)" ]; then
kill -s HUP $pid
fi
done
local log_file_name="$STR_TEST_DASHED.log"
local log_file_path="$OPT_ARTIFACTS_DIR/$log_file_name"
local status
if [[ $rc -eq 127 ]]; then
status="ERROR"
elif grep -q "RESULT: WARN" "$log_file_path"; then
status="ERROR"
elif grep -q "RESULT: FAIL" "$log_file_path"; then
status="FAIL"
elif grep -q "RESULT: PASS" "$log_file_path"; then
status="PASS"
elif grep -q "FAIL" "$log_file_path"; then
status="FAIL"
elif grep -q "PASS" "$log_file_path"; then
status="PASS"
else
status="ERROR"
fi
echo "$status $OPT_ALIAS" >> "$OPT_ARTIFACTS_DIR/test.log"
mv "$log_file_path" "$OPT_ARTIFACTS_DIR/${status}-${log_file_name}"
local results="$OPT_ARTIFACTS_DIR/results.yml"
local result=$(echo $status | tr '[:upper:]' '[:lower:]')
test -f "$results" || echo 'results:' > "$results"
printf '%s\n' '' \
"- test: $OPT_ALIAS" \
" result: $result" \
" logs:" \
" - ${status}_${log_file_name}" \
>> "$results"
exit 0
}
trap clean_exit SIGINT SIGTERM SIGABRT EXIT
cachedir=`pkg-config --variable cachedir fontconfig`
tmpconfd=`mktemp --tmpdir -d fontsci.XXXXXXXX`
conf=$(for i in `rpm -ql $OPT_PACKAGE | grep conf.d`; do
echo "<include>$i</include>"
done)
cat <<_EOF_> $tmpconfd/fonts.conf
<fontconfig>
<dir>/usr/share/fonts</dir>
$conf
<cachedir>$cachedir</cachedir>
</fontconfig>
_EOF_
debug "Config: `cat $tmpconfd/fonts.conf`"
mkdir -p "$OPT_ARTIFACTS_DIR"
export OUTPUTFILE="$(realpath "$OPT_ARTIFACTS_DIR")/$STR_TEST_DASHED-out.log"
logfile="$OPT_ARTIFACTS_DIR/$STR_TEST_DASHED.log"
logfile="$(realpath "$logfile")"
exec > >(tee -a "$logfile") 2>&1
debug "Check family assignment"
res=`FONTCONFIG_FILE=$tmpconfd/fonts.conf fc-match -f "%{family[0]}" :family=$OPT_ALIAS:lang=$OPT_LANG`
ret=0
if [ "x$res" = "x$OPT_FAMILY" ]; then
echo "RESULT: PASS: $OPT_FAMILY was assigned to $OPT_ALIAS as expected"
else
echo "RESULT: FAIL: $OPT_FAMILY wasn't assigned to $OPT_ALIAS (actual result: $res)"
ret=1
fi
rm -rf $tmpconfd
exit $ret

@ -1,233 +0,0 @@
#! /bin/bash -efu
debug() {
if [ -n "$DEBUG" ]; then
echo "$*" >&2
fi
}
msg_usage() {
cat <<_EOF_
Run language coverage test.
Usage:
$PROG <options>
Options:
-h, --help Display this help and exit
-v, --verbose Turn on debug
-l, --lang=LANG Test LANG language coverage (default: en)
-p, --path=PATH Test fonts on PATH
-n, --name=NAME Set NAME to store a log file.
-a, --artifactsdir=DIR test environment dir to store artifacts
-e, --exclude=FILE Exclude FILE to check.
-i, --include=FILE Include File to check.
_EOF_
}
PROG="${PROG:-${0##*/}}"
DEBUG="${DEBUG:-}"
OPT_LANG="${OPT_LANG:-en}"
OPT_PATH=()
OPT_ARTIFACTS_DIR="${OPT_ARTIFACTS_DIR:-}"
OPT_EXCLUDE=()
OPT_INCLUDE=()
OPT_NAME="${OPT_NAME:-}"
opt=$(getopt -n "$0" --options "hvl:p:n:a:e:i:" --longoptions "help,verbose,lang:,path:,name:,artifactsdir:,exclude:,include:" -- "$@")
eval set -- "$opt"
while [[ $# -gt 0 ]]; do
case "$1" in
-n|--name)
OPT_NAME="$2"
shift 2
;;
-i|--include)
OPT_INCLUDE+=("$2")
shift 2
;;
-e|--exclude)
OPT_EXCLUDE+=("$2")
shift 2
;;
-a|--artifactsdir)
OPT_ARTIFACTS_DIR="$2"
shift 2
;;
-p|--path)
OPT_PATH+=("$2")
shift 2
;;
-l|--lang)
OPT_LANG="$2"
shift 2
;;
-v|--verbose)
DEBUG="-v"
shift
;;
-h|--help)
msg_usage
exit 0
;;
--)
shift
;;
*)
msg_usage
exit 1
esac
done
if [ -z "$OPT_ARTIFACTS_DIR" ] || [ -z "$OPT_LANG" ] || [ -z "$OPT_PATH" ]; then
echo "Use: $PROG -h for help."
exit 0
fi
STR_TEST_DASHED=$(echo "${OPT_NAME:-$OPT_LANG}" | sed -e 's/\//-/g')
clean_exit() {
rc=$?;
trap - SIGINT SIGTERM SIGABRT EXIT
echo "Run test $OPT_LANG: done. Test's exit code: $rc"
for pid in $(ps -o pid --no-headers --ppid $$); do
if [ -n "$(ps -p $pid -o pid=)" ]; then
kill -s HUP $pid
fi
done
local log_file_name="$STR_TEST_DASHED.log"
local log_file_path="$OPT_ARTIFACTS_DIR/$log_file_name"
local status
if [[ $rc -eq 127 ]]; then
status="ERROR"
elif grep -q "RESULT: WARN" "$log_file_path"; then
status="ERROR"
elif grep -q "RESULT: FAIL" "$log_file_path"; then
status="FAIL"
elif grep -q "RESULT: PASS" "$log_file_path"; then
status="PASS"
elif grep -q "WARN" "$log_file_path"; then
status="ERROR"
elif grep -q "FAIL" "$log_file_path"; then
status="FAIL"
elif grep -q "PASS" "$log_file_path"; then
status="PASS"
else
status="ERROR"
fi
echo "$status $OPT_LANG" >> "$OPT_ARTIFACTS_DIR/test.log"
mv "$log_file_path" "$OPT_ARTIFACTS_DIR/${status}-${log_file_name}"
local results="$OPT_ARTIFACTS_DIR/results.yml"
local result=$(echo $status | tr '[:upper:]' '[:lower:]')
test -f "$results" || echo 'results:' > "$results"
printf '%s\n' '' \
"- test: $OPT_LANG" \
" result: $result" \
" logs:" \
" - ${status}_${log_file_name}" \
>> "$results"
exit 0
}
trap clean_exit SIGINT SIGTERM SIGABRT EXIT
mkdir -p "$OPT_ARTIFACTS_DIR"
export OUTPUTFILE="$(realpath "$OPT_ARTIFACTS_DIR")/$STR_TEST_DASHED-out.log"
logfile="$OPT_ARTIFACTS_DIR/$STR_TEST_DASHED.log"
logfile="$(realpath "$logfile")"
exec > >(tee -a "$logfile") 2>&1
expand_regex() {
local p ret=()
local regex="$1"
shift
debug "Expanding $regex"
for p; do
set +f
debug "$p: $regex"
(cd $p;
local x=$(find -regextype posix-egrep -regex "./$regex" -print|sed -e 's,^\./,,g')
debug "$x"
ret+=($x)
set -f
echo -n ${ret[@]}
)
done
echo -n ${ret[@]}
}
iv=()
ev=()
x=()
for p in ${OPT_INCLUDE[@]}; do
x=$(expand_regex $p ${OPT_PATH[@]})
if [ "x$x" == "x" ]; then
echo "RESULT: WARN: No matches on \"$p\". maybe typo or something changed?"
continue
fi
iv=("${iv[@]}" "${x[@]}")
done
for p in ${OPT_EXCLUDE[@]}; do
x=$(expand_regex $p ${OPT_PATH[@]})
if [ "x$x" == "x" ]; then
echo "RESULT: WARN: No matches on \"$p\". maybe typo or something changed?"
continue
fi
ev=("${ev[@]}" "${x[@]}")
done
OPT_EXCLUDE=(${ev[@]})
OPT_INCLUDE=(${iv[@]})
debug "Path: ${OPT_PATH[@]}"
debug "Lang: $OPT_LANG"
debug "Artifacts dir: $OPT_ARTIFACTS_DIR"
debug "Exclude: ${#OPT_EXCLUDE[@]}: ${OPT_EXCLUDE[@]}"
debug "Include: ${#OPT_INCLUDE[@]}: ${OPT_INCLUDE[@]}"
contains() {
local e match="$1"
shift
for e; do [[ "$e" == "$match" ]] && return 1; done
return 0
}
debug "Check language coverage"
ret=0
set +f
for p in ${OPT_PATH[@]}; do
for i in `find $p -regex '.*/*\.\(t1\)?\(ttf\)?\(otf\)?\(ttc\)?\(pcf.*\)?\(pfa\)?'`; do
set -f
debug "$i"
if test -f $i; then
n=`basename $i`
set +e
contains "$n" "${OPT_EXCLUDE[@]}"
ret=$?
set -e
if [ $ret -eq 1 ]; then
debug "ignoring $i"
continue
fi
if [ ${#OPT_INCLUDE[@]} -ne 0 ]; then
set +e
contains "$n" "${OPT_INCLUDE[@]}"
ret=$?
set -e
if [ $ret -eq 0 ]; then
debug "$i isn't targeted file"
continue
fi
NOT_MATCHED=("${NOT_MATCHED[@]/$n}")
fi
debug " $i"
res=`fc-validate -l $OPT_LANG $i || :`
if echo $res | grep -q Missing; then
echo "RESULT: FAIL: $i doesn't satisfy $OPT_LANG language coverage."
ret=1
else
echo "RESULT: PASS: $i satisfy $OPT_LANG language coverage."
fi
fi
done
done
exit $ret

@ -1,4 +0,0 @@
---
dependencies:
- role: str-common-init

@ -1,52 +0,0 @@
---
- block:
- name: language coverage
environment:
LANG: "en_US.UTF-8"
script: run-lang-coverage-test --lang "{{ item }}" {% if coverage.values is not defined or coverage[item].path_prefix is not defined %} --path {{ path_prefix }} {% else %} {{ '--path "' + (coverage[item].path_prefix | join('" --path "')) + '"' }} {% endif %} --artifactsdir "{{ remote_artifacts }}" {{ "" if coverage.values is not defined or coverage[item].name is not defined else "--name " + coverage[item].name }} {{ "" if coverage.values is not defined or coverage[item].exclude is not defined else '--exclude "' + (coverage[item].exclude | join('" --exclude "')) + '"'}} {{ "" if coverage.values is not defined or coverage[item].include is not defined else '--include "' + (coverage[item].include | join('" --include "')) + '"'}}
with_items:
- "{{ coverage if coverage.keys is not defined else coverage.keys()|list }}"
- name: generic family assignment
environment:
LANG: "en_US.UTF-8"
when: families is defined
script: run-family-test --lang {{ item.lang }} --family '{{ item.family }}' --alias {{ item.alias }} --artifactsdir {{ remote_artifacts }} --package {{ package if item.package is not defined else item.package }}
with_items:
- "{{ families }}"
- name: Collect all of failures into one file
shell: |
grep -v PASS "{{ remote_artifacts }}"/FAIL_*.log > "{{ remote_artifacts }}"/FAIL-all.log || :
- name: Check the results
shell: |
log="{{ remote_artifacts }}/test.log"
if [ ! -f "$log" ]; then
echo ERROR
echo "Test results not found." 1>&2
elif grep ^ERROR "$log" 1>&2; then
echo ERROR
elif grep ^FAIL "$log" 1>&2; then
echo FAIL
elif grep -q ^PASS "$log"; then
echo PASS
else
echo ERROR
echo "No test results found." 1>&2
fi
register: test_results
- name: Set role result
set_fact:
role_result: "{{ test_results.stdout }}"
role_message: "{{ test_results.stderr|d('test execution error.') }}"
role_result_failed: "{{ test_results.stdout != 'PASS' }}"
role_result_msg: "{{ test_results.stderr|d('test execution error.') }}"
- include_role:
name: str-common-final
- name: Validate the result
shell: echo "test_results.stdout"
failed_when: test_results.stdout != 'PASS'

@ -1,22 +0,0 @@
- hosts: localhost
tags:
- classic
roles:
- role: custom-test-fonts
required_packages:
- linux-libertine-fonts
- linux-libertine-biolinum-fonts
path_prefix: /usr/share/fonts/linux-libertine
coverage:
en:
exclude:
- LinLibertine_I.otf
families:
- lang: en
alias: serif
family: Linux Libertine O
package: linux-libertine-fonts
- lang: en
alias: sans-serif
family: Linux Biolinum O
package: linux-libertine-biolinum-fonts
Loading…
Cancel
Save