Discussion:
Various issues with AX_DIST_RPM
Thomas Petersen
2018-01-18 16:02:34 UTC
Permalink
Hi

I am trying to use AX_DIST_RPM in my project to make it easy to build
rpm packages but doing so I have encountered various issues.

If this isn't the right place to discuss it please direct me elsewhere.
Also I'm not very skilled in the m4/autoconf/automake stuff so I will
probably not be able to produce a fully functioning patch.

Anyway this is my experiences:

1.
My project consists of several directories in multiple levels.
AX_DIST_RPM adds various rules using AX_ADD_AM_MACRO_STATIC and wants
those included in the toplevel Makefile.am file. It also uses
AX_INSTALL_FILES which also put rules into aminclude_static.am but these
seem to be required in all Makefile.am files. If it isn't included in
all files the do-mfstamp rule doesn't work recursively.
Now when including aminclude_static.am in all Makefile.am files it at
first seems to work but it copies the spec file to all subdirectories
which isn't supposed to happen. This is caused by the dist-hook:
dist-hook-ax-dist-rpm now present in all Makefiles. As a consequence
rpmbuild later fails because it somehow seems to merge all the spec
files together and finally complains about a second %prep.

For now I have made an ugly hack. I have made AX_DIST_RPM call a
modified version of AX_ADD_AM_MACRO_STATIC which adds to
aminclude_static_toplevel.am instead and then I only include this file
in the toplevel Makefile.am.
That does the trick but a more clean solution could be to add some
conditional stuff to the Makefile logic where AX_DIST_RPM_EXTRA_DIST is
set so it is only set in the toplevel Makefile.

2.
An RPMChangeLog file is build from ChangeLog and dates and times are
converted to an RPM compatible format using gawk and strftime. This
output however depends on the currently selected locale but rpmbuild
expects english formatted dates. Most other locales than english make
rpmbuild fail. Setting LC_ALL=C when calling gawk is a possible fix for
this.

3.
Lastly the macro uses the variable PLATFORM_SUFFIX as part of the name
of the resulting rpm file but the value of the variable is actually
substituted already when running aclocal and the value given when
running configure is ignored. Escaping it at various places makes it use
the value from configure which I guess is what was expected.

I can prepare a patch covering 2. and 3. and put it on the patch
tracker. I'm not sure about the first issue though. Would a condition
check in the makefile be okay or do you have any other suggestions?

Regards,
Thomas Petersen
Kip Warner
2018-01-18 18:17:16 UTC
Permalink
Post by Thomas Petersen
Hi
I am trying to use AX_DIST_RPM in my project to make it easy to build
rpm packages but doing so I have encountered various issues.
Hey Thomas,

This doesn't really answer your question, but is a gentle suggestion in
another direction. I'd encourage you to not make your build environment
(e.g. Autoconf and Automake) depend on distro specific packaging tools,
but keep them separate.

Everything needed to build Debian packages, as an example, is isolated
into a debian/ directory such that what's in it can depend on what's
outside of it (e.g. configure.ac, Makefile.am, etc.), but not the other
way around.

There are many reasons for this, but one of them is that building from
source may occur on a distribution other than the one you are using
where .spec or pbuilder environments are non-existent.

Yours truly,
--
Kip Warner | Senior Software Engineer
OpenPGP signed/encrypted mail preferred
http://www.thevertigo.com
Thomas Petersen
2018-01-23 15:12:23 UTC
Permalink
Post by Kip Warner
Post by Thomas Petersen
I am trying to use AX_DIST_RPM in my project to make it easy to build
rpm packages but doing so I have encountered various issues.
This doesn't really answer your question, but is a gentle suggestion in
another direction. I'd encourage you to not make your build environment
(e.g. Autoconf and Automake) depend on distro specific packaging tools,
but keep them separate.
Thank you for your comments. I agree it would be prettier to have those
distro specific things isolated in subdirectories as you suggest. I
guess I just try out this macro as it seemed to be an easy way to build
a rpm package.

Using the macro doesn't really make the project depend on this specific
packaging tool. It's still an optional feature that is available if rpm
is present. The program still compiles and installs as usual (make &&
make install) if rpm is not present.

Anyway I have put a patch on the patch tracker (#9550) with my
suggestions to improving ax_dist_rpm. Your comments are welcome.

Regards,
Thomas Petersen

Loading...