From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11989 invoked by alias); 30 Jul 2008 06:03:14 -0000 Received: (qmail 11983 invoked by alias); 30 Jul 2008 06:03:14 -0000 X-Spam-Status: No, hits=0.0 required=5.0 tests=BAYES_00,J_CHICKENPOX_28,J_CHICKENPOX_34,J_CHICKENPOX_43,J_CHICKENPOX_73,KAM_MX,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on bastion.fedora.phx.redhat.com X-Spam-Level: Subject: master - build: clean up perl bindings build system To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 19b27052fff6857834585e604ecd235a85f2b979 X-Git-Newrev: db0f63e07772a29541918fffedfbbdee794dba5e From: "Fabio M. Di Nitto" Message-Id: <20080730060227.D8CA512001F@lists.fedorahosted.org> Date: Wed, 30 Jul 2008 08:34:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2008-q3/txt/msg00171.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=db0f63e07772a29541918fffedfbbdee794dba5e Commit: db0f63e07772a29541918fffedfbbdee794dba5e Parent: 19b27052fff6857834585e604ecd235a85f2b979 Author: Fabio M. Di Nitto AuthorDate: Wed Jul 30 07:58:52 2008 +0200 Committer: Fabio M. Di Nitto CommitterDate: Wed Jul 30 07:58:52 2008 +0200 build: clean up perl bindings build system create a generic make/binding-passthrough.mk to use Makefile.bindings because the final Makefile is create by perl create a generic make/perl-binding-common.mk to include basically all targets that can be shared by different bindings simplify bindings/perl/Makefile to use only binding-passthrough.mk create bindings/perl/ccs/Makefile.bindings to use bindings infrastructure generate CCS.pm and META.yml from respective .in files to change data at build time (for example release version) Signed-off-by: Fabio M. Di Nitto --- bindings/perl/Makefile | 13 +--- bindings/perl/ccs/CCS.pm | 145 ----------------------------------- bindings/perl/ccs/CCS.pm.in | 145 +++++++++++++++++++++++++++++++++++ bindings/perl/ccs/META.yml | 13 --- bindings/perl/ccs/META.yml.in | 13 +++ bindings/perl/ccs/Makefile.bindings | 11 +++ make/binding-passthrough.mk | 7 ++ make/perl-binding-common.mk | 30 +++++++ 8 files changed, 207 insertions(+), 170 deletions(-) diff --git a/bindings/perl/Makefile b/bindings/perl/Makefile index 91fefc4..cf3a25a 100644 --- a/bindings/perl/Makefile +++ b/bindings/perl/Makefile @@ -1,15 +1,4 @@ include ../../make/defines.mk +include $(OBJDIR)/make/binding-passthrough.mk SUBDIRS=ccs - -all: ${SUBDIRS} - -%: - set -e && \ - for i in ${SUBDIRS}; do \ - cd $$i; \ - perl Makefile.PL INC='-I${ccsincdir}' LIBS='-L${ccslibdir} -lccs' INSTALLDIRS=vendor; \ - ${MAKE} $@ LD_RUN_PATH=""; \ - rm -f Makefile.old; \ - cd ..; \ - done diff --git a/bindings/perl/ccs/CCS.pm b/bindings/perl/ccs/CCS.pm deleted file mode 100644 index 91ca7a5..0000000 --- a/bindings/perl/ccs/CCS.pm +++ /dev/null @@ -1,145 +0,0 @@ -package Cluster::CCS; - -use strict; -use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); - -require Exporter; -require DynaLoader; - -@ISA = qw(Exporter DynaLoader); -# Items to export into callers namespace by default. Note: do not export -# names by default without a very good reason. Use EXPORT_OK instead. -# Do not simply export all your public functions/methods/constants. -our %EXPORT_TAGS = ( 'all' => [qw( - -)]); -@EXPORT = qw( - -); -@EXPORT_OK = (@{$EXPORT_TAGS{'all'}}); - -our $VERSION = '0.01'; - -require XSLoader; -XSLoader::load('Cluster::CCS', $VERSION); - -sub new { - my $class = shift; - my $self = bless { - @_ - }; - return $self; -} - -1; -__END__ - -=head1 NAME - -Cluster::CCS - Perl wrapper for the Cluster Configuration Service library - -=head1 SYNOPSIS - - use Cluster::CCS; - - my $ccs = new Cluster::CCS(); - - $ccs->fullxpath(1); - - my $ccshandle = $ccs->connect(); - - if ($ccshandle < 1) { - print "Cannot comunicate with libccs\n"; - exit $ccshandle; - } - - my $rtn; - my $err; - - $err = $ccs->get($ccshandle, '/cluster/@name', $rtn); - - if ($err != 0) { - print "Query is not valid\n"; - } - - print "My Cluster name is $rtn\n"; - - $err = $ccs->disconnect($ccshandle); - - if ($err != 0) { - print "Problems disconnecting from libccs\n"; - } - - exit $err; - -=head1 DESCRIPTION - - Cluster::CCS provides a perl XS wrapper for libccs. - -=head1 METHODS - -=head2 new - - Creates a new Cluster::CCS object. - -=head2 fullxpath(value) - - Enable or disable full xpath queries. Set 1 to enable, 0 to disable. - This has to be set before connect() or force_connect. - In order to change this value, a disconnect operation is required. - -=head2 connect() - - Initialize the connection to libccs/libconfdb/corosync objdb. - Returns 1 on success or negative on failure. - -=head2 force_connect(cluster_name, blocking) - - Initialize the connection to libccs/libconfdb/corosync objdb. - If blocking is set, it will retry the operation until it succeed. - Returns 1 on success or negative on failure. - -=head2 disconnect(desc) - - Disconnect and free resources allocated during opertaion. - Returns 0 on success. - -=head2 get(desc, query, rtn) - - Perform a simple xpath query. - Returns 0 on success, negative otherwise. On success rtn will contain the - requested data. - -=head2 get_list(desc, query, rtn) - - Perform a simple xpath query and retain some data to iterate over a list of - results. - Returns 0 on success, negative otherwise. On success rtn will contain the - requested data. - -=head2 set(desc, path, val) - - This operation is not yet implemented in libccs. - -=head2 lookup_nodename(desc, nodename, rtn) - - Perform a nodename lookup using several methods. - Return 0 on success and rtn will contain the requested data. - -=head1 EXPORTS - -Nothing is exported by default. - -=head1 BUGS - - https://bugzilla.redhat.com/ - -=head1 SEE ALSO - - cluster.conf(5), ccs(7), ccs_tool(8) - -=head1 AUTHOR - -Fabio M. Di Nitto - -=cut diff --git a/bindings/perl/ccs/CCS.pm.in b/bindings/perl/ccs/CCS.pm.in new file mode 100644 index 0000000..59573c7 --- /dev/null +++ b/bindings/perl/ccs/CCS.pm.in @@ -0,0 +1,145 @@ +package Cluster::CCS; + +use strict; +use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); + +require Exporter; +require DynaLoader; + +@ISA = qw(Exporter DynaLoader); +# Items to export into callers namespace by default. Note: do not export +# names by default without a very good reason. Use EXPORT_OK instead. +# Do not simply export all your public functions/methods/constants. +our %EXPORT_TAGS = ( 'all' => [qw( + +)]); +@EXPORT = qw( + +); +@EXPORT_OK = (@{$EXPORT_TAGS{'all'}}); + +our $VERSION = '@VERSION@'; + +require XSLoader; +XSLoader::load('Cluster::CCS', $VERSION); + +sub new { + my $class = shift; + my $self = bless { + @_ + }; + return $self; +} + +1; +__END__ + +=head1 NAME + +Cluster::CCS - Perl wrapper for the Cluster Configuration Service library + +=head1 SYNOPSIS + + use Cluster::CCS; + + my $ccs = new Cluster::CCS(); + + $ccs->fullxpath(1); + + my $ccshandle = $ccs->connect(); + + if ($ccshandle < 1) { + print "Cannot comunicate with libccs\n"; + exit $ccshandle; + } + + my $rtn; + my $err; + + $err = $ccs->get($ccshandle, '/cluster/@name', $rtn); + + if ($err != 0) { + print "Query is not valid\n"; + } + + print "My Cluster name is $rtn\n"; + + $err = $ccs->disconnect($ccshandle); + + if ($err != 0) { + print "Problems disconnecting from libccs\n"; + } + + exit $err; + +=head1 DESCRIPTION + + Cluster::CCS provides a perl XS wrapper for libccs. + +=head1 METHODS + +=head2 new + + Creates a new Cluster::CCS object. + +=head2 fullxpath(value) + + Enable or disable full xpath queries. Set 1 to enable, 0 to disable. + This has to be set before connect() or force_connect. + In order to change this value, a disconnect operation is required. + +=head2 connect() + + Initialize the connection to libccs/libconfdb/corosync objdb. + Returns 1 on success or negative on failure. + +=head2 force_connect(cluster_name, blocking) + + Initialize the connection to libccs/libconfdb/corosync objdb. + If blocking is set, it will retry the operation until it succeed. + Returns 1 on success or negative on failure. + +=head2 disconnect(desc) + + Disconnect and free resources allocated during opertaion. + Returns 0 on success. + +=head2 get(desc, query, rtn) + + Perform a simple xpath query. + Returns 0 on success, negative otherwise. On success rtn will contain the + requested data. + +=head2 get_list(desc, query, rtn) + + Perform a simple xpath query and retain some data to iterate over a list of + results. + Returns 0 on success, negative otherwise. On success rtn will contain the + requested data. + +=head2 set(desc, path, val) + + This operation is not yet implemented in libccs. + +=head2 lookup_nodename(desc, nodename, rtn) + + Perform a nodename lookup using several methods. + Return 0 on success and rtn will contain the requested data. + +=head1 EXPORTS + +Nothing is exported by default. + +=head1 BUGS + + https://bugzilla.redhat.com/ + +=head1 SEE ALSO + + cluster.conf(5), ccs(7), ccs_tool(8) + +=head1 AUTHOR + +Fabio M. Di Nitto + +=cut diff --git a/bindings/perl/ccs/META.yml b/bindings/perl/ccs/META.yml deleted file mode 100644 index eda2445..0000000 --- a/bindings/perl/ccs/META.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- #YAML:1.0 -name: Cluster-CCS -version: 0.01 -abstract: ~ -license: ~ -author: - - Fabio M. Di Nitto -generated_by: ExtUtils::MakeMaker version 6.42 -distribution_type: module -requires: -meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.3.html - version: 1.3 diff --git a/bindings/perl/ccs/META.yml.in b/bindings/perl/ccs/META.yml.in new file mode 100644 index 0000000..32ae9a3 --- /dev/null +++ b/bindings/perl/ccs/META.yml.in @@ -0,0 +1,13 @@ +--- #YAML:1.0 +name: Cluster-CCS +version: @VERSION@ +abstract: ~ +license: ~ +author: + - Fabio M. Di Nitto +generated_by: ExtUtils::MakeMaker version 6.42 +distribution_type: module +requires: +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.3.html + version: 1.3 diff --git a/bindings/perl/ccs/Makefile.bindings b/bindings/perl/ccs/Makefile.bindings new file mode 100644 index 0000000..3df4973 --- /dev/null +++ b/bindings/perl/ccs/Makefile.bindings @@ -0,0 +1,11 @@ +include ../../../make/defines.mk + +PMTARGET = CCS.pm + +TARGET = $(PMTARGET) + +CFLAGS=-I${ccsincdir} + +LDFLAGS=-L${ccslibdir} -lccs + +include $(OBJDIR)/make/perl-binding-common.mk diff --git a/make/binding-passthrough.mk b/make/binding-passthrough.mk new file mode 100644 index 0000000..5f3a1bb --- /dev/null +++ b/make/binding-passthrough.mk @@ -0,0 +1,7 @@ +all: ${SUBDIRS} + +%: + set -e && \ + for i in ${SUBDIRS}; do \ + ${MAKE} -C $$i -f Makefile.bindings $@; \ + done diff --git a/make/perl-binding-common.mk b/make/perl-binding-common.mk new file mode 100644 index 0000000..f7e6007 --- /dev/null +++ b/make/perl-binding-common.mk @@ -0,0 +1,30 @@ +TARGET += Makefile \ + META.yml + +all: $(TARGET) + ${MAKE} LD_RUN_PATH=""; + +%.pm: $(S)/%.pm.in + cat $< | \ + sed \ + -e 's/@VERSION@/${RELEASE_VERSION}/g' \ + > $@ + +%.yml: $(S)/%.yml.in + cat $< | \ + sed \ + -e 's/@VERSION@/${RELEASE_VERSION}/g' \ + > $@ + +Makefile: META.yml $(PMTARGET) + perl Makefile.PL INC='$(CFLAGS)' LIBS='$(LDFLAGS)' INSTALLDIRS=vendor + +install: $(TARGET) + ${MAKE} -f Makefile install + +uninstall: + echo uninstall target not supported yet + +clean: + -${MAKE} -f Makefile clean + rm -f $(TARGET) Makefile.old