[Pkg-privacy-commits] [Git][pkg-privacy-team/mat2][master] 7 commits: New upstream version 0.12.2

Georg Faerber (@georg) georg at debian.org
Sun Aug 29 13:40:45 BST 2021



Georg Faerber pushed to branch master at Privacy Maintainers / mat2


Commits:
8edc8161 by Georg Faerber at 2021-08-29T11:55:37+00:00
New upstream version 0.12.2
- - - - -
b3ecdce9 by Georg Faerber at 2021-08-29T11:55:43+00:00
Update upstream source from tag 'upstream/0.12.2'

Update to upstream version '0.12.2'
with Debian dir 8156a7bbdcccec3a05ab4326fc68d3834dc4924c
- - - - -
2d75fd65 by Georg Faerber at 2021-08-29T12:11:08+00:00
debian/patches: Drop obsolete patch to fix printing pdf files

- - - - -
c9a1764b by Georg Faerber at 2021-08-29T12:11:40+00:00
debian/patches: Drop obsolete patch to improve support wrt XLSX files

- - - - -
ab699753 by Georg Faerber at 2021-08-29T12:22:21+00:00
debian/control: Bump Standards-Version to 4.6.0, no changes necessary

- - - - -
a4d6b155 by Georg Faerber at 2021-08-29T12:25:57+00:00
debian/control: Mention added support of aiff files

- - - - -
7fd42989 by Georg Faerber at 2021-08-29T12:35:56+00:00
debian/changelog: Debian release 0.12.2-1

- - - - -


18 changed files:

- .gitlab-ci.yml
- CHANGELOG.md
- debian/changelog
- debian/control
- − debian/patches/0001-improve-support-for-xlsx-files.patch
- − debian/patches/0002-fix-printing-of-cleaned-pdf-files.patch
- − debian/patches/series
- doc/mat2.1
- dolphin/mat2.desktop
- libmat2/audio.py
- libmat2/images.py
- libmat2/office.py
- libmat2/pdf.py
- mat2
- nautilus/mat2.py
- setup.py
- + tests/data/dirty.aiff
- tests/test_libmat2.py


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -63,6 +63,7 @@ tests:debian:
 tests:debian_with_bubblewrap:
   image: $CONTAINER_REGISTRY:debian
   stage: test
+  allow_failure: true
   <<: *prepare_env
   script:
     - su - mat2 -c "python3-coverage run --branch -m unittest discover -s tests/"


=====================================
CHANGELOG.md
=====================================
@@ -1,3 +1,10 @@
+# 0.12.2 - 2021-08-29
+
+- Add support for aiff files
+- Improve MS Office support
+- Improve compatibility with newer/older version of mat2's dependencies
+- Fix possible issues with the resolution of processed pdf
+
 # 0.12.1 - 2021-03-19
 
 - Improve epub support


=====================================
debian/changelog
=====================================
@@ -1,3 +1,21 @@
+mat2 (0.12.2-1) unstable; urgency=medium
+
+  * New upstream version 0.12.2:
+    - Add support of aiff files.
+    - Improve support of MS Office (xlsx) files.
+    - Fix printing issues of cleaned pdf files.
+    - Tests:
+      - Fix expected output of ffmpeg >= 4.4. (Closes: #992912)
+      - Handle output of libimage-exiftool-perl >= 12.23. (Closes: #993209)
+  * debian/control:
+    - Bump Standards-Version to 4.6.0; no changes necessary.
+    - Mention added support of aiff files in description.
+  * debian/patches:
+    - Drop now obsolete patches to improve support of xlsx files and to fix
+      printing issues of cleaned pdf files.
+
+ -- Georg Faerber <georg at debian.org>  Sun, 29 Aug 2021 12:35:37 +0000
+
 mat2 (0.12.1-3) unstable; urgency=medium
 
   * debian/patches:


=====================================
debian/control
=====================================
@@ -15,7 +15,7 @@ Build-Depends: debhelper-compat (= 13),
                python3-gi-cairo,
                python3-mutagen,
                python3-setuptools,
-Standards-Version: 4.5.1
+Standards-Version: 4.6.0
 Homepage: https://0xacab.org/jvoisin/mat2
 Vcs-Git: https://salsa.debian.org/pkg-privacy-team/mat2.git
 Vcs-Browser: https://salsa.debian.org/pkg-privacy-team/mat2
@@ -57,6 +57,7 @@ Description: Metadata anonymisation toolkit v2
  any metadata, or better: use plain-text.
  .
  Formats supported to some extent are:
+    - Audio Interchange File Format (.aiff)
     - Audio Video Interleave (.avi)
     - Electronic Publication (.epub)
     - Free Lossless Audio Codec (.flac)


=====================================
debian/patches/0001-improve-support-for-xlsx-files.patch deleted
=====================================
@@ -1,37 +0,0 @@
-Description: Improve support of Open XML (xlsx) files
-Origin: upstream
-Applied-Upstream: bf0c777cb9159e220f636b0c019fe4957e4fea75, 0b094b594bd1db017ed3d063a10714f6b2a7b9f3
-Reviewed-by: Georg Faerber <georg at debian.org>
-Last-Update: 2021-07-29
----
-This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
-Index: mat2/libmat2/office.py
-===================================================================
---- mat2.orig/libmat2/office.py	2021-07-29 15:56:40.307190532 +0000
-+++ mat2/libmat2/office.py	2021-07-29 15:58:33.200905419 +0000
-@@ -88,6 +88,7 @@
-             r'^\[Content_Types\]\.xml$',
-             r'^_rels/\.rels$',
-             r'^xl/sharedStrings\.xml$',  # https://docs.microsoft.com/en-us/office/open-xml/working-with-the-shared-string-table
-+            r'^xl/calcChain\.xml$',
-             r'^(?:word|ppt|xl)/_rels/document\.xml\.rels$',
-             r'^(?:word|ppt|xl)/_rels/footer[0-9]*\.xml\.rels$',
-             r'^(?:word|ppt|xl)/_rels/header[0-9]*\.xml\.rels$',
-@@ -107,6 +108,9 @@
-             # TODO: check if p:bgRef can be randomized
-             r'^ppt/slideMasters/slideMaster[0-9]+\.xml',
-             r'^ppt/slideMasters/_rels/slideMaster[0-9]+\.xml\.rels',
-+            r'^xl/worksheets/_rels/sheet[0-9]+\.xml\.rels',
-+            r'^xl/drawings/vmlDrawing[0-9]+\.vml',
-+            r'^xl/drawings/drawing[0-9]+\.xml',
-         }))
-         self.files_to_omit = set(map(re.compile, {  # type: ignore
-             r'^\[trash\]/',
-@@ -123,6 +127,7 @@
-             # Additional presentation-wide properties like printing properties,
-             # presentation show properties etc.
-             r'^(?:word|ppt|xl)/presProps\.xml$',
-+            r'^(?:word|ppt|xl)/comments[0-9]+\.xml$',
- 
-             # we have an allowlist in self.files_to_keep,
-             # so we can trash everything else


=====================================
debian/patches/0002-fix-printing-of-cleaned-pdf-files.patch deleted
=====================================
@@ -1,48 +0,0 @@
-Description: Fix issues if printing cleaned pdf file
- pyCairo by default renders the PDF surfaces with a resolution of 72
- dpi which is so low that the bitmap gets blurred compared to original.
- Since pyCairo 1.12.0, a new method set_device_scale(x_scale, y_scale)
- is added, which allows changing the canvas resolution.
-Origin: upstream
-Applied-Upstream: 3b094ae449afbb2c375454c1ee76b76aa98648d4
-Reviewed-by: Georg Faerber <georg at debian.org>
-Last-Update: 2021-07-29
----
-This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
-Index: mat2/libmat2/pdf.py
-===================================================================
---- mat2.orig/libmat2/pdf.py	2021-07-29 16:11:46.254777280 +0000
-+++ mat2/libmat2/pdf.py	2021-07-29 16:12:42.239485144 +0000
-@@ -32,7 +32,7 @@
-     def __init__(self, filename):
-         super().__init__(filename)
-         self.uri = 'file://' + os.path.abspath(self.filename)
--        self.__scale = 2  # how much precision do we want for the render
-+        self.__scale = 200 / 72.0  # how much precision do we want for the render
-         try:  # Check now that the file is valid, to avoid surprises later
-             Poppler.Document.new_from_file(self.uri, None)
-         except GLib.GError:  # Invalid PDF
-@@ -90,8 +90,8 @@
-             page_width, page_height = page.get_size()
-             logging.info("Rendering page %d/%d", pagenum + 1, pages_count)
- 
--            width = int(page_width) * self.__scale
--            height = int(page_height) * self.__scale
-+            width = int(page_width * self.__scale)
-+            height = int(page_height * self.__scale)
-             img_surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
-             img_context = cairo.Context(img_surface)
- 
-@@ -105,7 +105,11 @@
-             buf.seek(0)
- 
-             img = cairo.ImageSurface.create_from_png(buf)
--            pdf_surface.set_size(page_width*self.__scale, page_height*self.__scale)
-+            if cairo.version_info < (1, 12, 0):
-+                pdf_surface.set_size(width, height)
-+            else:
-+                pdf_surface.set_size(page_width, page_height)
-+                pdf_surface.set_device_scale(1 / self.__scale, 1 / self.__scale)
-             pdf_context.set_source_surface(img, 0, 0)
-             pdf_context.paint()
-             pdf_context.show_page()  # draw pdf_context on pdf_surface


=====================================
debian/patches/series deleted
=====================================
@@ -1,2 +0,0 @@
-0002-fix-printing-of-cleaned-pdf-files.patch
-0001-improve-support-for-xlsx-files.patch


=====================================
doc/mat2.1
=====================================
@@ -1,4 +1,4 @@
-.TH mat2 "1" "March 2021" "mat2 0.12.1" "User Commands"
+.TH mat2 "1" "August 2021" "mat2 0.12.2" "User Commands"
 
 .SH NAME
 mat2 \- the metadata anonymisation toolkit 2


=====================================
dolphin/mat2.desktop
=====================================
@@ -6,6 +6,8 @@ Type=Service
 
 [Desktop Action cleanMetadata]
 Name=Clean metadata
+Name[de]=Metadaten löschen
 Name[es]=Limpiar metadatos
 Icon=/usr/share/icons/hicolor/scalable/apps/mat2.svg
 Exec=kdialog --yesno  "$( mat2 -s %U )" --title "Clean Metadata?" && mat2 %U
+Exec[de]=kdialog --yesno  "$( mat2 -s %U )" --title "Metadaten löschen?" && mat2 %U


=====================================
libmat2/audio.py
=====================================
@@ -90,3 +90,14 @@ class WAVParser(video.AbstractFFmpegParser):
                       'FileSize', 'FileType', 'FileTypeExtension',
                       'MIMEType', 'NumChannels', 'SampleRate', 'SourceFile',
                      }
+
+class AIFFParser(video.AbstractFFmpegParser):
+    mimetypes = {'audio/aiff', 'audio/x-aiff'}
+    meta_allowlist = {'AvgBytesPerSec', 'BitsPerSample', 'Directory',
+                      'Duration', 'Encoding', 'ExifToolVersion',
+                      'FileAccessDate', 'FileInodeChangeDate',
+                      'FileModifyDate', 'FileName', 'FilePermissions',
+                      'FileSize', 'FileType', 'FileTypeExtension',
+                      'MIMEType', 'NumChannels', 'SampleRate', 'SourceFile',
+                      'NumSampleFrames', 'SampleSize',
+                     }


=====================================
libmat2/images.py
=====================================
@@ -63,7 +63,7 @@ class PNGParser(exiftool.ExiftoolParser):
 
         try:  # better fail here than later
             cairo.ImageSurface.create_from_png(self.filename)
-        except Exception:  # pragma: no cover
+        except:  # pragma: no cover
             # Cairo is returning some weird exceptions :/
             raise ValueError
 


=====================================
libmat2/office.py
=====================================
@@ -88,6 +88,7 @@ class MSOfficeParser(ZipParser):
             r'^\[Content_Types\]\.xml$',
             r'^_rels/\.rels$',
             r'^xl/sharedStrings\.xml$',  # https://docs.microsoft.com/en-us/office/open-xml/working-with-the-shared-string-table
+            r'^xl/calcChain\.xml$',
             r'^(?:word|ppt|xl)/_rels/document\.xml\.rels$',
             r'^(?:word|ppt|xl)/_rels/footer[0-9]*\.xml\.rels$',
             r'^(?:word|ppt|xl)/_rels/header[0-9]*\.xml\.rels$',
@@ -107,6 +108,9 @@ class MSOfficeParser(ZipParser):
             # TODO: check if p:bgRef can be randomized
             r'^ppt/slideMasters/slideMaster[0-9]+\.xml',
             r'^ppt/slideMasters/_rels/slideMaster[0-9]+\.xml\.rels',
+            r'^xl/worksheets/_rels/sheet[0-9]+\.xml\.rels',
+            r'^xl/drawings/vmlDrawing[0-9]+\.vml',
+            r'^xl/drawings/drawing[0-9]+\.xml',
         }))
         self.files_to_omit = set(map(re.compile, {  # type: ignore
             r'^\[trash\]/',
@@ -123,6 +127,7 @@ class MSOfficeParser(ZipParser):
             # Additional presentation-wide properties like printing properties,
             # presentation show properties etc.
             r'^(?:word|ppt|xl)/presProps\.xml$',
+            r'^(?:word|ppt|xl)/comments[0-9]+\.xml$',
 
             # we have an allowlist in self.files_to_keep,
             # so we can trash everything else


=====================================
libmat2/pdf.py
=====================================
@@ -32,7 +32,7 @@ class PDFParser(abstract.AbstractParser):
     def __init__(self, filename):
         super().__init__(filename)
         self.uri = 'file://' + os.path.abspath(self.filename)
-        self.__scale = 2  # how much precision do we want for the render
+        self.__scale = 200 / 72.0  # how much precision do we want for the render
         try:  # Check now that the file is valid, to avoid surprises later
             Poppler.Document.new_from_file(self.uri, None)
         except GLib.GError:  # Invalid PDF
@@ -90,8 +90,8 @@ class PDFParser(abstract.AbstractParser):
             page_width, page_height = page.get_size()
             logging.info("Rendering page %d/%d", pagenum + 1, pages_count)
 
-            width = int(page_width) * self.__scale
-            height = int(page_height) * self.__scale
+            width = int(page_width * self.__scale)
+            height = int(page_height * self.__scale)
             img_surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
             img_context = cairo.Context(img_surface)
 
@@ -105,7 +105,11 @@ class PDFParser(abstract.AbstractParser):
             buf.seek(0)
 
             img = cairo.ImageSurface.create_from_png(buf)
-            pdf_surface.set_size(page_width*self.__scale, page_height*self.__scale)
+            if cairo.version_info < (1, 12, 0):
+                pdf_surface.set_size(width, height)
+            else:
+                pdf_surface.set_size(page_width, page_height)
+                pdf_surface.set_device_scale(1 / self.__scale, 1 / self.__scale)
             pdf_context.set_source_surface(img, 0, 0)
             pdf_context.paint()
             pdf_context.show_page()  # draw pdf_context on pdf_surface


=====================================
mat2
=====================================
@@ -17,7 +17,7 @@ except ValueError as e:
     print(e)
     sys.exit(1)
 
-__version__ = '0.12.1'
+__version__ = '0.12.2'
 
 # Make pyflakes happy
 assert Set


=====================================
nautilus/mat2.py
=====================================
@@ -231,7 +231,7 @@ class Mat2Extension(GObject.GObject, Nautilus.MenuProvider, Nautilus.LocationWid
         """
         # Do not show the menu item if not a single file has a chance to be
         # processed by mat2.
-        if not any([is_valid for (is_valid, _) in map(self.__validate, files)]):
+        if not any((is_valid for (is_valid, _) in map(self.__validate, files))):
             return None
 
         item = Nautilus.MenuItem(


=====================================
setup.py
=====================================
@@ -5,7 +5,7 @@ with open("README.md", encoding='utf-8') as fh:
 
 setuptools.setup(
     name="mat2",
-    version='0.12.1',
+    version='0.12.2',
     author="Julien (jvoisin) Voisin",
     author_email="julien.voisin+mat2 at dustri.org",
     description="A handy tool to trash your metadata",


=====================================
tests/data/dirty.aiff
=====================================
Binary files /dev/null and b/tests/data/dirty.aiff differ


=====================================
tests/test_libmat2.py
=====================================
@@ -230,6 +230,11 @@ class TestGetMeta(unittest.TestCase):
         p = images.SVGParser('./tests/data/weird.svg')
         self.assertEqual(p.get_meta()['Xmlns'], 'http://www.w3.org/1337/svg')
 
+    def test_aiff(self):
+        p = audio.AIFFParser('./tests/data/dirty.aiff')
+        meta = p.get_meta()
+        self.assertEqual(meta['Name'], 'I am so')
+
 
 class TestRemovingThumbnails(unittest.TestCase):
     def test_odt(self):
@@ -312,6 +317,12 @@ class TestCleaning(unittest.TestCase):
             'meta': {'Comment': 'Zomg, a comment!'},
             'expected_meta': {},
         }, {
+            'name': 'aiff',
+            'parser': audio.AIFFParser,
+            'meta': {'Annotation': 'Thank you for using MAT !'},
+            'expected_meta': {},
+        },
+        {
             'name': 'mp3',
             'parser': audio.MP3Parser,
             'meta': {'TXXX:I am a': 'various comment'},
@@ -442,13 +453,17 @@ class TestCleaning(unittest.TestCase):
                 'Encoder':  'HandBrake 0.9.4 2009112300',
             },
             'expected_meta': {
+                'AverageBitrate': 465641,
+                'BufferSize': 0,
                 'CompatibleBrands': ['isom', 'iso2', 'avc1', 'mp41'],
+                'ColorRepresentation': 'nclx 1 1 1',
                 'CompressorID': 'avc1',
                 'GraphicsMode': 'srcCopy',
                 'HandlerDescription': 'SoundHandler',
                 'HandlerType': 'Metadata',
                 'HandlerVendorID': 'Apple',
-                'MajorBrand': 'MP4  Base Media v1 [IS0 14496-12:2003]',
+                'MajorBrand': 'Base Media v1 [IS0 14496-12:2003]',
+                'MaxBitrate': 465641,
                 'MediaDataOffset': 48,
                 'MediaDataSize': 379872,
                 'MediaHeaderVersion': 0,
@@ -502,7 +517,7 @@ class TestCleaning(unittest.TestCase):
             p2 = case['parser'](p1.output_filename)
             for k, v in p2.get_meta().items():
                 self.assertIn(k, case['expected_meta'])
-                self.assertEqual(v, case['expected_meta'][k])
+                self.assertIn(str(case['expected_meta'][k]), str(v))
             self.assertTrue(p2.remove_all())
 
             os.remove(target)



View it on GitLab: https://salsa.debian.org/pkg-privacy-team/mat2/-/compare/61457934a899b4b600d91a99a142204b98eb0671...7fd42989880b67e3cfe7637383af12c80f9410de

-- 
View it on GitLab: https://salsa.debian.org/pkg-privacy-team/mat2/-/compare/61457934a899b4b600d91a99a142204b98eb0671...7fd42989880b67e3cfe7637383af12c80f9410de
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/20210829/0f75a3b4/attachment-0001.htm>


More information about the Pkg-privacy-commits mailing list