[Git][reproducible-builds/diffoscope][master] Dump PE32+ executables (including EFI applications) using objdump. (Closes:...
Chris Lamb
gitlab at salsa.debian.org
Sun Jun 28 14:56:29 UTC 2020
Chris Lamb pushed to branch master at Reproducible Builds / diffoscope
Commits:
7d597414 by Chris Lamb at 2020-06-28T15:51:01+01:00
Dump PE32+ executables (including EFI applications) using objdump. (Closes: reproducible-builds/diffoscope#181)
- - - - -
2 changed files:
- diffoscope/comparators/__init__.py
- + diffoscope/comparators/pe32.py
Changes:
=====================================
diffoscope/comparators/__init__.py
=====================================
@@ -101,6 +101,7 @@ class ComparatorManager:
("openssh.PublicKeyFile",),
("gif.GifFile",),
("pcap.PcapFile",),
+ ("pe32.Pe32PlusFile",),
("pgp.PgpFile",),
("pgp.PgpSignature",),
("kbx.KbxFile",),
=====================================
diffoscope/comparators/pe32.py
=====================================
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+#
+# diffoscope: in-depth comparison of files, archives, and directories
+#
+# Copyright © 2020 Chris Lamb <lamby at 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 re
+
+from diffoscope.tools import tool_required
+from diffoscope.difference import Difference
+
+from .utils.file import File
+from .utils.command import Command
+
+
+class Objdump(Command):
+ @tool_required("objdump")
+ def cmdline(self):
+ return (
+ "objdump",
+ "--all-headers",
+ "--disassemble-all",
+ "--line-numbers",
+ self.path,
+ )
+
+ def filter(self, line):
+ if line.startswith(self.path.encode("utf-8")):
+ return b""
+
+ return line
+
+
+class Pe32PlusFile(File):
+ DESCRIPTION = "PE32 files"
+ FILE_TYPE_RE = re.compile(r"^PE32\+")
+
+ def compare_details(self, other, source=None):
+ return [
+ Difference.from_command(
+ Objdump, self.path, other.path, source="objdump"
+ )
+ ]
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/7d597414be93278616b9ea81c47f783b2515915e
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/7d597414be93278616b9ea81c47f783b2515915e
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20200628/7fca1685/attachment.htm>
More information about the rb-commits
mailing list