[Git][reproducible-builds/diffoscope][master] 5 commits: Strip newlines when determining Black version to avoid "requires black >=...
Chris Lamb
gitlab at salsa.debian.org
Fri Feb 19 08:33:56 UTC 2021
Chris Lamb pushed to branch master at Reproducible Builds / diffoscope
Commits:
77da1376 by Chris Lamb at 2021-02-17T12:54:48+00:00
Strip newlines when determining Black version to avoid "requires black >= 20.8b1 (18.9b0\n detected)" in test output.
- - - - -
28eec327 by Chris Lamb at 2021-02-19T08:25:25+00:00
Tidy imports in diffoscope.comparators.fit.
- - - - -
a3fbad45 by Chris Lamb at 2021-02-19T08:27:12+00:00
Don't rely on dumpimage returning an appropriate exit code; check that the file actually exists.
- - - - -
71ce125a by Chris Lamb at 2021-02-19T08:32:41+00:00
Fix FIT tests in buster.
- - - - -
c18be232 by Chris Lamb at 2021-02-19T08:33:43+00:00
Update my copyright years.
Gbp-Dch: ignore
- - - - -
4 changed files:
- diffoscope/comparators/fit.py
- tests/comparators/test_apk.py
- tests/comparators/test_fit.py
- tests/test_source.py
Changes:
=====================================
diffoscope/comparators/fit.py
=====================================
@@ -3,6 +3,7 @@
# diffoscope: in-depth comparison of files, archives, and directories
#
# Copyright © 2020-2021 Conrad Ratschan <ratschance at gmail.com>
+# Copyright © 2021 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
@@ -16,15 +17,17 @@
#
# You should have received a copy of the GNU General Public License
# along with diffoscope. If not, see <https://www.gnu.org/licenses/>.
-import logging
+
import os
import re
+import logging
+import subprocess
from diffoscope.tools import tool_required, tool_check_installed
from diffoscope.difference import Difference
+
from .utils import command
from .utils.archive import Archive
-
from .utils.file import File
from .utils.command import Command
@@ -58,6 +61,7 @@ class FitContainer(Archive):
# Save mapping of name -> position as dumpimage takes position as an argument
self._members[member_name] = pos
members.append(member_name)
+
return members
@tool_required("dumpimage")
@@ -66,18 +70,23 @@ class FitContainer(Archive):
dest_path = os.path.join(dest_dir, os.path.basename(member_name))
logger.debug("fit image extracting %s to %s", member_name, dest_path)
- command.our_check_output(
- [
- "dumpimage",
- "-T",
- "flat_dt",
- "-p",
- pos,
- self.source.path,
- "-o",
- dest_path,
- ],
+ cmd = (
+ "dumpimage",
+ "-T",
+ "flat_dt",
+ "-p",
+ pos,
+ self.source.path,
+ "-o",
+ dest_path,
)
+
+ output = command.our_check_output(cmd)
+
+ # Cannot rely on dumpimage returning a non-zero exit code on failure.
+ if not os.path.exists(dest_path):
+ raise subprocess.CalledProcessError(1, cmd)
+
return dest_path
=====================================
tests/comparators/test_apk.py
=====================================
@@ -2,7 +2,7 @@
# diffoscope: in-depth comparison of files, archives, and directories
#
# Copyright © 2017 Maria Glukhova <siammezzze at gmail.com>
-# Copyright © 2017, 2019-2020 Chris Lamb <lamby at debian.org>
+# Copyright © 2017, 2019-2021 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
=====================================
tests/comparators/test_fit.py
=====================================
@@ -3,6 +3,7 @@
# diffoscope: in-depth comparison of files, archives, and directories
#
# Copyright © 2020 Conrad Ratschan <ratschance at gmail.com>
+# Copyright © 2021 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
@@ -26,13 +27,22 @@ from diffoscope.comparators.fit import FlattenedImageTreeFile
from diffoscope.comparators.utils.specialize import specialize
from ..utils.data import data, assert_diff, load_fixture
-from ..utils.tools import skip_unless_tools_exist
+from ..utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least
from ..utils.nonexisting import assert_non_existing
cpio1 = load_fixture("test1.cpio")
cpio2 = load_fixture("test2.cpio")
+def dumpimage_version():
+ return (
+ subprocess.check_output(("dumpimage", "-V"))
+ .decode("utf-8")
+ .strip()
+ .split(" ")[-1]
+ )
+
+
def fit_fixture(prefix, entrypoint):
@pytest.fixture
def uboot_fit(tmp_path):
@@ -98,21 +108,21 @@ def nested_differences(uboot_fit1, uboot_fit2):
return uboot_fit1.compare(uboot_fit2).details[1].details
- at skip_unless_tools_exist("dumpimage")
+ at skip_unless_tool_is_at_least("dumpimage", dumpimage_version, "2021.01")
@skip_unless_tools_exist("fdtdump")
def test_file_differences(differences):
assert_diff(differences[0], "fit_expected_diff")
@skip_unless_tools_exist("cpio")
- at skip_unless_tools_exist("dumpimage")
+ at skip_unless_tool_is_at_least("dumpimage", dumpimage_version, "2021.01")
@skip_unless_tools_exist("fdtdump")
def test_nested_listing(nested_differences):
assert_diff(nested_differences[0], "cpio_listing_expected_diff")
@skip_unless_tools_exist("cpio")
- at skip_unless_tools_exist("dumpimage")
+ at skip_unless_tool_is_at_least("dumpimage", dumpimage_version, "2021.01")
@skip_unless_tools_exist("fdtdump")
def test_nested_symlink(nested_differences):
assert nested_differences[1].source1 == "dir/link"
@@ -121,7 +131,7 @@ def test_nested_symlink(nested_differences):
@skip_unless_tools_exist("cpio")
- at skip_unless_tools_exist("dumpimage")
+ at skip_unless_tool_is_at_least("dumpimage", dumpimage_version, "2021.01")
@skip_unless_tools_exist("fdtdump")
def test_nested_compressed_files(nested_differences):
assert nested_differences[2].source1 == "dir/text"
@@ -130,7 +140,7 @@ def test_nested_compressed_files(nested_differences):
@skip_unless_tools_exist("cpio")
- at skip_unless_tools_exist("dumpimage")
+ at skip_unless_tool_is_at_least("dumpimage", dumpimage_version, "2021.01")
@skip_unless_tools_exist("fdtdump")
def test_compare_non_existing(monkeypatch, uboot_fit1):
assert_non_existing(monkeypatch, uboot_fit1)
=====================================
tests/test_source.py
=====================================
@@ -1,7 +1,7 @@
#
# diffoscope: in-depth comparison of files, archives, and directories
#
-# Copyright © 2018-2020 Chris Lamb <lamby at debian.org>
+# Copyright © 2018-2021 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
@@ -238,7 +238,7 @@ def black_version():
out = subprocess.check_output(("black", "--version"))
except subprocess.CalledProcessError as e:
out = e.output
- return out.decode("utf-8").rsplit(" ", 1)[-1]
+ return out.strip().decode("utf-8").rsplit(" ", 1)[-1]
@skip_unless_tool_is_at_least("black", black_version, "20.8b1")
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/6913a10e9a90a95a61d6f06bd763dfe2e9a5918c...c18be23275ca39dd2866e4fb0b38593d6f716b96
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/6913a10e9a90a95a61d6f06bd763dfe2e9a5918c...c18be23275ca39dd2866e4fb0b38593d6f716b96
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/20210219/48444e60/attachment.htm>
More information about the rb-commits
mailing list