Skip to content

Commit ed453b6

Browse files
authored
fixed build for fonts-rpm-macros (#13078)
1 parent 1a078f8 commit ed453b6

File tree

4 files changed

+150
-18
lines changed

4 files changed

+150
-18
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
diff -pruN fonts-rpm-macros-2.0.5.orig/bin/gen-fontconf fonts-rpm-macros-2.0.5/bin/gen-fontconf
2+
--- fonts-rpm-macros-2.0.5.orig/bin/gen-fontconf 2020-04-03 07:55:50.000000000 +0900
3+
+++ fonts-rpm-macros-2.0.5/bin/gen-fontconf 2024-06-03 14:07:58.244902559 +0900
4+
@@ -23,7 +23,11 @@ from lxml import etree
5+
from operator import itemgetter
6+
import os
7+
from pathlib import PurePath
8+
-import ruamel.yaml
9+
+yaml_supported = True
10+
+try:
11+
+ import ruamel.yaml
12+
+except ModuleNotFoundError:
13+
+ yaml_supported = False
14+
import subprocess
15+
import sys
16+
17+
@@ -36,14 +40,17 @@ oneormore = ['fullname', 'family', 'styl
18+
parser = argparse.ArgumentParser(
19+
description='Generate traditional fontconfig syntax from a high-level configuration file')
20+
cgroup = parser.add_mutually_exclusive_group(required=True)
21+
-cgroup.add_argument("-y", "--yaml", "-c", "--config", type=str,
22+
- help="YAML configuration file to process")
23+
+mode = ['xml', 'legacy']
24+
+if yaml_supported:
25+
+ mode.append('yaml')
26+
+ cgroup.add_argument("-y", "--yaml", "-c", "--config", type=str,
27+
+ help="YAML configuration file to process")
28+
cgroup.add_argument("-x", "--xml", type=str,
29+
help="XML configuration file to process")
30+
parser.add_argument("-l", "--license", metavar="SPDX ID", type=str, nargs='?', default="MIT",
31+
help="SPDX license identifier for the generated files")
32+
parser.add_argument("-m", "--mode", metavar="MODE", type=str, nargs='?',
33+
- default="legacy", choices=['xml', 'yaml', 'legacy'],
34+
+ default="legacy", choices=mode,
35+
help="Output format: current fontconfig syntax, or XML/YAML syntax proposals")
36+
parser.add_argument("-w", "--write", action="store_true",
37+
help="Write output to disk")
38+
@@ -685,7 +692,7 @@ ext = '.conf'
39+
if args.mode == 'xml':
40+
ext = '.xml'
41+
42+
-if args.yaml != None:
43+
+if yaml_supported and args.yaml != None:
44+
groups = readyaml(args.yaml)
45+
if args.write and output == None:
46+
output = PurePath(PurePath(args.yaml).name).with_suffix(ext)
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
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
2+
--- fonts-rpm-macros-2.0.5.orig/rpm/lua/srpm/fonts.lua 2024-06-19 16:39:41.814323447 +0900
3+
+++ fonts-rpm-macros-2.0.5/rpm/lua/srpm/fonts.lua 2024-06-19 16:42:07.095849192 +0900
4+
@@ -172,13 +172,31 @@ local function pkg(forcemain, forcesub,
5+
end
6+
end
7+
8+
+-- Output Requires(meta) line
9+
+local function output_requires(fontpkg)
10+
+ if tonumber(rpm.expand("0%{?epoch}")) == 0 then
11+
+ print(rpm.expand( "Requires(meta): " .. fontpkg .. " = %{version}-%{release}\n"))
12+
+ else
13+
+ print(rpm.expand( "Requires(meta): " .. fontpkg .. " = %{epoch}:%{version}-%{release}\n"))
14+
+ end
15+
+end
16+
+
17+
-- Create a font (sub)metapackage header
18+
local function metapkg(name, summary, description, suffixes)
19+
local fedora = require "fedora.common"
20+
local fontpkgs = fedora.getsuffixed("fontpkgname")
21+
+ local hsuffix
22+
if (name == "") then
23+
name, _ = string.gsub(rpm.expand("%{name}"), "-fonts$", "")
24+
name = name .. "-fonts-all"
25+
+ hsuffix = "all"
26+
+ else
27+
+ hsuffix = norm(name)
28+
+ end
29+
+ if (rpm.expand("%{?fontpkgheader" .. hsuffix .. "}") ~= "") then
30+
+ fedora.explicitset( "currentfontpkgheader", "%{fontpkgheader" .. hsuffix .. "}", false)
31+
+ else
32+
+ fedora.explicitunset( "currentfontpkgheader", false)
33+
end
34+
if (summary == "") then
35+
summary = "All the font packages, generated from %{name}"
36+
@@ -192,18 +210,19 @@ local function metapkg(name, summary, de
37+
"Summary: " .. summary .. "\n"))
38+
if (suffixes == "") then
39+
for _, fontpkg in pairs(fontpkgs) do
40+
- print(rpm.expand( "Requires(meta): " .. fontpkg .. " = %{version}-%{release}\n"))
41+
+ output_requires(fontpkg)
42+
end
43+
else
44+
for suffix in string.gmatch(rpm.expand(suffixes), "[^%s%p]+") do
45+
local fontpkg = fontpkgs[suffix]
46+
if (fontpkg ~= nil) then
47+
- print(rpm.expand("Requires(meta): " .. fontpkg .. " = %{version}-%{release}\n"))
48+
+ output_requires(fontpkg)
49+
end
50+
end
51+
end
52+
print(rpm.expand(
53+
"BuildArch: noarch\n" ..
54+
+ "%{?currentfontpkgheader}\n" ..
55+
"%description -n " .. name .. "\n" ..
56+
description .. "\n" ..
57+
"%files -n " .. name .. "\n\n"))

SPECS-EXTENDED/fonts-rpm-macros/fonts-rpm-macros.spec

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,24 @@ Version: 2.0.5
2222
BuildArch: noarch
2323

2424
Name: fonts-rpm-macros
25-
Release: 13%{?dist}
25+
Release: 14%{?dist}
2626
Summary: Build-stage rpm automation for fonts packages
2727

2828
License: GPL-3.0-or-later
2929
URL: https://docs.fedoraproject.org/en-US/packaging-guidelines/FontsPolicy/
3030
Source: %{forgesource}
3131
Patch0: %{name}-omit-foundry-in-family.patch
32-
Patch1: update_for_azl.patch
32+
Patch1: %{name}-drop-yaml.patch
33+
Patch2: %{name}-epoch-in-req.patch
34+
Patch3: update_for_azl.patch
3335

34-
Requires: fonts-srpm-macros = %{?epoch:%{epoch}:}%{version}-%{release}
35-
Requires: fonts-filesystem = %{?epoch:%{epoch}:}%{version}-%{release}
36+
Requires: fonts-srpm-macros = %{version}-%{release}
37+
Requires: fonts-filesystem = %{version}-%{release}
3638

37-
Provides: fontpackages-devel = %{?epoch:%{epoch}:}%{version}-%{release}
38-
Obsoletes: fontpackages-devel < %{?epoch:%{epoch}:}%{version}-%{release}
39+
Provides: fontpackages-devel = %{version}-%{release}
40+
Obsoletes: fontpackages-devel < %{version}-%{release}
3941
# Tooling dropped for now as no one was willing to maintain it
40-
Obsoletes: fontpackages-tools < %{?epoch:%{epoch}:}%{version}-%{release}
42+
Obsoletes: fontpackages-tools < %{version}-%{release}
4143

4244
Requires: fontconfig
4345
Requires: libappstream-glib
@@ -72,8 +74,8 @@ fonts-srpm-macros will pull in for fonts packages only.
7274
Summary: Directories used by font packages
7375
License: MIT
7476

75-
Provides: fontpackages-filesystem = %{?epoch:%{epoch}:}%{version}-%{release}
76-
Obsoletes: fontpackages-filesystem < %{?epoch:%{epoch}:}%{version}-%{release}
77+
Provides: fontpackages-filesystem = %{version}-%{release}
78+
Obsoletes: fontpackages-filesystem < %{version}-%{release}
7779

7880
%description -n fonts-filesystem
7981
This package contains the basic directory layout used by font packages,
@@ -83,8 +85,8 @@ including the correct permissions for the directories.
8385
Summary: Example fonts packages rpm spec templates
8486
License: MIT
8587

86-
Requires: fonts-rpm-macros = %{?epoch:%{epoch}:}%{version}-%{release}
87-
Supplements: fonts-rpm-macros = %{?epoch:%{epoch}:}%{version}-%{release}
88+
Requires: fonts-rpm-macros = %{version}-%{release}
89+
Supplements: fonts-rpm-macros = %{version}-%{release}
8890

8991
%description -n fonts-rpm-templates
9092
This package contains documented rpm spec templates showcasing how to use the
@@ -98,8 +100,10 @@ for template in templates/rpm/*\.spec ; do
98100
grep -v '^%%dnl' "${template}" > "${target}"
99101
touch -r "${template}" "${target}"
100102
done
101-
%patch 0 -p1 -b .1-omit-foundry-in-family
102-
%patch 1 -p1
103+
%patch -P0 -p1 -b .1-omit-foundry-in-family
104+
%patch -P1 -p1 -b .1-drop-yaml
105+
%patch -P2 -p1 -b .2-epoch-in-req
106+
%patch -P3 -p1
103107

104108
%install
105109
install -m 0755 -d %{buildroot}%{_fontbasedir} \
@@ -155,6 +159,10 @@ install -m 0755 -vp bin/* %{buildroot}%{_bindir}
155159
%doc %{ftcgtemplatedir}/*txt
156160

157161
%changelog
162+
* Fri Mar 21 2025 Jyoti kanase <[email protected]> - 2.0.5-14
163+
- Applying patches for Build fix
164+
- License verified.
165+
158166
* Thu Feb 22 2024 Pawel Winogrodzki <[email protected]> - 2.0.5-13
159167
- Updating file paths for 3.0 version of Azure Linux.
160168
- Resetting 'Epoch' for 3.0 version of Azure Linux.

SPECS-EXTENDED/fonts-rpm-macros/update_for_azl.patch

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@ index bb7475b..c9bd17c 100644
1414
local oldtag = nil
1515
local oldadvance = nil
1616
diff --git a/rpm/lua/srpm/fonts.lua b/rpm/lua/srpm/fonts.lua
17-
index 95cc2bd..36df0ea 100644
17+
index 3a40f2c..8896225 100644
1818
--- a/rpm/lua/srpm/fonts.lua
1919
+++ b/rpm/lua/srpm/fonts.lua
20+
@@ -1,4 +1,4 @@
21+
--- Copyright © 2018-2019 Nicolas Mailhot <[email protected]>
22+
+-- Copyright © 2018-2019 Nicolas Mailhot <[email protected]>
23+
--
24+
-- This program is free software: you can redistribute it and/or modify
25+
-- it under the terms of the GNU General Public License as published by
2026
@@ -92,12 +92,12 @@ end
2127
-- The fontenv macro main processing function
2228
-- See the documentation in the macros.fonts file for argument description
@@ -106,18 +112,30 @@ index 95cc2bd..36df0ea 100644
106112
singlepkg(forcemain, forcesub, suffix, verbose)
107113
end
108114
else
109-
@@ -174,8 +174,8 @@ end
115+
@@ -183,8 +183,8 @@ end
110116

111117
-- Create a font (sub)metapackage header
112118
local function metapkg(name, summary, description, suffixes)
113119
- local fedora = require "fedora.common"
114120
- local fontpkgs = fedora.getsuffixed("fontpkgname")
115121
+ local azl = require "azl.common"
116122
+ local fontpkgs = azl.getsuffixed("fontpkgname")
123+
local hsuffix
117124
if (name == "") then
118125
name, _ = string.gsub(rpm.expand("%{name}"), "-fonts$", "")
119-
name = name .. "-fonts-all"
120-
@@ -186,7 +186,7 @@ local function metapkg(name, summary, description, suffixes)
126+
@@ -194,9 +194,9 @@ local function metapkg(name, summary, description, suffixes)
127+
hsuffix = norm(name)
128+
end
129+
if (rpm.expand("%{?fontpkgheader" .. hsuffix .. "}") ~= "") then
130+
- fedora.explicitset( "currentfontpkgheader", "%{fontpkgheader" .. hsuffix .. "}", false)
131+
+ azl.explicitset( "currentfontpkgheader", "%{fontpkgheader" .. hsuffix .. "}", false)
132+
else
133+
- fedora.explicitunset( "currentfontpkgheader", false)
134+
+ azl.explicitunset( "currentfontpkgheader", false)
135+
end
136+
if (summary == "") then
137+
summary = "All the font packages, generated from %{name}"
138+
@@ -204,7 +204,7 @@ local function metapkg(name, summary, description, suffixes)
121139
if (description == "") then
122140
description = "This meta-package installs all the font packages, generated from the %{name} source package."
123141
end
@@ -220,7 +238,7 @@ index 6d2fa82..2426370 100644
220238
end
221239
else
222240
diff --git a/rpm/macros.d/macros.fonts-srpm b/rpm/macros.d/macros.fonts-srpm
223-
index eec2b1c..7df42c3 100644
241+
index 77365d6..8132b95 100644
224242
--- a/rpm/macros.d/macros.fonts-srpm
225243
+++ b/rpm/macros.d/macros.fonts-srpm
226244
@@ -45,7 +45,7 @@
@@ -259,3 +277,6 @@ index eec2b1c..7df42c3 100644
259277
local name = rpm.expand("%{?-n*}")
260278
local summary = rpm.expand("%{?-s*}")
261279
if (summary ~= "") then
280+
--
281+
2.45.2
282+

0 commit comments

Comments
 (0)