[trydiffoscope] 01/01: Initial commit.
Chris Lamb
chris at chris-lamb.co.uk
Fri Dec 9 11:04:59 UTC 2016
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository trydiffoscope.
commit 51e42dd543a7811e05a30e4d5fd3f485a9990db6
Author: Chris Lamb <lamby at debian.org>
Date: Fri Dec 9 12:02:58 2016 +0100
Initial commit.
Signed-off-by: Chris Lamb <chris at chris-lamb.co.uk>
---
debian/changelog | 5 ++
debian/compat | 1 +
debian/control | 32 ++++++++++
debian/copyright | 24 +++++++
debian/rules | 15 +++++
debian/source/format | 1 +
debian/trydiffoscope.manpages | 1 +
setup.py | 11 ++++
trydiffoscope | 144 ++++++++++++++++++++++++++++++++++++++++++
trydiffoscope.1.rst | 59 +++++++++++++++++
10 files changed, 293 insertions(+)
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..94abaa4
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+trydiffoscope (64) UNRELEASED; urgency=medium
+
+ * New release after splitting from src:diffoscope.
+
+ -- Chris Lamb <lamby at debian.org> Fri, 09 Dec 2016 11:45:20 +0100
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..f599e28
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+10
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..2f652c8
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,32 @@
+Source: trydiffoscope
+Section: devel
+Priority: optional
+Maintainer: Reproducible builds folks <reproducible-builds at lists.alioth.debian.org>
+Uploaders:
+ Chris Lamb <lamby at debian.org>,
+Build-Depends:
+ debhelper (>= 10),
+ python-docutils,
+ python3-all,
+Standards-Version: 3.9.8
+Homepage: https://diffoscope.org/
+Vcs-Git: https://anonscm.debian.org/git/reproducible/trydiffoscope.git
+Vcs-Browser: https://anonscm.debian.org/git/reproducible/trydiffoscope.git
+
+Package: trydiffoscope
+Architecture: all
+Depends:
+ python3-requests,
+ ${misc:Depends},
+ ${python3:Depends},
+Description: in-depth comparison of files, archives, etc. (try.diffoscope.org client)
+ 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. The differences can
+ be shown in a text or HTML report.
+ .
+ diffoscope is developed as part of the “reproducible builds” Debian
+ project.
+ .
+ This package contains the https://try.diffoscope.org/ command-line client.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..257c5c9
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,24 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: trydiffoscope
+Source: https://anonscm.debian.org/cgit/reproducible/trydiffoscope.git/
+
+Files: *
+Copyright: 2016 Chris Lamb <lamby at debian.org>
+License: GPL-3+
+
+License: GPL-3+
+ This program 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.
+ .
+ This package 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 this program. If not, see <http://www.gnu.org/licenses/>.
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..bb19417
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,15 @@
+#!/usr/bin/make -f
+
+MANPAGES = trydiffoscope.1
+
+%:
+ dh $@ --with python3 --buildsystem=pybuild
+
+%.1: %.1.rst
+ rst2man $< $@
+
+override_dh_auto_clean:
+ rm -f $(MANPAGES)
+
+override_dh_auto_build: $(MANPAGES)
+ dh_auto_build
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
diff --git a/debian/trydiffoscope.manpages b/debian/trydiffoscope.manpages
new file mode 100644
index 0000000..b1462c7
--- /dev/null
+++ b/debian/trydiffoscope.manpages
@@ -0,0 +1 @@
+trydiffoscope.1
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..274ab43
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,11 @@
+from distutils.core import setup
+
+setup(
+ name='trydiffoscope',
+ version='64',
+ author="Chris Lamb",
+ author_email="lamby at debian.org",
+ scripts=(
+ 'trydiffoscope',
+ ),
+)
diff --git a/trydiffoscope b/trydiffoscope
new file mode 100755
index 0000000..f3d6f55
--- /dev/null
+++ b/trydiffoscope
@@ -0,0 +1,144 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# diffoscope: in-depth comparison of files, archives, and directories
+#
+# Copyright © 2016 Chris Lamb <lamby at 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 <http://www.gnu.org/licenses/>.
+
+import io
+import os
+import sys
+import time
+import argparse
+import requests
+import webbrowser
+
+class TryDiffoscope(object):
+ def __init__(self, args):
+ self.args = args
+ self.session = requests.Session()
+
+ def main(self):
+ response = self.session.post(self.args.endpoint, files={
+ 'file_a': open(self.args.file[0], 'rb'),
+ 'file_b': open(self.args.file[1], 'rb'),
+ })
+
+ response.raise_for_status()
+ poll_uri = response.json()['result']['uri']
+
+ while True:
+ response = self.session.get(poll_uri)
+ response.raise_for_status()
+ comparison = response.json()['result']
+
+ # Bail out early if --url or --webbrowser specified
+ if self.args.url or self.args.webbrowser:
+ print(comparison['uri'])
+
+ if self.args.webbrowser:
+ webbrowser.open(comparison['uri'])
+
+ return 0
+
+ if comparison['state'] not in ('queued', 'running'):
+ break
+
+ time.sleep(1)
+
+ if comparison['state'] not in ('identical', 'different'):
+ print("E: Received state '{}' from server. See {}".format(
+ comparison['state'],
+ comparison['uri'],
+ ), file=sys.stderr)
+ return 2
+
+ if comparison['state'] == 'identical':
+ return 0
+
+ # Report/save output
+ to_save = {x for x in ('html', 'text') if getattr(self.args, x)}
+
+ for x in to_save:
+ response = self.session.get(comparison['formats'][x])
+ response.raise_for_status()
+
+ with open(getattr(self.args, x), 'w') as f:
+ print(response.text, file=f)
+
+ if not to_save:
+ response = self.session.get(comparison['formats']['text'])
+ response.raise_for_status()
+ print(response.content.decode('utf-8'))
+
+ return 1
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+
+ parser.add_argument(
+ 'file',
+ help="files to compare",
+ nargs=2,
+ default=[],
+ )
+
+ parser.add_argument(
+ '--endpoint',
+ help="specify trydiffoscope API endpoint",
+ default='https://try.diffoscope.org/api/v3/comparison',
+ )
+
+ parser.add_argument(
+ '--text',
+ help="write plain text output to given file",
+ default=None,
+ )
+
+ parser.add_argument(
+ '--html',
+ help="write HTML report to given file",
+ default=None,
+ )
+
+ parser.add_argument(
+ '-u',
+ '--url',
+ help="print URL instead of managing results locally",
+ action='store_true',
+ )
+
+ parser.add_argument(
+ '-w',
+ '--webbrowser',
+ help="open webbrowser to URL instead of managing results "
+ "locally (implies -u)",
+ action='store_true',
+ )
+
+ args = parser.parse_args()
+
+ for x in args.file:
+ if not os.path.exists(x):
+ parser.error("{}: does not exist".format(x))
+
+ if sys.stdout.encoding != 'UTF-8':
+ sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='UTF-8')
+
+ try:
+ sys.exit(TryDiffoscope(args).main())
+ except KeyboardInterrupt:
+ sys.exit(1)
diff --git a/trydiffoscope.1.rst b/trydiffoscope.1.rst
new file mode 100644
index 0000000..2072203
--- /dev/null
+++ b/trydiffoscope.1.rst
@@ -0,0 +1,59 @@
+==============
+ trydiffoscope
+==============
+
+-----------------------------------------------------------------------------------
+in-depth comparison of files, archives, and directories (try.diffoscope.org client)
+-----------------------------------------------------------------------------------
+
+:Author: Chris Lamb <lamby at debian.org>
+:Copyright: GPL-3+
+:Manual section: 1
+:Manual group: Debian
+
+SYNOPSIS
+========
+
+ trydiffoscope [-h] [--endpoint ENDPOINT] [--text TEXT] [--html HTML] [--url] [--webbrowser] file file
+
+DESCRIPTION
+===========
+
+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” Debian
+project and was formerly known as “debbindiff”.
+
+trydiffoscope is a command-line API to the trydiffoscope web service.
+
+OPTIONS
+=======
+
+-h, --help show this help message and exit
+--endpoint ENDPOINT specify trydiffoscope API endpoint
+--text TEXT write plain text output to given file
+--html HTML write HTML report to given file
+-u, --url print URL instead of managing results locally
+-w, --webbrowser open webbrowser to URL instead of managing results
+ locally (implies -u)
+
+EXIT STATUS
+===========
+
+Exit status is 0 if inputs are the same, 1 if different, 2 if trouble.
+
+SEE ALSO
+========
+
+* `<https://diffoscope.org/>`
+* `<https://try.diffoscope.org/>`
+* `<https://wiki.debian.org/ReproducibleBuilds>`
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/trydiffoscope.git
More information about the Reproducible-commits
mailing list