[arch-commits] Commit in diffoscope/trunk (2 files)

Jelle van der Waa jelle at archlinux.org
Wed Feb 17 15:41:48 UTC 2021


    Date: Wednesday, February 17, 2021 @ 15:41:48
  Author: jelle
Revision: 862552

upgpkg: diffoscope 166-1

Added:
  diffoscope/trunk/c72c30f29ea3760eb4c785644dc7cd4c26833740.patch
Modified:
  diffoscope/trunk/PKGBUILD

------------------------------------------------+
 PKGBUILD                                       |   16 +++--
 c72c30f29ea3760eb4c785644dc7cd4c26833740.patch |   70 +++++++++++++++++++++++
 2 files changed, 80 insertions(+), 6 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2021-02-17 15:41:44 UTC (rev 862551)
+++ PKGBUILD	2021-02-17 15:41:48 UTC (rev 862552)
@@ -1,7 +1,7 @@
 # Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
 
 pkgname=diffoscope
-pkgver=165
+pkgver=166
 pkgrel=1
 pkgdesc='Tool for in-depth comparison of files, archives, and directories'
 url='https://diffoscope.org/'
@@ -63,11 +63,13 @@
   'hdf5' 'imagemagick' 'java-environment=11' 'fontforge' 'gettext' 'ghc' 'gnupg' 'mono' 'mono-tools' 'poppler' 'sqlite' 'squashfs-tools'
   'lz4' 'unzip' 'gzip' 'tar' 'tcpdump' 'vim' 'xz' 'llvm' 'colord' 'fpc' 'openssh' 'openssl' 'odt2txt' 'docx2txt' 'r' 'dtc' 'giflib'
   'gnumeric' 'python-progressbar' 'binwalk' 'python-argcomplete' 'zstd')
-source=(https://diffoscope.org/archive/diffoscope-${pkgver}.tar.bz2{,.asc})
-sha512sums=('d89c05d7f66fa44f225a2cc66931d9cc3676ee2db20d4f3722b72276e7b5819a5d5d22e659893492bca6bca0fe62c094ce9c79cf9b73e505254d429b228bd941'
-            'SKIP')
-b2sums=('199d16c50364f538a537b628cec8ae02114911190fd98666b131e90bfb3686b13be910da35f6068dcb14aae137090d5e21a32141702997f74498133ad78bc56a'
-        'SKIP')
+source=(https://diffoscope.org/archive/diffoscope-${pkgver}.tar.bz2{,.asc} c72c30f29ea3760eb4c785644dc7cd4c26833740.patch)
+sha512sums=('db3d51e71baec7ce56e094f09d2b1feb936c36bc3ed5760fe70d27ec8e784dbf935224ddd5bbc829777b77a943d3288a2de97abd1fecc048061b5ec129ec798d'
+            'SKIP'
+            '9d7d81fbad05a921456c09d527e062e933cdf3e4815ec3bed57ab4a1c9caa11981fcc09b5f58dcaab71647e0d99a7836b4f8c67101917f7f322fb331a21d3a91')
+b2sums=('bcb5589eccdb29378ba37c42bd5f4d233bf1d8b0c7591d698d6668bfd282cfc34b9fccbb9486fd09f647d59ee5ae9665971d557f16bd7c40e1043b496922abe5'
+        'SKIP'
+        '5b8790f5bb0a92db7e6bc30001b26d79ecb04d26bc617bc664c8fbebd875bd7262f1f92c042ab41a4816a89bff96699a6465a1fc27afa17785f15aa1f7d1b0ef')
 validpgpkeys=("C2FE4BD271C139B86C533E461E953E27D4311E58") # "Chris Lamb <chris at chris-lamb.co.uk>"
 
 
@@ -74,6 +76,8 @@
 prepare() {
   cd ${pkgname}-${pkgver}
   sed '/python-magic/d' -i setup.py
+  # pypi python-magic comptability broke libmagic compat, fixed upstream in 74c0d3f40efb49cfd78d3592bc87c76211e20570
+  patch -Np1 -R -i ${srcdir}/c72c30f29ea3760eb4c785644dc7cd4c26833740.patch
 }
 
 build() {

Added: c72c30f29ea3760eb4c785644dc7cd4c26833740.patch
===================================================================
--- c72c30f29ea3760eb4c785644dc7cd4c26833740.patch	                        (rev 0)
+++ c72c30f29ea3760eb4c785644dc7cd4c26833740.patch	2021-02-17 15:41:48 UTC (rev 862552)
@@ -0,0 +1,70 @@
+From c72c30f29ea3760eb4c785644dc7cd4c26833740 Mon Sep 17 00:00:00 2001
+From: Chris Lamb <lamby at debian.org>
+Date: Thu, 28 Jan 2021 12:22:17 +0000
+Subject: [PATCH] Prefer to use magic.Magic over the magic.open compatibility
+ interface. (Closes: reproducible-builds/diffoscope#236)
+
+See <https://github.com/ahupp/python-magic/blob/master/COMPAT.md> for more info.
+---
+ diffoscope/comparators/utils/file.py | 28 ++++++++++++++--------------
+ 1 file changed, 14 insertions(+), 14 deletions(-)
+
+diff --git a/diffoscope/comparators/utils/file.py b/diffoscope/comparators/utils/file.py
+index 32700f02..fb3b4316 100644
+--- a/diffoscope/comparators/utils/file.py
++++ b/diffoscope/comparators/utils/file.py
+@@ -65,37 +65,37 @@ def _run_tests(fold, tests):
+ 
+ 
+ class File(metaclass=abc.ABCMeta):
+-    if hasattr(magic, "open"):  # use Magic-file-extensions from file
++    if hasattr(magic, "Magic"):  # use python-magic
+ 
+         @classmethod
+         def guess_file_type(cls, path):
+             if not hasattr(cls, "_mimedb"):
+-                cls._mimedb = magic.open(magic.NONE)
+-                cls._mimedb.load()
+-            return cls._mimedb.file(
+-                path.encode("utf-8", errors="surrogateescape")
+-            )
++                cls._mimedb = magic.Magic()
++            return maybe_decode(cls._mimedb.from_file(path))
+ 
+         @classmethod
+         def guess_encoding(cls, path):
+             if not hasattr(cls, "_mimedb_encoding"):
+-                cls._mimedb_encoding = magic.open(magic.MAGIC_MIME_ENCODING)
+-                cls._mimedb_encoding.load()
+-            return cls._mimedb_encoding.file(path)
++                cls._mimedb_encoding = magic.Magic(mime_encoding=True)
++            return maybe_decode(cls._mimedb_encoding.from_file(path))
+ 
+-    else:  # use python-magic
++    else:  # use Magic-file-extensions from file
+ 
+         @classmethod
+         def guess_file_type(cls, path):
+             if not hasattr(cls, "_mimedb"):
+-                cls._mimedb = magic.Magic()
+-            return maybe_decode(cls._mimedb.from_file(path))
++                cls._mimedb = magic.open(magic.NONE)
++                cls._mimedb.load()
++            return cls._mimedb.file(
++                path.encode("utf-8", errors="surrogateescape")
++            )
+ 
+         @classmethod
+         def guess_encoding(cls, path):
+             if not hasattr(cls, "_mimedb_encoding"):
+-                cls._mimedb_encoding = magic.Magic(mime_encoding=True)
+-            return maybe_decode(cls._mimedb_encoding.from_file(path))
++                cls._mimedb_encoding = magic.open(magic.MAGIC_MIME_ENCODING)
++                cls._mimedb_encoding.load()
++            return cls._mimedb_encoding.file(path)
+ 
+     def __init__(self, container=None):
+         self._comments = []
+-- 
+GitLab
+


More information about the arch-commits mailing list