Author: challngr
Date: Fri May  8 15:18:01 2015
New Revision: 1678377

URL: http://svn.apache.org/r1678377
Log:
UIMA-4358 Install ducc_ling in architecture-dependent location.

Added:
    uima/sandbox/uima-ducc/trunk/src/main/admin/build_duccling   (with props)
    
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/OsArch.java
Modified:
    uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install
    uima/sandbox/uima-ducc/trunk/src/main/resources/default.ducc.properties

Added: uima/sandbox/uima-ducc/trunk/src/main/admin/build_duccling
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/build_duccling?rev=1678377&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/admin/build_duccling (added)
+++ uima/sandbox/uima-ducc/trunk/src/main/admin/build_duccling Fri May  8 
15:18:01 2015
@@ -0,0 +1,92 @@
+#!/usr/bin/env python
+# -----------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# -----------------------------------------------------------------------
+
+import os
+import sys
+import glob
+import shutil
+import subprocess
+
+# simple bootstratp to establish DUCC_HOME and to set the python path so it can
+# find the common code in DUCC_HOME/admin
+# Infer DUCC_HOME from our location - no longer use a (possibly inaccurate) 
environment variable
+me = os.path.abspath(__file__)    
+ndx = me.rindex('/')
+ndx = me.rindex('/', 0, ndx)
+DUCC_HOME = me[:ndx]          # split from 0 to ndx
+    
+sys.path.append(DUCC_HOME + '/bin')
+from ducc_base import DuccBase
+from properties import Properties
+
+
+def main():
+
+    props = Properties()
+    props.load('../resources/ducc.properties')
+    java = props.get('ducc.jvm')
+    print 'Using', java
+    
+    fn = '../lib/uima-ducc/uima-ducc-common*.jar'
+    common_jar = glob.glob(fn)
+
+    osarch = 'org.apache.uima.ducc.common.utils.OsArch'
+
+    CMD = ' '.join([java, '-cp', common_jar[0], osarch])
+    print CMD
+
+    proc = subprocess.Popen(CMD, shell=True, bufsize=0, 
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+    lines = []
+    for  line in proc.stdout:
+        lines.append(line.strip())
+        proc.wait()
+        rc = proc.returncode
+
+    if ( rc != 0 ):
+        print 'build_duccling: Cannot find java property os.arch. The 
following command failed:'
+        print CMD
+        sys.exit(1)
+
+    arch = lines[0]
+    print 'Os Architecture:', arch
+
+    if ( not os.path.exists(arch) ):
+        os.mkdir(arch)
+
+    here = os.getcwd()
+    os.chdir("../duccling/src")
+    rc = os.system("make clean all")
+    if ( rc != 0 ):
+        print 'Cannot run "make" in ../duccling/src.  Insure you have a C 
compiler on this system.'
+        sys.exit(1)
+    os.chdir(here)
+
+    shutil.copyfile("../duccling/src/ducc_ling",  arch + '/ducc_ling')
+    os.chmod(arch + '/ducc_ling', 0755)
+
+    CMD = ' '.join([arch + '/ducc_ling', '-v'])
+    rc = os.system(CMD)
+    if ( rc != 0 ):
+        print 'Could not run', arch +'ducc_ling -v'
+
+    print 'ducc_ling is installed for architecture', arch + '. See the 
installation guide for multi-user setup.'
+
+
+main()

Propchange: uima/sandbox/uima-ducc/trunk/src/main/admin/build_duccling
------------------------------------------------------------------------------
    svn:executable = *

Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install?rev=1678377&r1=1678376&r2=1678377&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install Fri May  8 
15:18:01 2015
@@ -385,23 +385,20 @@ class PostInstall():
             os.symlink(duccbook, ws_duccbook)
         print '\nDUCC book installed into webserver root\n'
 
-        # Make duccling
-        here = os.getcwd()
-        os.chdir("../duccling/src")
-        os.system("make clean all")
-        os.chdir(here)
-        shutil.copyfile("../duccling/src/ducc_ling", self.DUCC_HOME + 
"/admin/ducc_ling")
-        os.chmod(self.DUCC_HOME + '/admin/ducc_ling', 0755)
-        print 'Initial ducc_ling is installed.  See the installation guide for 
multi-user setup.'
-
+        # set up the local properties, required to build ducc_ling
         self.ducc_private_properties.write(keystore_properties_name)
         self.ducc_site_properties.write(self.site_properties_name)
         self.merge_properties()
-        #amqhome = self.ducc_head
-        #os.chdir(amqhome + '/bin')
-        # os.system("sed -i.bak 's/\r//' activemq")
 
-        os.chdir(here)
+        # Make duccling
+        rc = os.system('build_duccling')
+        if ( rc != 0 ):
+            print 'Could not build ducc_ling.  Run the command'
+            print '   build_duccling'
+            print 'to complete the installation (it must run without error).'
+            sys.exit(1)
+
+        print 'Initial DUCC setup complete.'
 
 if __name__ == "__main__":
 

Modified: 
uima/sandbox/uima-ducc/trunk/src/main/resources/default.ducc.properties
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/resources/default.ducc.properties?rev=1678377&r1=1678376&r2=1678377&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/resources/default.ducc.properties 
(original)
+++ uima/sandbox/uima-ducc/trunk/src/main/resources/default.ducc.properties Fri 
May  8 15:18:01 2015
@@ -425,7 +425,7 @@ ducc.agent.launcher.thread.pool.size=10
 # ducc.agent.launcher.use.ducc_spawn: true, use ducc_ling. Default: false
 ducc.agent.launcher.use.ducc_spawn=true
 # specify location of ducc_ling in the filesystem
-ducc.agent.launcher.ducc_spawn_path=${DUCC_HOME}/admin/ducc_ling
+ducc.agent.launcher.ducc_spawn_path=${DUCC_HOME}/admin/${os.arch}/ducc_ling
 # Max amount of time (in millis) agent allows the process to stop before 
issuing kill -9
 ducc.agent.launcher.process.stop.timeout=60000
 # Max time in millis allowed for AE initialization. Default 2 hours 7200000.   
                                                              

Added: 
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/OsArch.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/OsArch.java?rev=1678377&view=auto
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/OsArch.java
 (added)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/OsArch.java
 Fri May  8 15:18:01 2015
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.common.utils;
+
+/**
+ * For setting up ducc_ling, find curren't java's opinion of the os 
architecture.
+ */
+public class OsArch
+{
+    public static void main(String[] args)
+    {
+        System.out.println(System.getProperty("os.arch"));
+    }
+}


Reply via email to