From: Bernard Li <be...@va...> - 2011-02-25 06:12:18
|
This should be a better patch against current trunk, which does not add gengetopt as a build dependency (unless you need to modify cmdline.sh and re-generate the files): Index: gmetric/Makefile.am =================================================================== --- gmetric/Makefile.am (revision 2490) +++ gmetric/Makefile.am (working copy) @@ -1,3 +1,5 @@ +include $(top_srcdir)/ganglia.inc + if STATIC_BUILD GCFLAGS = GLDADD = @@ -8,13 +10,19 @@ GLDFLAGS = endif -AM_CFLAGS = -I../lib -I../include $(GCFLAGS) -DSYSCONFDIR='"$(sysconfdir)"' +AM_CFLAGS = -I../lib -I../include $(GCFLAGS) bin_PROGRAMS = gmetric -gmetric_SOURCES = gmetric.c cmdline.c cmdline.h + +cmdline.c: cmdline.c.in $(FIXCONFIG) + $(FIXCONFIG) cmdline.c.in + +gmetric_SOURCES = gmetric.c cmdline.c.in cmdline.c cmdline.h gmetric_LDADD = $(top_builddir)/lib/libganglia.la \ $(top_builddir)/lib/libgetopthelper.a \ $(top_builddir)/libmetrics/libmetrics.la \ $(GLDADD) gmetric_LDFLAGS = $(GLDFLAGS) + +CLEANFILES = cmdline.c Index: gmetric/cmdline.sh =================================================================== --- gmetric/cmdline.sh (revision 2490) +++ gmetric/cmdline.sh (working copy) @@ -5,7 +5,7 @@ purpose "The Ganglia Metric Client (gmetric) announces a metric on the list of defined send channels defined in a configuration file" -option "conf" c "The configuration file to use for finding send channels" string default="/etc/ganglia/gmond.conf" no +option "conf" c "The configuration file to use for finding send channels" string default="@sysconfdir@/gmond.conf" no option "name" n "Name of the metric" string no option "value" v "Value of the metric" string no option "type" t "Either string|int8|uint8|int16|uint16|int32|uint32|float|double" string no @@ -13,6 +13,9 @@ option "slope" s "Either zero|positive|negative|both" string default="both" no option "tmax" x "The maximum time in seconds between gmetric calls" int default="60" no option "dmax" d "The lifetime in seconds of this metric" int default="0" no +option "group" g "Groupof the metric" string no +option "desc" D "Description of the metric" string no +option "title" T "Titlei of the metric" string no option "spoof" S "IP address and name of host/device (colon separated) we are spoofing" string default="" no option "heartbeat" H "spoof a heartbeat message (use with spoof option)" no Notes: - gengetopt is called via: gengetopt --c-extension=c.in --input cmdline.sh which generates cmdline.c.in, this will then have @sysconfdir@ replaced by the correct value to generate cmdline.c - cmdline.c is included in the distribution tarball and will have a bogus sysconfdir (usually /usr/local/etc) but it will get replaced when the user does ./configure - make clean would delete cmdline.c If this looks good to everyone, I will check this into trunk and update the backport proposal for adding groups/desc/title to gmetric for 3.1 branch. Thanks, Bernard On Wed, Sep 1, 2010 at 11:56 PM, Bernard Li <be...@va...> wrote: > Hi all: > > I'm trying to get the backport proposal for adding group, description > and title metadata tags to gmetric approved and am in the process of > fixing the auto-generated files that were patched in the changesets > outlined below: > > http://sourceforge.net/apps/trac/ganglia/browser/branches/monitor-core-3.1/STATUS#L209 > > In the process, I found that additional auto-generated files have been patched: > > http://sourceforge.net/apps/trac/ganglia/changeset/2021/ > > In order to fix that, I'll need to modify cmdline.sh and add " > SYSCONFDIR " inside the default clause. Try as I may, it doesn't > appear that I could include double quotes, and escaping with \ has the > generated cmdline.c showing up as \" SYSCONFDIR \" which doesn't get > work. > > To get around the problem, I propose that we delete cmdline.c and > cmdline.h from gmond, gmetric, gmetad sub directories, move cmdline.sh > -> cmdline.sh.in, and update the Makefile.am targets such that > fixconfig is called on cmdline.sh.in to generate cmdline.sh. > cmdline.c and cmdline.h will need to be generated on the fly (so > gengetopt will be an additional build dependency). > > The patch will look something like this: > > Index: gmetric/Makefile.am > =================================================================== > --- gmetric/Makefile.am (revision 2322) > +++ gmetric/Makefile.am (working copy) > @@ -1,3 +1,5 @@ > +include $(top_srcdir)/ganglia.inc > + > if STATIC_BUILD > GCFLAGS = > GLDADD = > @@ -8,9 +10,16 @@ > GLDFLAGS = > endif > > -AM_CFLAGS = -I../lib -I../include $(GCFLAGS) -DSYSCONFDIR='"$(sysconfdir)"' > +AM_CFLAGS = -I../lib -I../include $(GCFLAGS) > > bin_PROGRAMS = gmetric > + > +cmdline.sh: cmdline.sh.in $(FIXCONFIG) > + $(FIXCONFIG) cmdline.sh.in > + > +cmdline.c cmdline.h: cmdline.sh > + gengetopt --input ./cmdline.sh > + > gmetric_SOURCES = gmetric.c cmdline.c cmdline.h > gmetric_LDADD = $(top_builddir)/lib/libganglia.la \ > $(top_builddir)/lib/libgetopthelper.a \ > Index: gmetric/cmdline.sh.in > =================================================================== > --- gmetric/cmdline.sh.in (revision 2322) > +++ gmetric/cmdline.sh.in (working copy) > @@ -5,7 +5,7 @@ > purpose "The Ganglia Metric Client (gmetric) announces a metric > on the list of defined send channels defined in a configuration file" > > -option "conf" c "The configuration file to use for finding send > channels" string default="/etc/ganglia/gmond.conf" no > +option "conf" c "The configuration file to use for finding send > channels" string default="@sysconfdir@/gmond.conf" no > option "name" n "Name of the metric" string no > option "value" v "Value of the metric" string no > option "type" t "Either > string|int8|uint8|int16|uint16|int32|uint32|float|double" string no > @@ -13,6 +13,9 @@ > option "slope" s "Either zero|positive|negative|both" string default="both" no > option "tmax" x "The maximum time in seconds between gmetric calls" > int default="60" no > option "dmax" d "The lifetime in seconds of this metric" int default="0" no > +option "group" g "Group of the metric" string default="" no > +option "desc" D "Description of the metric" string default="" no > +option "title" T "Title of the metric" string default="" no > option "spoof" S "IP address and name of host/device (colon > separated) we are spoofing" string default="" no > option "heartbeat" H "spoof a heartbeat message (use with spoof option)" no > > > Property changes on: gmetric/cmdline.sh.in > ___________________________________________________________________ > Deleted: svn:executable > - * > > Thoughts? > > Cheers, > > Bernard > |