***SPAM*** [OpenSRF-GIT] OpenSRF branch master updated. 339ac28d47a466d2fd0009c24fe0385cb5326479

Evergreen Git git at git.evergreen-ils.org
Fri May 2 14:29:53 EDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "OpenSRF".

The branch, master has been updated
       via  339ac28d47a466d2fd0009c24fe0385cb5326479 (commit)
       via  8fb4405a2768dd752743dab71d6e2e8a50ee6cd5 (commit)
       via  8a8b4cbbae62d3e927b24541f31fec93949b1752 (commit)
      from  0d2c6d74cf60e000646e534a7682b508c84ea55a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 339ac28d47a466d2fd0009c24fe0385cb5326479
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Fri Feb 28 09:33:19 2014 -0800

    LP#1286248: remove osrf_ctl.sh
    
    As osrf_ctl.sh was deprecated in favor of osrf_control, this patch
    removes the deprecated script entirely.
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>
    Signed-off-by: Bill Erickson <berick at esilibrary.com>

diff --git a/.gitignore b/.gitignore
index a370737..99021f3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,7 +2,6 @@ aclocal.m4
 autom4te.cache/
 bin/opensrf-perl.pl
 bin/osrf_config
-bin/osrf_ctl.sh
 compile
 config.guess
 config.log
diff --git a/bin/osrf_ctl.sh.in b/bin/osrf_ctl.sh.in
deleted file mode 100755
index aa6d623..0000000
--- a/bin/osrf_ctl.sh.in
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/bin/sh
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
- 
-# Strictness to avoid folly
-set -e
-set -u
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-
-OPT_ACTION=""
-OPT_CONFIG=""
-OPT_PID_DIR=""
-OSRF_HOSTNAME=""
-
-# ---------------------------------------------------------------------------
-# Make sure we're running as the correct user
-# ---------------------------------------------------------------------------
-[ $(whoami) != 'opensrf' ] && echo 'Must run as user "opensrf"' && exit;
-
-
-usage() {
-	cat << EOF
-
-usage: $0 [OPTION]... -c <c_config> -a <action>
-
-Mandatory parameters:
-  -a    action to perform
-
-Optional parameters:";
-  -c    full path to C configuration file (opensrf_core.xml)
-  -d    store PID files in this directory
-  -l    accept 'localhost' as the fully-qualified domain name
-
-Actions include:
-    stop_all
-    start_all
-    restart_all
-
-Examples:
-  $0 -a restart_all
-  $0 -l -c opensrf_core.xml -a restart_all
-
-EOF
-}
-
-# ---------------------------------------------------------------------------
-# Load the command line options and set the global vars
-# ---------------------------------------------------------------------------
-while getopts  "a:d:c:s:k:lh" flag; do
-	case $flag in	
-		"a")		OPT_ACTION="$OPTARG";;
-		"c")		OPT_CONFIG="$OPTARG";;
-		"d")		OPT_PID_DIR="$OPTARG";;
-		"l")		export OSRF_HOSTNAME="localhost";;
-		"h"|*)	usage;;
-	esac;
-done
-
-OSRF_CONFIG="@bindir@/osrf_config"
-[ ! -f "$OSRF_CONFIG" ] && OSRF_CONFIG=`which osrf_config`
-
-[ -z "$OPT_CONFIG" ] && OPT_CONFIG=`$OSRF_CONFIG --sysconfdir`/opensrf_core.xml;
-if [ ! -r "$OPT_CONFIG" ]; then
-	echo "Please specify the location of the opensrf_core.xml file using the -c flag";
-	exit 1;
-fi;
-[ -z "$OPT_PID_DIR" ] && OPT_PID_DIR=`$OSRF_CONFIG --localstatedir`/run/opensrf;
-[ -z "$OPT_ACTION" ] && usage;
-
-
-start_all() {
-    opensrf-perl.pl --pid-dir $OPT_PID_DIR \
-        --config $OPT_CONFIG --start-all --settings-startup-pause 3
-}
-
-stop_all() {
-    opensrf-perl.pl --pid-dir $OPT_PID_DIR --config $OPT_CONFIG --stop-all
-}
-
-# ---------------------------------------------------------------------------
-# Do the requested action
-# ---------------------------------------------------------------------------
-echo "$0 is deprecated.  Use osrf_control instead"
-
-case $OPT_ACTION in
-	"stop_all") stop_all;;
-	"start_all") start_all;;
-	"restart_all") stop_all; start_all;;
-	*) usage;;
-esac;
-
-
diff --git a/configure.ac b/configure.ac
index 289c356..dd5d3a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -375,8 +375,7 @@ if test "x$OSRF_INSTALL_CORE" = "xtrue"; then
 			 src/srfsh/Makefile
              tests/Makefile
 			 bin/opensrf-perl.pl
-			 bin/osrf_config
-			 bin/osrf_ctl.sh])
+			 bin/osrf_config])
 fi
 
 AC_OUTPUT
diff --git a/src/Makefile.am b/src/Makefile.am
index 846eeb9..282f577 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -46,7 +46,7 @@ dist_bin_SCRIPTS = @top_srcdir@/bin/opensrf-perl.pl @top_srcdir@/src/python/open
 else
 dist_bin_SCRIPTS = @top_srcdir@/bin/opensrf-perl.pl
 endif
-bin_SCRIPTS = @top_srcdir@/bin/osrf_config @top_srcdir@/bin/osrf_ctl.sh 
+bin_SCRIPTS = @top_srcdir@/bin/osrf_config
 dist_sysconf_DATA = @top_srcdir@/examples/opensrf.xml.example @top_srcdir@/examples/opensrf_core.xml.example @top_srcdir@/examples/srfsh.xml.example 
 endif
 

commit 8fb4405a2768dd752743dab71d6e2e8a50ee6cd5
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Wed Apr 2 15:24:06 2014 -0700

    LP#1285915: document that perl2JSON doesn't order hash keys
    
    This patch documents that JSON strings returned by
    OpenSRF::Utils::JSON->perl2JSON() should not be expected to have
    hash keys sorted in any particular order.  It also adjusts a
    corresponding test case to consistently pass under Perl 5.18, which
    introduces hash order randomization.
    
    Forcing JSON output to be in canonical form is another option, and
    easily done by JSON::XS, but would add overhead.
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>
    Signed-off-by: Bill Erickson <berick at esilibrary.com>

diff --git a/src/perl/lib/OpenSRF/Utils/JSON.pm b/src/perl/lib/OpenSRF/Utils/JSON.pm
index a83e9d1..6411870 100644
--- a/src/perl/lib/OpenSRF/Utils/JSON.pm
+++ b/src/perl/lib/OpenSRF/Utils/JSON.pm
@@ -80,7 +80,8 @@ sub JSON2perl {
 =head2 perl2JSON
 
 Given a Perl object, returns a JSON stringified representation of that
-object.
+object.  Callers should not expect that the JSON string has hash keys
+sorted in any particular order.
 
 =cut
 
diff --git a/src/perl/t/09-Utils-JSON.t b/src/perl/t/09-Utils-JSON.t
index ce94012..ff5d580 100644
--- a/src/perl/t/09-Utils-JSON.t
+++ b/src/perl/t/09-Utils-JSON.t
@@ -109,7 +109,11 @@ is_deeply ($jsonobj, { __c => 'osrfException', __p => { foo => 'bar' } },
 #
 # perl2JSON
 my $jsonstr = OpenSRF::Utils::JSON->perl2JSON($fakeobj);
-is ($jsonstr, '{"__c":"osrfException","__p":{"foo":"bar"}}');
+ok (
+    ($jsonstr eq '{"__c":"osrfException","__p":{"foo":"bar"}}' ||
+     $jsonstr eq '{"__p":{"foo":"bar"},"__c":"osrfException"}'),
+    'JSON corresponds to Perl object (though hash key order by vary)'
+);
 
 
 #

commit 8a8b4cbbae62d3e927b24541f31fec93949b1752
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Wed Apr 2 16:05:33 2014 -0700

    LP#1234816: improve const-correctness of osrfCachePutString and osrfCachePutObject
    
    Since the cache key is not modified by osrfCachePutString and
    osrfCachePutObject, this patch changes the key parameter of those
    two functions from char* to const char*.  It also updates one
    caller osrfCachePutObject to not cast away const-ness.
    
    This patch has no functional impact, but enables future callers
    of osrfCachePut* to pass constant strings without having to
    cast away the const-ness.
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>
    Signed-off-by: Bill Erickson <berick at esilibrary.com>

diff --git a/include/opensrf/osrf_cache.h b/include/opensrf/osrf_cache.h
index 591b3a8..37e48ac 100644
--- a/include/opensrf/osrf_cache.h
+++ b/include/opensrf/osrf_cache.h
@@ -47,7 +47,7 @@ int osrfCacheInit( const char* serverStrings[], int size, time_t maxCacheSeconds
 	to cache up to 'maxCacheSeconds' as set by osrfCacheInit()
   @return 0 on success, -1 on error
   */
-int osrfCachePutObject( char* key, const jsonObject* obj, time_t seconds );
+int osrfCachePutObject( const char* key, const jsonObject* obj, time_t seconds );
 
 /**
   Puts a string into the cache
@@ -57,7 +57,7 @@ int osrfCachePutObject( char* key, const jsonObject* obj, time_t seconds );
 	to cache up to 'maxCacheSeconds' as set by osrfCacheInit()
   @return 0 on success, -1 on error
   */
-int osrfCachePutString( char* key, const char* value, time_t seconds);
+int osrfCachePutString( const char* key, const char* value, time_t seconds);
 
 /**
   Grabs an object from the cache.
diff --git a/src/gateway/osrf_http_translator.c b/src/gateway/osrf_http_translator.c
index cec0d4e..ab46db4 100644
--- a/src/gateway/osrf_http_translator.c
+++ b/src/gateway/osrf_http_translator.c
@@ -382,7 +382,7 @@ static void osrfHttpTranslatorCacheSession(osrfHttpTranslator* trans, const char
     jsonObjectSetKey(cacheObj, "ip", jsonNewObject(trans->remoteHost));
     jsonObjectSetKey(cacheObj, "jid", jsonNewObject(jid));
     jsonObjectSetKey(cacheObj, "service", jsonNewObject(trans->service));
-    osrfCachePutObject((char*) trans->thread, cacheObj, CACHE_TIME);
+    osrfCachePutObject(trans->thread, cacheObj, CACHE_TIME);
 }
 
 
diff --git a/src/libopensrf/osrf_cache.c b/src/libopensrf/osrf_cache.c
index c19354a..fc4d488 100644
--- a/src/libopensrf/osrf_cache.c
+++ b/src/libopensrf/osrf_cache.c
@@ -43,7 +43,7 @@ int osrfCacheInit( const char* serverStrings[], int size, time_t maxCacheSeconds
 	return 0;
 }
 
-int osrfCachePutObject( char* key, const jsonObject* obj, time_t seconds ) {
+int osrfCachePutObject( const char* key, const jsonObject* obj, time_t seconds ) {
 	if( !(key && obj) ) return -1;
 	char* s = jsonObjectToJSON( obj );
 	osrfLogInternal( OSRF_LOG_MARK, "osrfCachePut(): Putting object (key=%s): %s", key, s);
@@ -52,7 +52,7 @@ int osrfCachePutObject( char* key, const jsonObject* obj, time_t seconds ) {
 	return 0;
 }
 
-int osrfCachePutString( char* key, const char* value, time_t seconds ) {
+int osrfCachePutString( const char* key, const char* value, time_t seconds ) {
 	memcached_return rc;
 	if( !(key && value) ) return -1;
 	seconds = (seconds <= 0 || seconds > _osrfCacheMaxSeconds) ? _osrfCacheMaxSeconds : seconds;

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                         |    1 -
 bin/osrf_ctl.sh.in                 |  102 ------------------------------------
 configure.ac                       |    3 +-
 include/opensrf/osrf_cache.h       |    4 +-
 src/Makefile.am                    |    2 +-
 src/gateway/osrf_http_translator.c |    2 +-
 src/libopensrf/osrf_cache.c        |    4 +-
 src/perl/lib/OpenSRF/Utils/JSON.pm |    3 +-
 src/perl/t/09-Utils-JSON.t         |    6 ++-
 9 files changed, 14 insertions(+), 113 deletions(-)
 delete mode 100755 bin/osrf_ctl.sh.in


hooks/post-receive
-- 
OpenSRF


More information about the opensrf-commits mailing list