[Opensrf-commits] r1863 - in trunk: . bin doc examples (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Nov 27 17:47:55 EST 2009


Author: dbs
Date: 2009-11-27 17:47:49 -0500 (Fri, 27 Nov 2009)
New Revision: 1863

Modified:
   trunk/bin/opensrf-perl.pl.in
   trunk/configure.ac
   trunk/doc/dokuwiki-doc-stubber.pl.in
   trunk/examples/math_bench.pl.in
   trunk/examples/math_client.py.in
Log:
Partial fix for launchpad bug 489294: OpenSRF seems to depend on explicit --prefix configure option

In the process of creating Perl and Python scripts using AC_SUBST(sysconfdir),
autoconf would generate variables like '${prefix}' if no explicit --prefix
option was passed to configure - and this would cause those scripts to fail
with syntax errors.

We can work around that, and so we shall. The bigger question is whether
creating scripts with hardcoded defaults results in problems when it comes
to creating system packages; according to http://www.gnu.org/software/hello/manual/autoconf/Installation-Directory-Variables.html
one should try to defer these changes to the Makefile so that the
destination directory can be specified at make or make install time,
instead.

At least this gets us working with no explicit configure options again.
Perhaps a packaging expert can help us out of this mire :)


Modified: trunk/bin/opensrf-perl.pl.in
===================================================================
--- trunk/bin/opensrf-perl.pl.in	2009-11-25 16:05:55 UTC (rev 1862)
+++ trunk/bin/opensrf-perl.pl.in	2009-11-27 22:47:49 UTC (rev 1863)
@@ -27,7 +27,7 @@
 
 my $opt_action = undef;
 my $opt_service = undef;
-my $opt_config = "@sysconfdir@/opensrf_core.xml";
+my $opt_config = "@CONF_DIR@/opensrf_core.xml";
 my $opt_pid_dir = "@TMP@";
 my $opt_no_daemon = 0;
 my $opt_settings_pause = 0;
@@ -215,7 +215,7 @@
 sub do_help {
     print <<HELP;
 
-    Usage: perl $0 --pid_dir @TMP@ --config @sysconfdir@/opensrf_core.xml --service opensrf.settings --action start
+    Usage: perl $0 --pid_dir @TMP@ --config @CONF_DIR@/opensrf_core.xml --service opensrf.settings --action start
 
     --action <action>
         Actions include start, stop, restart, and start_all, stop_all, and restart_all

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2009-11-25 16:05:55 UTC (rev 1862)
+++ trunk/configure.ac	2009-11-27 22:47:49 UTC (rev 1863)
@@ -24,11 +24,20 @@
 AM_INIT_AUTOMAKE([OpenSRF], [trunk])
 AC_REVISION($Revision: 0.1 $)
 AC_CONFIG_SRCDIR([configure.ac])
-AC_PREFIX_DEFAULT([/opensrf/])
+AC_PREFIX_DEFAULT([/opensrf])
 AC_CONFIG_MACRO_DIR([m4])
 
+# Enable $prefix to resolve to a reasonable value in substitutions in
+# scripts if no explict value was passed in to configure
+if test "$prefix" = "NONE"; then
+   prefix=$ac_default_prefix
+fi
+
+# Perl and Python scripts don't want ${prefix} if no value was specified
+eval "eval CONF_DIR=$sysconfdir"
+AC_SUBST([CONF_DIR])
+
 AC_SUBST(prefix)
-AC_SUBST(sysconfdir)
 AC_SUBST(bindir)
 
 

Modified: trunk/doc/dokuwiki-doc-stubber.pl.in
===================================================================
--- trunk/doc/dokuwiki-doc-stubber.pl.in	2009-11-25 16:05:55 UTC (rev 1862)
+++ trunk/doc/dokuwiki-doc-stubber.pl.in	2009-11-27 22:47:49 UTC (rev 1863)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-use OpenSRF::System qw(@sysconfdir@/opensrf_core.xml);
+use OpenSRF::System qw(@CONF_DIR@/opensrf_core.xml);
 use Getopt::Long
 
 $| = 1;

Modified: trunk/examples/math_bench.pl.in
===================================================================
--- trunk/examples/math_bench.pl.in	2009-11-25 16:05:55 UTC (rev 1862)
+++ trunk/examples/math_bench.pl.in	2009-11-27 22:47:49 UTC (rev 1863)
@@ -13,7 +13,7 @@
 print "usage: $0 <num_requests>\n" and exit unless $count;
 
 # * connect to the Jabber network
-OpenSRF::System->bootstrap_client( config_file => "@sysconfdir@/opensrf_core.xml" );
+OpenSRF::System->bootstrap_client( config_file => "@CONF_DIR@/opensrf_core.xml" );
 $log->set_service('math_bench');
 
 # * create a new application session for the opensrf.math service

Modified: trunk/examples/math_client.py.in
===================================================================
--- trunk/examples/math_client.py.in	2009-11-25 16:05:55 UTC (rev 1862)
+++ trunk/examples/math_client.py.in	2009-11-27 22:47:49 UTC (rev 1863)
@@ -3,7 +3,7 @@
 import osrf.ses
 
 # XXX: Replace with command line arguments
-file = '@sysconfdir@/opensrf_core.xml'
+file = '@CONF_DIR@/opensrf_core.xml'
 operator = 'add'
 operand1 = 5
 operand2 = 7



More information about the opensrf-commits mailing list