Commit aa0b2654 authored by Chris Lamb's avatar Chris Lamb 👀
Browse files

Add support for GnuPG "keybox" files. Thanks to Daniel Kahn Gillmor for the...

Add support for GnuPG "keybox" files. Thanks to Daniel Kahn Gillmor for the suggestion. (Closes: #871244, #23)
parent dc5ad047
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ Build-Depends:
 ghostscript <!nocheck>,
 giflib-tools <!nocheck>,
 gnumeric <!nocheck>,
 gnupg-utils <!nocheck>,
 help2man,
 imagemagick <!nocheck>,
 jsbeautifier <!nocheck>,
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
#   $ mv debian/tests/control.tmp debian/tests/control

Tests: pytest-with-recommends
Depends: diffoscope, python3-pytest, file, linux-image-amd64 [amd64] | linux-image-generic [amd64], abootimg, acl, apktool [!ppc64el !s390x], binutils-multiarch, bzip2, caca-utils, colord, db-util, default-jdk-headless | default-jdk | java-sdk, device-tree-compiler, docx2txt, e2fsprogs, enjarify, ffmpeg, fontforge-extras, fp-utils [!ppc64el !s390x], genisoimage, gettext, ghc, ghostscript, giflib-tools, gnumeric, gnupg, imagemagick, jsbeautifier, libarchive-tools, llvm, lz4 | liblz4-tool, mono-utils, ocaml-nox, odt2txt, openssh-client, pgpdump, poppler-utils, r-base-core, rpm2cpio, sng, sqlite3, squashfs-tools, tcpdump, unzip, xmlbeans, xxd | vim-common, xz-utils, zip, python3-argcomplete, python3-binwalk, python3-defusedxml, python3-distro, python3-guestfs, python3-jsondiff, python3-progressbar, python3-pypdf2, python3-debian, python3-pyxattr, python3-rpm, python3-tlsh
Depends: diffoscope, python3-pytest, file, linux-image-amd64 [amd64] | linux-image-generic [amd64], abootimg, acl, apktool [!ppc64el !s390x], binutils-multiarch, bzip2, caca-utils, colord, db-util, default-jdk-headless | default-jdk | java-sdk, device-tree-compiler, docx2txt, e2fsprogs, enjarify, ffmpeg, fontforge-extras, fp-utils [!ppc64el !s390x], genisoimage, gettext, ghc, ghostscript, giflib-tools, gnumeric, gnupg, gnupg-utils, imagemagick, jsbeautifier, libarchive-tools, llvm, lz4 | liblz4-tool, mono-utils, ocaml-nox, odt2txt, openssh-client, pgpdump, poppler-utils, r-base-core, rpm2cpio, sng, sqlite3, squashfs-tools, tcpdump, unzip, xmlbeans, xxd | vim-common, xz-utils, zip, python3-argcomplete, python3-binwalk, python3-defusedxml, python3-distro, python3-guestfs, python3-jsondiff, python3-progressbar, python3-pypdf2, python3-debian, python3-pyxattr, python3-rpm, python3-tlsh

Tests: pytest
Depends: diffoscope, python3-pytest, file
+1 −0
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ class ComparatorManager(object):
        ('pcap.PcapFile',),
        ('pgp.PgpFile',),
        ('pgp.PgpSignature',),
        ('kbx.KbxFile',),
        ('dtb.DeviceTreeFile',),
        ('ogg.OggFile',),
        ('xsb.XsbFile',),
+50 −0
Original line number Diff line number Diff line
# -*- coding: utf-8 -*-
#
# diffoscope: in-depth comparison of files, archives, and directories
#
# Copyright © 2019 Chris Lamb <lamby@debian.org>
#
# diffoscope 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.
#
# diffoscope 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 diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import re

from diffoscope.tools import tool_required
from diffoscope.difference import Difference

from .utils.file import File
from .utils.command import Command


class Kbxutil(Command):
    @tool_required('kbxutil')
    def cmdline(self):
        return ('kbxutil', self.path)

    def filter(self, line):
        return line
        if line.decode('utf-8').strip() == self.path:
            return b''
        return line


class KbxFile(File):
    DESCRIPTION = "GPG keybox databases"
    FILE_TYPE_RE = re.compile(r'^GPG keybox database\b')

    def compare_details(self, other, source=None):
        return [
            Difference.from_command(
                Kbxutil, self.path, other.path, source='kbxutil'
            )
        ]
+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ EXTERNAL_TOOLS = {
        'arch': 'java-environment',
    },
    'js-beautify': {'debian': 'jsbeautifier', 'arch': 'python-jsbeautifier'},
    'kbxutil': {'debian': 'gnupg-utils'},
    'llvm-bcanalyzer': {'debian': 'llvm', 'arch': 'llvm'},
    'llvm-config': {'debian': 'llvm', 'arch': 'llvm'},
    'llvm-dis': {'debian': 'llvm', 'arch': 'llvm'},
Loading