#1 Update pam_wrapper in el6 + few test related fixes.
Merged 5 years ago by asn. Opened 5 years ago by lslebodn.
rpms/ lslebodn/pam_wrapper el6_new_version  into  el6

file modified
+3
@@ -1,1 +1,4 @@ 

  /pam_wrapper-1.0.1.tar.gz

+ /pam_wrapper-1.0.2.tar.gz

+ /pam_wrapper-1.0.3.tar.gz

+ /pam_wrapper-1.0.7.tar.gz

@@ -0,0 +1,144 @@ 

+ --- a/tests/pypamtest_test.py	2018-02-13 08:55:46.000000000 +0100

+ +++ b/tests/pypamtest_test.py	2019-02-02 20:00:11.953650422 +0100

+ @@ -4,6 +4,141 @@

+  import os

+  import sys

+  import os.path

+ +import re

+ +

+ +def assertSequenceEqual(self, seq1, seq2, msg=None, seq_type=None):

+ +    """An equality assertion for ordered sequences (like lists and tuples).

+ +

+ +    For the purposes of this function, a valid ordered sequence type is one

+ +    which can be indexed, has a length, and has an equality operator.

+ +

+ +    Args:

+ +        seq1: The first sequence to compare.

+ +        seq2: The second sequence to compare.

+ +        seq_type: The expected datatype of the sequences, or None if no

+ +                datatype should be enforced.

+ +        msg: Optional message to use on failure instead of a list of

+ +                differences.

+ +    """

+ +    if seq_type is not None:

+ +        seq_type_name = seq_type.__name__

+ +        if not isinstance(seq1, seq_type):

+ +            raise self.failureException('First sequence is not a %s: %s'

+ +                                    % (seq_type_name, safe_repr(seq1)))

+ +        if not isinstance(seq2, seq_type):

+ +            raise self.failureException('Second sequence is not a %s: %s'

+ +                                    % (seq_type_name, safe_repr(seq2)))

+ +    else:

+ +        seq_type_name = "sequence"

+ +

+ +    differing = None

+ +    try:

+ +        len1 = len(seq1)

+ +    except (TypeError, NotImplementedError):

+ +        differing = 'First %s has no length.    Non-sequence?' % (

+ +                seq_type_name)

+ +

+ +    if differing is None:

+ +        try:

+ +            len2 = len(seq2)

+ +        except (TypeError, NotImplementedError):

+ +            differing = 'Second %s has no length.    Non-sequence?' % (

+ +                    seq_type_name)

+ +

+ +    if differing is None:

+ +        if seq1 == seq2:

+ +            return

+ +

+ +        seq1_repr = safe_repr(seq1)

+ +        seq2_repr = safe_repr(seq2)

+ +        if len(seq1_repr) > 30:

+ +            seq1_repr = seq1_repr[:30] + '...'

+ +        if len(seq2_repr) > 30:

+ +            seq2_repr = seq2_repr[:30] + '...'

+ +        elements = (seq_type_name.capitalize(), seq1_repr, seq2_repr)

+ +        differing = '%ss differ: %s != %s\n' % elements

+ +

+ +        for i in xrange(min(len1, len2)):

+ +            try:

+ +                item1 = seq1[i]

+ +            except (TypeError, IndexError, NotImplementedError):

+ +                differing += ('\nUnable to index element %d of first %s\n' %

+ +                             (i, seq_type_name))

+ +                break

+ +

+ +            try:

+ +                item2 = seq2[i]

+ +            except (TypeError, IndexError, NotImplementedError):

+ +                differing += ('\nUnable to index element %d of second %s\n' %

+ +                             (i, seq_type_name))

+ +                break

+ +

+ +            if item1 != item2:

+ +                differing += ('\nFirst differing element %d:\n%s\n%s\n' %

+ +                             (i, safe_repr(item1), safe_repr(item2)))

+ +                break

+ +        else:

+ +            if (len1 == len2 and seq_type is None and

+ +                type(seq1) != type(seq2)):

+ +                # The sequences are the same, but have differing types.

+ +                return

+ +

+ +        if len1 > len2:

+ +            differing += ('\nFirst %s contains %d additional '

+ +                         'elements.\n' % (seq_type_name, len1 - len2))

+ +            try:

+ +                differing += ('First extra element %d:\n%s\n' %

+ +                              (len2, safe_repr(seq1[len2])))

+ +            except (TypeError, IndexError, NotImplementedError):

+ +                differing += ('Unable to index element %d '

+ +                              'of first %s\n' % (len2, seq_type_name))

+ +        elif len1 < len2:

+ +            differing += ('\nSecond %s contains %d additional '

+ +                         'elements.\n' % (seq_type_name, len2 - len1))

+ +            try:

+ +                differing += ('First extra element %d:\n%s\n' %

+ +                              (len1, safe_repr(seq2[len1])))

+ +            except (TypeError, IndexError, NotImplementedError):

+ +                differing += ('Unable to index element %d '

+ +                              'of second %s\n' % (len1, seq_type_name))

+ +    standardMsg = differing

+ +    diffMsg = '\n' + '\n'.join(

+ +        difflib.ndiff(pprint.pformat(seq1).splitlines(),

+ +                      pprint.pformat(seq2).splitlines()))

+ +    standardMsg = self._truncateMessage(standardMsg, diffMsg)

+ +    msg = self._formatMessage(msg, standardMsg)

+ +    self.fail(msg)

+ +

+ +

+ +def assertRaisesRegexp(self, excClass, expected_regexp,

+ +                       callable_obj=None, *args, **kwargs):

+ +    """Asserts that the message in a raised exception matches a regexp.

+ +

+ +    Args:

+ +        expected_exception: Exception class expected to be raised.

+ +        expected_regexp: Regexp (re pattern object or string) expected

+ +                to be found in error message.

+ +        callable_obj: Function to be called.

+ +        args: Extra args.

+ +        kwargs: Extra kwargs.

+ +    """

+ +    if expected_regexp is not None:

+ +        expected_regexp = re.compile(expected_regexp)

+ +    try:

+ +        callable_obj(*args, **kwargs)

+ +    except excClass as exc_value:

+ +        if not expected_regexp.search(str(exc_value)):

+ +            raise self.failureException('"%s" does not match "%s"' %

+ +                     (expected_regexp.pattern, str(exc_value)))

+ +        return

+ +    else:

+ +        if hasattr(excClass,'__name__'): excName = excClass.__name__

+ +        else: excName = str(excClass)

+ +        raise self.failureException, "%s not raised" % excName

+ +

+ +setattr(unittest.TestCase, 'assertSequenceEqual', assertSequenceEqual)

+ +setattr(unittest.TestCase, 'assertRaisesRegexp', assertRaisesRegexp)

+ +

+  

+  class PyPamTestCase(unittest.TestCase):

+      def assertPamTestResultEqual(self, test_result, err_list, info_list):

file modified
+27 -11
@@ -1,5 +1,5 @@ 

  Name:           pam_wrapper

- Version:        1.0.1

+ Version:        1.0.7

  Release:        2%{?dist}

  

  Summary:        A tool to test PAM applications and PAM modules
@@ -7,15 +7,16 @@ 

  Url:            http://cwrap.org/

  

  Source0:        https://ftp.samba.org/pub/cwrap/%{name}-%{version}.tar.gz

+ Patch0001:      0001-pypamtest_test.patch

  

  BuildRequires:  cmake

  BuildRequires:  libcmocka-devel

- BuildRequires:  python-devel

+ BuildRequires:  python2-devel

  BuildRequires:  pam-devel

  BuildRequires:  doxygen

  

- Recommends:     cmake

- Recommends:     pkgconfig

+ Requires:     cmake

+ Requires:     pkgconfig

  

  %description

  This component of cwrap allows you to either test your PAM (Linux-PAM
@@ -44,8 +45,8 @@ 

  Requires:       pam_wrapper = %{version}-%{release}

  Requires:       libpamtest = %{version}-%{release}

  

- Recommends:     cmake

- Recommends:     pkgconfig

+ Requires:     cmake

+ Requires:     pkgconfig

  

  

  %description -n libpamtest-devel
@@ -61,13 +62,15 @@ 

  Documentation for libpamtest development.

  

  

- %package -n python-libpamtest

+ %package -n python2-libpamtest

  Summary:        A python wrapper for libpamtest

  License:        GPLv3+

  Requires:       pam_wrapper = %{version}-%{release}

  Requires:       libpamtest = %{version}-%{release}

+ Provides:       python-libpamtest = %{version}-%{release}

+ Obsoletes:      python-libpamtest < %{version}-%{release}

  

- %description -n python-libpamtest

+ %description -n python2-libpamtest

  If you plan to develop python tests for a PAM module you can use this

  library, which simplifies testing of modules. This subpackage includes

  the header files for libpamtest
@@ -75,6 +78,7 @@ 

  

  %prep

  %setup -q

+ %patch0001 -p1

  

  

  %build
@@ -108,7 +112,7 @@ 

  

  %check

  pushd obj

- ctest -V

+ LD_LIBRARY_PATH=`pwd`/src ctest --output-on-failure

  popd

  

  %files
@@ -143,12 +147,24 @@ 

  %defattr(-,root,root,-)

  %doc obj/doc/html

  

- %files -n python-libpamtest

+ %files -n python2-libpamtest

  %defattr(-,root,root,-)

- %{python2_sitearch}/pypamtest.so

+ %{python_sitearch}/pypamtest.so

  

  

  %changelog

+ * Mon Oct 01 2018 Andreas Schneider <asn@redhat.com> - 1.0.7-2

+ - Fix upgrade path for python-libpamtest

+ 

+ * Wed Sep 26 2018 Andreas Schneider <asn@redhat.com> - 1.0.7-1

+ - Update to version 1.0.7

+ 

+ * Thu Jun  2 2016 Jakub Hrozek <jakub.hrozek@posteo.se> - 1.0.1-2

+ - New upstream release 1.0.2

+ 

+ * Fri Apr 22 2016 Jakub Hrozek <jhrozek@redhat.com> - 1.0.1-3

+ - Use Requires, not Recommends for EPEL

+ 

  * Tue Jan 19 2016 Jakub Hrozek <jakub.hrozek@posteo.se> - 1.0.1-2

  - Fix review comments from rhbz#1299637

  

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

- 3336b38247d67a60b32b033769cd480f  pam_wrapper-1.0.1.tar.gz

+ SHA512 (pam_wrapper-1.0.7.tar.gz) = 14b182a99d1a95905d4e58b2b20d4d13538a75d9397768638a64ddf903688114ab58fb283e0425800b42387eda3a9c9e8b827d4f90c51ab3ac4e93d48563b11f

There is downstream only patch pypamtest_test.py because it does not make a sense to support python2.6 in upstream.
And such version of patch is not upstream ready.

@asn PTAL and create build + bodhi update

Pull-Request has been merged by asn

5 years ago