[Reproducible-commits] [debbindiff] 04/10: Add support for comparing .hi and .p_hi files
Jérémy Bobbio
lunar at moszumanska.debian.org
Mon Sep 29 22:35:19 UTC 2014
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch master
in repository debbindiff.
commit 40763627e0d3b498b23f17be095bac1b107e32a8
Author: Jérémy Bobbio <lunar at debian.org>
Date: Mon Sep 29 23:50:26 2014 +0200
Add support for comparing .hi and .p_hi files
---
debbindiff/comparators/__init__.py | 2 ++
debbindiff/comparators/haskell.py | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/debbindiff/comparators/__init__.py b/debbindiff/comparators/__init__.py
index 7cf749d..a2940a4 100644
--- a/debbindiff/comparators/__init__.py
+++ b/debbindiff/comparators/__init__.py
@@ -27,6 +27,7 @@ from debbindiff.comparators.bzip2 import compare_bzip2_files
from debbindiff.comparators.changes import compare_changes_files
from debbindiff.comparators.deb import compare_deb_files
from debbindiff.comparators.gzip import compare_gzip_files
+from debbindiff.comparators.haskell import compare_hi_files
from debbindiff.comparators.text import compare_text_files
from debbindiff.comparators.tar import compare_tar_files
from debbindiff.comparators.xz import compare_xz_files
@@ -54,6 +55,7 @@ def compare_unknown(path1, path2, source=None):
COMPARATORS = [
(None, r'\.changes$', compare_changes_files),
+ (None, r'\.(p_)?hi$', compare_hi_files),
(r'^application/x-xz(;|$)', r'\.xz$', compare_xz_files),
(r'^application/x-tar(;|$)', r'\.tar$', compare_tar_files),
(r'^application/x-debian-package(;|$)', r'\.deb$', compare_deb_files),
diff --git a/debbindiff/comparators/haskell.py b/debbindiff/comparators/haskell.py
new file mode 100644
index 0000000..360b65f
--- /dev/null
+++ b/debbindiff/comparators/haskell.py
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+#
+# debbindiff: highlight differences between two builds of Debian packages
+#
+# Copyright © 2014 Jérémy Bobbio <lunar at debian.org>
+#
+# debdindiff 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.
+#
+# debbindiff 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 debbindiff. If not, see <http://www.gnu.org/licenses/>.
+
+import os.path
+import subprocess
+from debbindiff.comparators.utils import binary_fallback
+from debbindiff.difference import Difference
+
+def show_iface(path):
+ return subprocess.check_output(['ghc', '--show-iface', path], shell=False)
+
+ at binary_fallback
+def compare_hi_files(path1, path2, source=None):
+ iface1 = show_iface(path1)
+ iface2 = show_iface(path2)
+ if iface1 != iface2:
+ return [Difference(iface1.splitlines(1), iface2.splitlines(1), path1, path2, source='ghc --show-iface')]
+ return []
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/debbindiff.git
More information about the Reproducible-commits
mailing list