Related to the unversioned docdirs F-20 feature [1], here's a couple of questions:
1) Should specfiles be using %{_docdir} or %{_defaultdocdir} when referring to the /usr/share/doc dir? Both seem to work, both are being used. To me %{_docdir} sounds better for some reason.
2) Packages that want to refer to the doc dir created by the special %doc form need to take %{_docdir_fmt} into account. I didn't find a nice way to do it, but here's one uglyish way to define a variable in specfiles that should point to the correct location before and after the %{_docdir_fmt} change (everything on one row):
%global pkgdocdir %{_docdir}/%{?_docdir_fmt:%{expand:%(echo '%{_docdir_fmt}' | tr A-Z a-z)}}%{!?_docdir_fmt:%{name}-%{version}}
Do we want to encourage using this in specfiles that need to refer to the dir created by %doc, or does someone have a better solution?
Packages can obviously conditionalize stuff on 0%{?fedora} >= 20 but that doesn't sound too nice to me.
[1] https://fedoraproject.org/wiki/Changes/UnversionedDocdirs
On 07/23/2013 03:33 PM, Ville Skyttä wrote:
Related to the unversioned docdirs F-20 feature [1], here's a couple of questions:
- Should specfiles be using %{_docdir} or %{_defaultdocdir} when
referring to the /usr/share/doc dir? Both seem to work, both are being used. To me %{_docdir} sounds better for some reason.
- Packages that want to refer to the doc dir created by the special
%doc form need to take %{_docdir_fmt} into account. I didn't find a nice way to do it, but here's one uglyish way to define a variable in specfiles that should point to the correct location before and after the %{_docdir_fmt} change (everything on one row):
%global pkgdocdir %{_docdir}/%{?_docdir_fmt:%{expand:%(echo '%{_docdir_fmt}' | tr A-Z a-z)}}%{!?_docdir_fmt:%{name}-%{version}}
Shouldn't this be in one of the macro files and not replicated in various spec files?
Do we want to encourage using this in specfiles that need to refer to the dir created by %doc, or does someone have a better solution?
I never liked the magic behavior of %doc. Nothing else magically installs files by simply applying an attribute, it's weird, under documented and error prone. Apparently the behavior depends on whether the filenames which follow the %doc directive are absolute or not, make a mistake in listing the file and you get different behavior. The %doc documentation is also incomplete when it comes to sub-package behavior. In many instances you want the sub-package to install it's doc in the doc area for the main package.
All of the above is why I explicitly define a docdir macro in my spec files and explicitly install files relative to it. This eliminates the under specified magic behavior of %doc and replaces it with well defined actions. Also a number of configure scripts accept a docdir configuration option so when make install runs it will install it's documentation relative to this root directory. Another reason to have a nicely defined docdir variable.
When I tried to bring my packages into alignment with the proposed change I discovered it was not obvious at all how to make it work cleanly because there doesn't seem to be any predfined docdir variable which implements the before and after behavior (versioned vs. unversioned).
I strongly suggest the standard macros define a pkgdocdir variable, if it's not defined it can default to the previous behavior. Off the top of my head I would think a spec file might look like this:
%global docdir %{?pkgdocdir:%{_docdir}/%{name}-%{version}}
Packages can obviously conditionalize stuff on 0%{?fedora} >= 20 but that doesn't sound too nice to me.
[1] https://fedoraproject.org/wiki/Changes/UnversionedDocdirs
packaging mailing list packaging@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/packaging
On Tue, Jul 23, 2013 at 12:33 PM, Ville Skyttä ville.skytta@iki.fi wrote:
Related to the unversioned docdirs F-20 feature [1], here's a couple of questions:
- Should specfiles be using %{_docdir} or %{_defaultdocdir} when
referring to the /usr/share/doc dir? Both seem to work, both are being used. To me %{_docdir} sounds better for some reason.
Only the latter one seems to work?
% rpm -E '%{_docdir}' %{_docdir}
% rpm -E '%{_defaultdocdir}' /usr/share/doc
- Packages that want to refer to the doc dir created by the special
%doc form need to take %{_docdir_fmt} into account. I didn't find a nice way to do it, but here's one uglyish way to define a variable in specfiles that should point to the correct location before and after the %{_docdir_fmt} change (everything on one row):
%global pkgdocdir %{_docdir}/%{?_docdir_fmt:%{expand:%(echo '%{_docdir_fmt}' | tr A-Z a-z)}}%{!?_docdir_fmt:%{name}-%{version}}
Why not just define %{pkgdocdir} in redhat-rpm-config instead of making everyone do this in spec files?
Do we want to encourage using this in specfiles that need to refer to the dir created by %doc, or does someone have a better solution?
Packages can obviously conditionalize stuff on 0%{?fedora} >= 20 but that doesn't sound too nice to me.
IMHO it would be a lot simpler if we just define %{pkgdocdir} in redhat-rpm-config, make sure it does the right thing regardless of Fedora version, and backport to current Fedora releases. (We backported the systemd macros to earlier Fedora releases for similar reasons so there's precedent for this.) Then specs can be ported without need for conditionals.
-T.C.
P.S. Thanks for the Unversioned Docdirs proposal. It's an awesome improvement! :-)
On 2013-07-23 23:00, T.C. Hollingsworth wrote:
On Tue, Jul 23, 2013 at 12:33 PM, Ville Skyttä ville.skytta@iki.fi wrote:
Related to the unversioned docdirs F-20 feature [1], here's a couple of questions:
- Should specfiles be using %{_docdir} or %{_defaultdocdir} when
referring to the /usr/share/doc dir? Both seem to work, both are being used. To me %{_docdir} sounds better for some reason.
Only the latter one seems to work?
Both do work. %{_docdir} is defined by rpmbuild at specfile parse time, so you can't --eval it.
- Packages that want to refer to the doc dir created by the special
%doc form need to take %{_docdir_fmt} into account. I didn't find a nice way to do it, but here's one uglyish way to define a variable in specfiles that should point to the correct location before and after the %{_docdir_fmt} change (everything on one row):
%global pkgdocdir %{_docdir}/%{?_docdir_fmt:%{expand:%(echo '%{_docdir_fmt}' | tr A-Z a-z)}}%{!?_docdir_fmt:%{name}-%{version}}
Why not just define %{pkgdocdir} in redhat-rpm-config instead of making everyone do this in spec files?
That'd be better, yes, but I'll note that it's only a smallish subset of packages that need this, not "everyone".
Anyway, exactly HOW to define it is my main question at the moment. %{_docdir_fmt} is a bit special because it's run through headerFormat() which AFAIK isn't available for use in macros or specfiles, hence the hackish expansion of the lowercased version of its value in the above implementation.
On 2013-07-23 23:19, Ville Skyttä wrote:
On 2013-07-23 23:00, T.C. Hollingsworth wrote:
Why not just define %{pkgdocdir} in redhat-rpm-config instead of making everyone do this in spec files?
That'd be better, yes, [...]
I just realized that we most likely can't get that to current RHEL versions' redhat-rpm-config which makes this approach less appealing.
On 2013-07-23 23:19, Ville Skyttä wrote:
On 2013-07-23 23:00, T.C. Hollingsworth wrote:
On Tue, Jul 23, 2013 at 12:33 PM, Ville Skyttä ville.skytta@iki.fi wrote:
%global pkgdocdir %{_docdir}/%{?_docdir_fmt:%{expand:%(echo '%{_docdir_fmt}' | tr A-Z a-z)}}%{!?_docdir_fmt:%{name}-%{version}}
Why not just define %{pkgdocdir} in redhat-rpm-config instead of making everyone do this in spec files?
That'd be better, yes, but I'll note that it's only a smallish subset of packages that need this, not "everyone".
Anyway, exactly HOW to define it is my main question at the moment.
Hm, if we define it in redhat-rpm-config where %{_docdir_fmt} is defined as well, we can just "duplicate" its value, no need to be that fancy, so:
%_docdir_fmt %%{NAME} %pkgdocdir %{_docdir}/%{name}
BTW thoughts if it should be %pkgdocdir or %_pkgdocdir?
2013-7-24 PM2:00,"Ville Skyttä" ville.skytta@iki.fi写道:
BTW thoughts if it should be %pkgdocdir or %_pkgdocdir?
The latter one is good.
On Tue, Jul 23, 2013 at 11:00 PM, Ville Skyttä ville.skytta@iki.fi wrote:
On 2013-07-23 23:19, Ville Skyttä wrote:
Anyway, exactly HOW to define it is my main question at the moment.
Hm, if we define it in redhat-rpm-config where %{_docdir_fmt} is defined as well, we can just "duplicate" its value, no need to be that fancy, so:
%_docdir_fmt %%{NAME} %pkgdocdir %{_docdir}/%{name}
Yeah, don't see why it matters now that it's just %{name}. ;-)
BTW thoughts if it should be %pkgdocdir or %_pkgdocdir?
+1 for the latter too. All the other *dirs have the underscore, not sure why but it's less confusing to stay consistent. I left them in the new directories in the Web Assets drafts [1] for the same reason.
-T.C.
[1] https://fedoraproject.org/wiki/User:Patches/PackagingDrafts/Web_Assets#RPM_M...
On Tue, Jul 23, 2013 at 1:19 PM, Ville Skyttä ville.skytta@iki.fi wrote:
On 2013-07-23 23:00, T.C. Hollingsworth wrote:
On Tue, Jul 23, 2013 at 12:33 PM, Ville Skyttä ville.skytta@iki.fi wrote:
Related to the unversioned docdirs F-20 feature [1], here's a couple of questions:
- Should specfiles be using %{_docdir} or %{_defaultdocdir} when
referring to the /usr/share/doc dir? Both seem to work, both are being used. To me %{_docdir} sounds better for some reason.
Only the latter one seems to work?
Both do work. %{_docdir} is defined by rpmbuild at specfile parse time, so you can't --eval it.
Ah. I used %{_defaultdocdir} in nodejs because that worked with `rpm --eval`. I suspect I'm not the only one. ;-)
- Packages that want to refer to the doc dir created by the special
%doc form need to take %{_docdir_fmt} into account. I didn't find a nice way to do it, but here's one uglyish way to define a variable in specfiles that should point to the correct location before and after the %{_docdir_fmt} change (everything on one row):
%global pkgdocdir %{_docdir}/%{?_docdir_fmt:%{expand:%(echo '%{_docdir_fmt}' | tr A-Z a-z)}}%{!?_docdir_fmt:%{name}-%{version}}
Why not just define %{pkgdocdir} in redhat-rpm-config instead of making everyone do this in spec files?
That'd be better, yes, but I'll note that it's only a smallish subset of packages that need this, not "everyone".
True, but we should avoid making packagers copy/paste boilerplate stuff wherever possible.
Anyway, exactly HOW to define it is my main question at the moment. %{_docdir_fmt} is a bit special because it's run through headerFormat() which AFAIK isn't available for use in macros or specfiles, hence the hackish expansion of the lowercased version of its value in the above implementation.
Will answer downthread...
-T.C.
On Tue, Jul 23, 2013 at 4:00 PM, T.C. Hollingsworth tchollingsworth@gmail.com wrote:
On Tue, Jul 23, 2013 at 12:33 PM, Ville Skyttä ville.skytta@iki.fi wrote:
Related to the unversioned docdirs F-20 feature [1], here's a couple of questions:
- Should specfiles be using %{_docdir} or %{_defaultdocdir} when
referring to the /usr/share/doc dir? Both seem to work, both are being used. To me %{_docdir} sounds better for some reason.
Only the latter one seems to work?
% rpm -E '%{_docdir}' %{_docdir}
% rpm -E '%{_defaultdocdir}' /usr/share/doc
Try "rpm --showrc".
On Tue, Jul 23, 2013 at 2:47 PM, Nico Kadel-Garcia nkadel@gmail.com wrote:
Try "rpm --showrc".
I did. I'm 99% sure this is what I did when I tried to figure this out for nodejs:
% rpm --showrc | grep doc <snip>
Oh, there's a %{_docdir}!
% rpm -E '%{_docdir}' %{_docdir}
Sad panda. *Looks back at 'showrc' output.* Hmm, there's a %{_defaultdocdir} too...
% rpm -E '%{_defaultdocdir}' /usr/share/doc
Yay!!! Teh users can haz docs now!
I'm not aware of any other directory macro that works like this. It's obvious why macros like %{name} and %{summary} won't eval but there's no reason why I would expect %{_docdir} not to. (If it evaluated like %{_pkgdocdir} is planned to that would be a different story...)
-T.C.
packaging@lists.fedoraproject.org