[diffoscope] 01/01: test_dtb.py: Only parse the version number, not any "-dirty" suffix. (Closes: #880279)
Mattia Rizzolo
mattia at debian.org
Fri Nov 3 12:26:23 UTC 2017
You did this, but actually the bug was already fixed (i.e. it wasn't broken
by the "-dirty" suffix, but due to the output changing the order of the
lines)
Nonetheless, I find your solution of using a regular expression superior to
my guesswork, but I would have still considered the -dirty suffix relevant
and part of the version.
On Fri, 3 Nov 2017, 10:02 a.m. Chris Lamb, <chris at chris-lamb.co.uk> wrote:
> This is an automated email from the git hooks/post-receive script.
>
> lamby pushed a commit to branch master
> in repository diffoscope.
>
> commit d4ce05062e0368549ffe34276233f48f9ab68900
> Author: Chris Lamb <lamby at debian.org>
> Date: Fri Nov 3 10:01:39 2017 +0100
>
> test_dtb.py: Only parse the version number, not any "-dirty" suffix.
> (Closes: #880279)
> ---
> tests/comparators/test_dtb.py | 19 +++++++++++--------
> 1 file changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/tests/comparators/test_dtb.py b/tests/comparators/test_dtb.py
> index 635ff30..eeb5db6 100644
> --- a/tests/comparators/test_dtb.py
> +++ b/tests/comparators/test_dtb.py
> @@ -18,6 +18,7 @@
> # 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
> import pytest
> import subprocess
>
> @@ -35,14 +36,16 @@ dtb2 = load_fixture('devicetree2.dtb')
>
>
> def fdtdump_version():
> - out = subprocess.check_output(('fdtdump', '--version'),
> stderr=subprocess.STDOUT)
> - # We are looking for a line like
> - # Version: DTC 1.4.5
> - # that usually is placed last
> - for line in reversed(out.decode().splitlines()):
> - if line.startswith('Version: '):
> - return line.split()[2]
> - raise ValueError('Error parsing `fdtdump --version` output')
> + out = subprocess.check_output(
> + ('fdtdump', '--version'),
> + stderr=subprocess.STDOUT,
> + ).decode('utf-8')
> +
> + m = re.search(r'Version: DTC (?P<version>\d+\.\d+\.\d+)', out)
> + if m is None:
> + raise ValueError("Error parsing `fdtdump --version` output")
> +
> + return m.group('version')
>
>
> def test_identification(dtb1):
>
> --
> Alioth's /usr/local/bin/git-commit-notice on /srv/
> git.debian.org/git/reproducible/diffoscope.git
>
> _______________________________________________
> Reproducible-commits mailing list
> Reproducible-commits at lists.alioth.debian.org
> https://lists.alioth.debian.org/mailman/listinfo/reproducible-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/reproducible-builds/attachments/20171103/18c31fdf/attachment.html>
More information about the Reproducible-builds
mailing list