- Update to 18.2.7

- Fix build with python3
- Add better way to fix linking with jansson library
This commit is contained in:
Jose Alonso Cardenas Marquez 2019-12-29 20:35:44 +00:00
parent d71653bc5e
commit 8e075f556b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=521424
12 changed files with 301 additions and 49 deletions

View File

@ -2,8 +2,8 @@
PORTNAME= bareos
DISTVERSIONPREFIX= Release/
DISTVERSION= 18.2.6
PORTREVISION?= 1
DISTVERSION= 18.2.7
PORTREVISION?= 0
CATEGORIES?= sysutils
PKGNAMEPREFIX?= #
PKGNAMESUFFIX?= -server
@ -33,7 +33,7 @@ SHEBANG_LANG= perl
SHEBANG_FILES= ${WRKSRC}/core/src/cats/make_catalog_backup.pl.in
CPPFLAGS+= -I${LOCALBASE}/readline -I${LOCALBASE}/include
LDFLAGS+= -L${LOCALBASE}/lib -ljansson
LDFLAGS+= -L${LOCALBASE}/lib
OPTIONS_DEFAULT= OPENSSL
OPTIONS_SINGLE= CRYPTO
@ -66,7 +66,7 @@ SCSICRYPTO_CMAKE_ON= -Dscsi-crypto=ON
SCSICRYPTO_CMAKE_OFF= -Dscsi-crypto=OFF
.if ${PKGNAMESUFFIX} == "-client" || ${PKGNAMESUFFIX} == "-server" #Till end of the file
PYTHON_USES= python:2.7
PYTHON_USES= python
PYTHON_CMAKE_ON= -Dpython=ON
PYTHON_CMAKE_OFF= -Dpython=OFF
PYTHON_PLUGIN= yes
@ -192,7 +192,7 @@ MP1+= bsmtp.1 bregex.1 bwild.1 bareos-tray-monitor.1
MAKE_ENV+= MAN8="${MP8}" MAN1="${MP1}"
post-patch:
@${REINPLACE_CMD} '21d' ${WRKSRC}/CMakeLists.txt
@${REINPLACE_CMD} '42d' ${WRKSRC}/CMakeLists.txt
.if ${PKGNAMESUFFIX} == "-server"
@${REINPLACE_CMD} '25d' ${WRKSRC}/core/src/plugins/CMakeLists.txt
.endif

View File

@ -1,3 +1,3 @@
TIMESTAMP = 1556169589
SHA256 (bareos-bareos-Release-18.2.6_GH0.tar.gz) = 43ff0546d4d5486bc70db90ccb7fb1f6a3ac3f9b7293de010d2c300b548056d8
SIZE (bareos-bareos-Release-18.2.6_GH0.tar.gz) = 9991951
TIMESTAMP = 1576174612
SHA256 (bareos-bareos-Release-18.2.7_GH0.tar.gz) = 08fea6e9505188a5e585f90448d6f30befeff2fafc2c494a68e2b571c7c6637f
SIZE (bareos-bareos-Release-18.2.7_GH0.tar.gz) = 10552298

View File

@ -1,6 +1,6 @@
--- core/CMakeLists.txt 2019-02-13 09:25:55.000000000 -0500
+++ core/CMakeLists.txt 2019-05-10 14:14:16.122670000 -0500
@@ -116,7 +116,9 @@
--- core/CMakeLists.txt 2019-12-12 12:04:14.000000000 -0500
+++ core/CMakeLists.txt 2019-12-28 16:17:19.843397000 -0500
@@ -117,7 +117,9 @@
set(PSCMD "ps -ax -o pid,command")
include_directories(/usr/local/include)
link_directories(/usr/local/lib)
@ -11,7 +11,7 @@
endif()
IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
@@ -173,7 +175,9 @@
@@ -176,7 +178,9 @@
add_definitions("-D_FILE_OFFSET_BITS=64")
endif()
@ -22,7 +22,7 @@
IF(developer)
add_definitions("-DDEVELOPER=1")
@@ -576,7 +580,6 @@
@@ -586,7 +590,6 @@
add_subdirectory(scripts)
add_subdirectory(manpages)

View File

@ -9,8 +9,8 @@
- find_package(PythonInterp)
- INCLUDE(FindPythonLibs)
+ if (python)
+ # make sure we get python 2 not 3
+ set(Python_ADDITIONAL_VERSIONS 2.5 2.6 2.7 2.8 2.9)
+ # make sure we get python 2 or 3
+ set(Python_ADDITIONAL_VERSIONS 3.5 3.6 3.7 3.8 2.7)
+ find_package(PythonInterp)
+ INCLUDE(FindPythonLibs)

View File

@ -1,12 +1,12 @@
--- core/scripts/CMakeLists.txt 2019-05-08 19:49:45.595270000 -0500
+++ core/scripts/CMakeLists.txt 2019-05-08 19:51:39.443730000 -0500
@@ -17,28 +17,29 @@
--- core/scripts/CMakeLists.txt 2019-12-12 12:04:14.000000000 -0500
+++ core/scripts/CMakeLists.txt 2019-12-28 16:23:36.207715000 -0500
@@ -17,36 +17,37 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
+IF(client-only)
+ INSTALL(FILES
+ btraceback
+ bareos btraceback
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
+ GROUP_READ GROUP_EXECUTE
+ WORLD_READ WORLD_EXECUTE
@ -19,18 +19,33 @@
- WORLD_READ WORLD_EXECUTE
- DESTINATION "${sbindir}")
+ INSTALL(FILES
+ bareos-ctl-fd
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
+ GROUP_READ GROUP_EXECUTE
+ WORLD_READ WORLD_EXECUTE
+ DESTINATION "${scriptdir}"
+ COMPONENT filedaemon)
-INSTALL(FILES
- bareos-ctl-fd
- PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
- GROUP_READ GROUP_EXECUTE
- WORLD_READ WORLD_EXECUTE
- DESTINATION "${scriptdir}"
- COMPONENT filedaemon)
+ INSTALL(FILES
+ bareos
+ btraceback.gdb
+ btraceback.dbx
+ btraceback.mdb
+ bareos-config
+ bareos-config-lib.sh
+ bareos-ctl-fd
+ bareos-ctl-funcs
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
+ GROUP_READ GROUP_EXECUTE
+ WORLD_READ WORLD_EXECUTE
+ DESTINATION "${scriptdir}")
+ DESTINATION "${scriptdir}"
+ )
+ENDIF()
-INSTALL(FILES
@ -40,17 +55,17 @@
- btraceback.mdb
- bareos-config
- bareos-config-lib.sh
- bareos-ctl-fd
- bareos-ctl-funcs
- PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
- GROUP_READ GROUP_EXECUTE
- WORLD_READ WORLD_EXECUTE
- DESTINATION "${scriptdir}")
- DESTINATION "${scriptdir}"
- )
-
IF(NOT client-only)
INSTALL(FILES
mtx-changer
@@ -47,7 +48,6 @@
@@ -55,7 +56,6 @@
bareos-glusterfind-wrapper
bareos-ctl-dir
bareos-ctl-sd

View File

@ -0,0 +1,61 @@
--- core/src/plugins/dird/python-dir.cc 2019-12-12 12:04:14.000000000 -0500
+++ core/src/plugins/dird/python-dir.cc 2019-12-29 00:20:30.334502000 -0500
@@ -35,6 +35,13 @@
#error "Need at least Python version 2.6 or newer"
#endif
+#if (PY_VERSION_HEX > 0x03050000)
+#define PyInt_AsLong PyLong_AsLong
+#define PyInt_FromLong PyLong_FromLong
+#define PyString_AsString PyUnicode_AsUTF8
+#define PyString_FromString PyUnicode_FromString
+#endif
+
#include "python-dir.h"
#include "lib/edit.h"
@@ -118,6 +125,20 @@
*/
static PyThreadState *mainThreadState;
+#if (PY_VERSION_HEX > 0x03050000)
+static struct PyModuleDef BareosDIRModuleDef = {
+ PyModuleDef_HEAD_INIT,
+ "bareosdir",
+ NULL,
+ -1,
+ BareosDIRMethods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -679,7 +700,11 @@
/*
* Make our callback methods available for Python.
*/
+#if (PY_VERSION_HEX > 0x03050000)
+ p_ctx->pInstance = PyModule_Create(&BareosDIRModuleDef);
+#else
p_ctx->pInstance = Py_InitModule("bareosdir", BareosDIRMethods);
+#endif
}
/*
@@ -959,7 +984,11 @@
char *value;
ctx = PyGetbpContext(pyCtx);
+#if (PY_VERSION_HEX > 0x03050000)
+ value = bstrdup(PyString_AsString(pyValue));
+#else
value = PyString_AsString(pyValue);
+#endif
if (value) {
retval = bfuncs->setBareosValue(ctx, (bwDirVariable)var, value);
}

View File

@ -1,7 +1,7 @@
--- core/src/plugins/filed/CMakeLists.txt 2019-05-10 13:49:40.521620000 -0500
+++ core/src/plugins/filed/CMakeLists.txt 2019-05-10 13:50:25.954964000 -0500
@@ -99,18 +99,18 @@
INSTALL(TARGETS test-plugin-fd DESTINATION ${plugindir})
--- core/src/plugins/filed/CMakeLists.txt 2019-12-12 12:04:14.000000000 -0500
+++ core/src/plugins/filed/CMakeLists.txt 2019-12-28 16:26:47.855833000 -0500
@@ -100,18 +100,18 @@
INSTALL(TARGETS test-plugin-fd DESTINATION ${plugindir} COMPONENT filedaemon)
endif()
-set (PYFILES
@ -16,20 +16,20 @@
- BareosFdPluginLDAP.py
- )
+if (python)
+ set (PYFILES
+ bareos-fd.py.template
+ bareos-fd-local-fileset.py
+ bareos-fd-mock-test.py
+ BareosFdPluginBaseclass.py
+ BareosFdPluginLocalFileset.py
+ BareosFdWrapper.py
+ bareos_fd_consts.py
+ bareos-fd-ldap.py
+ BareosFdPluginLDAP.py
+ )
+ set (PYFILES
+ bareos-fd.py.template
+ bareos-fd-local-fileset.py
+ bareos-fd-mock-test.py
+ BareosFdPluginBaseclass.py
+ BareosFdPluginLocalFileset.py
+ BareosFdWrapper.py
+ bareos_fd_consts.py
+ bareos-fd-ldap.py
+ BareosFdPluginLDAP.py
+ )
-INSTALL(FILES ${PYFILES} DESTINATION ${plugindir})
-INSTALL(FILES ${PYFILES} DESTINATION ${plugindir} COMPONENT filedaemon)
-
-
+ INSTALL(FILES ${PYFILES} DESTINATION ${plugindir})
+ INSTALL(FILES ${PYFILES} DESTINATION ${plugindir} COMPONENT filedaemon)
+endif()

View File

@ -0,0 +1,111 @@
--- core/src/plugins/filed/python-fd.cc 2019-12-12 12:04:14.000000000 -0500
+++ core/src/plugins/filed/python-fd.cc 2019-12-29 00:41:38.985785000 -0500
@@ -40,6 +40,14 @@
#error "Need at least Python version 2.6 or newer"
#endif
+#if (PY_VERSION_HEX > 0x03050000)
+#define PyInt_AsLong PyLong_AsLong
+#define PyInt_FromLong PyLong_FromLong
+#define PyString_AsString PyUnicode_AsUTF8
+#define PyString_FromString PyUnicode_FromString
+#define PyString_Check PyBytes_Check
+#endif
+
static const int debuglevel = 150;
#define PLUGIN_LICENSE "Bareos AGPLv3"
@@ -163,6 +171,20 @@
*/
static PyThreadState *mainThreadState;
+#if (PY_VERSION_HEX > 0x03050000)
+static struct PyModuleDef BareosFDModuleDef = {
+ PyModuleDef_HEAD_INIT,
+ "bareosfd",
+ NULL,
+ -1,
+ BareosFDMethods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -1226,7 +1248,11 @@
/*
* Make our callback methods available for Python.
*/
+#if (PY_VERSION_HEX > 0x03050000)
+ p_ctx->pInstance = PyModule_Create(&BareosFDModuleDef);
+#else
p_ctx->pInstance = Py_InitModule("bareosfd", BareosFDMethods);
+#endif
/*
* Fill in the slots of PyRestoreObject
@@ -2704,7 +2730,11 @@
case bVarFileSeen: {
char *value;
+#if (PY_VERSION_HEX > 0x03050000)
+ value = bstrdup(PyString_AsString(pyValue));
+#else
value = PyString_AsString(pyValue);
+#endif
if (value) {
retval = bfuncs->setBareosValue(ctx, (bVariable)var, value);
}
@@ -3091,7 +3121,11 @@
sp.type = pSavePkt->type;
if (pSavePkt->fname) {
if (PyString_Check(pSavePkt->fname)) {
+#if (PY_VERSION_HEX > 0x03050000)
+ sp.fname = bstrdup(PyString_AsString(pSavePkt->fname));
+#else
sp.fname = PyString_AsString(pSavePkt->fname);
+#endif
} else {
goto bail_out;
}
@@ -3100,7 +3134,11 @@
}
if (pSavePkt->link) {
if (PyString_Check(pSavePkt->link)) {
+#if (PY_VERSION_HEX > 0x03050000)
+ sp.link = bstrdup(PyString_AsString(pSavePkt->link));
+#else
sp.link = PyString_AsString(pSavePkt->link);
+#endif
} else {
goto bail_out;
}
@@ -3143,7 +3181,11 @@
*/
if (pSavePkt->fname) {
if (PyString_Check(pSavePkt->fname)) {
+#if (PY_VERSION_HEX > 0x03050000)
+ sp.fname = bstrdup(PyString_AsString(pSavePkt->fname));
+#else
sp.fname = PyString_AsString(pSavePkt->fname);
+#endif
} else {
goto bail_out;
}
@@ -3219,8 +3261,11 @@
if (!object || !PyString_Check(object)) {
return (char *)"";
}
-
+#if (PY_VERSION_HEX > 0x03050000)
+ return bstrdup(PyString_AsString(object));
+#else
return PyString_AsString(object);
+#endif
}
static inline char *PyGetByteArrayValue(PyObject *object)

View File

@ -0,0 +1,61 @@
--- core/src/plugins/stored/python-sd.cc 2019-12-12 12:04:14.000000000 -0500
+++ core/src/plugins/stored/python-sd.cc 2019-12-29 00:19:19.366390000 -0500
@@ -36,6 +36,13 @@
#error "Need at least Python version 2.6 or newer"
#endif
+#if (PY_VERSION_HEX > 0x03050000)
+#define PyInt_AsLong PyLong_AsLong
+#define PyInt_FromLong PyLong_FromLong
+#define PyString_AsString PyUnicode_AsUTF8
+#define PyString_FromString PyUnicode_FromString
+#endif
+
static const int debuglevel = 150;
#define PLUGIN_LICENSE "Bareos AGPLv3"
@@ -121,6 +128,20 @@
extern "C" {
#endif
+#if (PY_VERSION_HEX > 0x03050000)
+static struct PyModuleDef BareosSDModuleDef = {
+ PyModuleDef_HEAD_INIT,
+ "bareossd",
+ NULL,
+ -1,
+ BareosSDMethods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+#endif
+
/**
* loadPlugin() and unloadPlugin() are entry points that are
* exported, so Bareos can directly call these two entry points
@@ -698,7 +719,11 @@
/*
* Make our callback methods available for Python.
*/
+#if (PY_VERSION_HEX > 0x03050000)
+ p_ctx->pInstance = PyModule_Create(&BareosSDModuleDef);
+#else
p_ctx->pInstance = Py_InitModule("bareossd", BareosSDMethods);
+#endif
}
/*
@@ -979,7 +1004,11 @@
char *value;
ctx = PyGetbpContext(pyCtx);
+#if (PY_VERSION_HEX > 0x03050000)
+ value = bstrdup(PyString_AsString(pyValue));
+#else
value = PyString_AsString(pyValue);
+#endif
if (value) {
bfuncs->setBareosValue(ctx, (bsdwVariable)var, value);
}

View File

@ -1,6 +1,6 @@
--- core/src/stored/CMakeLists.txt 2019-02-13 09:25:55.000000000 -0500
+++ core/src/stored/CMakeLists.txt 2019-05-10 14:55:03.636098000 -0500
@@ -192,6 +192,8 @@
--- core/src/stored/CMakeLists.txt 2019-12-12 12:04:14.000000000 -0500
+++ core/src/stored/CMakeLists.txt 2019-12-28 17:19:55.461762000 -0500
@@ -193,6 +193,8 @@
target_link_libraries(bareos-sd
stored_objects
${BAREOS_SD_LIBRARIES}
@ -9,31 +9,34 @@
)
add_executable(bls ${BLSSRCS})
@@ -202,6 +204,7 @@
@@ -203,6 +205,8 @@
add_executable(bextract ${BEXTRACTSRS})
target_link_libraries(bextract
bareossd bareosfind bareos
+ ${JANSSON_LIBRARIES}
+ ${PTHREAD_LIBRARIES}
)
add_executable(bscan ${BSCANSRCS})
@@ -212,6 +215,7 @@
@@ -213,6 +217,8 @@
add_executable(btape ${BTAPESRCS})
target_link_libraries(btape
bareossd bareos
+ ${JANSSON_LIBRARIES}
+ ${PTHREAD_LIBRARIES}
)
add_executable(bcopy ${BCOPYSRCS})
@@ -219,6 +223,7 @@
@@ -220,6 +226,8 @@
target_link_libraries(bcopy
bareossd bareos
+ ${JANSSON_LIBRARIES}
+ ${PTHREAD_LIBRARIES}
)
INSTALL(TARGETS bareossd DESTINATION ${libdir})
@@ -231,7 +236,7 @@
@@ -232,7 +240,7 @@
install(CODE "set(SRC_DIR \"${PROJECT_SOURCE_DIR}\")")
install(SCRIPT ${PROJECT_SOURCE_DIR}/cmake/install-stored-configfiles.cmake)

View File

@ -41,6 +41,8 @@ man/man1/bconsole.1.gz
man/man8/bareos-fd.8.gz
man/man8/bareos.8.gz
@group bareos
sbin/bareos
@group bareos
sbin/bareos-fd
@group bareos
sbin/bconsole

View File

@ -1,7 +1,6 @@
# $FreeBSD$
PORTNAME= bareos
PORTREVISION= 1
PKGNAMESUFFIX= -traymonitor
COMMENT= Backup archiving recovery open sourced (traymonitor)