Skip to content

Commit

Permalink
Merge branch 'release-0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsatula committed Jan 12, 2019
2 parents 0b38ab8 + 55ee01a commit bc3b779
Show file tree
Hide file tree
Showing 37 changed files with 971 additions and 300 deletions.
30 changes: 30 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
language: c
services:
- docker
env:
- ORACLE_HOME=$HOME/instantclient_18_3 LD_LIBRARY_PATH=$ORACLE_HOME PATH=$ORACLE_HOME:$PATH
addons:
apt:
update: true
packages:
- libpopt-dev
sudo: required
before_install:
- echo "$DOCKER_PASSWORD" | docker login --username $DOCKER_USERNAME --password-stdin
- docker run --detach
--privileged
--publish 127.0.0.1:1521:1521
--env ORACLE_PWD
maxsatula/agile:18.4.0-xe
- |
(cd $HOME
for t in basic sdk sqlplus tools
do
f=instantclient-${t}-linux.x64-18.3.0.0.0dbru.zip
wget https://github.com/bumpx/oracle-instantclient/raw/master/$f
unzip -q $f && rm $f
done)
- .travis/oracle/wait.sh
- .travis/oracle/customize.sh
before_script: autoreconf --install
script: ./configure --with-oci=y --with-oci-include=$ORACLE_HOME/sdk/include --with-oci-lib=$ORACLE_HOME && make && .travis/test.sh
36 changes: 36 additions & 0 deletions .travis/oracle/customize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh -e

sqlplus -L -S sys/$ORACLE_PWD@127.0.0.1:1521/XEPDB1 AS SYSDBA <<SQL
CREATE USER ocptest IDENTIFIED BY test;
GRANT CREATE SESSION,
CREATE TYPE,
CREATE PROCEDURE,
CREATE JOB
TO ocptest;
GRANT READ, WRITE
ON DIRECTORY data_pump_dir
TO ocptest;
GRANT EXECUTE
ON utl_file
TO ocptest;
GRANT SELECT
ON v_\$session
TO ocptest;
BEGIN
FOR d IN (SELECT directory_path
FROM dba_directories
WHERE directory_name = 'DATA_PUMP_DIR') LOOP
dbms_java.grant_permission( 'OCPTEST', 'SYS:java.io.FilePermission', d.directory_path, 'read' );
dbms_java.grant_permission( 'OCPTEST', 'SYS:java.io.FilePermission', d.directory_path || '/*', 'read' );
END LOOP;
END;
/
SQL

expdp system/$ORACLE_PWD@127.0.0.1:1521/XEPDB1 logfile=expdp_system.log dumpfile=somefile.dmp directory=data_pump_dir
11 changes: 11 additions & 0 deletions .travis/oracle/wait.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh -e

docker logs --follow $(docker ps -lq) &
tail_pid=$!

until docker logs $(docker ps -lq) | grep "#########################"
do
sleep 15
done

kill $tail_pid
12 changes: 12 additions & 0 deletions .travis/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh -e
PATH=$PATH:$PWD/src
CON=ocptest/test@localhost:1521/XEPDB1

ocp $CON --list-directories
ocp $CON DATA_PUMP_DIR:somefile.dmp localfile.dmp
ocp $CON -9 DATA_PUMP_DIR:somefile.dmp onthefly.dmp
ocp $CON -9 onthefly.dmp DATA_PUMP_DIR:
ocp $CON --gzip DATA_PUMP_DIR:somefile.dmp
ocp $CON --install
ocp $CON --ls DATA_PUMP_DIR
ocp $CON --rm DATA_PUMP_DIR:onthefly.dmp
63 changes: 1 addition & 62 deletions COPYING
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GNU GENERAL PUBLIC LICENSE
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991

Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
Expand Down Expand Up @@ -276,64 +276,3 @@ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

END OF TERMS AND CONDITIONS

How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

{description}
Copyright (C) {year} {fullname}

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.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:

Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.

{signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice

This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
14 changes: 14 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
2019-01-12 Max Satula <[email protected]>

* Allow connection as SYSASM, SYSBKP, SYSDGD, SYSKMT, and SYSRAC

2017-07-16 Max Satula <[email protected]>

* Add man page

2017-07-12 Max Satula <[email protected]>

* Fix crash in --ls when Oracle directory object points
to a nonexistent directory
* Do not print column names if no files found in --ls

2016-04-18 Max Satula <[email protected]>

* Fix compiler warnings
Expand Down
3 changes: 2 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = progressmeter yesno src
dist_noinst_SCRIPTS = updateforeigns.sh win/build.cmd
dist_noinst_DATA = m4/ax_lib_oracle_oci.m4.patch win/README.md
dist_noinst_DATA = README.md win/README.md
dist_noinst_HEADERS = win/include/config.h win/include/unistd.h
dist_man1_MANS = ocp.1
8 changes: 8 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
ocp 0.3

* added man page
* added --sysasm, --sysbkp, --sysdgd, --syskmt, and --sysrac options
to connect to Oracle with roles introduced in 12c

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

ocp 0.2

* added --sysdba and --sysoper options to connect to Oracle accordingly
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
ocp
===

[![Build Status](https://travis-ci.org/maxsatula/ocp.svg?branch=develop)](https://travis-ci.org/maxsatula/ocp)
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=P3D68AUUXLNQU&lc=US&item_number=github%2docp&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted)

`ocp` is a command line tool to download and upload files from/to Oracle Database directories (e.g. DATA_PUMP_DIR)
using Oracle SQL Net connection only. Hence no other kind of filesystem access required to a database server.

Expand Down
8 changes: 4 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.63])
AC_INIT([ocp],[0.2],[Max Satula <[email protected]>])
AC_INIT([ocp],[0.3],[Max Satula <[email protected]>])
AM_INIT_AUTOMAKE
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/ocp.h])
Expand All @@ -20,18 +20,18 @@ AC_SYS_LARGEFILE
# Checks for libraries.
AX_LIB_ORACLE_OCI
if test "x${HAVE_ORACLE_OCI}" = xno; then
AC_MSG_ERROR([----------------------------------------------
AC_MSG_ERROR([
----------------------------------------------
This software requires Oracle installation
1. Have you set \$ORACLE_HOME?
2. Check if Oracle Home 64/32-bit is OK
3. Check whether native compiler (not GCC)
is used for non-Linux platforms
----------------------------------------------)])
----------------------------------------------])
fi
AC_SUBST([ORACLE_OCI_CFLAGS])
AC_SUBST([ORACLE_OCI_LDFLAGS])

#AC_SEARCH_LIBS([OCIEnvCreate], [clntsh])
AC_SEARCH_LIBS([poptGetContext], [popt])
AC_SEARCH_LIBS([deflateInit2_], [z])
AC_SEARCH_LIBS([clock_gettime], [rt])
Expand Down
18 changes: 11 additions & 7 deletions m4/ax_lib_oracle_oci.m4
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# NOTE: These options described above do not take yes|no values. If 'yes'
# value is passed, then WARNING message will be displayed, 'no' value, as
# well as the --without-oci-* variations will cause the macro to not check
# enything.
# anything.
#
# This macro calls:
#
Expand All @@ -48,7 +48,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.

#serial 13
#serial 16

AC_DEFUN([AX_LIB_ORACLE_OCI],
[
Expand Down Expand Up @@ -156,8 +156,11 @@ Please, locate Oracle directories using --with-oci or \
dnl Depending on later Oracle version detection,
dnl -lnnz10 flag might be removed for older Oracle < 10.x
saved_LDFLAGS="$LDFLAGS"
oci_ldflags="-L$oracle_lib_dir -lclntsh"
saved_LIBS="$LIBS"
oci_ldflags="-L$oracle_lib_dir"
oci_libs="-lclntsh"
LDFLAGS="$LDFLAGS $oci_ldflags"
LIBS="$LIBS $oci_libs"
dnl
dnl Check OCI headers
Expand All @@ -170,11 +173,11 @@ Please, locate Oracle directories using --with-oci or \
[[
#if defined(OCI_MAJOR_VERSION)
#if OCI_MAJOR_VERSION == 10 && OCI_MINOR_VERSION == 2
// Oracle 10.2 detected
/* Oracle 10.2 detected */
#endif
#elif defined(OCI_V7_SYNTAX)
// OK, older Oracle detected
// TODO - mloskot: find better macro to check for older versions;
/* OK, older Oracle detected */
/* TODO - mloskot: find better macro to check for older versions; */
#else
# error Oracle oci.h header not found
#endif
Expand Down Expand Up @@ -214,7 +217,7 @@ if (envh) OCIHandleFree(envh, OCI_HTYPE_ENV);
]]
)],
[
ORACLE_OCI_LDFLAGS="$oci_ldflags"
ORACLE_OCI_LDFLAGS="$oci_ldflags $oci_libs"
oci_lib_found="yes"
AC_MSG_RESULT([yes])
],
Expand All @@ -228,6 +231,7 @@ if (envh) OCIHandleFree(envh, OCI_HTYPE_ENV);
CPPFLAGS="$saved_CPPFLAGS"
LDFLAGS="$saved_LDFLAGS"
LIBS="$saved_LIBS"
fi
dnl
Expand Down
38 changes: 0 additions & 38 deletions m4/ax_lib_oracle_oci.m4.patch

This file was deleted.

Loading

0 comments on commit bc3b779

Please sign in to comment.