ports/sysutils/py-diffoscope/files/patch-diffoscope_comparators_directory.py
Kubilay Kocak f7da613142 [NEW] sysutils/py-diffoscope: In-depth comparison of files, archives, and directories
diffoscope will try to get to the bottom of what makes files or
directories different. It will recursively unpack archives of many kinds
and transform various binary formats into more human readable form to
compare them. It can compare two tarballs, ISO images, or PDF just as
easily.

It can be scripted through error codes, and a report can be produced
with the detected differences. The report can be text or HTML. When no
type of report has been selected, diffoscope defaults to write a text
report on the standard output.

diffoscope is developed as part of the 'reproducible builds' Deian
project. It is meant to be able to quickly understand why two builds
of the same package produce different outputs. diffoscope was previously
named debbindiff.

WWW: https://diffoscope.org/

Thank you to bapt for providing the background context, information and
the getfacl patch to get this port going.

Requested by:	emaste, bapt (for reproducible builds & FOSDEM talk)
2016-01-31 08:38:33 +00:00

47 lines
1.8 KiB
Python

--- diffoscope/comparators/directory.py.orig 2016-01-30 11:54:52 UTC
+++ diffoscope/comparators/directory.py
@@ -72,8 +72,11 @@ def lsattr(path):
class Getfacl(Command):
@tool_required('getfacl')
def cmdline(self):
- return ['getfacl', '-p', '-c', self.path]
-
+ osname = os.uname()[0]
+ if osname == 'Linux':
+ return ['getfacl', '-p', '-c', self.path]
+ else: # FreeBSD
+ return ['getfacl', '-q', '-h', self.path]
def compare_meta(path1, path2):
logger.debug('compare_meta(%s, %s)', path1, path2)
@@ -84,17 +87,19 @@ def compare_meta(path1, path2):
logger.warn("'stat' not found! Is PATH wrong?")
if os.path.islink(path1) or os.path.islink(path2):
return [d for d in differences if d is not None]
- try:
- lsattr1 = lsattr(path1)
- lsattr2 = lsattr(path2)
- differences.append(Difference.from_text(
- lsattr1, lsattr2, path1, path2, source="lattr"))
- except RequiredToolNotFound:
- logger.info("Unable to find 'lsattr'.")
- try:
- differences.append(Difference.from_command(Getfacl, path1, path2))
- except RequiredToolNotFound:
- logger.info("Unable to find 'getfacl'.")
+ osname = os.uname()[0]
+ if osname == "Linux" or osname == "FreeBSD":
+ try:
+ lsattr1 = lsattr(path1)
+ lsattr2 = lsattr(path2)
+ differences.append(Difference.from_text(
+ lsattr1, lsattr2, path1, path2, source="lattr"))
+ except RequiredToolNotFound:
+ logger.info("Unable to find 'lsattr'.")
+ try:
+ differences.append(Difference.from_command(Getfacl, path1, path2))
+ except RequiredToolNotFound:
+ logger.info("Unable to find 'getfacl'.")
return [d for d in differences if d is not None]