diff --git a/fonts-rpm-macros-drop-yaml.patch b/fonts-rpm-macros-drop-yaml.patch new file mode 100644 index 0000000..3f9a29a --- /dev/null +++ b/fonts-rpm-macros-drop-yaml.patch @@ -0,0 +1,46 @@ +diff -pruN fonts-rpm-macros-2.0.5.orig/bin/gen-fontconf fonts-rpm-macros-2.0.5/bin/gen-fontconf +--- fonts-rpm-macros-2.0.5.orig/bin/gen-fontconf 2020-04-03 07:55:50.000000000 +0900 ++++ fonts-rpm-macros-2.0.5/bin/gen-fontconf 2024-06-03 14:07:58.244902559 +0900 +@@ -23,7 +23,11 @@ from lxml import etree + from operator import itemgetter + import os + from pathlib import PurePath +-import ruamel.yaml ++yaml_supported = True ++try: ++ import ruamel.yaml ++except ModuleNotFoundError: ++ yaml_supported = False + import subprocess + import sys + +@@ -36,14 +40,17 @@ oneormore = ['fullname', 'family', 'styl + parser = argparse.ArgumentParser( + description='Generate traditional fontconfig syntax from a high-level configuration file') + cgroup = parser.add_mutually_exclusive_group(required=True) +-cgroup.add_argument("-y", "--yaml", "-c", "--config", type=str, +- help="YAML configuration file to process") ++mode = ['xml', 'legacy'] ++if yaml_supported: ++ mode.append('yaml') ++ cgroup.add_argument("-y", "--yaml", "-c", "--config", type=str, ++ help="YAML configuration file to process") + cgroup.add_argument("-x", "--xml", type=str, + help="XML configuration file to process") + parser.add_argument("-l", "--license", metavar="SPDX ID", type=str, nargs='?', default="MIT", + help="SPDX license identifier for the generated files") + parser.add_argument("-m", "--mode", metavar="MODE", type=str, nargs='?', +- default="legacy", choices=['xml', 'yaml', 'legacy'], ++ default="legacy", choices=mode, + help="Output format: current fontconfig syntax, or XML/YAML syntax proposals") + parser.add_argument("-w", "--write", action="store_true", + help="Write output to disk") +@@ -685,7 +692,7 @@ ext = '.conf' + if args.mode == 'xml': + ext = '.xml' + +-if args.yaml != None: ++if yaml_supported and args.yaml != None: + groups = readyaml(args.yaml) + if args.write and output == None: + output = PurePath(PurePath(args.yaml).name).with_suffix(ext) diff --git a/fonts-rpm-macros-epoch-in-req.patch b/fonts-rpm-macros-epoch-in-req.patch new file mode 100644 index 0000000..fcd8fe8 --- /dev/null +++ b/fonts-rpm-macros-epoch-in-req.patch @@ -0,0 +1,57 @@ +diff -pruN fonts-rpm-macros-2.0.5.orig/rpm/lua/srpm/fonts.lua fonts-rpm-macros-2.0.5/rpm/lua/srpm/fonts.lua +--- fonts-rpm-macros-2.0.5.orig/rpm/lua/srpm/fonts.lua 2024-06-19 16:39:41.814323447 +0900 ++++ fonts-rpm-macros-2.0.5/rpm/lua/srpm/fonts.lua 2024-06-19 16:42:07.095849192 +0900 +@@ -172,13 +172,31 @@ local function pkg(forcemain, forcesub, + end + end + ++-- Output Requires(meta) line ++local function output_requires(fontpkg) ++ if tonumber(rpm.expand("0%{?epoch}")) == 0 then ++ print(rpm.expand( "Requires(meta): " .. fontpkg .. " = %{version}-%{release}\n")) ++ else ++ print(rpm.expand( "Requires(meta): " .. fontpkg .. " = %{epoch}:%{version}-%{release}\n")) ++ end ++end ++ + -- Create a font (sub)metapackage header + local function metapkg(name, summary, description, suffixes) + local fedora = require "fedora.common" + local fontpkgs = fedora.getsuffixed("fontpkgname") ++ local hsuffix + if (name == "") then + name, _ = string.gsub(rpm.expand("%{name}"), "-fonts$", "") + name = name .. "-fonts-all" ++ hsuffix = "all" ++ else ++ hsuffix = norm(name) ++ end ++ if (rpm.expand("%{?fontpkgheader" .. hsuffix .. "}") ~= "") then ++ fedora.explicitset( "currentfontpkgheader", "%{fontpkgheader" .. hsuffix .. "}", false) ++ else ++ fedora.explicitunset( "currentfontpkgheader", false) + end + if (summary == "") then + summary = "All the font packages, generated from %{name}" +@@ -192,18 +210,19 @@ local function metapkg(name, summary, de + "Summary: " .. summary .. "\n")) + if (suffixes == "") then + for _, fontpkg in pairs(fontpkgs) do +- print(rpm.expand( "Requires(meta): " .. fontpkg .. " = %{version}-%{release}\n")) ++ output_requires(fontpkg) + end + else + for suffix in string.gmatch(rpm.expand(suffixes), "[^%s%p]+") do + local fontpkg = fontpkgs[suffix] + if (fontpkg ~= nil) then +- print(rpm.expand("Requires(meta): " .. fontpkg .. " = %{version}-%{release}\n")) ++ output_requires(fontpkg) + end + end + end + print(rpm.expand( + "BuildArch: noarch\n" .. ++ "%{?currentfontpkgheader}\n" .. + "%description -n " .. name .. "\n" .. + description .. "\n" .. + "%files -n " .. name .. "\n\n")) diff --git a/fonts-rpm-macros.spec b/fonts-rpm-macros.spec index 02dd13c..3aa421a 100644 --- a/fonts-rpm-macros.spec +++ b/fonts-rpm-macros.spec @@ -18,13 +18,15 @@ Version: 2.0.5 BuildArch: noarch Name: fonts-rpm-macros -Release: 15%{?dist} +Release: 16%{?dist} Summary: Build-stage rpm automation for fonts packages License: GPL-3.0-or-later URL: https://docs.fedoraproject.org/en-US/packaging-guidelines/FontsPolicy/ Source: %{forgesource} Patch0: %{name}-omit-foundry-in-family.patch +Patch1: %{name}-drop-yaml.patch +Patch2: %{name}-epoch-in-req.patch Requires: fonts-srpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} Requires: fonts-filesystem = %{?epoch:%{epoch}:}%{version}-%{release} @@ -39,7 +41,9 @@ Requires: libappstream-glib Requires: uchardet # For the experimental generator +%if 0%{?fedora} || 0%{?rhel} < 10 Requires: python3-ruamel-yaml +%endif Requires: python3-lxml %description @@ -99,7 +103,11 @@ for template in templates/rpm/*\.spec ; do grep -v '^%%dnl' "${template}" > "${target}" touch -r "${template}" "${target}" done -%patch0 -p1 -b .1-omit-foundry-in-family +%patch -P0 -p1 -b .0-omit-foundry-in-family +%if 0%{?rhel} >= 10 +%patch -P1 -p1 -b .1-drop-yaml +%endif +%patch -P2 -p1 -b .2-epoch-in-req %install install -m 0755 -d %{buildroot}%{_fontbasedir} \ @@ -155,6 +163,13 @@ install -m 0755 -vp bin/* %{buildroot}%{_bindir} %doc %{ftcgtemplatedir}/*txt %changelog +* Wed Jun 19 2024 Akira TAGOH - 1:2.0.5-16 +- Add %%{epoch} in Requires line if needed +- Support fontpkgheader macro for meta packages. + +* Mon Jun 3 2024 Akira TAGOH - 1:2.0.5-15 +- Drop YAML support in gen-fontconf for RHEL10 or later. + * Mon Jun 24 2024 Troy Dawson - 1:2.0.5-15 - Bump release for June 2024 mass rebuild