Commit 40763627 authored by Jérémy Bobbio's avatar Jérémy Bobbio

Add support for comparing .hi and .p_hi files

parent a822efca
......@@ -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):
(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),
# -*- coding: utf-8 -*-
# debbindiff: highlight differences between two builds of Debian packages
# Copyright © 2014 Jérémy Bobbio <>
# 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
# 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 <>.
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)
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 []
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment