Source: diffoscope
Version: 84
Severity: normal

Some test cases failed when running diffoscope test suite on FreeBSD. Most of 
the issues are caused by the difference between BSD Diff (`diff` on FreeBSD) 
and GNU Diff (`gdiff` on FreeBSD).

Diffoscope should use `gdiff` when available. I will make sure that `gdiff` is 
a dependency of diffoscope in FreeBSD Ports. 

A proposed patch is attached. Not sure if this implementation is clean enough 
though.
diff --git a/diffoscope/diff.py b/diffoscope/diff.py
index 17a5289..bf46ec6 100644
--- a/diffoscope/diff.py
+++ b/diffoscope/diff.py
@@ -31,11 +31,19 @@ from multiprocessing.dummy import Queue
 
 from diffoscope.tempfiles import get_temporary_directory
 
+from distutils.spawn import find_executable
+
 from .tools import tool_required
 from .config import Config
 
 DIFF_CHUNK = 4096
 
+DIFF_TOOL = 'diff'
+
+gdiff_path = find_executable('gdiff')
+if gdiff_path:
+    DIFF_TOOL = 'gdiff'
+
 logger = logging.getLogger(__name__)
 re_diff_change = re.compile(r'^([+-@]).*', re.MULTILINE)
 
@@ -159,9 +167,9 @@ class DiffParser(object):
         return self.skip_block
 
 
-@tool_required('diff')
+@tool_required(DIFF_TOOL)
 def run_diff(fifo1, fifo2, end_nl_q1, end_nl_q2):
-    cmd = ['diff', '-aU7', fifo1, fifo2]
+    cmd = [DIFF_TOOL, '-aU7', fifo1, fifo2]
 
     logger.debug("Running %s", ' '.join(cmd))
 
_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to