#3 Upgrade to python-ldap 2.5.2
Closed 4 years ago by cheimes. Opened 4 years ago by cheimes.
rpms/ cheimes/python-ldap python-ldap-2.5.1  into  master

file modified
+2
@@ -4,3 +4,5 @@ 

  /python-ldap-2.4.16.tar.gz

  /python-ldap-2.4.17.tar.gz

  /python-ldap-2.4.25.tar.gz

+ /python-ldap-2.5.1.tar.gz

+ /python-ldap-2.5.2.tar.gz

@@ -1,168 +0,0 @@ 

- From a89bd2361a3971d0dc11908707509bbf5e1fd1ac Mon Sep 17 00:00:00 2001

- From: Ilya Etingof <etingof@gmail.com>

- Date: Wed, 11 Oct 2017 20:27:41 +0200

- Subject: [PATCH] accommodate changed pyasn1 behaviour

- 

- pyasn1 versions prior to 0.2.3 indicate absent value by

- returning `None` object, later pyasn1 versions use

- the `noValue` sentinel object which is the basis for

- the `.hasValue()` method call (and .isValue property).

- 

- This fix makes the code compatible with both `None` sentinel

- and the `.hasValue()` test thus making it compatible with all

- reasonable pyasn1 versions in circulation.

- ---

- Index: Lib/ldap/syncrepl.py

- ===================================================================

- RCS file: /cvsroot/python-ldap/python-ldap/Lib/ldap/syncrepl.py,v

- retrieving revision 1.9

- diff -u -r1.9 syncrepl.py

- --- Lib/ldap/syncrepl.py	9 Oct 2017 15:09:28 -0000	1.9

- +++ Lib/ldap/syncrepl.py	7 Nov 2017 13:40:32 -0000

- @@ -131,11 +131,13 @@

-          d = decoder.decode(encodedControlValue, asn1Spec = syncStateValue())

-          state = d[0].getComponentByName('state')

-          uuid = UUID(bytes=d[0].getComponentByName('entryUUID'))

- -        self.cookie = d[0].getComponentByName('cookie')

- +        cookie = d[0].getComponentByName('cookie')

- +        if cookie is None or not cookie.hasValue():

- +            self.cookie = None

- +        else:

- +            self.cookie = str(cookie)

-          self.state = self.__class__.opnames[int(state)]

-          self.entryUUID = str(uuid)

- -        if self.cookie is not None:

- -            self.cookie = str(self.cookie)

-  

-  KNOWN_RESPONSE_CONTROLS[SyncStateControl.controlType] = SyncStateControl

-  

- @@ -165,10 +167,10 @@

-  

-      def decodeControlValue(self, encodedControlValue):

-          d = decoder.decode(encodedControlValue, asn1Spec = syncDoneValue())

- -        self.cookie = d[0].getComponentByName('cookie')

- +        cookie = d[0].getComponentByName('cookie')

- +        if cookie is not None and cookie.hasValue():

- +            self.cookie = str(cookie)

-          self.refreshDeletes = d[0].getComponentByName('refreshDeletes')

- -        if self.cookie is not None:

- -            self.cookie = str(self.cookie)

-          if self.refreshDeletes is not None:

-              self.refreshDeletes = bool(self.refreshDeletes)

-  

- @@ -263,7 +265,7 @@

-          for attr in [ 'newcookie', 'refreshDelete', 'refreshPresent', 'syncIdSet']:

-              comp = d[0].getComponentByName(attr)

-  

- -            if comp is not None:

- +            if comp is not None and comp.hasValue():

-  

-                  if attr == 'newcookie':

-                      self.newcookie = str(comp)

- @@ -272,7 +274,7 @@

-                  val = dict()

-  

-                  cookie = comp.getComponentByName('cookie')

- -                if cookie is not None:

- +                if cookie is not None and cookie.hasValue():

-                      val['cookie'] = str(cookie)

-  

-                  if attr.startswith('refresh'):

- Index: Lib/ldap/controls/ppolicy.py

- ===================================================================

- RCS file: /cvsroot/python-ldap/python-ldap/Lib/ldap/controls/ppolicy.py,v

- retrieving revision 1.6

- diff -u -r1.6 ppolicy.py

- --- Lib/ldap/controls/ppolicy.py	9 Oct 2017 15:09:28 -0000	1.6

- +++ Lib/ldap/controls/ppolicy.py	7 Nov 2017 13:40:32 -0000

- @@ -71,7 +71,7 @@

-    def decodeControlValue(self,encodedControlValue):

-      ppolicyValue,_ = decoder.decode(encodedControlValue,asn1Spec=PasswordPolicyResponseValue())

-      warning = ppolicyValue.getComponentByName('warning')

- -    if warning is None:

- +    if warning is None or not warning.hasValue():

-        self.timeBeforeExpiration,self.graceAuthNsRemaining = None,None

-      else:

-        timeBeforeExpiration = warning.getComponentByName('timeBeforeExpiration')

- @@ -85,7 +85,7 @@

-        else:

-          self.graceAuthNsRemaining = None

-      error = ppolicyValue.getComponentByName('error')

- -    if error is None:

- +    if error is None or not error.hasValue():

-        self.error = None

-      else:

-        self.error = int(error)

- Index: Lib/ldap/controls/psearch.py

- ===================================================================

- RCS file: /cvsroot/python-ldap/python-ldap/Lib/ldap/controls/psearch.py,v

- retrieving revision 1.6

- diff -u -r1.6 psearch.py

- --- Lib/ldap/controls/psearch.py	9 Oct 2017 15:09:28 -0000	1.6

- +++ Lib/ldap/controls/psearch.py	7 Nov 2017 13:40:32 -0000

- @@ -115,18 +115,16 @@

-    def decodeControlValue(self,encodedControlValue):

-      ecncValue,_ = decoder.decode(encodedControlValue,asn1Spec=EntryChangeNotificationValue())

-      self.changeType = int(ecncValue.getComponentByName('changeType'))

- -    if len(ecncValue)==3:

- -      self.previousDN = str(ecncValue.getComponentByName('previousDN'))

- -      self.changeNumber = int(ecncValue.getComponentByName('changeNumber'))

- -    elif len(ecncValue)==2:

- -      if self.changeType==8:

- -        self.previousDN = str(ecncValue.getComponentByName('previousDN'))

- -        self.changeNumber = None

- -      else:

- -        self.previousDN = None

- -        self.changeNumber = int(ecncValue.getComponentByName('changeNumber'))

- +    previousDN = ecncValue.getComponentByName('previousDN')

- +    if previousDN is None or not previousDN.hasValue():

- +      self.previousDN = None

-      else:

- -      self.previousDN,self.changeNumber = None,None

- +      self.previousDN = str(previousDN)

- +    changeNumber = ecncValue.getComponentByName('changeNumber')

- +    if changeNumber is None or not changeNumber.hasValue():

- +      self.changeNumber = None

- +    else:

- +      self.changeNumber = int(changeNumber)

-      return (self.changeType,self.previousDN,self.changeNumber)

-  

-  KNOWN_RESPONSE_CONTROLS[EntryChangeNotificationControl.controlType] = EntryChangeNotificationControl

- Index: Lib/ldap/controls/sss.py

- ===================================================================

- RCS file: /cvsroot/python-ldap/python-ldap/Lib/ldap/controls/sss.py,v

- retrieving revision 1.5

- diff -u -r1.5 sss.py

- --- Lib/ldap/controls/sss.py	9 Oct 2017 15:09:28 -0000	1.5

- +++ Lib/ldap/controls/sss.py	7 Nov 2017 13:40:32 -0000

- @@ -121,7 +121,9 @@

-          assert not rest, 'all data could not be decoded'

-          self.result = int(p.getComponentByName('sortResult'))

-          self.result_code = p.getComponentByName('sortResult').prettyOut(self.result)

- -        self.attribute_type_error = p.getComponentByName('attributeType')

- +        attribute_type_error = p.getComponentByName('attributeType')

- +        if attribute_type_error is not None and attribute_type_error.hasValue():

- +            self.attribute_type_error = attribute_type_error

-  

-  

-  KNOWN_RESPONSE_CONTROLS[SSSRequestControl.controlType] = SSSRequestControl

- Index: Lib/ldap/controls/vlv.py

- ===================================================================

- RCS file: /cvsroot/python-ldap/python-ldap/Lib/ldap/controls/vlv.py,v

- retrieving revision 1.5

- diff -u -r1.5 vlv.py

- --- Lib/ldap/controls/vlv.py	9 Oct 2017 15:09:28 -0000	1.5

- +++ Lib/ldap/controls/vlv.py	7 Nov 2017 13:40:32 -0000

- @@ -130,8 +130,9 @@

-          self.result = int(p.getComponentByName('virtualListViewResult'))

-          self.result_code = p.getComponentByName('virtualListViewResult') \

-                  .prettyOut(self.result)

- -        self.context_id = p.getComponentByName('contextID')

- -        if self.context_id:

- -            self.context_id = str(self.context_id)

- +        context_id = p.getComponentByName('contextID')

- +        if context_id is not None and context_id.hasValue():

- +            self.context_id = str(context_id)

- +

-  

-  KNOWN_RESPONSE_CONTROLS[VLVResponseControl.controlType] = VLVResponseControl

file modified
+30 -9
@@ -1,8 +1,8 @@ 

  ### Abstract ###

  

  Name: python-ldap

- Version: 2.4.25

- Release: 9%{?dist}

+ Version: 2.5.2

+ Release: 1%{?dist}

  Epoch: 0

  License: Python

  Group: System Environment/Libraries
@@ -13,9 +13,7 @@ 

  ### Patches ###

  # Fedora specific patch

  Patch0: python-ldap-2.4.16-dirs.patch

- # Fix for pyasn1 >= 0.3

- # https://github.com/pyldap/pyldap/pull/126

- Patch1: accommodate-changed-pyasn1-behaviour.patch

+ Patch1: tests_no_syslog.patch

  

  ### Dependencies ###

  # LDAP controls, extop, syncrepl require pyasn1
@@ -25,6 +23,11 @@ 

  BuildRequires: openssl-devel

  BuildRequires: python2-devel 

  BuildRequires: cyrus-sasl-devel

+ # Test dependencies

+ BuildRequires: openldap-servers

+ BuildRequires: openldap-clients

+ BuildRequires: python2-pyasn1 >= 0.3.7

+ BuildRequires: python2-pyasn1-modules >= 0.1.5

  

  # we don't want to provide private python extension libs

  %{?filter_setup:
@@ -43,7 +46,8 @@ 

  %package -n python2-ldap

  Summary: %summary

  Requires: openldap

- Requires: python-pyasn1, python-pyasn1-modules

+ Requires: python2-pyasn1 >= 0.3.7

+ Requires: python2-pyasn1-modules >= 0.1.5

  %{?python_provide:%python_provide python2-ldap}

  

  %description -n python2-ldap %_description
@@ -51,7 +55,7 @@ 

  %prep

  %setup -q -n python-ldap-%{version}

  %patch0 -p1 -b .dirs

- %patch1 -p0 -b accommodate-changed-pyasn1-behaviour.patch

+ %patch1 -p1 -b .no_syslog

  

  # clean up cvs hidden files

  rm -rf Demo/Lib/ldap/.cvsignore Demo/.cvsignore Demo/Lib/ldif/.cvsignore Demo/Lib/ldap/async/.cvsignore \
@@ -60,24 +64,41 @@ 

  # Fix interpreter

  sed -i 's|#! python|#!/usr/bin/python|g' Demo/simplebrowse.py

  

+ 

  %build

  %{__python} setup.py build

  

+ 

+ %check

+ %{__python} setup.py test

+ # test places shared library in-tree

+ rm -f Lib/*.so

+ 

+ 

  %install

  %{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT

+ rm %{buildroot}%{python_sitearch}/slapdtest.py*

  

  

  %files -n python2-ldap

  %defattr(-,root,root,-)

  %doc LICENCE CHANGES README TODO Demo

  %{python_sitearch}/_ldap.so

- %{python_sitearch}/dsml.py*

  %{python_sitearch}/ldapurl.py*

  %{python_sitearch}/ldif.py*

  %{python_sitearch}/ldap/

  %{python_sitearch}/python_ldap-%{version}-*.egg-info

  

+ 

  %changelog

+ * Tue Nov 21 2017 Christian Heimes <cheimes@redhat.com> - 0:2.5.2-1

+ - New upstream release 2.5.2 (RHBZ #1496470)

+ 

+ * Thu Nov 16 2017 Christian Heimes <cheimes@redhat.com> - 0:2.5.1-1

+ - New upstream release 2.5.1 (RHBZ #1496470)

+ - Resolves RHBZ #1489184

+ - Enable unittests

+ 

  * Wed Nov 08 2017 Christian Heimes <cheimes@redhat.com> - 0:2.4.25-9

  - Fix issue in pyasn1 patch

  
@@ -201,7 +222,7 @@ 

  * Wed May 17 2006 Matthew Barnes <mbarnes@redhat.com> - 2.2.0-2

  - Put back the epoch line... happy beehive?

  

- * Tue May 15 2006 Matthew Barnes <mbarnes@redhat.com> - 2.2.0-1

+ * Mon May 15 2006 Matthew Barnes <mbarnes@redhat.com> - 2.2.0-1

  - Update to 2.2.0

  - Update python-ldap-2.0.6-rpath.patch and rename it to

    python-ldap-2.2.0-dirs.patch.

file modified
+1 -1
@@ -1,1 +1,1 @@ 

- 21523bf21dbe566e0259030f66f7a487  python-ldap-2.4.25.tar.gz

+ SHA512 (python-ldap-2.5.2.tar.gz) = d5b1fe047d0f16e6c32e286391d0586e0493cbfa8ad817bd64b917f6aa53699eca84477854088d48ef06e378917a2af9d3669762a0a607d17b1e1c75a371c9ad

@@ -0,0 +1,12 @@ 

+ diff -ur a/Lib/slapdtest.py b/Lib/slapdtest.py

+ --- a/Lib/slapdtest.py	2017-11-17 11:53:57.353334584 +0100

+ +++ b/Lib/slapdtest.py	2017-11-17 11:54:33.334893431 +0100

+ @@ -118,7 +118,7 @@

+      _start_sleep = 1.5

+  

+      def __init__(self):

+ -        self._log = combined_logger('python-ldap-test')

+ +        self._log = combined_logger('python-ldap-test', sys_log_format=None)

+          self._proc = None

+          self._port = self._avail_tcp_port()

+          self.server_id = self._port % 4096