summary refs log tree commit diff
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2016-09-11 21:43:06 +0300
committerEfraim Flashner <efraim@flashner.co.il>2016-09-18 23:19:46 +0300
commitb8ea5204ab1d9eb9464753fa6b1af9f5705a1084 (patch)
tree7de1b70485c0cb090236cb0281e8ba9f5d936b21
parentd488d5d65b1bfb85da5277bd4697a29d75b2d373 (diff)
downloadguix-b8ea5204ab1d9eb9464753fa6b1af9f5705a1084.tar.gz
gnu: Add onionshare.
* gnu/packages/tor.scm (onionshare): New variable.
* gnu/packages/patches/onionshare-fix-install-paths.patch: New variable.
* gnu/local.mk (dist_patch_DATA): Add it.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/patches/onionshare-fix-install-paths.patch39
-rw-r--r--gnu/packages/tor.scm100
3 files changed, 140 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index e2cf40d4ae..407612155f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -702,6 +702,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/nvi-db4.patch				\
   %D%/packages/patches/ocaml-CVE-2015-8869.patch		\
   %D%/packages/patches/ocaml-findlib-make-install.patch	\
+  %D%/packages/patches/onionshare-fix-install-paths.patch		\
   %D%/packages/patches/openexr-missing-samples.patch		\
   %D%/packages/patches/openjpeg-CVE-2015-6581.patch		\
   %D%/packages/patches/openjpeg-CVE-2016-5157.patch		\
diff --git a/gnu/packages/patches/onionshare-fix-install-paths.patch b/gnu/packages/patches/onionshare-fix-install-paths.patch
new file mode 100644
index 0000000000..721b89f04b
--- /dev/null
+++ b/gnu/packages/patches/onionshare-fix-install-paths.patch
@@ -0,0 +1,39 @@
+From 7afdd3366711a0c508bfb9323af8f4268ab77c9b Mon Sep 17 00:00:00 2001
+From: Efraim Flashner <efraim@flashner.co.il>
+Date: Thu, 21 Jul 2016 13:22:45 +0300
+Subject: [PATCH] patch
+
+---
+ setup.py | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index 8ae56fe..8b245c9 100644
+--- a/setup.py
++++ b/setup.py
+@@ -91,15 +91,15 @@ setup(
+     include_package_data=True,
+     scripts=['install/scripts/onionshare', 'install/scripts/onionshare-gui'],
+     data_files=[
+-        (os.path.join(sys.prefix, 'share/applications'), ['install/onionshare.desktop']),
+-        (os.path.join(sys.prefix, 'share/appdata'), ['install/onionshare.appdata.xml']),
+-        (os.path.join(sys.prefix, 'share/pixmaps'), ['install/onionshare80.xpm']),
+-        (os.path.join(sys.prefix, 'share/onionshare'), [
++        ('share/applications', ['install/onionshare.desktop']),
++        ('share/appdata', ['install/onionshare.appdata.xml']),
++        ('share/pixmaps', ['install/onionshare80.xpm']),
++        ('share/onionshare', [
+             'resources/version.txt',
+             'resources/wordlist.txt'
+         ]),
+-        (os.path.join(sys.prefix, 'share/onionshare/images'), images),
+-        (os.path.join(sys.prefix, 'share/onionshare/locale'), locale),
+-        (os.path.join(sys.prefix, 'share/onionshare/html'), html)
++        ('share/onionshare/images', images),
++        ('share/onionshare/locale', locale),
++        ('share/onionshare/html', html)
+     ]
+ )
+-- 
+2.9.1
+
diff --git a/gnu/packages/tor.scm b/gnu/packages/tor.scm
index 951b8f680b..fe74c3c972 100644
--- a/gnu/packages/tor.scm
+++ b/gnu/packages/tor.scm
@@ -31,6 +31,7 @@
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages qt)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages w3m))
@@ -145,3 +146,102 @@ flexible configuration and can be customized to suit individual needs and
 tastes.  It has application for both stand-alone systems and multi-user
 networks.")
     (license gpl2+)))
+
+(define-public onionshare
+  (package
+    (name "onionshare")
+    (version "0.9")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append "https://github.com/micahflee/onionshare/archive/v"
+                            version ".tar.gz"))
+        (file-name (string-append name "-" version ".tar.gz"))
+        (sha256
+         (base32
+          "0pc3xbq379415s0i0y6rz02hay20zbvgra1jmg4mgrl9vbdr8zmw"))
+        (patches (search-patches "onionshare-fix-install-paths.patch"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-install-path
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out        (assoc-ref outputs "out"))
+                    (onionshare (string-append out "/share/onionshare")))
+               (substitute*
+                 "install/pyinstaller.spec"
+                 ;; inform onionshare where the 'resources' files are installed
+                 (("../resources") onionshare))
+               (substitute*
+                 "onionshare/strings.py"
+                 ;; correct the locale directory
+                 (("helpers.get_resource_path\\('locale'\\)")
+                  (string-append "'" onionshare "/locale'")))
+               (substitute*
+                 "onionshare/helpers.py"
+                 ;; correct the location of version.txt
+                 (("/usr") out)
+                 (("get_resource_path\\('version.txt'\\)")
+                  (string-append "'" onionshare "/version.txt'"))
+                 (("get_resource_path\\('wordlist.txt'\\)")
+                  (string-append "'" onionshare "/wordlist.txt'")))
+               (substitute*
+                 "onionshare/web.py"
+                 ;; fix the location of the html files
+                 (("helpers.get_resource_path\\('html/denied.html'\\)")
+                  (string-append "'" onionshare "/html/denied.html'"))
+                 (("helpers.get_resource_path\\('html/404.html'\\)")
+                  (string-append "'" onionshare "/html/404.html'"))
+                 (("helpers.get_resource_path\\('html/index.html'\\)")
+                  (string-append "'" onionshare "/html/index.html'")))
+               (substitute*
+                 "onionshare_gui/file_selection.py"
+                 (("helpers.get_resource_path\\('images/drop_files.png'\\)")
+                  (string-append "'" onionshare "/images/drop_files.png'")))
+               (substitute*
+                 "onionshare_gui/server_status.py"
+                 (("helpers.get_resource_path\\('images/server_stopped.png'\\)")
+                  (string-append "'" onionshare "/images/server_stopped.png'"))
+                 (("helpers.get_resource_path\\('images/server_working.png'\\)")
+                  (string-append "'" onionshare "/images/server_working.png'"))
+                 (("helpers.get_resource_path\\('images/server_started.png'\\)")
+                  (string-append "'" onionshare "/images/server_started.png'")))
+               (substitute*
+                 "onionshare_gui/onionshare_gui.py"
+                 (("helpers.get_resource_path\\('images/logo.png'\\)")
+                  (string-append "'" onionshare "/images/logo.png'")))
+               (substitute*
+                 "install/onionshare.desktop"
+                 (("/usr") out))
+             #t)))
+         (delete 'check)
+         (add-before 'strip 'tests
+           ;; After all the patching we run the tests after installing.
+           ;; This is also a known issue:
+           ;; https://github.com/micahflee/onionshare/issues/284
+           (lambda _ (zero? (system* "nosetests" "test")))))
+       ;; can't compress the egg because it expects to find all the resources
+       ;; inside the egg as though it were a folder.
+       #:configure-flags '("--single-version-externally-managed" "--root=/")
+       ))
+    (native-inputs
+     `(("python-nose" ,python-nose)))
+    (inputs
+     `(("python-flask" ,python-flask)
+       ("python-nautilus" ,python-nautilus)
+       ("python-sip" ,python-sip)
+       ("python-stem" ,python-stem)
+       ("python-pyqt" ,python-pyqt)))
+    (home-page "https://onionshare.org/")
+    (synopsis "Securely and anonymously share files")
+    (description "OnionShare lets you securely and anonymously share files of
+any size.  It works by starting a web server, making it accessible as a Tor
+hidden service, and generating an unguessable URL to access and download the
+files.  It doesn't require setting up a server on the internet somewhere or
+using a third party filesharing service.  You host the file on your own computer
+and use a Tor hidden service to make it temporarily accessible over the
+internet.  The other user just needs to use Tor Browser to download the file
+from you.")
+    (license (list license:gpl3+
+                   license:bsd-3)))) ; onionshare/socks.py