[Reproducible-commits] [debbindiff] 03/05: Add support for ttf and otf files

Jérémy Bobbio lunar at moszumanska.debian.org
Tue Dec 30 11:48:57 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 9c5f4edbac03f9ceeebf4eb54c42281bc63b9914
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Mon Dec 29 14:20:18 2014 +0000

    Add support for ttf and otf files
---
 README                             |  1 +
 debbindiff/comparators/__init__.py |  2 ++
 debbindiff/comparators/fonts.py    | 36 ++++++++++++++++++++++++++++++++++++
 debian/control                     |  1 +
 4 files changed, 40 insertions(+)

diff --git a/README b/README
index 3d3714e..d56805c 100644
--- a/README
+++ b/README
@@ -37,6 +37,7 @@ in the path:
 | msgunfmt | gettext            |
 | objdump  | binutils-multiarch |
 | readelf  | binutils-multiarch |
+| showttf  | fontforge-extras   |
 | vim      | vim                |
 | xxd      | vim-common         |
 | xz       | xz-utils           |
diff --git a/debbindiff/comparators/__init__.py b/debbindiff/comparators/__init__.py
index 296ee31..753c396 100644
--- a/debbindiff/comparators/__init__.py
+++ b/debbindiff/comparators/__init__.py
@@ -28,6 +28,7 @@ from debbindiff.comparators.changes import compare_changes_files
 from debbindiff.comparators.deb import compare_deb_files, compare_md5sums_files
 from debbindiff.comparators.elf import \
     compare_elf_files, compare_static_lib_files
+from debbindiff.comparators.fonts import compare_ttf_files
 from debbindiff.comparators.gettext import compare_mo_files
 from debbindiff.comparators.gzip import compare_gzip_files
 from debbindiff.comparators.haskell import compare_hi_files
@@ -74,6 +75,7 @@ COMPARATORS = [
     (r'^application/x-executable(;|$)', None, compare_elf_files),
     (r'^application/x-sharedlib(;|$)', r'\.so($|\.[0-9.]+$)',
      compare_elf_files),
+    (r'^application/(x-font-ttf|vnd.ms-opentype)(;|$)', r'\.(ttf|otf)$', compare_ttf_files),
     (None, r'\.a$', compare_static_lib_files),
     ]
 
diff --git a/debbindiff/comparators/fonts.py b/debbindiff/comparators/fonts.py
new file mode 100644
index 0000000..181235e
--- /dev/null
+++ b/debbindiff/comparators/fonts.py
@@ -0,0 +1,36 @@
+# -*- 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 subprocess
+from debbindiff.comparators.utils import binary_fallback
+from debbindiff.difference import Difference
+
+
+def show_ttf(path):
+    return subprocess.check_output(['showttf', path], shell=False)
+
+
+ at binary_fallback
+def compare_ttf_files(path1, path2, source=None):
+    ttf1 = show_ttf(path1)
+    ttf2 = show_ttf(path2)
+    if ttf1 != ttf2:
+        return [Difference(ttf1.splitlines(1), ttf2.splitlines(1),
+                           path1, path2, source='showttf')]
+    return []
diff --git a/debian/control b/debian/control
index 95ce89b..9a0c03e 100644
--- a/debian/control
+++ b/debian/control
@@ -20,6 +20,7 @@ Architecture: all
 Depends: binutils-multiarch,
          bzip2,
          file,
+         fontforge-extras,
          gettext,
          ghc,
          gnupg,

-- 
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