[open-ils-commits] r10931 - in branches/rel_1_4: . Open-ILS/src/offline Open-ILS/src/support-scripts

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Oct 27 23:14:54 EDT 2008


Author: dbs
Date: 2008-10-27 23:14:47 -0400 (Mon, 27 Oct 2008)
New Revision: 10931

Removed:
   branches/rel_1_4/Open-ILS/src/offline/offline-config.pl.in
Modified:
   branches/rel_1_4/Makefile.am
   branches/rel_1_4/Open-ILS/src/support-scripts/eg_db_config.pl
   branches/rel_1_4/configure.ac
Log:
Merge 10930 from trunk:
Teach eg_db_config.pl to generate offline-config.pl
Make eg_db_config.pl generate timestamped backups of opensrf.xml
Clean up configure options and output
Remove no-longer-necessary offline-config.pl.in
Write live-db-setup.pl to the sysconfdir directory


Modified: branches/rel_1_4/Makefile.am
===================================================================
--- branches/rel_1_4/Makefile.am	2008-10-28 03:11:22 UTC (rev 10930)
+++ branches/rel_1_4/Makefile.am	2008-10-28 03:14:47 UTC (rev 10931)
@@ -37,13 +37,6 @@
 export DBI_LIBS = @DBI_LIBS@
 export OPENSRF_HEADERS = @OPENSRF_HEADERS@
 export OPENSRF_LIBS = @OPENSRF_LIBS@
-#export DBDRVR = @DBDRVR@
-#export DBHOST = @DBHOST@
-#export DBPORT = @DBPORT@
-#export DBNAME = @DBNAME@
-#export DBUSER = @DBUSER@
-#export DBPW = @DBPW@
-#export DBVER = @DBVER@
 
 SUBDIRS = Open-ILS/src
 

Deleted: branches/rel_1_4/Open-ILS/src/offline/offline-config.pl.in
===================================================================
--- branches/rel_1_4/Open-ILS/src/offline/offline-config.pl.in	2008-10-28 03:11:22 UTC (rev 10930)
+++ branches/rel_1_4/Open-ILS/src/offline/offline-config.pl.in	2008-10-28 03:14:47 UTC (rev 10931)
@@ -1,5 +0,0 @@
-$main::config{base_dir} = '@localstatedir@/data/offline/';
-$main::config{bootstrap} = '@sysconfdir@/opensrf_core.xml';
-$main::config{dsn} = 'dbi:@DBDRVR@:host=@DBHOST@;dbname=@DBNAME@;port=@DBPORT@';
-$main::config{usr} = '@DBUSER@';
-$main::config{pw} = '@DBPW@';

Modified: branches/rel_1_4/Open-ILS/src/support-scripts/eg_db_config.pl
===================================================================
--- branches/rel_1_4/Open-ILS/src/support-scripts/eg_db_config.pl	2008-10-28 03:11:22 UTC (rev 10930)
+++ branches/rel_1_4/Open-ILS/src/support-scripts/eg_db_config.pl	2008-10-28 03:14:47 UTC (rev 10931)
@@ -28,8 +28,13 @@
 my $config_file = '';
 my $build_db_sh = '';
 my $bootstrap_file = '';
+my $offline_file = '';
+my $prefix = '';
+my $sysconfdir = '';
 my @services;
 
+my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
+
 # Get the directory for this script
 my $script_dir = dirname($0);
 
@@ -61,10 +66,12 @@
 		}
 	}
 
-	if (copy($config_file, "$config_file.bak")) {
-		print "Backed up original configuration file to '$config_file.bak'\n";
+	my $timestamp = sprintf("%d.%d.%d.%d.%d.%d",
+		$year + 1900, $mon +1, $mday, $hour, $min, $sec);
+	if (copy($config_file, "$config_file.$timestamp")) {
+		print "Backed up original configuration file to '$config_file.$timestamp'\n";
 	} else {
-		print STDERR "Unable to write to '$config_file.bak'; bailed out.\n";
+		print STDERR "Unable to write to '$config_file.$timestamp'; bailed out.\n";
     }
 
 	$opensrf_config->toFile($config_file) or
@@ -77,7 +84,7 @@
 
     open(FH, '>', $setup) or die "Could not write database setup to $setup\n";
 
-	print "Writing database bootstrapping configuration to $setup...\n";
+	print "Writing database bootstrapping configuration to $setup\n";
 
 	printf FH "\$main::config{dsn} = 'dbi:Pg:host=%s;dbname=%s;port=%d';\n",
 		$settings->{host}, $settings->{db}, $settings->{port};
@@ -89,6 +96,25 @@
     close(FH);
 }
 
+# write out the offline config
+sub create_offline_config {
+	my ($setup, $settings) = @_;
+
+    open(FH, '>', $setup) or die "Could not write offline database setup to $setup\n";
+
+	print "Writing offline database configuration to $setup\n";
+
+	printf FH "\$main::config{base_dir} = '%s/var/data/offline/';\n", $prefix;
+	printf FH "\$main::config{bootstrap} = '%s/opensrf_core.xml';\n", $sysconfdir;
+
+	printf FH "\$main::config{dsn} = 'dbi:Pg:host=%s;dbname=%s;port=%d';\n",
+		$settings->{host}, $settings->{db}, $settings->{port};
+
+	printf FH "\$main::config{usr} = '%s';\n", $settings->{user};
+	printf FH "\$main::config{pw} = '%s';\n", $settings->{pw};
+
+    close(FH);
+}
 # Extracts database settings from opensrf.xml
 sub get_settings {
 	my $settings = shift;
@@ -122,12 +148,14 @@
 }
 
 my $bootstrap;
+my $offline;
 my $cschema;
 my $uconfig;
 my %settings;
 
 GetOptions("create-schema" => \$cschema, 
 		"create-bootstrap" => \$bootstrap,
+		"create-offline" => \$offline,
 		"update-config" => \$uconfig,
 		"bootstrap-file=s" => \$bootstrap_file,
 		"config-file=s" => \$config_file,
@@ -150,17 +178,28 @@
 if (!$config_file) { 
 	my @temp = `$eg_config --sysconfdir`;
 	chomp $temp[0];
-	$config_file = File::Spec->catfile($temp[0], "opensrf.xml");
+	$sysconfdir = $temp[0];
+	$config_file = File::Spec->catfile($sysconfdir, "opensrf.xml");
 }
 
+if (!$prefix) {
+	my @temp = `$eg_config --prefix`;
+	chomp $temp[0];
+	$prefix = $temp[0];
+}
+
 if (!$build_db_sh) {
 	$build_db_sh = File::Spec->catfile($script_dir, '../sql/Pg/build-db.sh');
 }
 
 if (!$bootstrap_file) {
-	$bootstrap_file = ('/openils/var/cgi-bin/live-db-setup.pl');
+	$bootstrap_file = File::Spec->catfile($sysconfdir, 'live-db-setup.pl');
 }
 
+if (!$offline_file) {
+	$offline_file = File::Spec->catfile($sysconfdir, 'offline-config.pl');
+}
+
 unless (-e $build_db_sh) { die "Error: $build_db_sh does not exist. \n"; }
 unless (-e $config_file) { die "Error: $config_file does not exist. \n"; }
 
@@ -171,8 +210,9 @@
 
 if ($cschema) { create_schema(\%settings); }
 if ($bootstrap) { create_db_bootstrap($bootstrap_file, \%settings); }
+if ($offline) { create_offline_config($offline_file, \%settings); }
 
-if ((!$cschema && !$uconfig && !$bootstrap) || $help) {
+if ((!$cschema && !$uconfig && !$bootstrap && !$offline) || $help) {
 	print <<HERE;
 
 SYNOPSIS
@@ -189,12 +229,17 @@
         specifies the opensrf.xml file. Defaults to /openils/conf/opensrf.xml
 
     --bootstrap-file
-        specifies the database bootstrap file required by the CGI setup interface
+        specifies the database bootstrap file required by the CGI setup
+        interface. Defaults to /openils/conf/live-db-setup.pl
 
     --build-db-file
         specifies the script that creates the database schema. Defaults to
         Open-ILS/src/sql/pg/build-db.sh
 
+    --offline-file
+        specifies the offline database settings file required by the offline
+        data uploader. Defaults to /openils/conf/offline-config.pl
+
 COMMANDS
     --update-config
         Configures Evergreen database settings in the file specified by
@@ -203,6 +248,9 @@
     --create-bootstrap
         Creates the database bootstrap file required by the CGI setup interface
 
+    --create-offline
+        Creates the database setting file required by the offline data uploader
+
     --create-schema
         Creates the Evergreen database schema according to the settings in
         the file specified by --config-file.  
@@ -235,7 +283,7 @@
    script with a complete set of commands:
 
    perl Open-ILS/src/support-scripts/eg_db_config.pl --update-config \
-       --service all --create-schema --create-bootstrap \
+       --service all --create-schema --create-bootstrap --create-offline \
        --user evergreen --password evergreen --hostname localhost --port 5432 \
        --database evergreen 
 

Modified: branches/rel_1_4/configure.ac
===================================================================
--- branches/rel_1_4/configure.ac	2008-10-28 03:11:22 UTC (rev 10930)
+++ branches/rel_1_4/configure.ac	2008-10-28 03:14:47 UTC (rev 10931)
@@ -56,12 +56,12 @@
 #[openils_all=false])
 
 # install evergreen-core?
-AC_ARG_ENABLE([evergreen-core],
-[  --disable-evergreen-core    disables the installation of the evergreen core components ],
+AC_ARG_ENABLE([core],
+[  --disable-core    disables installation of the Evergreen core components ],
 [case "${enableval}" in
     yes) openils_core=true ;;
     no)  openils_core=false ;;
-  *) AC_MSG_ERROR([please choose another value for --disable-evergreen-core (supported values are yes or no])
+  *) AC_MSG_ERROR([please choose another value for --disable-core (supported values are yes or no])
 esac],
 [openils_core=true])
 
@@ -69,12 +69,12 @@
 
 # install evergreen-web?
 
-AC_ARG_ENABLE([evergreen-web],
-[  --disable-evergreen-web    disables the installation of the openils web modules ],
+AC_ARG_ENABLE([web],
+[  --disable-web    disables installation of the Evergreen web modules ],
 [case "${enableval}" in
     yes) openils_web=true ;;
     no)  openils_web=false ;;
-  *) AC_MSG_ERROR([please choose another value for --disable-evergreen-web (supported values are yes or no])
+  *) AC_MSG_ERROR([please choose another value for --disable-web (supported values are yes or no])
 esac],
 [openils_web=true])
 
@@ -82,12 +82,12 @@
 
 # build evergreen-reporter ?
 
-AC_ARG_ENABLE([evergreen-reporter],
-[  --disable-evergreen-reporter    disables the installation of the evergreen reporter module ],
+AC_ARG_ENABLE([reporter],
+[  --disable-reporter    disables installation of the Evergreen reporter module ],
 [case "${enableval}" in
     yes) openils_reporter=true ;;
     no)  openils_reporter=false ;;
-  *) AC_MSG_ERROR([please choose another value for --disable-evergreen-reporter (supported values are yes or no])
+  *) AC_MSG_ERROR([please choose another value for --disable-reporter (supported values are yes or no])
 esac],
 [openils_reporter=true])
 
@@ -95,12 +95,12 @@
 
 # build evergreen-client ?
 
-AC_ARG_ENABLE([evergreen-client],
-[  --disable-evergreen-client    disables the installation of the evergreen staff client ],
+AC_ARG_ENABLE([client],
+[  --disable-client    disables installation of the Evergreen staff client ],
 [case "${enableval}" in
     yes) openils_client=true ;;
     no)  openils_client=false ;;
-  *) AC_MSG_ERROR([please choose another value for --disable-evergreen-client (supported values are yes or no])
+  *) AC_MSG_ERROR([please choose another value for --disable-client (supported values are yes or no])
 esac],
 [openils_client=true])
 
@@ -109,12 +109,12 @@
 
 # build evergreen java ?
 
-AC_ARG_ENABLE([evergreen-java],
-[  --enable-evergreen-java    enables the installation of the evergreen java components ],
+AC_ARG_ENABLE([java],
+[  --enable-java    enables installation of the Evergreen Java components ],
 [case "${enableval}" in
     yes) evergreen_java=true ;;
     no)  evergreen_java=false ;;
-  *) AC_MSG_ERROR([please choose another value for --enable-evergreen-java (supported values are yes or no])
+  *) AC_MSG_ERROR([please choose another value for --enable-java (supported values are yes or no])
 esac],
 [evergreen_java=false])
 
@@ -123,12 +123,12 @@
 
 # build the evergreen python modules?
 
-AC_ARG_ENABLE([evergreen-python],
-[  --enable-evergreen-python    enables the installation of the evergreen python modules ],
+AC_ARG_ENABLE([python],
+[  --enable-python    enables installation of the Evergreen Python modules ],
 [case "${enableval}" in
     yes) EG_PYTHON_INSTALL=true ;;
     no)  EG_PYTHON_INSTALL=false ;;
-  *) AC_MSG_ERROR([please choose another value for --enable-python-install (supported values are yes or no)])
+  *) AC_MSG_ERROR([please choose another value for --enable-python (supported values are yes or no)])
 esac],
 [EG_PYTHON_INSTALL=false])
 
@@ -171,7 +171,7 @@
 #-----------------------------------
 
 AC_ARG_WITH([tmp],
-[ --with-tmp=path		location for the tmp dir for OpenILS (default is /tmp) ],
+[  --with-tmp=path             location of the Evergreen temporary directory (default is /tmp) ],
 [TMP=${withval}],
 [TMP=/tmp])
 AC_SUBST([TMP])
@@ -186,26 +186,26 @@
 APR_HEADERS=`apr-config --includedir`
 AC_SUBST([APR_HEADERS])
 
-AC_ARG_WITH([libxml],
-[  --with-libxml=path         location of the libxml headers (default is /usr/include/libxml2)],
+AC_ARG_WITH([libxml2],
+[  --with-libxml2=path         location of the libxml2 headers (default is /usr/include/libxml2)],
 [LIBXML2_HEADERS=${withval}],
 [LIBXML2_HEADERS=/usr/include/libxml2/])
 AC_SUBST([LIBXML2_HEADERS])
 
 AC_ARG_WITH([dbi],
-[  --with-dbi=path		location of the libdbi libraries (default is /usr/local/lib/dbd)],
+[  --with-dbi=path             location of the libdbi libraries (default is /usr/local/lib/dbd)],
 [DBI_LIBS=${withval}],
 [DBI_LIBS=/usr/local/lib/dbd/])
 AC_SUBST([DBI_LIBS])
 
 AC_ARG_WITH([opensrf-headers],
-[  --with-opensrf-headers=path		location of the opensrf header files (default is /openils/include/)],
+[  --with-opensrf-headers=path location of the OpenSRF header files (default is /openils/include/)],
 [OPENSRF_HEADERS=${withval}],
 [OPENSRF_HEADERS=/openils/include/])
 AC_SUBST([OPENSRF_HEADERS])
 
 AC_ARG_WITH([opensrf-libs],
-[  --with-opensrf-libs=path		location of the opensrf libraries (default is /openils/lib/)],
+[  --with-opensrf-libs=path    location of the OpenSRF libraries (default is /openils/lib/)],
 [OPENSRF_LIBS=${withval}],
 [OPENSRF_LIBS=/openils/lib/])
 AC_SUBST([OPENSRF_LIBS])
@@ -214,7 +214,7 @@
 # Checks for libraries. 
 #------------------------------------
 
-# Check for the existance of libraries in non-standard locations
+# Check for the existence of libraries in non-standard locations
 
 AC_MSG_CHECKING(for -lopensrf)
 if test -e ${OPENSRF_LIBS}/libopensrf.so; then
@@ -286,7 +286,6 @@
                  Open-ILS/src/java/Makefile
                  Open-ILS/src/python/Makefile
                  Open-ILS/xul/staff_client/Makefile
-                 Open-ILS/src/offline/offline-config.pl
                  Open-ILS/src/extras/eg_config],  [if test -e "./Open-ILS/src/extras/eg_config"; then chmod 755 Open-ILS/src/extras/eg_config; fi])
 AC_OUTPUT
 
@@ -331,15 +330,15 @@
 fi
 AC_MSG_RESULT([]) 
 AC_MSG_RESULT([-------- Installation Directories --------])
-AC_MSG_RESULT(Installation dir prefix:                  ${prefix})
-AC_MSG_RESULT(Temporary dir location:                   ${TMP})
-AC_MSG_RESULT(APXS2 dir location:                       ${APXS2})
+AC_MSG_RESULT(Installation directory prefix:            ${prefix})
+AC_MSG_RESULT(Temporary directory:                      ${TMP})
+AC_MSG_RESULT(APXS2 location:                           ${APXS2})
 AC_MSG_RESULT(Apache headers location:                  ${APACHE2_HEADERS})
 AC_MSG_RESULT(APR headers location:                     ${APR_HEADERS})
-AC_MSG_RESULT(libxml headers location:                  ${LIBXML2_HEADERS})
-AC_MSG_RESULT(libdbi dir location:                      ${DBI_LIBS})
-AC_MSG_RESULT(OpenSRF Headers location:                 ${OPENSRF_HEADERS})
-AC_MSG_RESULT(OpenSRF Libraries location:               ${OPENSRF_LIBS})
+AC_MSG_RESULT(libxml2 headers location:                 ${LIBXML2_HEADERS})
+AC_MSG_RESULT(libdbi location:                          ${DBI_LIBS})
+AC_MSG_RESULT(OpenSRF headers location:                 ${OPENSRF_HEADERS})
+AC_MSG_RESULT(OpenSRF libraries location:               ${OPENSRF_LIBS})
 
 AC_MSG_RESULT([----------------------------------------------------------------------])
 



More information about the open-ils-commits mailing list