Processed: Re: Bug#861109: diffoscope: Please add support for .dtb (device tree blob) files.

2017-04-24 Thread Debian Bug Tracking System
Processing control commands:

> tag 861109 pending
Bug #861109 [diffoscope] diffoscope: Please add support for .dtb (device tree 
blob) files.
Added tag(s) pending.

-- 
861109: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=861109
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems

___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds


Bug#861109: diffoscope: Please add support for .dtb (device tree blob) files.

2017-04-24 Thread Vagrant Cascadian
Control: tag 861109 pending

On 2017-04-24, Chris Lamb wrote:
> Thanks for implementing this. :)  I'd just check two things:
>
>   a) Unused subprocess import in test_dtb.py

Tested that it works without; committed and pushed.


>   b) Whether the tests pass with jessie's device-tree-compiler
>  (1.4.0) and add a conditional if so.

I was unable to build diffoscope on jessie. It appears that fdtdump from
jessie *does* produce different output, so I guess I'll also add
versioned dependency...


> After that. please just go-ahead and push these commits to the
> experimental branch :)

Thanks!

live well,
  vagrant


signature.asc
Description: PGP signature
___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Bug#861109: diffoscope: Please add support for .dtb (device tree blob) files.

2017-04-24 Thread Chris Lamb
Hey Vagrant,

Thanks for implementing this. :)  I'd just check two things:

  a) Unused subprocess import in test_dtb.py

  b) Whether the tests pass with jessie's device-tree-compiler
 (1.4.0) and add a conditional if so.

After that. please just go-ahead and push these commits to the
experimental branch :)


Regards,

-- 
  ,''`.
 : :'  : Chris Lamb
 `. `'`  la...@debian.org / chris-lamb.co.uk
   `-

___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds


Bug#861109: diffoscope: Please add support for .dtb (device tree blob) files.

2017-04-24 Thread Vagrant Cascadian
Package: diffoscope
Version: 81
Severity: wishlist
Tags: patch

I've worked on support for diffing .dtb files, a format used to
describe systems such as powerpc, arm and mips.

Attached are two patches, the first implementing support, and the
second adding tests.

They're also available as a git branch:

  https://anonscm.debian.org/cgit/reproducible/diffoscope.git/log/?h=vagrant/dtb


I basically copied the openssh pub key diffing support and modifed to
support .dtb files instead.  Any comments, suggestions or improvements
welcome!


live well,
  vagrant

From c55c67da65ed37bd4268005fbdede27767b1331b Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian 
Date: Mon, 24 Apr 2017 10:21:21 -0700
Subject: [PATCH 1/2] Add support for .dtb (device tree blob) files.

---
 diffoscope/comparators/__init__.py |  1 +
 diffoscope/comparators/dtb.py  | 39 ++
 diffoscope/external_tools.py   |  3 +++
 3 files changed, 43 insertions(+)
 create mode 100644 diffoscope/comparators/dtb.py

diff --git a/diffoscope/comparators/__init__.py b/diffoscope/comparators/__init__.py
index 81f6d16..6527b6d 100644
--- a/diffoscope/comparators/__init__.py
+++ b/diffoscope/comparators/__init__.py
@@ -84,6 +84,7 @@ class ComparatorManager(object):
 ('gif.GifFile',),
 ('pcap.PcapFile',),
 ('pgp.PgpFile',),
+('dtb.DeviceTreeFile',),
 )
 
 _singleton = {}
diff --git a/diffoscope/comparators/dtb.py b/diffoscope/comparators/dtb.py
new file mode 100644
index 000..12dbf39
--- /dev/null
+++ b/diffoscope/comparators/dtb.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+#
+# diffoscope: in-depth comparison of files, archives, and directories
+#
+# Copyright © 2016 Emanuel Bronshtein 
+# Copyright © 2016 Vagrant Cascadian 
+#
+# 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 .
+
+import re
+
+from diffoscope.tools import tool_required
+from diffoscope.difference import Difference
+
+from .utils.file import File
+from .utils.command import Command
+
+
+class DeviceTreeContents(Command):
+@tool_required('fdtdump')
+def cmdline(self):
+return ['fdtdump', self.path]
+
+class DeviceTreeFile(File):
+RE_FILE_TYPE = re.compile(r'^Device Tree Blob')
+
+def compare_details(self, other, source=None):
+return [Difference.from_command(DeviceTreeContents, self.path, other.path)]
diff --git a/diffoscope/external_tools.py b/diffoscope/external_tools.py
index 3ce2cbd..8788936 100644
--- a/diffoscope/external_tools.py
+++ b/diffoscope/external_tools.py
@@ -57,6 +57,9 @@ EXTERNAL_TOOLS = {
 'debian': 'enjarify',
 'arch': 'enjarify',
 },
+'fdtdump': {
+'debian': 'device-tree-compiler',
+},
 'file': {
 'debian': 'file',
 'arch': 'file',
-- 
2.11.0

From 78d43c516db58a89c23ee41a1eb23e47bf2109c8 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian 
Date: Mon, 24 Apr 2017 10:35:52 -0700
Subject: [PATCH 2/2] Add tests for .dtb files.

---
 debian/control  |   1 +
 debian/copyright|  12 ++
 tests/comparators/test_dtb.py   |  57 +
 tests/data/devicetree1.dtb  | Bin 0 -> 68260 bytes
 tests/data/devicetree2.dtb  | Bin 0 -> 68323 bytes
 tests/data/devicetree_expected_diff |  71 
 6 files changed, 141 insertions(+)
 create mode 100644 tests/comparators/test_dtb.py
 create mode 100644 tests/data/devicetree1.dtb
 create mode 100644 tests/data/devicetree2.dtb
 create mode 100644 tests/data/devicetree_expected_diff

diff --git a/debian/control b/debian/control
index d0eef28..e3cbc55 100644
--- a/debian/control
+++ b/debian/control
@@ -19,6 +19,7 @@ Build-Depends:
  dh-python (>= 2.20160818~),
  docx2txt ,
  dpkg-dev (>= 1.17.14),
+ device-tree-compiler ,
  enjarify ,
  fontforge-extras ,
  fp-utils ,
diff --git a/debian/copyright b/debian/copyright
index ac52ac0..8c0e230 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -93,6 +93,18 @@ Copyright: 2007-2014 OpenWrt.org
2010 Vertical Communications
 License: GPL-2
 
+Files: tests/data/devicetree*.dtb
+Copyright:
+	2015 Nikolaus Schaller 
+	2012 Texas Instruments Incorporated - http:www.ti.com/
+	2011 Texas Instruments Incorporated - http:www.ti.com/
+	2013 Linaro, Ltd.
+	2015 Sakari Ailus
+	2011 Texas Instruments Incorporated - http:www.ti.com/
+	2017 Texas