Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package diffoscope for openSUSE:Factory checked in at 2021-10-15 23:04:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/diffoscope (Old) and /work/SRC/openSUSE:Factory/.diffoscope.new.1890 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "diffoscope" Fri Oct 15 23:04:38 2021 rev:20 rq:925543 version:187 Changes: -------- --- /work/SRC/openSUSE:Factory/diffoscope/diffoscope.changes 2021-10-11 15:32:24.522921101 +0200 +++ /work/SRC/openSUSE:Factory/.diffoscope.new.1890/diffoscope.changes 2021-10-15 23:05:12.098150422 +0200 @@ -1,0 +2,7 @@ +Sat Oct 9 10:24:44 UTC 2021 - Sebastian Wagner <sebix+novell....@sebix.at> + +- update to version 187: + - Add support for comparing .pyc files. Thanks to Sergei Trofimovich. + (Closes: reproducible-builds/diffoscope#278) + +------------------------------------------------------------------- Old: ---- diffoscope-186.tar.bz2 diffoscope-186.tar.bz2.asc New: ---- diffoscope-187.tar.bz2 diffoscope-187.tar.bz2.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ diffoscope.spec ++++++ --- /var/tmp/diff_new_pack.FsOKhR/_old 2021-10-15 23:05:12.594150776 +0200 +++ /var/tmp/diff_new_pack.FsOKhR/_new 2021-10-15 23:05:12.598150779 +0200 @@ -17,7 +17,7 @@ Name: diffoscope -Version: 186 +Version: 187 Release: 0 Summary: In-depth comparison of files, archives, and directories License: GPL-3.0-or-later ++++++ diffoscope-186.tar.bz2 -> diffoscope-187.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-186/debian/changelog new/diffoscope-187/debian/changelog --- old/diffoscope-186/debian/changelog 2021-10-01 10:02:51.000000000 +0200 +++ new/diffoscope-187/debian/changelog 2021-10-08 10:02:03.000000000 +0200 @@ -1,3 +1,10 @@ +diffoscope (187) unstable; urgency=medium + + * Add support for comparing .pyc files. Thanks to Sergei Trofimovich. + (Closes: reproducible-builds/diffoscope#278) + + -- Chris Lamb <la...@debian.org> Fri, 08 Oct 2021 09:01:52 +0100 + diffoscope (186) unstable; urgency=medium [ Chris Lamb ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-186/debian/source/lintian-overrides new/diffoscope-187/debian/source/lintian-overrides --- old/diffoscope-186/debian/source/lintian-overrides 2021-10-01 10:02:51.000000000 +0200 +++ new/diffoscope-187/debian/source/lintian-overrides 2021-10-08 10:02:03.000000000 +0200 @@ -14,5 +14,7 @@ source-is-missing tests/data/test1.o source-is-missing tests/data/test2.debug source-is-missing tests/data/test2.o +source-is-missing tests/data/test1.pyc-renamed +source-is-missing tests/data/test2.pyc-renamed source-contains-prebuilt-windows-binary tests/data/test1.exe source-contains-prebuilt-windows-binary tests/data/test2.exe diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-186/diffoscope/__init__.py new/diffoscope-187/diffoscope/__init__.py --- old/diffoscope-186/diffoscope/__init__.py 2021-10-01 10:02:51.000000000 +0200 +++ new/diffoscope-187/diffoscope/__init__.py 2021-10-08 10:02:03.000000000 +0200 @@ -17,4 +17,4 @@ # You should have received a copy of the GNU General Public License # along with diffoscope. If not, see <https://www.gnu.org/licenses/>. -VERSION = "186" +VERSION = "187" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-186/diffoscope/comparators/__init__.py new/diffoscope-187/diffoscope/comparators/__init__.py --- old/diffoscope-186/diffoscope/comparators/__init__.py 2021-10-01 10:02:51.000000000 +0200 +++ new/diffoscope-187/diffoscope/comparators/__init__.py 2021-10-08 10:02:03.000000000 +0200 @@ -106,6 +106,7 @@ ("pe32.Pe32PlusFile",), ("pgp.PgpFile",), ("pgp.PgpSignature",), + ("python.PycFile",), ("kbx.KbxFile",), ("fit.FlattenedImageTreeFile",), ("dtb.DeviceTreeFile",), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-186/diffoscope/comparators/python.py new/diffoscope-187/diffoscope/comparators/python.py --- old/diffoscope-186/diffoscope/comparators/python.py 1970-01-01 01:00:00.000000000 +0100 +++ new/diffoscope-187/diffoscope/comparators/python.py 2021-10-08 10:02:03.000000000 +0200 @@ -0,0 +1,122 @@ +# +# diffoscope: in-depth comparison of files, archives, and directories +# +# Copyright ?? 2021 Chris Lamb <la...@debian.org> +# Copyright ?? 2021 Sergei Trofimovich +# +# diffoscope is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# diffoscope is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with diffoscope. If not, see <https://www.gnu.org/licenses/>. + +import binascii +import dis +import io +import marshal +import re +import struct +import time +import types + +from diffoscope.difference import Difference + +from .utils.file import File + +re_memory_address = re.compile(r" at 0x\w+(?=, )") + + +class PycFile(File): + DESCRIPTION = "Python .pyc files" + FILE_TYPE_RE = re.compile(r"^python .*byte-compiled$") + + def compare_details(self, other, source=None): + return [ + Difference.from_text( + describe_pyc(self.path), + describe_pyc(other.path), + self.path, + other.path, + source="Python bytecode", + ) + ] + + +def describe_pyc(filename): + with open(filename, "rb") as f: + return "\n".join(parse_pyc(f)) + + +def parse_pyc(f): + magic = f.read(4) + yield "magic: {}".format(hexlify(magic)) + + f.seek(4, 1) + moddate = f.read(4) + modtime = time.asctime(time.gmtime(struct.unpack("=L", moddate)[0])) + yield "moddate: {} ({} UTC)".format(hexlify(moddate), modtime) + + filesz = f.read(4) + filesz = struct.unpack("=L", filesz) + yield f"files sz: {filesz[0]}" + + code = marshal.load(f) + yield from show_code(code) + + +def show_code(code, indent=""): + yield f"{indent}code" + + indent += " " + + for x in ("argcount", "nlocals", "stacksize", "flags"): + yield "{}{: <10}: {!r}".format(indent, x, getattr(code, f"co_{x}")) + + yield from show_hex("code", code.co_code, indent=indent) + s = io.StringIO() + dis.disassemble(code, file=s) + for x in s.getvalue().splitlines(): + yield "{}{}".format(indent, re_memory_address.sub("", x)) + + yield f"{indent}consts" + for const in code.co_consts: + if type(const) == types.CodeType: + yield from show_code(const, f"{indent} ") + else: + yield f" {indent}{const!r}" + + for x in ( + "names", + "varnames", + "freevars", + "cellvars", + "filename", + "name", + "firstlineno", + ): + yield "{}{: <10} {!r}".format(indent, x, getattr(code, f"co_{x}")) + + yield from show_hex("lnotab", code.co_lnotab, indent=indent) + + +def show_hex(label, val, indent): + val = hexlify(val) + + if len(val) < 60: + yield f"{indent}{label} {val}" + return + + yield f"{indent}{label}" + for i in range(0, len(val), 60): + yield "{} {}".format(indent, val[i : i + 60]) + + +def hexlify(val): + return "0x{}".format(binascii.hexlify(val).decode("utf-8")) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-186/tests/comparators/test_python.py new/diffoscope-187/tests/comparators/test_python.py --- old/diffoscope-186/tests/comparators/test_python.py 1970-01-01 01:00:00.000000000 +0100 +++ new/diffoscope-187/tests/comparators/test_python.py 2021-10-08 10:02:03.000000000 +0200 @@ -0,0 +1,45 @@ +# +# diffoscope: in-depth comparison of files, archives, and directories +# +# Copyright ?? 2021 Chris Lamb <la...@debian.org> +# +# diffoscope is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# diffoscope is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with diffoscope. If not, see <https://www.gnu.org/licenses/>. + +import pytest + +from diffoscope.comparators.python import PycFile + +from ..utils.data import assert_diff, load_fixture + + +pyc1 = load_fixture("test1.pyc-renamed") +pyc2 = load_fixture("test2.pyc-renamed") + + +def test_identification(pyc1, pyc2): + assert isinstance(pyc1, PycFile) + assert isinstance(pyc2, PycFile) + + +def test_no_differences(pyc1): + assert pyc1.compare(pyc1) is None + + +@pytest.fixture +def differences(pyc1, pyc2): + return pyc1.compare(pyc2).details + + +def test_diff(differences): + assert_diff(differences[0], "pyc_expected_diff") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-186/tests/data/pyc_expected_diff new/diffoscope-187/tests/data/pyc_expected_diff --- old/diffoscope-186/tests/data/pyc_expected_diff 1970-01-01 01:00:00.000000000 +0100 +++ new/diffoscope-187/tests/data/pyc_expected_diff 2021-10-08 10:02:03.000000000 +0200 @@ -0,0 +1,11 @@ +@@ -1,9 +1,9 @@ + magic: 0x610d0d0a +-moddate: 0xbd103561 (Sun Sep 5 18:47:25 2021 UTC) ++moddate: 0xae814d61 (Fri Sep 24 07:43:42 2021 UTC) + files sz: 14217 + code + argcount : 0 + nlocals : 0 + stacksize : 3 + flags : 64 + code Binary files old/diffoscope-186/tests/data/test1.pyc-renamed and new/diffoscope-187/tests/data/test1.pyc-renamed differ Binary files old/diffoscope-186/tests/data/test2.pyc-renamed and new/diffoscope-187/tests/data/test2.pyc-renamed differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-186/tests/test_source.py new/diffoscope-187/tests/test_source.py --- old/diffoscope-186/tests/test_source.py 2021-10-01 10:02:51.000000000 +0200 +++ new/diffoscope-187/tests/test_source.py 2021-10-08 10:02:03.000000000 +0200 @@ -130,6 +130,7 @@ "test1.png", "test1.ppu", "test1.ps", + "test1.pyc-renamed", "test1.rdb", "test1.rdx", "test1.rlib", @@ -192,6 +193,7 @@ "test2.png", "test2.ppu", "test2.ps", + "test2.pyc-renamed", "test2.rdb", "test2.rdx", "test2.rlib",