SHA256
1
0
forked from pool/pam_wrapper

Accepting request 579098 from devel:tools

- Update to version 1.0.5
  * Added support to build python2 and python3 module at the same time
  * Improved pam test directory creating
  * Fixed python 2.6 compatibilty
  * Fixed some build issues on FreeBSD
  * Fix build on OpenBSD
  * Fix a resource leak
- Removed pam_wrapper-1.0.3-build-python2-and-python3-modules.patch

OBS-URL: https://build.opensuse.org/request/show/579098
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/pam_wrapper?expand=0&rev=6
This commit is contained in:
Dominique Leuenberger 2018-02-23 14:29:49 +00:00 committed by Git OBS Bridge
commit 69b1c78803
5 changed files with 16 additions and 245 deletions

View File

@ -1,236 +0,0 @@
From 9beb9f9aaa223864128fd8222f0f92ba8ae697b7 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn@samba.org>
Date: Wed, 22 Nov 2017 15:27:44 +0100
Subject: [PATCH 1/2] cmake: Improve PAM_WRAPPER_LOACATION
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
---
src/CMakeLists.txt | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 713625b..76a87d6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -74,8 +74,4 @@ if (PYTHONLIBS_FOUND)
endif()
# This needs to be at the end
-if (POLICY CMP0026)
- cmake_policy(SET CMP0026 OLD)
-endif()
-get_target_property(PAM_WRAPPER_LOCATION pam_wrapper LOCATION)
-set(PAM_WRAPPER_LOCATION ${PAM_WRAPPER_LOCATION} PARENT_SCOPE)
+set(PAM_WRAPPER_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}pam_wrapper${CMAKE_SHARED_LIBRARY_SUFFIX}" PARENT_SCOPE)
--
2.16.1
From 5c36d4284918a3fcc1c58f29f01ca64c65a66fa7 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn@samba.org>
Date: Mon, 12 Feb 2018 12:01:22 +0100
Subject: [PATCH 2/2] cmake: Build python2 and python3 modules if possible
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
---
CMakeLists.txt | 5 -----
src/CMakeLists.txt | 4 +---
src/python/CMakeLists.txt | 15 ++-------------
src/python/python2/CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++
src/python/python3/CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++
tests/CMakeLists.txt | 29 ++++++++++++++++++++++-------
tests/pypamtest_test.py | 5 ++++-
7 files changed, 95 insertions(+), 29 deletions(-)
create mode 100644 src/python/python2/CMakeLists.txt
create mode 100644 src/python/python3/CMakeLists.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f03a137..af00610 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,11 +46,6 @@ macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out of source buil
set(CMAKE_THREAD_PREFER_PTHREADS ON)
find_package(Threads)
-find_package(PythonInterp)
-set(Python_ADDITIONAL_VERSIONS 2.6 2.7 3.3 3.4 3.6)
-find_package(PythonLibs)
-find_package(PythonSiteLibs)
-
# config.h checks
include(ConfigureChecks.cmake)
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 76a87d6..e3a1efd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -69,9 +69,7 @@ install(TARGETS pamtest
ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
add_subdirectory(modules)
-if (PYTHONLIBS_FOUND)
- add_subdirectory(python)
-endif()
+add_subdirectory(python)
# This needs to be at the end
set(PAM_WRAPPER_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}pam_wrapper${CMAKE_SHARED_LIBRARY_SUFFIX}" PARENT_SCOPE)
diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt
index cbee2a6..3394a84 100644
--- a/src/python/CMakeLists.txt
+++ b/src/python/CMakeLists.txt
@@ -1,15 +1,4 @@
project(pypamtest C)
-include_directories(${CMAKE_BINARY_DIR})
-include_directories(${pam_wrapper-headers_DIR})
-include_directories(${PYTHON_INCLUDE_DIR})
-
-python_add_module(pypamtest pypamtest.c)
-target_link_libraries(pypamtest pamtest ${PYTHON_LIBRARY})
-
-install(
- TARGETS
- pypamtest
- DESTINATION
- ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB}
-)
+add_subdirectory(python2)
+add_subdirectory(python3)
diff --git a/src/python/python2/CMakeLists.txt b/src/python/python2/CMakeLists.txt
new file mode 100644
index 0000000..faceec3
--- /dev/null
+++ b/src/python/python2/CMakeLists.txt
@@ -0,0 +1,33 @@
+project(python2-pamtest C)
+
+unset(PYTHON_EXECUTABLE CACHE)
+unset(PYTHON_INCLUDE_DIR CACHE)
+unset(PYTHON_LIBRARY CACHE)
+unset(PYTHON_SITELIB CACHE)
+unset(PYTHONLIBS_FOUND CACHE)
+unset(PYTHONLIBS_VERSION_STRING CACHE)
+
+set(Python_ADDITIONAL_VERSIONS 2.7 2.6)
+find_package(PythonLibs)
+find_package(PythonInterp)
+find_package(PythonSiteLibs)
+
+if (PYTHONLIBS_FOUND)
+ set(PYTHON2_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "PYTHON2_EXECUTABLE")
+ set(PYTHON2_INCLUDE_DIR ${PYTHON_INCLUDE_DIR})
+ set(PYTHON2_LIBRARY ${PYTHON_LIBRARY})
+ set(PYTHON2_SITELIB ${PYTHON_SITELIB})
+
+ include_directories(${CMAKE_BINARY_DIR})
+ include_directories(${pam_wrapper-headers_DIR})
+ include_directories(${PYTHON2_INCLUDE_DIR})
+
+ python_add_module(python2-pamtest ${pypamtest_SOURCE_DIR}/pypamtest.c)
+ target_link_libraries(python2-pamtest pamtest ${PYTHON2_LIBRARY})
+ set_target_properties(python2-pamtest PROPERTIES OUTPUT_NAME "pypamtest")
+
+ install(TARGETS
+ python2-pamtest
+ DESTINATION
+ ${CMAKE_INSTALL_PREFIX}/${PYTHON2_SITELIB})
+endif()
diff --git a/src/python/python3/CMakeLists.txt b/src/python/python3/CMakeLists.txt
new file mode 100644
index 0000000..1e1599b
--- /dev/null
+++ b/src/python/python3/CMakeLists.txt
@@ -0,0 +1,33 @@
+project(python3-pamtest C)
+
+unset(PYTHON_EXECUTABLE CACHE)
+unset(PYTHON_INCLUDE_DIR CACHE)
+unset(PYTHON_LIBRARY CACHE)
+unset(PYTHON_SITELIB CACHE)
+unset(PYTHONLIBS_FOUND CACHE)
+unset(PYTHONLIBS_VERSION_STRING CACHE)
+
+set(Python_ADDITIONAL_VERSIONS 3.8 3.7 3.6)
+find_package(PythonLibs)
+find_package(PythonInterp)
+find_package(PythonSiteLibs)
+
+if (PYTHONLIBS_FOUND)
+ set(PYTHON3_LIBRARY ${PYTHON_LIBRARY})
+ set(PYTHON3_INCLUDE_DIR ${PYTHON_INCLUDE_DIR})
+ set(PYTHON3_SITELIB ${PYTHON_SITELIB})
+ set(PYTHON3_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "PYTHON3_EXECUTABLE")
+
+ include_directories(${CMAKE_BINARY_DIR})
+ include_directories(${pam_wrapper-headers_DIR})
+ include_directories(${PYTHON3_INCLUDE_DIR})
+
+ python_add_module(python3-pamtest ${pypamtest_SOURCE_DIR}/pypamtest.c)
+ target_link_libraries(python3-pamtest pamtest ${PYTHON3_LIBRARY})
+ set_target_properties(python3-pamtest PROPERTIES OUTPUT_NAME "pypamtest")
+
+ install(TARGETS
+ python3-pamtest
+ DESTINATION
+ ${CMAKE_INSTALL_PREFIX}/${PYTHON3_SITELIB})
+endif()
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 30f0eb2..997c15e 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -47,11 +47,26 @@ set_property(
PROPERTY
ENVIRONMENT ${TEST_ENVIRONMENT})
-if (PYTHONLIBS_FOUND)
- add_test(pypamtest_test ${CMAKE_CURRENT_SOURCE_DIR}/pypamtest_test.py)
- set_property(
- TEST
- pypamtest_test
- PROPERTY
- ENVIRONMENT ${TEST_ENVIRONMENT})
+if (PYTHON2_EXECUTABLE)
+ add_test(NAME
+ py2pamtest_test
+ COMMAND
+ ${PYTHON2_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pypamtest_test.py)
+
+ set_property(TEST
+ py2pamtest_test
+ PROPERTY
+ ENVIRONMENT ${TEST_ENVIRONMENT})
+endif()
+
+if (PYTHON3_EXECUTABLE)
+ add_test(NAME
+ py3pamtest_test
+ COMMAND
+ ${PYTHON3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pypamtest_test.py)
+
+ set_property(TEST
+ py3pamtest_test
+ PROPERTY
+ ENVIRONMENT ${TEST_ENVIRONMENT})
endif()
diff --git a/tests/pypamtest_test.py b/tests/pypamtest_test.py
index 2c74c0b..32ef65d 100755
--- a/tests/pypamtest_test.py
+++ b/tests/pypamtest_test.py
@@ -16,7 +16,10 @@ class PyPamTestCase(unittest.TestCase):
class PyPamTestImport(unittest.TestCase):
def setUp(self):
" Make sure we load the in-tree module "
- self.modpath = os.path.join(os.getcwd(), "../src/python")
+ if sys.hexversion >= 0x3000000:
+ self.modpath = os.path.join(os.getcwd(), "../src/python/python3")
+ else:
+ self.modpath = os.path.join(os.getcwd(), "../src/python/python2")
self.system_path = sys.path[:]
sys.path = [ self.modpath ]
--
2.16.1

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:69f2bbddfa60bbc319392613e11220af22165897df0e98fba0413a597154b4bd
size 85419

3
pam_wrapper-1.0.5.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bcd9342b5f462b297359275762b8f1145068fc834887543699b617948dbbff26
size 88089

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Thu Feb 22 15:56:44 UTC 2018 - asn@cryptomilk.org
- Update to version 1.0.5
* Added support to build python2 and python3 module at the same time
* Improved pam test directory creating
* Fixed python 2.6 compatibilty
* Fixed some build issues on FreeBSD
* Fix build on OpenBSD
* Fix a resource leak
- Removed pam_wrapper-1.0.3-build-python2-and-python3-modules.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Feb 12 11:56:57 UTC 2018 - asn@cryptomilk.org Mon Feb 12 11:56:57 UTC 2018 - asn@cryptomilk.org

View File

@ -24,7 +24,7 @@
############################# NOTE ################################## ############################# NOTE ##################################
Name: pam_wrapper Name: pam_wrapper
Version: 1.0.3 Version: 1.0.5
Release: 0 Release: 0
Summary: A tool to test PAM applications and PAM modules Summary: A tool to test PAM applications and PAM modules
@ -35,9 +35,6 @@ Url: http://cwrap.org/
Source0: https://ftp.samba.org/pub/cwrap/%{name}-%{version}.tar.gz Source0: https://ftp.samba.org/pub/cwrap/%{name}-%{version}.tar.gz
Source1: %{name}-rpmlintrc Source1: %{name}-rpmlintrc
# PATCH-FIX-UPSTREAM Build python2 and python3 modules if possible
Patch0: pam_wrapper-1.0.3-build-python2-and-python3-modules.patch
BuildRequires: cmake BuildRequires: cmake
BuildRequires: doxygen BuildRequires: doxygen
BuildRequires: libcmocka-devel BuildRequires: libcmocka-devel
@ -119,8 +116,6 @@ the header files for libpamtest
%prep %prep
%setup -q %setup -q
%patch0 -p1
%build %build
%cmake \ %cmake \
-DUNIT_TESTING=ON -DUNIT_TESTING=ON