[Pkg-privacy-commits] [Git][pkg-privacy-team/mat2][debian/0.4.0-1] 13 commits: debian/patches: Add patch to fix tests if invoked via autopkgtest

Georg Faerber gitlab at salsa.debian.org
Thu Oct 4 21:13:42 BST 2018


Georg Faerber pushed to branch debian/0.4.0-1 at Privacy Maintainers / mat2


Commits:
9a820184 by Georg Faerber at 2018-10-04T19:54:16Z
debian/patches: Add patch to fix tests if invoked via autopkgtest

- - - - -
0e3084b6 by Georg Faerber at 2018-10-04T19:54:51Z
debian/patches: Add patch to fix shebang, forwarded upstream

- - - - -
45f92091 by Georg Faerber at 2018-10-04T19:54:53Z
debian/control: Depends: Drop python-nautilus, see bug #907591

- - - - -
e1f06d01 by Georg Faerber at 2018-10-04T19:54:53Z
debian/mat2.install: Don't install nautilus extension for now (#907591)

- - - - -
96f9741f by Georg Faerber at 2018-10-04T19:54:53Z
debian/mat2.install: Rename mat2.py to mat2

- - - - -
0a1b87d5 by Georg Faerber at 2018-10-04T19:54:54Z
debian/mat2.manpages: Install manpage for mat2

- - - - -
6c62e793 by Georg Faerber at 2018-10-04T19:54:54Z
debian/rules: Check $DEB_BUILD_OPTIONS for 'nocheck'

- - - - -
1d1611ee by Georg Faerber at 2018-10-04T19:54:54Z
debian/control: Section: Use 'utils' instead of 'python'

- - - - -
667f7a03 by Georg Faerber at 2018-10-04T19:54:54Z
debian/control: BD: Require debhelper >= 11~

- - - - -
59c6cadd by Georg Faerber at 2018-10-04T19:54:54Z
debian/control: Depend on packages, instead of only recommending them

For a related discussion, see: https://lists.debian.org/debian-ci/2018/06/msg00016.html

- - - - -
45f95467 by Georg Faerber at 2018-10-04T19:54:54Z
debian/tests/control: Drop deprecated 'needs-recommends' restriction

For the related discussion, see https://lists.debian.org/debian-ci/2018/06/msg00016.html

- - - - -
b7f88030 by Georg Faerber at 2018-10-04T19:58:56Z
debian/tests/test-installed: Export env var to call /usr/bin/env mat2

- - - - -
60ad7c88 by Georg Faerber at 2018-10-04T19:59:02Z
debian/changelog: Debian release 0.4.0-1

- - - - -


10 changed files:

- debian/changelog
- debian/control
- debian/mat2.install
- + debian/mat2.manpages
- + debian/patches/0001-autopkgtest-fix-tests.patch
- + debian/patches/0002-fix-shebang.patch
- debian/patches/series
- debian/rules
- debian/tests/control
- debian/tests/test-installed


Changes:

=====================================
debian/changelog
=====================================
@@ -1,5 +1,6 @@
-mat2 (0.1.1-1) unstable; urgency=medium
+mat2 (0.4.0-1) unstable; urgency=medium
 
+  [ Jonas Meurer ]
   * Initial release. (Closes: #898622)
 
- -- Jonas Meurer <jonas at freesources.org>  Fri, 18 May 2018 21:14:19 +0200
+ -- Georg Faerber <georg at riseup.net>  Thu, 04 Oct 2018 19:56:23 +0000


=====================================
debian/control
=====================================
@@ -1,10 +1,10 @@
 Source: mat2
-Section: python
+Section: utils
 Priority: optional
 Maintainer: Debian Privacy Tools Maintainers <pkg-privacy-maintainers at lists.alioth.debian.org>
 Uploaders: Georg Faerber <georg at riseup.net>,
            Jonas Meurer <jonas at freesources.org>,
-Build-Depends: debhelper (>= 11),
+Build-Depends: debhelper (>= 11~),
                dh-exec,
                dh-python,
                gir1.2-gdkpixbuf-2.0,
@@ -22,13 +22,13 @@ Vcs-Browser: https://salsa.debian.org/pkg-privacy-team/mat2
 
 Package: mat2
 Architecture: all
-Depends: ${misc:Depends}, ${python3:Depends}
-Recommends: gir1.2-gdkpixbuf-2.0,
-            gir1.2-poppler-0.18,
-            libimage-exiftool-perl,
-            python-nautilus,
-            python3-gi-cairo,
-            python3-mutagen,
+Depends: gir1.2-gdkpixbuf-2.0,
+         gir1.2-poppler-0.18,
+         libimage-exiftool-perl,
+         python3-gi-cairo,
+         python3-mutagen,
+         ${misc:Depends},
+         ${python3:Depends},
 Description: Metadata anonymisation toolkit v2
  Metadata consist of information that characterizes data. Metadata are
  used to provide documentation for data products. In essence, metadata


=====================================
debian/mat2.install
=====================================
@@ -1,3 +1,2 @@
 #!/usr/bin/dh-exec
-mat2.py => /usr/bin/mat2
-nautilus/nautilus_mat2.py => /usr/share/nautilus-python/extensions/mat2.py
+mat2 => /usr/bin/mat2


=====================================
debian/mat2.manpages
=====================================
@@ -0,0 +1 @@
+doc/mat2.1


=====================================
debian/patches/0001-autopkgtest-fix-tests.patch
=====================================
@@ -0,0 +1,194 @@
+Description: autopkgtest: fix tests
+  Some tests invoke the mat2 binary via './mat2'. This fails during
+  autopkgtest, as the software "as installed" should be tested, and
+  therefore, the 'tests' directory and the binary are not stored in the
+  same directory. The following upstream patch fixes this via
+  introducing an environment variable, which, if set, calls the binary
+  stored in '/usr/bin/'.
+
+Author: Georg Faerber <georg at riseup.net>
+Upstream: https://0xacab.org/jvoisin/mat2/issues/16#note_153878
+Last-Update: 2018-10-04
+--
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/tests/test_climat2.py
++++ b/tests/test_climat2.py
+@@ -4,16 +4,24 @@
+ import unittest
+ 
+ 
++mat2_binary = ['./mat2']
++
++if 'MAT2_GLOBAL_PATH_TESTSUITE' in os.environ:
++    # Debian runs tests after installing the package
++    # https://0xacab.org/jvoisin/mat2/issues/16#note_153878
++    mat2_binary = ['/usr/bin/env', 'mat2']
++
++
+ class TestHelp(unittest.TestCase):
+     def test_help(self):
+-        proc = subprocess.Popen(['./mat2', '--help'], stdout=subprocess.PIPE)
++        proc = subprocess.Popen(mat2_binary + ['--help'], stdout=subprocess.PIPE)
+         stdout, _ = proc.communicate()
+         self.assertIn(b'usage: mat2 [-h] [-v] [-l] [--check-dependencies] [-V]',
+                       stdout)
+         self.assertIn(b'[--unknown-members policy] [-s | -L]', stdout)
+ 
+     def test_no_arg(self):
+-        proc = subprocess.Popen(['./mat2'], stdout=subprocess.PIPE)
++        proc = subprocess.Popen(mat2_binary, stdout=subprocess.PIPE)
+         stdout, _ = proc.communicate()
+         self.assertIn(b'usage: mat2 [-h] [-v] [-l] [--check-dependencies] [-V]',
+                       stdout)
+@@ -22,29 +30,29 @@
+ 
+ class TestVersion(unittest.TestCase):
+     def test_version(self):
+-        proc = subprocess.Popen(['./mat2', '--version'], stdout=subprocess.PIPE)
++        proc = subprocess.Popen(mat2_binary + ['--version'], stdout=subprocess.PIPE)
+         stdout, _ = proc.communicate()
+         self.assertTrue(stdout.startswith(b'MAT2 '))
+ 
+ class TestDependencies(unittest.TestCase):
+     def test_dependencies(self):
+-        proc = subprocess.Popen(['./mat2', '--check-dependencies'], stdout=subprocess.PIPE)
++        proc = subprocess.Popen(mat2_binary + ['--check-dependencies'], stdout=subprocess.PIPE)
+         stdout, _ = proc.communicate()
+         self.assertTrue(b'MAT2' in stdout)
+ 
+ class TestReturnValue(unittest.TestCase):
+     def test_nonzero(self):
+-        ret = subprocess.call(['./mat2', './mat2'], stdout=subprocess.DEVNULL)
++        ret = subprocess.call(mat2_binary + ['mat2'], stdout=subprocess.DEVNULL)
+         self.assertEqual(255, ret)
+ 
+-        ret = subprocess.call(['./mat2', '--whololo'], stderr=subprocess.DEVNULL)
++        ret = subprocess.call(mat2_binary + ['--whololo'], stderr=subprocess.DEVNULL)
+         self.assertEqual(2, ret)
+ 
+     def test_zero(self):
+-        ret = subprocess.call(['./mat2'], stdout=subprocess.DEVNULL)
++        ret = subprocess.call(mat2_binary, stdout=subprocess.DEVNULL)
+         self.assertEqual(0, ret)
+ 
+-        ret = subprocess.call(['./mat2', '--show', './mat2'], stdout=subprocess.DEVNULL)
++        ret = subprocess.call(mat2_binary + ['--show', 'mat2'], stdout=subprocess.DEVNULL)
+         self.assertEqual(0, ret)
+ 
+ 
+@@ -57,19 +65,19 @@
+         shutil.copy('./tests/data/dirty.jpg', './tests/data/folder/clean1.jpg')
+         shutil.copy('./tests/data/dirty.jpg', './tests/data/folder/clean2.jpg')
+ 
+-        proc = subprocess.Popen(['./mat2', '--show', './tests/data/folder/'],
++        proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/folder/'],
+                 stdout=subprocess.PIPE)
+         stdout, _ = proc.communicate()
+         self.assertIn(b'Comment: Created with GIMP', stdout)
+ 
+-        proc = subprocess.Popen(['./mat2', './tests/data/folder/'],
++        proc = subprocess.Popen(mat2_binary + ['./tests/data/folder/'],
+                 stdout=subprocess.PIPE)
+         stdout, _ = proc.communicate()
+ 
+         os.remove('./tests/data/folder/clean1.jpg')
+         os.remove('./tests/data/folder/clean2.jpg')
+ 
+-        proc = subprocess.Popen(['./mat2', '--show', './tests/data/folder/'],
++        proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/folder/'],
+                 stdout=subprocess.PIPE)
+         stdout, _ = proc.communicate()
+         self.assertNotIn(b'Comment: Created with GIMP', stdout)
+@@ -81,16 +89,16 @@
+     def test_jpg(self):
+         shutil.copy('./tests/data/dirty.jpg', './tests/data/clean.jpg')
+ 
+-        proc = subprocess.Popen(['./mat2', '--show', './tests/data/clean.jpg'],
++        proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/clean.jpg'],
+                 stdout=subprocess.PIPE)
+         stdout, _ = proc.communicate()
+         self.assertIn(b'Comment: Created with GIMP', stdout)
+ 
+-        proc = subprocess.Popen(['./mat2', './tests/data/clean.jpg'],
++        proc = subprocess.Popen(mat2_binary + ['./tests/data/clean.jpg'],
+                 stdout=subprocess.PIPE)
+         stdout, _ = proc.communicate()
+ 
+-        proc = subprocess.Popen(['./mat2', '--show', './tests/data/clean.cleaned.jpg'],
++        proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/clean.cleaned.jpg'],
+                 stdout=subprocess.PIPE)
+         stdout, _ = proc.communicate()
+         self.assertNotIn(b'Comment: Created with GIMP', stdout)
+@@ -100,32 +108,32 @@
+ 
+ class TestIsSupported(unittest.TestCase):
+     def test_pdf(self):
+-        proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.pdf'],
++        proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/dirty.pdf'],
+                 stdout=subprocess.PIPE)
+         stdout, _ = proc.communicate()
+         self.assertNotIn(b"isn't supported", stdout)
+ 
+ class TestGetMeta(unittest.TestCase):
+     def test_pdf(self):
+-        proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.pdf'],
++        proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/dirty.pdf'],
+                 stdout=subprocess.PIPE)
+         stdout, _ = proc.communicate()
+         self.assertIn(b'producer: pdfTeX-1.40.14', stdout)
+ 
+     def test_png(self):
+-        proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.png'],
++        proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/dirty.png'],
+                 stdout=subprocess.PIPE)
+         stdout, _ = proc.communicate()
+         self.assertIn(b'Comment: This is a comment, be careful!', stdout)
+ 
+     def test_jpg(self):
+-        proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.jpg'],
++        proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/dirty.jpg'],
+                 stdout=subprocess.PIPE)
+         stdout, _ = proc.communicate()
+         self.assertIn(b'Comment: Created with GIMP', stdout)
+ 
+     def test_docx(self):
+-        proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.docx'],
++        proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/dirty.docx'],
+                 stdout=subprocess.PIPE)
+         stdout, _ = proc.communicate()
+         self.assertIn(b'Application: LibreOffice/5.4.5.1$Linux_X86_64', stdout)
+@@ -133,7 +141,7 @@
+         self.assertIn(b'revision: 1', stdout)
+ 
+     def test_odt(self):
+-        proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.odt'],
++        proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/dirty.odt'],
+                 stdout=subprocess.PIPE)
+         stdout, _ = proc.communicate()
+         self.assertIn(b'generator: LibreOffice/3.3$Unix', stdout)
+@@ -141,14 +149,14 @@
+         self.assertIn(b'date_time: 2011-07-26 02:40:16', stdout)
+ 
+     def test_mp3(self):
+-        proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.mp3'],
++        proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/dirty.mp3'],
+                 stdout=subprocess.PIPE)
+         stdout, _ = proc.communicate()
+         self.assertIn(b'TALB: harmfull', stdout)
+         self.assertIn(b'COMM::: Thank you for using MAT !', stdout)
+ 
+     def test_flac(self):
+-        proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.flac'],
++        proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/dirty.flac'],
+                 stdout=subprocess.PIPE)
+         stdout, _ = proc.communicate()
+         self.assertIn(b'comments: Thank you for using MAT !', stdout)
+@@ -156,7 +164,7 @@
+         self.assertIn(b'title: I am so', stdout)
+ 
+     def test_ogg(self):
+-        proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.ogg'],
++        proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/dirty.ogg'],
+                 stdout=subprocess.PIPE)
+         stdout, _ = proc.communicate()
+         self.assertIn(b'comments: Thank you for using MAT !', stdout)


=====================================
debian/patches/0002-fix-shebang.patch
=====================================
@@ -0,0 +1,14 @@
+Description: fix shebang
+Author: Georg Faerber <georg at riseup.net>
+Forwarded: https://0xacab.org/jvoisin/mat2/merge_requests/19
+Last-Update: 2018-10-03
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/libmat2/__init__.py
++++ b/libmat2/__init__.py
+@@ -1,4 +1,4 @@
+-#!/bin/env python3
++#!/usr/bin/env python3
+ 
+ import os
+ import collections


=====================================
debian/patches/series
=====================================
@@ -0,0 +1,2 @@
+0002-fix-shebang.patch
+0001-autopkgtest-fix-tests.patch


=====================================
debian/rules
=====================================
@@ -6,5 +6,6 @@ export DH_VERBOSE=1
 	dh $@ --with python3 --buildsystem=pybuild
 
 override_dh_auto_test:
-	python3 -m unittest discover
-	dh_auto_test
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+	python3 -m unittest discover -v
+endif


=====================================
debian/tests/control
=====================================
@@ -1,3 +1,3 @@
 Tests: test-installed
 Depends: @
-Restrictions: allow-stderr, needs-recommends
+Restrictions: allow-stderr


=====================================
debian/tests/test-installed
=====================================
@@ -3,8 +3,6 @@
 #                    source tree
 set -e
 
-WORKDIR=$(mktemp -d)
-cp -prv test/* $WORKDIR
-trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
-cd $WORKDIR
+export MAT2_GLOBAL_PATH_TESTSUITE
+
 python3 -m unittest discover -v



View it on GitLab: https://salsa.debian.org/pkg-privacy-team/mat2/compare/7bd4db66a3c86f6244f6575ccaab58558878e6be...60ad7c8898e9509a962c63381181ea299a8814cf

-- 
View it on GitLab: https://salsa.debian.org/pkg-privacy-team/mat2/compare/7bd4db66a3c86f6244f6575ccaab58558878e6be...60ad7c8898e9509a962c63381181ea299a8814cf
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-privacy-commits/attachments/20181004/bbccd69c/attachment-0001.html>


More information about the Pkg-privacy-commits mailing list