[CalendarServer-changes] [15725] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Jun 30 07:43:42 PDT 2016


Revision: 15725
          http://trac.calendarserver.org//changeset/15725
Author:   cdaboo at apple.com
Date:     2016-06-30 07:43:42 -0700 (Thu, 30 Jun 2016)
Log Message:
-----------
Allow newer macOS systems to use cx_Oracle when system integrity protection is enabled. Update instructions for using cx_Oracle.

Modified Paths:
--------------
    CalendarServer/trunk/bin/_build.sh
    CalendarServer/trunk/bin/caldavd
    CalendarServer/trunk/doc/OracleVM/ReadMe.md
    CalendarServer/trunk/setup.py

Removed Paths:
-------------
    CalendarServer/trunk/doc/OracleVM/oracle-on-mac.py

Modified: CalendarServer/trunk/bin/_build.sh
===================================================================
--- CalendarServer/trunk/bin/_build.sh	2016-06-29 20:33:20 UTC (rev 15724)
+++ CalendarServer/trunk/bin/_build.sh	2016-06-30 14:43:42 UTC (rev 15725)
@@ -720,6 +720,19 @@
 }
 
 
+macos_oracle () {
+  if [ "${ORACLE_HOME-}" ]; then
+    case "$(uname -s)" in
+      Darwin)
+        echo "macOS Oracle init."
+        export   LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-}:${ORACLE_HOME}";
+        export DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH:-}:${ORACLE_HOME}";
+        ;;
+    esac;
+  fi;
+}
+
+
 bootstrap_virtualenv () {
   mkdir -p "${py_ve_tools}";
   mkdir -p "${py_ve_tools}/lib";
@@ -801,6 +814,7 @@
   init_build;
   c_dependencies;
   py_dependencies;
+  macos_oracle;
 }
 
 

Modified: CalendarServer/trunk/bin/caldavd
===================================================================
--- CalendarServer/trunk/bin/caldavd	2016-06-29 20:33:20 UTC (rev 15724)
+++ CalendarServer/trunk/bin/caldavd	2016-06-30 14:43:42 UTC (rev 15725)
@@ -131,4 +131,14 @@
 
 export PYTHONPATH
 
+if [ "${ORACLE_HOME-}" ]; then
+  case "$(uname -s)" in
+    Darwin)
+      echo "macOS Oracle init."
+      export   LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-}:${ORACLE_HOME}";
+      export DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH:-}:${ORACLE_HOME}";
+      ;;
+  esac;
+fi;
+
 exec "${python}" "${twistdpath}" ${twistd_profile} ${twistd_reactor} ${daemonize} ${username} ${groupname} "${plugin_name}" ${configfile} ${service_type} ${errorlogenabled} ${profile} ${child_reactor} ${extra};

Modified: CalendarServer/trunk/doc/OracleVM/ReadMe.md
===================================================================
--- CalendarServer/trunk/doc/OracleVM/ReadMe.md	2016-06-29 20:33:20 UTC (rev 15724)
+++ CalendarServer/trunk/doc/OracleVM/ReadMe.md	2016-06-30 14:43:42 UTC (rev 15725)
@@ -2,9 +2,38 @@
 
 ## Setup
 
+### Oracle instantclient
+
+Download instantclient locally from "http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html"
+
+* instantclient-basic-macos.x64-11.2.0.4.0.zip
+* instantclient-sdk-macos.x64-11.2.0.4.0.zip
+
+Then run:
+
+	mkdir .oracle
+	cd .oracle
+	<<copy instantclient zips here>>
+	unzip instantclient-basic-macos.x64-11.2.0.4.0.zip
+	unzip instantclient-sdk-macos.x64-11.2.0.4.0.zip
+	ln -sf . lib
+	ln -sf libclntsh.dylib.11.1 libclntsh.dylib
+	cd ~
+	cat >> .bash_profile
+    function oracle_11 () {
+        export ORACLE_HOME="$HOME/.oracle/instantclient_11_2";
+    
+        # make sure we can find the client libraries
+        export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ORACLE_HOME";
+        export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$ORACLE_HOME";
+    }
+    ^D
+
+### Local Oracle Database
+If you want to run your own Oracle database rather than use an existing one:
+
 * Get VirtualBox
 * Install OTN\_Developer\_Day\_VM\_12c.otn
-* Install instantclient locally
 
 ## Run
 
@@ -16,13 +45,13 @@
 * In sqlplus: `@rebuild;`
 
 ### CS
-* Configure the DB:
+* Run the `oracle_11` alias to make sure paths are setup.
+* Rebuild the server with `bin/develop` to ensure the `cx_Oracle` module is built
+* Configure the DB in caldav-dev.plist:
 
     endpoint: tcp:192.168.56.101:1521
     database: orcl
     user: hr
     password: oracle
 
-* Paths: ensure that `~/.oracle/instantclient_xxx` is in `LD_LIBRARY_PATH`, `DYLD_LIBRARY_PATH`, and `ORACLE_HOME`
-
 * Run server

Deleted: CalendarServer/trunk/doc/OracleVM/oracle-on-mac.py
===================================================================
--- CalendarServer/trunk/doc/OracleVM/oracle-on-mac.py	2016-06-29 20:33:20 UTC (rev 15724)
+++ CalendarServer/trunk/doc/OracleVM/oracle-on-mac.py	2016-06-30 14:43:42 UTC (rev 15725)
@@ -1,84 +0,0 @@
-
-import webbrowser
-
-from pipes import quote as shellquote
-from textwrap import wrap, dedent
-from os.path import exists, expanduser, join as j
-from os import mkdir, symlink
-from errno import EEXIST, EISDIR
-from zipfile import ZipFile
-
-dlpage = "http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html"
-
-downloads = [
-    "instantclient-basic-macos.x64-11.2.0.4.0.zip",
-    "instantclient-sdk-macos.x64-11.2.0.4.0.zip",
-    "instantclient-sqlplus-macos.x64-11.2.0.4.0.zip",
-]
-
-ordir = expanduser("~/.oracle")
-
-
-
-def mkdirp(d):
-    try:
-        mkdir(d)
-    except OSError, ose:
-        if ose.errno not in (EEXIST, EISDIR):
-            pass
-mkdirp(ordir)
-
-
-
-def downloaded():
-    for download in downloads:
-        dl = j(expanduser("~/Downloads/OracleDB"), download)
-        if exists(dl):
-            ZipFile(dl).extractall(ordir)
-            continue
-        break
-    else:
-        return True
-    return False
-
-import fcntl
-import tty
-import struct
-th, tw, ign, ign = struct.unpack("4H", fcntl.ioctl(0, tty.TIOCGWINSZ, 'x' * 8))
-
-while not downloaded():
-    txt = "\n".join(wrap(" ".join("""
- Please sanctify the files, which I cannot automatically download, with your
- consent to abide by their respective license agreements via your web browser,
- then hit 'enter' to continue.  You need:
-        """.split()), tw)) + "\n\n" + "\n".join(downloads)
-    webbrowser.open(dlpage)
-    raw_input(txt)
-
-instantclient = j(ordir, "instantclient_11_2")
-
-# # Oracle is for Professional Software Engineers only.  Don't look for any namby-
-# # pamby "user interface" or "working installation process" here!
-for pdest in ["libclntsh.dylib.11.2", "libclntsh.dylib.11.1"]:
-    pdestfull = j(instantclient, pdest)
-    psrcfull = j(instantclient, "libclntsh.dylib")
-    if exists(pdestfull) and not exists(psrcfull):
-        symlink(pdestfull, psrcfull)
-        break
-
-ldestfull = j(instantclient, "lib")
-if not exists(ldestfull):
-    symlink(".", ldestfull)
-
-with open(expanduser("~/.bash_profile"), "a") as f:
-    f.write(dedent(
-        """
-        function oracle_11 () {
-            export ORACLE_HOME="$HOME/.oracle/instantclient_11_2";
-
-            # make sure we can find the client libraries
-            export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ORACLE_HOME";
-            export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$ORACLE_HOME";
-        }
-        """))
-

Modified: CalendarServer/trunk/setup.py
===================================================================
--- CalendarServer/trunk/setup.py	2016-06-29 20:33:20 UTC (rev 15724)
+++ CalendarServer/trunk/setup.py	2016-06-30 14:43:42 UTC (rev 15725)
@@ -368,7 +368,7 @@
 }
 
 if "ORACLE_HOME" in os.environ:
-    extras_requirements["Oracle"] = ["twextpy[Oracle]", "cx_Oracle"]
+    extras_requirements["Oracle"] = ["twextpy[Oracle]", "cx_Oracle==5.2"]
 
 
 #
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20160630/7649aab9/attachment-0001.html>


More information about the calendarserver-changes mailing list