diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..23845a6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/lasso-2.6.0.tar.gz diff --git a/.lasso.metadata b/.lasso.metadata new file mode 100644 index 0000000..2e170e3 --- /dev/null +++ b/.lasso.metadata @@ -0,0 +1 @@ +c48e1d6626e6563163146063cbf65ffef52bac1b SOURCES/lasso-2.6.0.tar.gz diff --git a/SOURCES/build-scripts-py3-compatible.patch b/SOURCES/build-scripts-py3-compatible.patch new file mode 100644 index 0000000..563ce43 --- /dev/null +++ b/SOURCES/build-scripts-py3-compatible.patch @@ -0,0 +1,255 @@ +commit d526669810e0dc0a454260d5081fc96e16fc9e13 +Author: John Dennis +Date: Mon Jun 25 16:26:24 2018 -0400 + + Make Python scripts compatible with both Py2 and Py3 + + During the build if the Python3 interpreter is used a number of + scripts will fail because they were never ported from Py2 to Py3. In + general we want Python code to be compatible with both Py2 and + Py3. This patch brings the scripts up to date with Py3 but retains + backwards compatibility with Py2 (specifically Py 2.7, the last Py2 + release). + + Examples of the required changes are: + + * Replace use of the built-in function file() with open(). file() + does not exist in Py3, open works in both Py2 and Py3. The code was + also modified to use a file context manager (e.g. with open(xxx) as + f:). This assures open files are properly closed when the code block + using the file goes out of scope. This is a standard modern Python + idiom. + + * Replace all use of the print keyword with the six.print_() + function, which itself is an emulation of Py3's print function. Py3 + no longer has a print keyword, only a print() function. + + * The dict methods .keys(), .values(), .items() no longer return a + list in Py3, instead they return a "view" object which is an + iterator whose result is an unordered set. The most notable + consequence is you cannot index the result of these functions like + your could in Py2 (e.g. dict.keys()[0] will raise a run time + exception). + + * Replace use of StringIO.StringIO and cStringIO with + six.StringIO. Py3 no longer has cStringIO and the six variant + handles the correct import. + + * Py3 no longer allows the "except xxx, variable" syntax, where + variable appering after the comma is assigned the exception object, + you must use the "as" keyword to perform the variable assignment + (e.g. execpt xxx as variable) + + Note: the modifications in this patch are the minimum necessary to get + the build to run with the Py3 interpreter. There are numerous other + Python scripts in the repo which need Py3 porting as well but because + they are not invoked during a build they will be updated in a + subsequent patch. + + License: MIT + Signed-off-by: John Dennis + +diff --git a/bindings/python/examples/get_attributes_from_assertion.py b/bindings/python/examples/get_attributes_from_assertion.py +index 44ceb9e5..8f37a337 100644 +--- a/bindings/python/examples/get_attributes_from_assertion.py ++++ b/bindings/python/examples/get_attributes_from_assertion.py +@@ -1,8 +1,10 @@ + # Example SP Python code to get attributes from an assertion + ++from six import print_ ++ + for attribute in assertion.attributeStatement[0].attribute: + if attribute.name == lasso.SAML2_ATTRIBUTE_NAME_EPR: + continue +- print 'attribute : ' + attribute.name ++ print_('attribute : ' + attribute.name) + for value in attribute.attributeValue: +- print ' value : ' + value.any[0].content ++ print_(' value : ' + value.any[0].content) +diff --git a/bindings/python/tests/binding_tests.py b/bindings/python/tests/binding_tests.py +index 6d8e0dfa..54c3635f 100755 +--- a/bindings/python/tests/binding_tests.py ++++ b/bindings/python/tests/binding_tests.py +@@ -311,8 +311,8 @@ class BindingTestCase(unittest.TestCase): + ''' + node = lasso.Node.newFromXmlNode(content) + assert 'next_url' in node.any[1] +- assert 'huhu' in node.attributes.keys()[0] +- assert node.attributes.values()[0] == 'xxx' ++ assert '{https://www.entrouvert.com/}huhu' in node.attributes.keys() ++ assert 'xxx' in node.attributes.values() + node.any = ('coin',) + node.attributes = {'michou': 'zozo'} + assert 'coin' in node.dump() +diff --git a/bindings/python/tests/idwsf2_tests.py b/bindings/python/tests/idwsf2_tests.py +index 6f80c53d..4e47a4a1 100755 +--- a/bindings/python/tests/idwsf2_tests.py ++++ b/bindings/python/tests/idwsf2_tests.py +@@ -27,7 +27,7 @@ + import os + import unittest + import sys +-from StringIO import StringIO ++from six import StringIO + import logging + + logging.basicConfig() +@@ -310,11 +310,11 @@ class MetadataTestCase(IdWsf2TestCase): + self.failUnless(idp_disco.request.svcMD[0].svcMDID is None) + try: + idp_disco.checkSecurityMechanism() +- except lasso.Error, e: ++ except lasso.Error as e: + self.fail(e) + try: + idp_disco.validateRequest() +- except lasso.Error, e: ++ except lasso.Error as e: + self.fail(e) + self.failUnless(idp_disco.response is not None) + self.failUnlessEqual(len(idp_disco.metadatas), 1) +@@ -391,16 +391,16 @@ class MetadataTestCase(IdWsf2TestCase): + self.failUnless(idp_disco is not None) + try: + idp_disco.processRequestMsg(wsp_disco.msgBody) +- except lasso.Error, e: ++ except lasso.Error as e: + self.fail(e) + self.failUnless(idp_disco.request is not None) + try: + idp_disco.checkSecurityMechanism() +- except lasso.Error, e: ++ except lasso.Error as e: + self.fail(e) + try: + idp_disco.failRequest(lasso.IDWSF2_DISCOVERY_STATUS_CODE_FAILED, lasso.IDWSF2_DISCOVERY_STATUS_CODE_FORBIDDEN) +- except lasso.Error, e: ++ except lasso.Error as e: + self.fail(e) + self.failUnless(idp_disco.response is not None) + self.failUnless(idp_disco.response.status is not None) +@@ -415,7 +415,7 @@ class MetadataTestCase(IdWsf2TestCase): + wsp_disco.processResponseMsg(idp_disco.msgBody) + except lasso.Idwsf2DiscoveryForbiddenError: + pass +- except lasso.Error, e: ++ except lasso.Error as e: + self.fail(e) + + def test03(self): +@@ -475,7 +475,7 @@ class MetadataTestCase(IdWsf2TestCase): + self.failUnless(soap_envelope.getMessageId() is not None) + try: + idp_disco.checkSecurityMechanism() +- except lasso.Error, e: ++ except lasso.Error as e: + self.fail(e) + # redirect + interactionUrl = spInteractionUrl +@@ -488,7 +488,7 @@ class MetadataTestCase(IdWsf2TestCase): + self.failUnless(response.detail.any[0].redirectURL.startswith(interactionUrl + '?transactionID=')) + try: + idp_disco.buildResponseMsg() +- except lasso.Error, e: ++ except lasso.Error as e: + self.fail(e) + self.failUnless(idp_disco.msgBody is not None) + +@@ -500,7 +500,7 @@ class MetadataTestCase(IdWsf2TestCase): + wsp_disco.processResponseMsg(idp_disco.msgBody) + except lasso.WsfprofileRedirectRequestError: + pass +- except lasso.Error, e: ++ except lasso.Error as e: + self.fail(e) + response_envelope = wsp_disco.getSoapEnvelopeResponse() + self.failUnless(response_envelope.sb2GetRedirectRequestUrl().startswith(interactionUrl + '?transactionID=')) +@@ -527,11 +527,11 @@ class MetadataTestCase(IdWsf2TestCase): + self.failUnless(idp_disco.request.svcMD[0].svcMDID is None) + try: + idp_disco.checkSecurityMechanism() +- except lasso.Error, e: ++ except lasso.Error as e: + self.fail(e) + try: + idp_disco.validateRequest() +- except lasso.Error, e: ++ except lasso.Error as e: + self.fail(e) + self.failUnless(idp_disco.response is not None) + self.failUnlessEqual(len(idp_disco.metadatas), 1) +diff --git a/lasso/build_strerror.py b/lasso/build_strerror.py +index fca59628..908638d5 100644 +--- a/lasso/build_strerror.py ++++ b/lasso/build_strerror.py +@@ -1,42 +1,42 @@ + #! /usr/bin/env python + +-from cStringIO import StringIO + import glob + import re + import sys + import os ++from six import print_, StringIO + + srcdir = sys.argv[1] + +-hlines = file('%s/errors.h' % srcdir,'r').readlines() + messages = dict() + description = '' + +-for line in hlines: +- m = re.match(r'^ \* LASSO.*ERROR', line) +- if m: +- description = '' +- continue +- m = re.match(r'^ \* (.*[^:])$', line) +- if m: +- description += m.group(1) +- m = re.match(r'#define (LASSO_\w*ERROR\w+)', line) +- if m and description: +- description = re.sub(r'[ \n]+', ' ', description).strip() +- messages[m.group(1)] = description +- description = '' +- else: +- m = re.match(r'#define (LASSO_\w*ERROR\w+)',line) ++with open('%s/errors.h' % srcdir,'r') as f: ++ for line in f: ++ m = re.match(r'^ \* LASSO.*ERROR', line) + if m: +- messages[m.group(1)] = m.group(1) ++ description = '' ++ continue ++ m = re.match(r'^ \* (.*[^:])$', line) ++ if m: ++ description += m.group(1) ++ m = re.match(r'#define (LASSO_\w*ERROR\w+)', line) ++ if m and description: ++ description = re.sub(r'[ \n]+', ' ', description).strip() ++ messages[m.group(1)] = description ++ description = '' ++ else: ++ m = re.match(r'#define (LASSO_\w*ERROR\w+)',line) ++ if m: ++ messages[m.group(1)] = m.group(1) + +-clines = file('%s/errors.c.in' % srcdir,'r').readlines() +-for line in clines: +- if '@ERROR_CASES@' in line: +- keys = messages.keys() +- keys.sort() +- for k in keys: +- print """ case %s: +- return "%s";""" % (k,messages[k].rstrip('\n')) +- else: +- print line, ++with open('%s/errors.c.in' % srcdir,'r') as f: ++ for line in f: ++ if '@ERROR_CASES@' in line: ++ keys = sorted(messages.keys()) ++ for k in keys: ++ print_(' case %s:\n' ++ ' return "%s";' % ++ (k,messages[k].rstrip('\n'))) ++ else: ++ print_(line, end="") diff --git a/SOURCES/duplicate-python-LogoutTestCase.patch b/SOURCES/duplicate-python-LogoutTestCase.patch new file mode 100644 index 0000000..2adea00 --- /dev/null +++ b/SOURCES/duplicate-python-LogoutTestCase.patch @@ -0,0 +1,83 @@ +commit 623d785f957acc9eccb47a9a3f88e5e167a370b6 +Author: John Dennis +Date: Mon Jun 25 17:37:45 2018 -0400 + + fix duplicate definition of LogoutTestCase and logoutSuite + + Commit 6f617027e added a duplicate definition of the LogoutTestCase + class containing only 1 test which shaddowed the original + LogoutTestCase containing 4 tests. The logoutSuite variable was also + shadowed and the allTests variable contained a duplicate of + logoutSuite causing the 2nd definition of LogoutTestCase to be run + twice. + + Not only were the original 4 tests not being run but the entire unit + test in profiles_tests.py was failing under Python3. This is because + the unittest code in Py3 deletes a test from it's list of tests to run + once it's been run. The second time the logoutSuite was invoked it no + longer contained any tests which caused an exception to be raised + because there were no tests to be run. + + License: MIT + Signed-off-by: John Dennis + +diff --git a/bindings/python/tests/profiles_tests.py b/bindings/python/tests/profiles_tests.py +index 547c9e24..0ba1e56e 100755 +--- a/bindings/python/tests/profiles_tests.py ++++ b/bindings/python/tests/profiles_tests.py +@@ -386,6 +386,21 @@ class LogoutTestCase(unittest.TestCase): + else: + self.fail('Logout processResponseMsg should have failed.') + ++ def test05(self): ++ '''Test parsing of a logout request with more than one session index''' ++ content = ''' ++ me ++ coin ++ id1 ++ id2 ++ id3 ++ ''' ++ ++ node = lasso.Samlp2LogoutRequest.newFromXmlNode(content) ++ assert isinstance(node, lasso.Samlp2LogoutRequest) ++ assert node.sessionIndex == 'id1' ++ assert node.sessionIndexes == ('id1', 'id2', 'id3') ++ + class DefederationTestCase(unittest.TestCase): + def test01(self): + """IDP initiated defederation; testing processNotificationMsg with non Liberty query.""" +@@ -478,32 +493,15 @@ class AttributeAuthorityTestCase(unittest.TestCase): + assert aq.response.assertion[0].attributeStatement[0].attribute[0] + assert aq.response.assertion[0].attributeStatement[0].attribute[0].attributeValue[0] + +-class LogoutTestCase(unittest.TestCase): +- def test01(self): +- '''Test parsing of a logout request with more than one session index''' +- content = ''' +- me +- coin +- id1 +- id2 +- id3 +- ''' +- +- node = lasso.Samlp2LogoutRequest.newFromXmlNode(content) +- assert isinstance(node, lasso.Samlp2LogoutRequest) +- assert node.sessionIndex == 'id1' +- assert node.sessionIndexes == ('id1', 'id2', 'id3') +- + serverSuite = unittest.makeSuite(ServerTestCase, 'test') + loginSuite = unittest.makeSuite(LoginTestCase, 'test') + logoutSuite = unittest.makeSuite(LogoutTestCase, 'test') + defederationSuite = unittest.makeSuite(DefederationTestCase, 'test') + identitySuite = unittest.makeSuite(IdentityTestCase, 'test') + attributeSuite = unittest.makeSuite(AttributeAuthorityTestCase, 'test') +-logoutSuite = unittest.makeSuite(LogoutTestCase, 'test') + + allTests = unittest.TestSuite((serverSuite, loginSuite, logoutSuite, defederationSuite, +- identitySuite, attributeSuite, logoutSuite)) ++ identitySuite, attributeSuite)) + + if __name__ == '__main__': + sys.exit(not unittest.TextTestRunner(verbosity = 2).run(allTests).wasSuccessful()) diff --git a/SOURCES/use-specified-python-interpreter.patch b/SOURCES/use-specified-python-interpreter.patch new file mode 100644 index 0000000..fcdc360 --- /dev/null +++ b/SOURCES/use-specified-python-interpreter.patch @@ -0,0 +1,80 @@ +commit e3e904af7dd308fe7530773bd9ea136afc90049b +Author: John Dennis +Date: Thu Jun 21 10:49:30 2018 -0400 + + Use python interpreter specified configure script + + The configure script allows you to specify the python interpreter to + use via the --with-python option. There were several places where the + python interpreter was implicity invoked without using the specified + version. This can create a number of problems in an environment with + multiple python versions as is the case during the transition from + Python 2 to Python 3. Python 2 is not compatible with Python + 3. Lasso's Python code is supposed to be compatible with both + versions. But during the build and when running the unit tests it is + essential the same interpreter be used consistently otherwise you can + have problems. + + This patch assures whenever python is invoked it does so via the + $(PYTHON) configuration variable. + + What about shebang lines (e.g #/usr/bin/python) at the top of scripts? + Python PEP 394 (https://www.python.org/dev/peps/pep-0394/) covers + this. Basically it says if a script is compatible only with Py2 the + shebang should be #/usr/bin/python2, if only compatible with Py3 the + shebang should be #/usr/bin/python3. However, if the script is + compatible with both versions it can continue to use the + compatible with both Py2 and Py3. + + License: MIT + Signed-off-by: John Dennis + +diff --git a/bindings/java/Makefile.am b/bindings/java/Makefile.am +index 05e5f9ee..8de0178d 100644 +--- a/bindings/java/Makefile.am ++++ b/bindings/java/Makefile.am +@@ -26,7 +26,7 @@ if WSF_ENABLED + EXTRA_ARGS = --enable-id-wsf + endif + +-java_lasso_source_files := $(shell python $(top_srcdir)/bindings/bindings.py -l java-list --src-dir=$(top_srcdir)/lasso/ $(EXTRA_ARGS) ) ++java_lasso_source_files := $(shell $(PYTHON) $(top_srcdir)/bindings/bindings.py -l java-list --src-dir=$(top_srcdir)/lasso/ $(EXTRA_ARGS) ) + + lasso_jardir=$(prefix)/share/java + lasso_jar_DATA=lasso.jar +diff --git a/bindings/python/tests/Makefile.am b/bindings/python/tests/Makefile.am +index 205e7613..1305f26f 100644 +--- a/bindings/python/tests/Makefile.am ++++ b/bindings/python/tests/Makefile.am +@@ -11,5 +11,8 @@ if WSF_ENABLED + TESTS += idwsf1_tests.py idwsf2_tests.py + endif + ++TEST_EXTENSIONS = .py ++PY_LOG_COMPILER = $(PYTHON) ++ + EXTRA_DIST = profiles_tests.py binding_tests.py idwsf1_tests.py idwsf2_tests.py \ + tests.py XmlTestRunner.py +diff --git a/lasso/Makefile.am b/lasso/Makefile.am +index 751f9419..49ae88a7 100644 +--- a/lasso/Makefile.am ++++ b/lasso/Makefile.am +@@ -91,7 +91,7 @@ liblasso_la_LDFLAGS = -no-undefined -version-info @LASSO_VERSION_INFO@ \ + endif + + $(srcdir)/errors.c: $(srcdir)/errors.h $(srcdir)/build_strerror.py +- python $(srcdir)/build_strerror.py $(srcdir) >.errors.c.new ++ $(PYTHON) $(srcdir)/build_strerror.py $(srcdir) >.errors.c.new + if ! cmp -s $(srcdir)/errors.c .errors.c.new; then \ + mv -f .errors.c.new $@; else \ + rm .errors.c.new; fi +diff --git a/tools/check-lasso-sections.py b/tools/check-lasso-sections.py +index cb4c39c4..3a6c9880 100755 +--- a/tools/check-lasso-sections.py ++++ b/tools/check-lasso-sections.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/env python + + import sys + import os.path diff --git a/SOURCES/versioned-python-configure.patch b/SOURCES/versioned-python-configure.patch new file mode 100644 index 0000000..9fe3d57 --- /dev/null +++ b/SOURCES/versioned-python-configure.patch @@ -0,0 +1,48 @@ +commit af29047480cacafaed697cb2a1fb24c5143078a8 +Author: John Dennis +Date: Sat Jul 7 10:59:32 2018 -0400 + + Configure should search for versioned Python interpreter. + + Following the guidelines in Python PEP 394 with regards to the python + command on UNIX like systems preference should be given to explicitly + versioned command interpreter as opposed to unversioned and that an + unversioned python command should (but might not) refer to + Python2. Also in some environments unversioned Python interpreters + (e.g. /usr/bin/python) do not even exist, onlyh their explicitly + versioned variants are (e.g. /usr/bin/python2 and /usr/bin/python3). + + Therefore the AC_CHECK_PROGS directive in configure.ac should not rely + exclusively on an unversioned Python interpreter as it does not, + rather it should search in priority order. First for python3, then for + an unversionsed python because some distributions have already moved + the default unversioned python to python3, and then finally search for + python2. In the scenario where unversioned python is still pointing to + python2 it's equivalent to selecting the last prority option of + python2, but if unversioned python is pointing to python3 you get + instead. The net result is always preferring python3 but gracefully + falling back to python2 not matter how the environment exports it's + Python. + + If AC_CHECK_PROGS for python does not check for the versioned variants + the build fails in environments that only have versioned variants with + this error: + + configure: error: Python must be installed to compile lasso + + License: MIT + Signed-off-by: John Dennis + +diff --git a/configure.ac b/configure.ac +index 898468e6..74766972 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -131,7 +131,7 @@ dnl AC_CHECK_PROGS(JAR, fastjar jar) + AC_CHECK_PROGS(PERL, perl) + AC_CHECK_PROGS(PHP5, php5 php) + AC_CHECK_PROGS(PHP5_CONFIG, php-config5 php-config) +-AC_CHECK_PROGS(PYTHON, python) ++AC_CHECK_PROGS(PYTHON, python3 python python2) + AC_CHECK_PROGS(SWIG, swig) + + dnl Make sure we have an ANSI compiler diff --git a/SPECS/lasso.spec b/SPECS/lasso.spec new file mode 100644 index 0000000..af8aeca --- /dev/null +++ b/SPECS/lasso.spec @@ -0,0 +1,450 @@ +%global with_java 1 +%global with_php 0 +%global with_perl 1 +%global with_python 1 +%global with_python2 0 +%global with_python3 0 +%global with_wsf 0 +%global obsolete_old_lang_subpackages 0 + +%if %{with_php} +%if "%{php_version}" < "5.6" +%global ini_name %{name}.ini +%else +%global ini_name 40-%{name}.ini +%endif +%endif + +%if (0%{?fedora} > 0 && 0%{?fedora} <= 29) || (0%{?rhel} > 0 && 0%{?rhel} <= 7) + %global obsolete_old_lang_subpackages 1 +%endif + +%if %{with_python} + %if (0%{?fedora} > 0 && 0%{?fedora} < 32) || (0%{?rhel} > 0 && 0%{?rhel} <= 7) + %global with_python2 1 + %endif + + %if 0%{?fedora} || 0%{?rhel} >= 8 + %global with_python3 1 + %endif +%endif + +%global configure_args %{nil} +%global configure_args %{configure_args} + +%if !%{with_java} + %global configure_args %{configure_args} --disable-java +%endif + +%if !%{with_perl} + %global configure_args %{configure_args} --disable-perl +%endif + +%if %{with_php} + %global configure_args %{configure_args} --enable-php5=yes --with-php5-config-dir=%{php_inidir} +%else + %global configure_args %{configure_args} --enable-php5=no +%endif + +%if %{with_wsf} + %global configure_args %{configure_args} --enable-wsf --with-sasl2=%{_prefix}/sasl2 +%endif + +%if !%{with_python} + %global configure_args %{configure_args} --disable-python +%endif + + +Summary: Liberty Alliance Single Sign On +Name: lasso +Version: 2.6.0 +Release: 4%{?dist} +License: GPLv2+ +Group: System Environment/Libraries +Source: http://dev.entrouvert.org/lasso/lasso-%{version}.tar.gz + +Patch1: use-specified-python-interpreter.patch +Patch2: build-scripts-py3-compatible.patch +Patch3: duplicate-python-LogoutTestCase.patch +Patch4: versioned-python-configure.patch + +BuildRequires: libtool autoconf automake + +# The Lasso build system requires python, especially the binding generators +%if %{with_python2} +BuildRequires: python2 +BuildRequires: python2-lxml +BuildRequires: python2-six +%endif + +%if %{with_python3} +BuildRequires: python3 +BuildRequires: python3-lxml +BuildRequires: python3-six +%endif + +%if %{with_wsf} +BuildRequires: cyrus-sasl-devel +%endif +BuildRequires: gtk-doc, libtool-ltdl-devel +BuildRequires: glib2-devel, swig +BuildRequires: libxml2-devel, openssl-devel +BuildRequires: xmlsec1-devel >= 1.2.25-4, xmlsec1-openssl-devel >= 1.2.25-4 +BuildRequires: zlib-devel, check-devel +BuildRequires: libtool autoconf automake +Url: http://lasso.entrouvert.org/ + +Requires: xmlsec1 >= 1.2.25-4 + +%description +Lasso is a library that implements the Liberty Alliance Single Sign On +standards, including the SAML and SAML2 specifications. It allows to handle +the whole life-cycle of SAML based Federations, and provides bindings +for multiple languages. + +%package devel +Summary: Lasso development headers and documentation +Group: Development/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +This package contains the header files, static libraries and development +documentation for Lasso. + +%if %{with_perl} +%package -n perl-%{name} +Summary: Liberty Alliance Single Sign On (lasso) Perl bindings +Group: Development/Libraries +BuildRequires: perl-devel +BuildRequires: perl(ExtUtils::MakeMaker) +BuildRequires: perl(Test::More) +BuildRequires: perl(Error) +Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description -n perl-%{name} +Perl language bindings for the lasso (Liberty Alliance Single Sign On) library. +%endif + +%if %{with_java} +%package -n java-%{name} +Summary: Liberty Alliance Single Sign On (lasso) Java bindings +Group: Development/Libraries +BuildRequires: java-devel +BuildRequires: jpackage-utils +Requires: java-headless +Requires: jpackage-utils +Requires: %{name}%{?_isa} = %{version}-%{release} +%if %{obsolete_old_lang_subpackages} +Provides: %{name}-java = %{version}-%{release} +Provides: %{name}-java%{?_isa} = %{version}-%{release} +Obsoletes: %{name}-java < %{version}-%{release} +%endif + +%description -n java-%{name} +Java language bindings for the lasso (Liberty Alliance Single Sign On) library. +%endif + +%if %{with_php} +%package -n php-%{name} +Summary: Liberty Alliance Single Sign On (lasso) PHP bindings +Group: Development/Libraries +BuildRequires: php-devel, expat-devel +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: php(zend-abi) = %{php_zend_api} +Requires: php(api) = %{php_core_api} + +%description -n php-%{name} +PHP language bindings for the lasso (Liberty Alliance Single Sign On) library. + +%endif + +%if %{with_python2} +%package -n python2-%{name} +%{?python_provide:%python_provide python2-%{name}} +Summary: Liberty Alliance Single Sign On (lasso) Python bindings +Group: Development/Libraries +BuildRequires: python2-devel +Requires: python2 +Requires: %{name}%{?_isa} = %{version}-%{release} +%if %{obsolete_old_lang_subpackages} +Provides: %{name}-python = %{version}-%{release} +Provides: %{name}-python%{?_isa} = %{version}-%{release} +Obsoletes: %{name}-python < %{version}-%{release} +%endif + +%description -n python2-%{name} +Python language bindings for the lasso (Liberty Alliance Single Sign On) +library. +%endif + +%if %{with_python3} +%package -n python3-%{name} +%{?python_provide:%python_provide python3-%{name}} +Summary: Liberty Alliance Single Sign On (lasso) Python bindings +Group: Development/Libraries +BuildRequires: python3-devel +Requires: python3 +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description -n python3-%{name} +Python language bindings for the lasso (Liberty Alliance Single Sign On) +library. +%endif + +%prep +%setup -q -n %{name}-%{version} + +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 + +# Remove any python script shebang lines (unless they refer to python3) +sed -i -E -e '/^#![[:blank:]]*(\/usr\/bin\/env[[:blank:]]+python[^3]?\>)|(\/usr\/bin\/python[^3]?\>)/d' \ + `grep -r -l -E '^#![[:blank:]]*(/usr/bin/python[^3]?)|(/usr/bin/env[[:blank:]]+python[^3]?)' *` + +%build +./autogen.sh +%if 0%{?with_python2} + %configure %{configure_args} --with-python=%{__python2} + pushd lasso + make %{?_smp_mflags} CFLAGS="%{optflags}" + popd + pushd bindings/python + make %{?_smp_mflags} CFLAGS="%{optflags}" + make check + mkdir py2 + mv lasso.py .libs/_lasso.so py2 + popd + make clean +%endif + +%if 0%{?with_python3} + %configure %{configure_args} --with-python=%{__python3} +%else + %configure %{configure_args} +%endif +make %{?_smp_mflags} CFLAGS="%{optflags}" + +%check +make check + +%install +#install -m 755 -d %{buildroot}%{_datadir}/gtk-doc/html + +make install exec_prefix=%{_prefix} DESTDIR=%{buildroot} +find %{buildroot} -type f -name '*.la' -exec rm -f {} \; +find %{buildroot} -type f -name '*.a' -exec rm -f {} \; + +%if 0%{?with_python2} + # Install Python 2 files saved from first build + install -d -m 0755 %{buildroot}/%{python2_sitearch} + install -m 0644 bindings/python/py2/lasso.py %{buildroot}/%{python2_sitearch} + install -m 0755 bindings/python/py2/_lasso.so %{buildroot}/%{python2_sitearch} +%endif + +# Perl subpackage +%if %{with_perl} +find %{buildroot} \( -name perllocal.pod -o -name .packlist \) -exec rm -v {} \; + +find %{buildroot}/usr/lib*/perl5 -type f -print | + sed "s@^%{buildroot}@@g" > %{name}-perl-filelist +if [ "$(cat %{name}-perl-filelist)X" = "X" ] ; then + echo "ERROR: EMPTY FILE LIST" + exit -1 +fi +%endif + +# PHP subpackage +%if %{with_php} +install -m 755 -d %{buildroot}%{_datadir}/php/%{name} +mv %{buildroot}%{_datadir}/php/lasso.php %{buildroot}%{_datadir}/php/%{name} + +# rename the PHP config file when needed (PHP 5.6+) +if [ "%{name}.ini" != "%{ini_name}" ]; then + mv %{buildroot}%{php_inidir}/%{name}.ini \ + %{buildroot}%{php_inidir}/%{ini_name} +fi +%endif + +# Remove bogus doc files +rm -fr %{buildroot}%{_defaultdocdir}/%{name} + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%{_libdir}/liblasso.so.* +%doc AUTHORS COPYING NEWS README + +%files devel +%{_libdir}/liblasso.so +%{_libdir}/pkgconfig/lasso.pc +%{_includedir}/%{name} + +%if %{with_perl} +%files -n perl-%{name} -f %{name}-perl-filelist +%endif + +%if %{with_java} +%files -n java-%{name} +%{_libdir}/java/libjnilasso.so +%{_javadir}/lasso.jar +%endif + +%if %{with_php} +%files -n php-%{name} +%attr(755,root,root) %{php_extdir}/lasso.so +%config(noreplace) %attr(644,root,root) %{php_inidir}/%{ini_name} +%attr(755,root,root) %dir %{_datadir}/php/%{name} +%attr(644,root,root) %{_datadir}/php/%{name}/lasso.php +%endif + +%if %{with_python2} +%files -n python2-%{name} +%{python2_sitearch}/lasso.py* +%{python2_sitearch}/_lasso.so +%endif + +%if %{with_python3} +%files -n python3-%{name} +%{python3_sitearch}/lasso.py* +%{python3_sitearch}/_lasso.so +%{python3_sitearch}/__pycache__/* +%endif + +%changelog +* Tue Jul 17 2018 - 2.6.0-4 +- more fixes for py2/py3 build dependencies + +* Mon Jul 9 2018 - 2.6.0-3 +- Modify configure to search for versioned python +- Resolves: rhbz#1598047 +- Related: rhbz#1589856 + +* Wed Jun 27 2018 - 2.6.0-2 +- fix language bindings package names to comply with guidelines, + instead of %{name}-lang use lang-%{name} +- fix conditional logic used to build on rhel +- Resolves: rhbz#1589856 Drop python2 subpackage from RHEL8 + +* Tue Jun 26 2018 - 2.6.0-1 +- Upgrade to latest upstream +- Build using Python3, add python3 subpackage +- Resolves: rhbz#1592416 Enable perl subpackage + +* Wed May 2 2018 John Dennis - 2.5.1-13 +- add xmlsec1 version dependency + +* Tue May 1 2018 John Dennis - 2.5.1-12 +- Resolves: rhbz#1542126, rhbz#1556016 +- xmlsec removed SOAP support, reimplement missing xmlSecSoap* in Lasso + +* Wed Feb 07 2018 Fedora Release Engineering - 2.5.1-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Fri Jan 05 2018 Iryna Shcherbina - 2.5.1-10 +- Update Python 2 dependency declarations to new packaging standards + (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) + +* Sun Aug 20 2017 Zbigniew Jędrzejewski-Szmek - 2.5.1-9 +- Add Provides for the old name without %%_isa + +* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek - 2.5.1-8 +- Python 2 binary package renamed to python2-lasso + See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3 + +* Thu Aug 03 2017 Fedora Release Engineering - 2.5.1-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 2.5.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Fri Feb 10 2017 Fedora Release Engineering - 2.5.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Tue Jul 19 2016 Fedora Release Engineering - 2.5.1-4 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Thu Jun 30 2016 John Dennis - 2.5.1-3 +- disbable PHP binding because PHP-7 is now the default and lasso + only knows how to build with PHP-5 + +* Wed Jun 15 2016 John Dennis - 2.5.1-2 +- fix CFLAGS override in configure + +* Mon Feb 22 2016 John Dennis - 2.5.1-1 +- Upgrade to upstream 2.5.1 release + See Changelog for details, mostly bugs fixes, + most signficant is proper support of SHA-2 + Resolves: #1295472 + Resolves: #1303573 +- Add java_binding_lasso_log.patch to fix "make check" failure during rpmbuild + upstream commit d8e3ae8 + +* Thu Feb 04 2016 Fedora Release Engineering - 2.5.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Mon Sep 14 2015 John Dennis - 2.5.0-1 +- Upgrade to new upstream 2.5.0 release + Includes ECP support + +* Wed Jun 17 2015 Fedora Release Engineering - 2.4.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Mon Mar 23 2015 Rob Crittenden - 2.4.1-3 +- Add BuildRequires on libtool +- Add -fPIC to LDFLAGS +- Disable perl bindings, it fails to build on x86. + +* Fri Jan 23 2015 Simo Sorce - 2.4.1-2 +- Enable perl bindings +- Also add support for building with automake 1.15 +- Fix build issues on rawhide due to missing build dep on perl(Error) + +* Thu Aug 28 2014 Simo Sorce - 2.4.1-1 +- New upstream relase 2.4.1 +- Drop patches as they have all been integrated upstream + +* Sun Aug 17 2014 Fedora Release Engineering - 2.4.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Fri Jun 20 2014 Remi Collet - 2.4.0-4 +- rebuild for https://fedoraproject.org/wiki/Changes/Php56 +- add numerical prefix to extension configuration file +- drop unneeded dependency on pecl +- add provides php-lasso + +* Sat Jun 07 2014 Fedora Release Engineering - 2.4.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Fri Apr 25 2014 Simo Sorce - 2.4.0-2 +- Fixes for arches where pointers and integers do not have the same size + (ppc64, s390, etc..) + +* Mon Apr 14 2014 Stanislav Ochotnicky - 2.4.0-1 +- Use OpenJDK instead of GCJ for java bindings + +* Sat Jan 11 2014 Simo Sorce 2.4.0-0 +- Update to final 2.4.0 version +- Drop all patches, they are now included in 2.4.0 +- Change Source URI + +* Mon Dec 9 2013 Simo Sorce 2.3.6-0.20131125.5 +- Add patches to fix rpmlint license issues +- Add upstream patches to fix some build issues + +* Thu Dec 5 2013 Simo Sorce 2.3.6-0.20131125.4 +- Add patch to support automake-1.14 for rawhide + +* Mon Nov 25 2013 Simo Sorce 2.3.6-0.20131125.3 +- Initial packaging +- Based on the spec file by Jean-Marc Liger +- Code is updated to latest master via a jumbo patch while waiting for + official upstream release. +- Jumbo patch includes also additional patches sent to upstream list) + to build on Fedora 20 +- Perl bindings are disabled as they fail to build +- Disable doc building as it doesn't ork correctly for now