On 2006-08-17T14:14:55, Monty Taylor <[EMAIL PROTECTED]> wrote:
> Ahh... well that at least explains why everything is hardcoded.
>
> I suppose from the way you that was worded that no one is likely to
> discuss that process... dare I ask why it's done that way?
Please, if you get a satisfactory answer to that question I'm all ears
;-)
> If it isn't up for debate, can I suggest not distributing the
> heartbeat.spec file at all, but instead only the heartbeat.spec.in, as
> there is no way for someone to know that the spec file is indended to
> only be generated from the packaging.
This seems sound.
> Also... (ok, I guess I am arguing now. sorry, I know I'm new on the
> list) the source RPM does not work if you do things this way.
Yes. This is well known. Sorry. The heartbeat build process is that you
build the specfile first, and then the package.
(Instead of using the specfile itself to bootstrap the build as it would
be normally done.)
> Configure should configure the software. An rpm spec file should run
> configure to configure the software based on the system-wide RPM
> settings.
I whole heartedly agree, and this is the reason why I have to build SUSE
packages with a different specfile - because our RPM build process
expects to start with a specfile and go from there, and this is exactly
what I do there... (Among some other things.)
But, while we're at the patch itself, I personally like the general
notion quite a bit:
> --- heartbeat-2.0.7/heartbeat.spec 2006-08-14 00:38:40.000000000 -0400
> +++ heartbeat.spec 2006-08-16 12:43:20.000000000 -0400
> @@ -1,9 +1,38 @@
> -# $Id: heartbeat.spec.in,v 1.196 2006/08/14 04:22:04 alan Exp $
> +# $Id: heartbeat.spec.in,v 1.188 2006/07/13 16:32:18 alan Exp $
... it might be worth-while to diff against the latest source, though
;-)
> %define _unpackaged_files_terminate_build 1
> %define _missing_doc_files_terminate_build 1
> -%define ENABLE_MGMT 1
> -%define ENABLE_SNMP_SUBAGENT 1
> +
> +# Setup defaults
> +%{!?_with_mgmt: %{!?_without_mgmt: %define _without_mgmt --disable-mgmt}}
> +%{!?_with_snmp: %{!?_without_snmp: %define _with_snmp
> --enable-snmp-subagent}}
> +
> +%{?_without_snmp: %define _without_snmp --disable-snmp-subagent}
> +%{?_with_mgmt: %define _with_mgmt --enable-mgmt}
> +
> +# use "rpmbuild --with mgmt" or "rpm --define '_with_mgmt 1'" (for RPM 3.x)
> +# to enable GUI Management Client (disabled by default)
> +%{?_with_mgmt:%define ENABLE_MGMT 1}
> +%{!?_with_mgmt:%define ENABLE_MGMT 0}
> +
> +# use "rpmbuild --without snmp" or "rpm --define '_without_snmp 1'" (for RPM
> 3.x)
> +# to enable SNMP Subagent (enabled by default)
> +%{?_with_snmp:%define ENABLE_SNMP_SUBAGENT 1}
> +%{!?_with_snmp:%define ENABLE_SNMP_SUBAGENT 0}
> +
> +%if %{ENABLE_SNMP_SUBAGENT}
> +%define snmp_prereq net-snmp-devel, bzip2-devel, lm_sensors-devel,
> libselinux-devel
> +%define snmp_req net-snmp, bzip2, lm_sensors, libselinux
> +%else
> +%define snmp_req ,
> +%define snmp_prereq ,
> +%endif
> +
> +%if %{ENABLE_MGMT}
> +%define mgmt_req libglade2, python-gtk
> +%else
> +%define mgmt_req ,
> +%endif
My goodness, this is certainly advanced RPM specfile magick! I'm
impressed. Now, if you can use something similar to hide the (build)
requirement differences across distributions & versions, you'll be my
personal hero.
I think that list is probably quite long for the snmp-subagent though,
at least on openSUSE build-requires etc is expanded recursively?
(BTW, I'll only comment on the lines I'm not sure about, the rest looks
fine.)
> -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-build
> -BuildPrereq: glib-devel, , perl, iputils, /usr/bin/ssh, openssl-devel, libnet
> +Source: http://linux-ha.org/download/heartbeat-%{version}.tar.gz
> +BuildRoot: %{_tmppath}/%{name}-%{version}-build
Why did you strip the release number from the build root?
> @@ -149,7 +179,6 @@
> themselves and don't appear to be harmful. They typically
> include a message something like this:
> WARN: Ignoring HA message (op=vote) from XXX: not in our membership
> list
> -
> * Thu Jul 13 2006 Alan Robertson <[EMAIL PROTECTED]> (see doc/AUTHORS file)
> + Version 2.0.6 - bug fix and a few enhancements release
> + Added the ability to start/stop groups from the GUI
BTW, we could take the opportunity to migrate the changes section out to
a different file using -f.
> @@ -1326,7 +1355,23 @@
> #
> #CFLAGS="${RPM_OPT_FLAGS}" \
> # ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
> -./configure '--prefix=/usr' '--sysconfdir=/etc' '--localstatedir=/var'
> '--with-group-id=90' '--with-ccmuser-id=90' '--libexecdir=/usr/lib64'
> '--libdir=/usr/lib64' '--disable-ansi' '--enable-mgmt'
> '--enable-bundled_ltdl' '--enable-snmp-subagent' 'CFLAGS=
> -fno-unit-at-a-time' --enable-ltdl-convenience
> +%if %{ENABLE_MGMT}
> +config_flags="${config_flags} --enable-mgmt "
> +%else
> +config_flags="${config_flags} --disable-mgmt "
> +%endif
> +
> +%if %{ENABLE_SNMP_SUBAGENT}
> +config_flags="${config_flags} --enable-snmp-subagent "
> +%else
> +config_flags="${config_flags} --disable-snmp-subagent "
> +%endif
We should only do this for diverting from the default, and then we can
use something like:
%configure ... \
%if %{ENABLE_MGMT}
--enable-mgmt \
%endif
...
That's slightly less clutter.
Maybe some of the changes I made for the openSUSE package are
interesting to you? http://repos.opensuse.org/server:/ha-clustering/
(Even if you went quite a bit beyond than I did in replacing the file
section with proper rpm macros, because I obviously only had the Linux
target in mind.)
> +CFLAGS="${RPM_OPT_FLAGS} -fno-unit-at-a-time" \
Why hard-code -fno-unit-at-atime here? I don't like that.
> +%configure '--with-group-id=90' '--with-ccmuser-id=90' '--disable-ansi'
> '--enable-bundled_ltdl' '--enable-ltdl-convenience' ${config_flags}
Be careful. The group-id and ccmuser-id are also platform-specific.
> +CFLAGS="${RPM_OPT_FLAGS} -fno-unit-at-a-time" \
> make
You could simply export CFLAGS in the build section and be done with it.
> @@ -1490,11 +1535,11 @@
> else
> GROUPOPT="-g 90"
> if
> - /usr/sbin/groupadd $GROUPOPT haclient 2>/dev/null
> + %{_sbindir}/groupadd $GROUPOPT haclient 2>/dev/null
> then
> : OK we were able to add group haclient
> else
> - /usr/sbin/groupadd haclient
> + %{_sbindir}/groupadd haclient
> fi
> fi
>
> @@ -1503,13 +1548,13 @@
> then
> : OK user hacluster already present
> else
> - USEROPT="-g haclient -u 90 -d /var/lib/heartbeat/cores/hacluster"
> + USEROPT="-g haclient -u 90 -d
> %{_localstatedir}/lib/heartbeat/cores/hacluster"
> if
> - /usr/sbin/useradd $USEROPT hacluster 2>/dev/null
> + %{_sbindir}/useradd $USEROPT hacluster 2>/dev/null
> then
> : OK we were able to add user hacluster
> else
> - /usr/sbin/useradd hacluster
> + %{_sbindir}/useradd hacluster
> fi
> fi
>
This section needs to be changed to reflect the uid/gid variables.
Overall, I like the idea quite a bit. If we could get one cross-platform
RPM spec file which worked for all platforms which use rpms, we might be
able to get rid of the spec.in file.
(I hope that now that this is suggested by someone else the idea will be
attributed more merit ;-)
Sincerely,
Lars Marowsky-Brée
--
High Availability & Clustering
SUSE Labs, Research and Development
SUSE LINUX Products GmbH - A Novell Business -- Charles Darwin
"Ignorance more frequently begets confidence than does knowledge"
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/