[Reproducible-commits] [debbindiff] 04/05: Add support for png 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 b311562e1c6e7bd5ab54f21fe25b6f229b25d9e8
Author: Jérémy Bobbio <lunar at debian.org>
Date: Tue Dec 30 11:29:21 2014 +0000
Add support for png files
Closes: #773573
---
README | 1 +
debbindiff/comparators/__init__.py | 2 ++
debbindiff/comparators/png.py | 43 ++++++++++++++++++++++++++++++++++++++
debian/control | 1 +
4 files changed, 47 insertions(+)
diff --git a/README b/README
index d56805c..1b4b115 100644
--- a/README
+++ b/README
@@ -38,6 +38,7 @@ in the path:
| objdump | binutils-multiarch |
| readelf | binutils-multiarch |
| showttf | fontforge-extras |
+| sng | sng |
| vim | vim |
| xxd | vim-common |
| xz | xz-utils |
diff --git a/debbindiff/comparators/__init__.py b/debbindiff/comparators/__init__.py
index 753c396..955d8dd 100644
--- a/debbindiff/comparators/__init__.py
+++ b/debbindiff/comparators/__init__.py
@@ -32,6 +32,7 @@ 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
+from debbindiff.comparators.png import compare_png_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
@@ -76,6 +77,7 @@ COMPARATORS = [
(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),
+ (r'^image/png(;|$)', r'\.png$', compare_png_files),
(None, r'\.a$', compare_static_lib_files),
]
diff --git a/debbindiff/comparators/png.py b/debbindiff/comparators/png.py
new file mode 100644
index 0000000..87f2538
--- /dev/null
+++ b/debbindiff/comparators/png.py
@@ -0,0 +1,43 @@
+# -*- 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 sng(path):
+ with open(path) as f:
+ p = subprocess.Popen(['sng'], shell=False, close_fds=True,
+ stdin=f, stdout=subprocess.PIPE)
+ out, err = p.communicate()
+ p.wait()
+ if p.returncode != 0:
+ return 'sng exited with error %d\n%s' % (p.returncode, err)
+ return out
+
+ at binary_fallback
+def compare_png_files(path1, path2, source=None):
+ sng1 = sng(path1)
+ sng2 = sng(path2)
+ if sng1 != sng2:
+ return [Difference(sng1.splitlines(1), sng2.splitlines(1),
+ path1, path2, source='sng')]
+ return []
+
diff --git a/debian/control b/debian/control
index 9a0c03e..deb0074 100644
--- a/debian/control
+++ b/debian/control
@@ -24,6 +24,7 @@ Depends: binutils-multiarch,
gettext,
ghc,
gnupg,
+ sng,
unzip,
vim,
vim-common,
--
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