Bug 819875

Summary: [RFE] Move font provide generation rules and scripts to fontpackages-devel
Product: [Fedora] Fedora Reporter: Panu Matilainen <pmatilai>
Component: fontpackagesAssignee: Nicolas Mailhot <nicolas.mailhot>
Status: ASSIGNED --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: fonts-bugs, nicolas.mailhot, paul, tagoh
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Panu Matilainen 2012-05-08 08:40:13 EDT
As previously suggested at least in bug 757105 and bug 521697, I think it's about time (since we these days easily can) to split the font dependency generation out of rpm-build into the hands of folks actually dealing with fonts.

This should be fairly trivial as font packages are well-behaved (all of them having the central build-require of fontpackages-devel), so no modifications to other packages should be necessary. 

Please pull the font provide script and font.attr rule (might want to usehttp://rpm.org/gitweb?p=rpm.git;a=blob_plain;f=fileattrs/font.attr;hb=HEAD as baseline for that) into fontpackages-devel and let me know when ready, I'll be more than glad to remove them from rpm-build immdediately.
Comment 1 Paul Flo Williams 2012-09-05 08:24:15 EDT
Here's my take on exactly what needs to be changed for this to happen, for review. It doesn't look that complicated, but I may have misunderstood something and I don't quite know how to finish this off.

Relevant other bugs, from comment 1:

Bug 757105 appears to be stuck on Fontconfig upstream, and doesn't impact most of our font packages, so I'll ignore it for now.

Bug 521697 suggests changing fc-query to fc-scan at first, but ends with the recommendation of still using fc-query with a faked-up fontconfig path that just includes the fontconfig file of the font we're packaging, so that is relevant.

So, we will be grabbing font.attr and fontconfig.prov from rpm.git and moving them to fontpackages. We will make some changes on the way.

font.attr is as simple as this:

  %__font_provides %{_rpmconfigdir}/fontconfig.prov
  %__font_requires %{nil}
  %__font_magic [Ff]ont?( (program|collection))?( (text|data))

We don't currently generate font provides for any fonts outside /usr/share/fonts, so we could add these two lines as well:

  %__font_path ^%{_datadir}/fonts/
  %__font_flags magic_and_path

(Yeah, there shouldn't *be* any fonts outside here, but ...)

From bug 521697, we now need to fake up a fontconfig "root file" that will point to the current font's fontconfig file, and pass this to the font provider script. I think this is achieved by some magic in our existing font macros which will take the name of the font-fontconfig file and write it into (say) /tmp/fake-fonts.conf and create a macro called %__font_provides_opts which contains this name.

When fontconfig.prov is called, the name of our faked fontconfig file will be passed on the command line, and we use that to set up the FONTCONFIG_FILE environment variable.

My sticking point is not knowing exactly when everything gets evaluated during building the font package, so I don't know which macro should magically create this temporary fontconfig root file (and, presumably, cleanly dispose of it).
Comment 2 Panu Matilainen 2012-09-05 08:42:16 EDT
Oh, if you agree this move makes sense, I would suggest taking one simple step at a time: ignore the other bugs for now and lets just get the rule-file and the script moved from rpm-build to fontpackage with no other changes at all.

Once that is done, you're obviously free to tweak the rules to your liking (which basically is the sole purpose of the move). And figure out what, if anything, to do with bug 521697. The other two bugs are not really related to where the font dependency magic lives.
Comment 3 Akira TAGOH 2012-09-05 21:23:50 EDT
*** Bug 843686 has been marked as a duplicate of this bug. ***
Comment 4 Paul Flo Williams 2012-11-06 09:00:14 EST
I'll just "ping" this by saying that I'm willing to do the changes I outlined in comment #1 if they are considered correct. I requested access to the fontpackages git commit group a month ago.
Comment 5 Nicolas Mailhot 2012-11-26 02:26:29 EST
(In reply to comment #4)
> I'll just "ping" this by saying that I'm willing to do the changes I
> outlined in comment #1 if they are considered correct. I requested access to
> the fontpackages git commit group a month ago.

Sorry about this, I really wanted to review the changes, but it seems finding this kind of time lately is hopeless, therefore I've given you commit access in git