On 12/06/2010 07:37 PM, Jussi Lehtola wrote:
On Mon, 06 Dec 2010 10:22:47 -0700
Orion Poplawski<orion(a)cora.nwra.com> wrote:
> Apparently there is a "GFORTRAN module version" number assigned to
> Fortran modules created by gfortran:
Yes, see section "Modules and include files" in
http://fedoraproject.org/wiki/Packaging:Fortran
> So, it makes sense to me to encode this into the rpm dependencies
> somehow. Perhaps gcc-gfortran can provides a gfortran-abi(VERSION)
> and the gfortran module packages can require it. rpm would need to
> automatically generate the requires though.
>
> Thoughts? Suggestions?
Yes, this would be a nice thing to have, it would reveal instantly
whenever people have forgot to (mass)rebuild Fortran packages.
Returning this oldish issue now that there's something that can
reasonably be done about it...
With rpm >= 4.9.0 packages can drop in their own dependency extractors
without having to patch rpm itself. I'm not at all familiar with fortran
peculiarities (all the more reason for having this outside rpm), but
I'll outline the basic idea that should get you started based on the above.
To add a dependency generator, you need to drop a rule file into
%{_rpmconfigdir}/fileattrs/. The rule would probably be something like
this (classify *.mod files in %{_libdir}/gfortran/modules/ as gfortran):
/usr/lib/rpm/fileattrs/gfortran.attr:
%__gfortran_requires %{_rpmconfigdir}/gfortran.req
%__gfortran_path ^%{_libdir}/gfortran/modules/.*\.mod$
Then you'll need to come up with the actual generator script
(gfortran.req in the above example) that parses the .mod and emits the
dependencies. At it's simplest it might be something like this, although
for a real world version you'd want to do extra sanity checking, remove
quotes etc:
----
#!/bin/sh
while read FNAME; do
head -1 $FNAME | awk '{print "gfortran(abi) = "$4}'
done
----
And finally something needs to create the matching provide, whether it's
possible/sensible to create with a automated rule like the above or
better to just manual use "Provides: gfortran(abi) = <something>" in
gfortran spec depends on the details of which I've no clue :)
These rules + scripts should go a package that's always present when
building gfortran modules, in this case gcc-gfortran sounds like a
fairly obvious choice.
- Panu -