Control: tags 947031 + pending

Dear maintainer,

I've prepared an NMU for python-libarchive-c (versioned 2.9-0.1)

The change can be smaller if you would like to cherry-pick the upstream commit, as the patch from the bug submitter.

I also took the liberty to update Standards-Version to current 4.5.0 and change a folder in autopkgtest as lintian suggested.

I have run autopkgtest against diffoscope to verify that it's tests still passes.

Regards,
Håvard
diff -Nru python-libarchive-c-2.8/debian/changelog 
python-libarchive-c-2.9/debian/changelog
--- python-libarchive-c-2.8/debian/changelog    2019-10-08 02:24:30.000000000 
+0200
+++ python-libarchive-c-2.9/debian/changelog    2020-02-17 17:17:23.000000000 
+0100
@@ -1,3 +1,13 @@
+python-libarchive-c (2.9-0.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * New upstream version 2.9
+    - Version is compatible with python3.8 closes: #947031
+  * Update Standards-Version to 4.5.0
+  * Change from ADTTMP to AUTOPKGTEST_TMP in d/tests/upstream-tests
+
+ -- Håvard Flaget Aasen <haavard_aa...@yahoo.no>  Mon, 17 Feb 2020 17:17:23 
+0100
+
 python-libarchive-c (2.8-0.4) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru python-libarchive-c-2.8/debian/control 
python-libarchive-c-2.9/debian/control
--- python-libarchive-c-2.8/debian/control      2019-10-08 02:23:51.000000000 
+0200
+++ python-libarchive-c-2.9/debian/control      2020-02-17 17:09:27.000000000 
+0100
@@ -9,7 +9,7 @@
                python3-mock,
                python3-pytest,
                python3-setuptools
-Standards-Version: 4.3.0
+Standards-Version: 4.5.0
 Rules-Requires-Root: no
 Homepage: https://github.com/Changaco/python-libarchive-c
 Vcs-Browser: https://salsa.debian.org/debian/python-libarchive-c
diff -Nru python-libarchive-c-2.8/debian/tests/upstream-tests 
python-libarchive-c-2.9/debian/tests/upstream-tests
--- python-libarchive-c-2.8/debian/tests/upstream-tests 2019-10-08 
02:24:24.000000000 +0200
+++ python-libarchive-c-2.9/debian/tests/upstream-tests 2020-02-17 
16:44:57.000000000 +0100
@@ -2,13 +2,13 @@
 
 set -e
 
-if ! [ -d "$ADTTMP" ]; then
-       echo "ADTTMP not set." >&2
+if ! [ -d "$AUTOPKGTEST_TMP" ]; then
+       echo "AUTOPKGTEST_TMP not set." >&2
        exit 1
 fi
 
-cp -rv tests "$ADTTMP"
-cd "$ADTTMP"
+cp -rv tests "$AUTOPKGTEST_TMP"
+cd "$AUTOPKGTEST_TMP"
 mkdir -v libarchive
 touch README.rst
 py.test-3 tests -vv -l -r a
diff -Nru python-libarchive-c-2.8/libarchive/entry.py 
python-libarchive-c-2.9/libarchive/entry.py
--- python-libarchive-c-2.8/libarchive/entry.py 2018-06-10 15:01:15.000000000 
+0200
+++ python-libarchive-c-2.9/libarchive/entry.py 2019-10-20 13:18:23.000000000 
+0200
@@ -24,6 +24,8 @@
 
 class ArchiveEntry(object):
 
+    __slots__ = ('_archive_p', '_entry_p')
+
     def __init__(self, archive_p, entry_p):
         self._archive_p = archive_p
         self._entry_p = entry_p
diff -Nru python-libarchive-c-2.8/libarchive/ffi.py 
python-libarchive-c-2.9/libarchive/ffi.py
--- python-libarchive-c-2.8/libarchive/ffi.py   2018-06-10 15:27:14.000000000 
+0200
+++ python-libarchive-c-2.9/libarchive/ffi.py   2019-10-20 13:18:23.000000000 
+0200
@@ -162,18 +162,18 @@
     try:
         ffi('read_support_format_'+f_name, [c_archive_p], c_int, check_int)
     except AttributeError:  # pragma: no cover
-        logger.warning('read format "%s" is not supported' % f_name)
+        logger.info('read format "%s" is not supported' % f_name)
         READ_FORMATS.remove(f_name)
 
 READ_FILTERS = set((
     'all', 'bzip2', 'compress', 'grzip', 'gzip', 'lrzip', 'lzip', 'lzma',
-    'lzop', 'none', 'rpm', 'uu', 'xz', 'lz4'
+    'lzop', 'none', 'rpm', 'uu', 'xz', 'lz4', 'zstd'
 ))
 for f_name in list(READ_FILTERS):
     try:
         ffi('read_support_filter_'+f_name, [c_archive_p], c_int, check_int)
     except AttributeError:  # pragma: no cover
-        logger.warning('read filter "%s" is not supported' % f_name)
+        logger.info('read filter "%s" is not supported' % f_name)
         READ_FILTERS.remove(f_name)
 
 ffi('read_open',
@@ -224,18 +224,18 @@
     try:
         ffi('write_set_format_'+f_name, [c_archive_p], c_int, check_int)
     except AttributeError:  # pragma: no cover
-        logger.warning('write format "%s" is not supported' % f_name)
+        logger.info('write format "%s" is not supported' % f_name)
         WRITE_FORMATS.remove(f_name)
 
 WRITE_FILTERS = set((
     'b64encode', 'bzip2', 'compress', 'grzip', 'gzip', 'lrzip', 'lzip', 'lzma',
-    'lzop', 'uuencode', 'xz', 'lz4'
+    'lzop', 'uuencode', 'xz', 'lz4', 'zstd'
 ))
 for f_name in list(WRITE_FILTERS):
     try:
         ffi('write_add_filter_'+f_name, [c_archive_p], c_int, check_int)
     except AttributeError:  # pragma: no cover
-        logger.warning('write filter "%s" is not supported' % f_name)
+        logger.info('write filter "%s" is not supported' % f_name)
         WRITE_FILTERS.remove(f_name)
 
 ffi('write_open',
diff -Nru python-libarchive-c-2.8/libarchive/__init__.py 
python-libarchive-c-2.9/libarchive/__init__.py
--- python-libarchive-c-2.8/libarchive/__init__.py      2018-06-10 
15:01:15.000000000 +0200
+++ python-libarchive-c-2.9/libarchive/__init__.py      2019-10-20 
13:18:23.000000000 +0200
@@ -6,10 +6,10 @@
 )
 from .write import custom_writer, fd_writer, file_writer, memory_writer
 
-__all__ = [
+__all__ = [x.__name__ for x in (
     ArchiveEntry,
     ArchiveError,
     extract_fd, extract_file, extract_memory,
     custom_reader, fd_reader, file_reader, memory_reader, stream_reader,
     custom_writer, fd_writer, file_writer, memory_writer
-]
+)]
diff -Nru python-libarchive-c-2.8/libarchive/write.py 
python-libarchive-c-2.9/libarchive/write.py
--- python-libarchive-c-2.8/libarchive/write.py 2018-06-10 15:27:14.000000000 
+0200
+++ python-libarchive-c-2.9/libarchive/write.py 2019-10-20 14:34:28.000000000 
+0200
@@ -77,25 +77,40 @@
 
     def add_file_from_memory(
             self, entry_path, entry_size, entry_data,
-            filetype=REGULAR_FILE,
-            permission=DEFAULT_UNIX_PERMISSION
+            filetype=REGULAR_FILE, permission=DEFAULT_UNIX_PERMISSION,
+            atime=None, mtime=None, ctime=None, birthtime=None,
     ):
         """"Add file from memory to archive.
 
         :param entry_path: where entry should be places in archive
         :type entry_path: str
-        :param entry_size: entire size of entry
+        :param entry_size: entire size of entry in bytes
         :type entry_size: int
         :param entry_data: content of entry
-        :type entry_data: iterable
+        :type entry_data: bytes or Iterable[bytes]
         :param filetype: which type of file: normal, symlink etc.
         should entry be created as
         :type filetype: octal number
         :param permission: with which permission should entry be created
         :type permission: octal number
+        :param atime: Last access time
+        :type atime: int seconds or tuple (int seconds, int nanoseconds)
+        :param mtime: Last modified time
+        :type mtime: int seconds or tuple (int seconds, int nanoseconds)
+        :param ctime: Creation time
+        :type ctime: int seconds or tuple (int seconds, int nanoseconds)
+        :param birthtime: Birth time (for archive formats that support it)
+        :type birthtime: int seconds or tuple (int seconds, int nanoseconds)
         """
         archive_pointer = self._pointer
 
+        if isinstance(entry_data, bytes):
+            entry_data = (entry_data,)
+        elif isinstance(entry_data, str):
+            raise TypeError(
+                "entry_data: expected bytes, got %r" % type(entry_data)
+            )
+
         with new_archive_entry() as archive_entry_pointer:
             archive_entry = ArchiveEntry(None, archive_entry_pointer)
 
@@ -103,6 +118,23 @@
             entry_set_size(archive_entry_pointer, entry_size)
             entry_set_filetype(archive_entry_pointer, filetype)
             entry_set_perm(archive_entry_pointer, permission)
+
+            if atime is not None:
+                if not isinstance(atime, tuple):
+                    atime = (atime, 0)
+                archive_entry.set_atime(*atime)
+            if mtime is not None:
+                if not isinstance(mtime, tuple):
+                    mtime = (mtime, 0)
+                archive_entry.set_mtime(*mtime)
+            if ctime is not None:
+                if not isinstance(ctime, tuple):
+                    ctime = (ctime, 0)
+                archive_entry.set_ctime(*ctime)
+            if birthtime is not None:
+                if not isinstance(birthtime, tuple):
+                    birthtime = (birthtime, 0)
+                archive_entry.set_birthtime(*birthtime)
             write_header(archive_pointer, archive_entry_pointer)
 
             for chunk in entry_data:
diff -Nru python-libarchive-c-2.8/libarchive_c.egg-info/PKG-INFO 
python-libarchive-c-2.9/libarchive_c.egg-info/PKG-INFO
--- python-libarchive-c-2.8/libarchive_c.egg-info/PKG-INFO      2018-06-10 
15:30:39.000000000 +0200
+++ python-libarchive-c-2.9/libarchive_c.egg-info/PKG-INFO      2019-10-20 
14:40:31.000000000 +0200
@@ -1,6 +1,6 @@
-Metadata-Version: 1.0
+Metadata-Version: 2.1
 Name: libarchive-c
-Version: 2.8
+Version: 2.9
 Summary: Python interface to libarchive
 Home-page: https://github.com/Changaco/python-libarchive-c
 Author: Changaco
@@ -22,11 +22,21 @@
         Compatibility
         =============
         
+        python
+        ------
+        
         python-libarchive-c is currently tested with python 2.7, 3.4, 3.5, and 
3.6.
         
         If you find an incompatibility with older versions you can send us a 
small patch,
         but we won't accept big changes.
         
+        libarchive
+        ----------
+        
+        python-libarchive-c may not work properly with obsolete versions of 
libarchive such as the ones included in MacOS. In that case you can install a 
recent version of libarchive (e.g. with ``brew install libarchive`` on MacOS) 
and use the ``LIBARCHIVE`` environment variable to point python-libarchive-c to 
it::
+        
+            export 
LIBARCHIVE=/usr/local/Cellar/libarchive/3.3.3/lib/libarchive.13.dylib
+        
         Usage
         =====
         
@@ -68,3 +78,4 @@
         
 Keywords: archive libarchive 7z tar bz2 zip gz
 Platform: UNKNOWN
+Description-Content-Type: text/x-rst
diff -Nru python-libarchive-c-2.8/PKG-INFO python-libarchive-c-2.9/PKG-INFO
--- python-libarchive-c-2.8/PKG-INFO    2018-06-10 15:30:39.000000000 +0200
+++ python-libarchive-c-2.9/PKG-INFO    2019-10-20 14:40:31.000000000 +0200
@@ -1,6 +1,6 @@
-Metadata-Version: 1.0
+Metadata-Version: 2.1
 Name: libarchive-c
-Version: 2.8
+Version: 2.9
 Summary: Python interface to libarchive
 Home-page: https://github.com/Changaco/python-libarchive-c
 Author: Changaco
@@ -22,11 +22,21 @@
         Compatibility
         =============
         
+        python
+        ------
+        
         python-libarchive-c is currently tested with python 2.7, 3.4, 3.5, and 
3.6.
         
         If you find an incompatibility with older versions you can send us a 
small patch,
         but we won't accept big changes.
         
+        libarchive
+        ----------
+        
+        python-libarchive-c may not work properly with obsolete versions of 
libarchive such as the ones included in MacOS. In that case you can install a 
recent version of libarchive (e.g. with ``brew install libarchive`` on MacOS) 
and use the ``LIBARCHIVE`` environment variable to point python-libarchive-c to 
it::
+        
+            export 
LIBARCHIVE=/usr/local/Cellar/libarchive/3.3.3/lib/libarchive.13.dylib
+        
         Usage
         =====
         
@@ -68,3 +78,4 @@
         
 Keywords: archive libarchive 7z tar bz2 zip gz
 Platform: UNKNOWN
+Description-Content-Type: text/x-rst
diff -Nru python-libarchive-c-2.8/README.rst python-libarchive-c-2.9/README.rst
--- python-libarchive-c-2.8/README.rst  2018-06-10 13:44:41.000000000 +0200
+++ python-libarchive-c-2.9/README.rst  2018-12-06 11:57:08.000000000 +0100
@@ -14,11 +14,21 @@
 Compatibility
 =============
 
+python
+------
+
 python-libarchive-c is currently tested with python 2.7, 3.4, 3.5, and 3.6.
 
 If you find an incompatibility with older versions you can send us a small 
patch,
 but we won't accept big changes.
 
+libarchive
+----------
+
+python-libarchive-c may not work properly with obsolete versions of libarchive 
such as the ones included in MacOS. In that case you can install a recent 
version of libarchive (e.g. with ``brew install libarchive`` on MacOS) and use 
the ``LIBARCHIVE`` environment variable to point python-libarchive-c to it::
+
+    export 
LIBARCHIVE=/usr/local/Cellar/libarchive/3.3.3/lib/libarchive.13.dylib
+
 Usage
 =====
 
diff -Nru python-libarchive-c-2.8/setup.cfg python-libarchive-c-2.9/setup.cfg
--- python-libarchive-c-2.8/setup.cfg   2018-06-10 15:30:39.000000000 +0200
+++ python-libarchive-c-2.9/setup.cfg   2019-10-20 14:40:31.000000000 +0200
@@ -3,7 +3,7 @@
 
 [flake8]
 exclude = .?*,env*/
-ignore = E226,E731
+ignore = E226,E731,W504
 max-line-length = 80
 
 [egg_info]
diff -Nru python-libarchive-c-2.8/setup.py python-libarchive-c-2.9/setup.py
--- python-libarchive-c-2.8/setup.py    2016-11-29 19:03:27.000000000 +0100
+++ python-libarchive-c-2.9/setup.py    2019-10-20 14:39:01.000000000 +0200
@@ -17,5 +17,6 @@
     license='CC0',
     packages=find_packages(exclude=['tests']),
     long_description=open(join(dirname(__file__), 'README.rst')).read(),
+    long_description_content_type='text/x-rst',
     keywords='archive libarchive 7z tar bz2 zip gz',
 )
diff -Nru python-libarchive-c-2.8/tests/__init__.py 
python-libarchive-c-2.9/tests/__init__.py
--- python-libarchive-c-2.8/tests/__init__.py   2018-06-10 13:44:59.000000000 
+0200
+++ python-libarchive-c-2.9/tests/__init__.py   2019-10-20 13:18:23.000000000 
+0200
@@ -6,6 +6,10 @@
 from os.path import abspath, dirname, join
 from stat import S_ISREG
 import tarfile
+try:
+    from stat import filemode
+except ImportError:  # Python 2
+    filemode = tarfile.filemode
 
 from libarchive import file_reader
 
@@ -83,7 +87,7 @@
                 path += '/'
             # libarchive introduces prefixes such as h prefix for
             # hardlinks: tarfile does not, so we ignore the first char
-            mode = tarfile.filemode(entry.mode)[1:]
+            mode = filemode(entry.mode)[1:]
             yield {
                 'path': path,
                 'mtime': entry.mtime,
diff -Nru python-libarchive-c-2.8/tests/test_entry.py 
python-libarchive-c-2.9/tests/test_entry.py
--- python-libarchive-c-2.8/tests/test_entry.py 2018-06-10 13:44:59.000000000 
+0200
+++ python-libarchive-c-2.9/tests/test_entry.py 2019-10-20 13:18:23.000000000 
+0200
@@ -7,12 +7,15 @@
 import locale
 from os import environ, stat
 from os.path import join
+import unicodedata
 
 from libarchive import memory_reader, memory_writer
 
 from . import data_dir, get_entries, get_tarinfos
 
 
+text_type = unicode if str is bytes else str  # noqa: F821
+
 locale.setlocale(locale.LC_ALL, '')
 
 # needed for sane time stamp comparison
@@ -93,4 +96,9 @@
         for key in ignore:
             e1.pop(key)
             e2.pop(key)
+        # Normalize all unicode (can vary depending on the system)
+        for d in (e1, e2):
+            for key in d:
+                if isinstance(d[key], text_type):
+                    d[key] = unicodedata.normalize('NFC', d[key])
         assert e1 == e2
diff -Nru python-libarchive-c-2.8/tests/test_rwx.py 
python-libarchive-c-2.9/tests/test_rwx.py
--- python-libarchive-c-2.8/tests/test_rwx.py   2018-06-10 15:01:15.000000000 
+0200
+++ python-libarchive-c-2.9/tests/test_rwx.py   2019-10-20 14:34:28.000000000 
+0200
@@ -1,12 +1,16 @@
 """Test reading, writing and extracting archives."""
 
 from __future__ import division, print_function, unicode_literals
+
 import io
+import json
 
 import libarchive
+from libarchive.entry import format_time
 from libarchive.extract import EXTRACT_OWNER, EXTRACT_PERM, EXTRACT_TIME
 from libarchive.write import memory_writer
 from mock import patch
+import pytest
 
 from . import check_archive, in_dir, treestat
 
@@ -115,24 +119,48 @@
     assert not write_fail_mock.called
 
 
-def test_adding_entry_from_memory():
-    entry_path = 'this is path'
-    entry_data = 'content'
-    entry_size = len(entry_data)
+@pytest.mark.parametrize(
+    'archfmt,data_bytes',
+    [('zip', b'content'),
+     ('gnutar', b''),
+     ('pax', json.dumps({'a': 1, 'b': 2, 'c': 3}).encode()),
+     ('7zip', b'lorem\0ipsum')])
+def test_adding_entry_from_memory(archfmt, data_bytes):
+    entry_path = 'testfile.data'
+    entry_data = data_bytes
+    entry_size = len(data_bytes)
 
     blocks = []
 
+    archfmt = 'zip'
+    has_birthtime = archfmt != 'zip'
+
+    atime = (1482144741, 495628118)
+    mtime = (1482155417, 659017086)
+    ctime = (1482145211, 536858081)
+    btime = (1482144740, 495628118) if has_birthtime else None
+
     def write_callback(data):
         blocks.append(data[:])
         return len(data)
 
-    with libarchive.custom_writer(write_callback, 'zip') as archive:
-        archive.add_file_from_memory(entry_path, entry_size, entry_data)
+    with libarchive.custom_writer(write_callback, archfmt) as archive:
+        archive.add_file_from_memory(
+            entry_path, entry_size, entry_data,
+            atime=atime, mtime=mtime, ctime=ctime, birthtime=btime
+        )
 
     buf = b''.join(blocks)
     with libarchive.memory_reader(buf) as memory_archive:
         for archive_entry in memory_archive:
-            assert entry_data.encode() == b''.join(
-                archive_entry.get_blocks()
-            )
+            expected = entry_data
+            actual = b''.join(archive_entry.get_blocks())
+            assert expected == actual
             assert archive_entry.path == entry_path
+            assert archive_entry.atime in (atime[0], format_time(*atime))
+            assert archive_entry.mtime in (mtime[0], format_time(*mtime))
+            assert archive_entry.ctime in (ctime[0], format_time(*ctime))
+            if has_birthtime:
+                assert archive_entry.birthtime in (
+                    btime[0], format_time(*btime)
+                )
diff -Nru python-libarchive-c-2.8/tox.ini python-libarchive-c-2.9/tox.ini
--- python-libarchive-c-2.8/tox.ini     2018-06-10 15:01:15.000000000 +0200
+++ python-libarchive-c-2.9/tox.ini     2019-10-20 13:18:23.000000000 +0200
@@ -1,11 +1,11 @@
 [tox]
-envlist=py27,py34,py35,py36
+envlist=py27,py35,py36,py37,py38
 skipsdist=True
 
 [testenv]
 passenv = LIBARCHIVE
 commands=
-    python -m pytest -vv --boxed --cov libarchive --cov-report term-missing 
{toxinidir}/tests {posargs}
+    python -m pytest -Wd -vv --boxed --cov libarchive --cov-report 
term-missing {toxinidir}/tests {posargs}
     flake8 {toxinidir}
 deps=
     flake8
diff -Nru python-libarchive-c-2.8/.travis.yml 
python-libarchive-c-2.9/.travis.yml
--- python-libarchive-c-2.8/.travis.yml 2018-06-10 15:01:15.000000000 +0200
+++ python-libarchive-c-2.9/.travis.yml 2019-10-20 13:18:23.000000000 +0200
@@ -2,9 +2,13 @@
 matrix:
   include:
     - python: 3.5
-      env: TOXENV=py27,py34,py35
+      env: TOXENV=py27,py35
     - python: 3.6
       env: TOXENV=py36
+    - python: 3.7
+      env: TOXENV=py37
+    - python: 3.8-dev
+      env: TOXENV=py38
 
 branches:
   only:
@@ -35,4 +39,4 @@
   email: false
 
 sudo: required
-dist: trusty
+dist: xenial

Reply via email to