From 102f42e225661adea46ee134455cacdec25a3f64 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 3 May 2020 13:56:18 -0700 Subject: [PATCH 01/15] Begin making a snapcraft.yaml --- BUILD.md | 1 + setup.py | 7 +++- snap/snapcraft.yaml | 83 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 snap/snapcraft.yaml diff --git a/BUILD.md b/BUILD.md index 2efd251e..c38f9542 100644 --- a/BUILD.md +++ b/BUILD.md @@ -301,6 +301,7 @@ Before making a release, all of these should be complete: * `share/version.txt` should have the correct version * `pyproject.toml` should have the correct version * `install/org.onionshare.OnionShare.appdata.xml` should have the correct version +* `snap/snapcraft.yaml` should have the correct version * `install/onionshare.nsi` should have the correct version, for the Windows installer * `CHANGELOG.md` should be updated to include a list of all major changes since the last release * There must be a PGP-signed git tag for the version, e.g. for OnionShare 2.1, the tag must be `v2.1` diff --git a/setup.py b/setup.py index e6953370..21e435b4 100644 --- a/setup.py +++ b/setup.py @@ -112,6 +112,11 @@ setup( "onionshare_gui.tab.mode.website_mode", ], include_package_data=True, - scripts=["install/scripts/onionshare", "install/scripts/onionshare-gui"], + entry_points={ + "console_scripts": [ + "onionshare = onionshare:main", + "onionshare-gui = onionshare_gui.main", + ], + }, data_files=data_files, ) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 00000000..7abf29ce --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,83 @@ +name: onionshare +base: core18 +version: '2.2' +summary: Securely and anonymously send and receive files, and publish onion sites +description: | + OnionShare is an open source tool for securely and anonymously sending and + receiving files and publishing websites using Tor onion services. It works by + starting a web server directly on your computer and making it accessible as + an unguessable Tor web address that others can load in Tor Browser. It + doesn't require setting up a separate server, using a third party service, or + even logging into an account. + +grade: devel # must be 'stable' to release into candidate/stable channels +confinement: devmode # use 'strict' once you have the right plugs and slots + +apps: + onionshare-gui: + common-id: org.onionshare.OnionShareGui + command: onionshare-gui + extensions: + - kde-neon + plugs: + - kde-frameworks-5-plug + - home + - opengl + - network + - network-bind + - pulseaudio + + # onionshare: + # common-id: org.onionshare.OnionShare + # command: onionshare + # plugs: + # - home + # - network + # - network-bind + +parts: + onionshare: + source: . + plugin: python + python-version: python3 + python-packages: + - Click + - Flask + - Flask-HTTPAuth + - pycryptodome + - PySocks + - requests + - stem + - urllib3 + - psutil + build-packages: + - pyqt5-dev + stage-packages: + - libatk-bridge2.0-0 + - libatspi2.0-0 + - libgtk-3-0 + - python3-pyqt5 + after: [tor, obfs4] + + tor: + source: https://dist.torproject.org/tor-0.4.2.7.tar.gz + source-checksum: sha256/06a1d835ddf382f6bca40a62e8fb40b71b2f73d56f0d53523c8bd5caf9b3026d + source-type: tar + plugin: autotools + build-packages: + - libssl-dev + - zlib1g-dev + after: [libevent] + + libevent: + source: https://github.com/libevent/libevent/releases/download/release-2.1.11-stable/libevent-2.1.11-stable.tar.gz + source-checksum: sha256/a65bac6202ea8c5609fd5c7e480e6d25de467ea1917c08290c521752f147283d + source-type: tar + plugin: autotools + + obfs4: + source: pass + plugin: go + go-importpath: gitlab.com/yawning/obfs4 + source: https://gitlab.com/yawning/obfs4 + source-type: git From 2508bbf29fc606046d0aeccbaa9a5ec9420a9ba1 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 3 May 2020 14:04:54 -0700 Subject: [PATCH 02/15] Update onionshare description, and reduce python version to 3.6 in pyproject.toml --- pyproject.toml | 4 ++-- setup.py | 26 ++++++-------------------- snap/snapcraft.yaml | 5 ++++- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fa83d133..34851025 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,12 @@ [tool.poetry] name = "onionshare" version = "2.2" -description = "OnionShare lets you securely and anonymously send and receive files. It works by starting a web server, making it accessible as a Tor onion service, and generating an unguessable web address so others can download files from you, or upload files to you. It does _not_ require setting up a separate server or using a third party file-sharing service." +description = "Securely and anonymously send and receive files, and publish onion sites" authors = ["Micah Lee "] license = "GPLv3+" [tool.poetry.dependencies] -python = "^3.7" +python = "^3.6" altgraph = "*" certifi = "*" chardet = "*" diff --git a/setup.py b/setup.py index 21e435b4..47514d73 100644 --- a/setup.py +++ b/setup.py @@ -33,25 +33,12 @@ def file_list(path): version = open("share/version.txt").read().strip() description = ( - """OnionShare lets you securely and anonymously send and receive files. It """ - """works by starting a web server, making it accessible as a Tor onion """ - """service, and generating an unguessable web address so others can download """ - """files from you, or upload files to you. It does _not_ require setting up """ - """a separate server or using a third party file-sharing service.""" -) -long_description = ( - description - + "\n\n" - + ( - """If you want to send files to someone, OnionShare hosts them on your own """ - """computer and uses a Tor onion service to make them temporarily accessible """ - """over the internet. The receiving user just needs to open the web address """ - """in Tor Browser to download the files. If you want to receive files, """ - """OnionShare hosts an anonymous dropbox directly on your computer and uses """ - """a Tor onion service to make it temporarily accessible over the internet. """ - """Other users can upload files to you from by loading the web address in """ - """Tor Browser.""" - ) + """OnionShare is an open source tool for securely and anonymously sending and """ + """receiving files and publishing websites using Tor onion services. It works by """ + """starting a web server directly on your computer and making it accessible as """ + """an unguessable Tor web address that others can load in Tor Browser. It """ + """doesn't require setting up a separate server, using a third party service, or """ + """even logging into an account.""" ) author = "Micah Lee" author_email = "micah@micahflee.com" @@ -92,7 +79,6 @@ setup( name="onionshare", version=version, description=description, - long_description=long_description, author=author, author_email=author_email, maintainer=author, diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 7abf29ce..d113af21 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -37,10 +37,13 @@ apps: parts: onionshare: - source: . + source: https://github.com/micahflee/onionshare.git + source-type: git + source-branch: 1111_snap plugin: python python-version: python3 python-packages: + - poetry - Click - Flask - Flask-HTTPAuth From 5ee883544855722ee5a1db632805f04e2afae5a1 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 3 May 2020 14:09:06 -0700 Subject: [PATCH 03/15] Update poetry deps --- poetry.lock | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/poetry.lock b/poetry.lock index 294522d6..a70cf920 100644 --- a/poetry.lock +++ b/poetry.lock @@ -12,7 +12,7 @@ description = "Atomic file writes." name = "atomicwrites" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "1.3.0" +version = "1.4.0" [[package]] category = "dev" @@ -50,7 +50,7 @@ description = "Composable command line interface toolkit" name = "click" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -version = "7.1.1" +version = "7.1.2" [[package]] category = "dev" @@ -95,7 +95,7 @@ description = "Basic and Digest HTTP authentication for Flask routes" name = "flask-httpauth" optional = false python-versions = "*" -version = "3.3.0" +version = "4.0.0" [package.dependencies] Flask = "*" @@ -146,7 +146,7 @@ description = "A very fast and expressive template engine." name = "jinja2" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -version = "2.11.1" +version = "2.11.2" [package.dependencies] MarkupSafe = ">=0.23" @@ -377,11 +377,11 @@ description = "HTTP library with thread-safe connection pooling, file post, and name = "urllib3" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" -version = "1.25.8" +version = "1.25.9" [package.extras] brotli = ["brotlipy (>=0.6.0)"] -secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] +secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "pyOpenSSL (>=0.14)", "ipaddress"] socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7,<2.0)"] [[package]] @@ -418,8 +418,8 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["jaraco.itertools", "func-timeout"] [metadata] -content-hash = "e341ce712d9198499f5e816edc1a62d75f5a913f22880ed631a8698c78d88fb7" -python-versions = "^3.7" +content-hash = "79337146bfcd763700b22316b037e469d2dcb27aa52ab16718efb740c030c994" +python-versions = "^3.6" [metadata.files] altgraph = [ @@ -427,8 +427,8 @@ altgraph = [ {file = "altgraph-0.17.tar.gz", hash = "sha256:1f05a47122542f97028caf78775a095fbe6a2699b5089de8477eb583167d69aa"}, ] atomicwrites = [ - {file = "atomicwrites-1.3.0-py2.py3-none-any.whl", hash = "sha256:03472c30eb2c5d1ba9227e4c2ca66ab8287fbfbbda3888aa93dc2e28fc6811b4"}, - {file = "atomicwrites-1.3.0.tar.gz", hash = "sha256:75a9445bac02d8d058d5e1fe689654ba5a6556a1dfd8ce6ec55a0ed79866cfa6"}, + {file = "atomicwrites-1.4.0-py2.py3-none-any.whl", hash = "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197"}, + {file = "atomicwrites-1.4.0.tar.gz", hash = "sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"}, ] attrs = [ {file = "attrs-19.3.0-py2.py3-none-any.whl", hash = "sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c"}, @@ -443,8 +443,8 @@ chardet = [ {file = "chardet-3.0.4.tar.gz", hash = "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"}, ] click = [ - {file = "click-7.1.1-py2.py3-none-any.whl", hash = "sha256:e345d143d80bf5ee7534056164e5e112ea5e22716bbb1ce727941f4c8b471b9a"}, - {file = "click-7.1.1.tar.gz", hash = "sha256:8a18b4ea89d8820c5d0c7da8a64b2c324b4dabb695804dbfea19b9be9d88c0cc"}, + {file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"}, + {file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"}, ] colorama = [ {file = "colorama-0.4.3-py2.py3-none-any.whl", hash = "sha256:7d73d2a99753107a36ac6b455ee49046802e59d9d076ef8e47b61499fa29afff"}, @@ -460,8 +460,8 @@ flask = [ {file = "Flask-1.1.2.tar.gz", hash = "sha256:4efa1ae2d7c9865af48986de8aeb8504bf32c7f3d6fdc9353d34b21f4b127060"}, ] flask-httpauth = [ - {file = "Flask-HTTPAuth-3.3.0.tar.gz", hash = "sha256:6ef8b761332e780f9ff74d5f9056c2616f52babc1998b01d9f361a1e439e61b9"}, - {file = "Flask_HTTPAuth-3.3.0-py2.py3-none-any.whl", hash = "sha256:0149953720489407e51ec24bc2f86273597b7973d71cd51f9443bd0e2a89bd72"}, + {file = "Flask-HTTPAuth-4.0.0.tar.gz", hash = "sha256:47d62edc33ff16798ed28e06a7387ed10a15f21249c5f61515b41351356a6afc"}, + {file = "Flask_HTTPAuth-4.0.0-py2.py3-none-any.whl", hash = "sha256:067768dbed7b68b2a0172453eaad64648cd6b004b8a2a3912f363050532d11c3"}, ] future = [ {file = "future-0.18.2.tar.gz", hash = "sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d"}, @@ -479,8 +479,8 @@ itsdangerous = [ {file = "itsdangerous-1.1.0.tar.gz", hash = "sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19"}, ] jinja2 = [ - {file = "Jinja2-2.11.1-py2.py3-none-any.whl", hash = "sha256:b0eaf100007721b5c16c1fc1eecb87409464edc10469ddc9a22a27a99123be49"}, - {file = "Jinja2-2.11.1.tar.gz", hash = "sha256:93187ffbc7808079673ef52771baa950426fd664d3aad1d0fa3e95644360e250"}, + {file = "Jinja2-2.11.2-py2.py3-none-any.whl", hash = "sha256:f0a4641d3cf955324a89c04f3d94663aa4d638abe8f733ecd3582848e1c37035"}, + {file = "Jinja2-2.11.2.tar.gz", hash = "sha256:89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c651b3bb0"}, ] macholib = [ {file = "macholib-1.14-py2.py3-none-any.whl", hash = "sha256:c500f02867515e6c60a27875b408920d18332ddf96b4035ef03beddd782d4281"}, @@ -634,8 +634,8 @@ stem = [ {file = "stem-1.8.0.tar.gz", hash = "sha256:a0b48ea6224e95f22aa34c0bc3415f0eb4667ddeae3dfb5e32a6920c185568c2"}, ] urllib3 = [ - {file = "urllib3-1.25.8-py2.py3-none-any.whl", hash = "sha256:2f3db8b19923a873b3e5256dc9c2dedfa883e33d87c690d9c7913e1f40673cdc"}, - {file = "urllib3-1.25.8.tar.gz", hash = "sha256:87716c2d2a7121198ebcb7ce7cccf6ce5e9ba539041cfbaeecfb641dc0bf6acc"}, + {file = "urllib3-1.25.9-py2.py3-none-any.whl", hash = "sha256:88206b0eb87e6d677d424843ac5209e3fb9d0190d0ee169599165ec25e9d9115"}, + {file = "urllib3-1.25.9.tar.gz", hash = "sha256:3018294ebefce6572a474f0604c2021e33b3fd8006ecd11d62107a5d2a963527"}, ] wcwidth = [ {file = "wcwidth-0.1.9-py2.py3-none-any.whl", hash = "sha256:cafe2186b3c009a04067022ce1dcd79cb38d8d65ee4f4791b8888d6599d1bbe1"}, From d1cda85b0a9bb0bb72aa92f702e482ce3a004f8e Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 3 May 2020 14:38:44 -0700 Subject: [PATCH 04/15] In setup.py use scripts instead of entrypoints; in snapcraft remove python packages and get them from pyproject.toml instead --- poetry.lock | 14 +++++++------- pyproject.toml | 2 +- setup.py | 7 +------ snap/snapcraft.yaml | 9 --------- 4 files changed, 9 insertions(+), 23 deletions(-) diff --git a/poetry.lock b/poetry.lock index a70cf920..8f65a9be 100644 --- a/poetry.lock +++ b/poetry.lock @@ -264,7 +264,7 @@ description = "Python bindings for the Qt cross platform application toolkit" name = "pyqt5" optional = false python-versions = ">=3.5" -version = "5.14.0" +version = "5.14.2" [package.dependencies] PyQt5-sip = ">=12.7,<13" @@ -418,7 +418,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["jaraco.itertools", "func-timeout"] [metadata] -content-hash = "79337146bfcd763700b22316b037e469d2dcb27aa52ab16718efb740c030c994" +content-hash = "8b05e3708399e2fd51876b0ac9468805989195fc7d322cf0cf6973ec5de49ac8" python-versions = "^3.6" [metadata.files] @@ -580,11 +580,11 @@ pyparsing = [ {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, ] pyqt5 = [ - {file = "PyQt5-5.14.0-5.14.0-cp35.cp36.cp37.cp38-abi3-macosx_10_6_intel.whl", hash = "sha256:895d4101f7f8c82bc728d7eb9da1c756955ce27a0c945eafe7f234dd03402853"}, - {file = "PyQt5-5.14.0-5.14.0-cp35.cp36.cp37.cp38-abi3-manylinux1_x86_64.whl", hash = "sha256:a757ba71c51f428b52ba404e781e2f19b4436b2c31298b8313339d5817781b65"}, - {file = "PyQt5-5.14.0-5.14.0-cp35.cp36.cp37.cp38-none-win32.whl", hash = "sha256:cc3529c0f7cbbe7491073458d5d15e7518ce544ad8c627f485e5db8a27fcaf61"}, - {file = "PyQt5-5.14.0-5.14.0-cp35.cp36.cp37.cp38-none-win_amd64.whl", hash = "sha256:0dcc128b72f83cce0fc7926c83f05a9b74b652b5eb31a4ab71693ac8829e73c8"}, - {file = "PyQt5-5.14.0.tar.gz", hash = "sha256:0145a6b7de15756366decb736c349a0cb510d706c83fda5b8cd9e0557bc1da72"}, + {file = "PyQt5-5.14.2-5.14.2-cp35.cp36.cp37.cp38-abi3-macosx_10_6_intel.whl", hash = "sha256:a9bdc46ab1f6397770e6b8dca84ac07a0250d26b1a31587f25619cf31a075532"}, + {file = "PyQt5-5.14.2-5.14.2-cp35.cp36.cp37.cp38-abi3-manylinux2014_x86_64.whl", hash = "sha256:ee168a486c9a758511568147815e2959652cd0aabea832fa5e87cf6b241d2180"}, + {file = "PyQt5-5.14.2-5.14.2-cp35.cp36.cp37.cp38-none-win32.whl", hash = "sha256:f61ddc78547d6ca763323ccd4a9e374c71b29feda1f5ce2d3e91e4f8d2cf1942"}, + {file = "PyQt5-5.14.2-5.14.2-cp35.cp36.cp37.cp38-none-win_amd64.whl", hash = "sha256:3b91dd1d0cbfaea85ad057247ba621187e511434b0c9d6d40de69fd5e833b109"}, + {file = "PyQt5-5.14.2.tar.gz", hash = "sha256:bd230c6fd699eabf1ceb51e13a8b79b74c00a80272c622427b80141a22269eb0"}, ] pyqt5-sip = [ {file = "PyQt5_sip-12.7.2-cp35-cp35m-macosx_10_6_intel.whl", hash = "sha256:df4f5cdb86f47df5f6fc35be29cc45df7b5a2c171d07dbf377d558b226554ea3"}, diff --git a/pyproject.toml b/pyproject.toml index 34851025..87f0d977 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ macholib = "*" MarkupSafe = "*" pefile = "*" pycryptodome = "*" -PyQt5 = "5.14" +PyQt5 = "*" PyQt5-sip = "*" PySocks = "*" requests = "*" diff --git a/setup.py b/setup.py index 47514d73..c5a00dc8 100644 --- a/setup.py +++ b/setup.py @@ -98,11 +98,6 @@ setup( "onionshare_gui.tab.mode.website_mode", ], include_package_data=True, - entry_points={ - "console_scripts": [ - "onionshare = onionshare:main", - "onionshare-gui = onionshare_gui.main", - ], - }, + scripts=["install/scripts/onionshare", "install/scripts/onionshare-gui"], data_files=data_files, ) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index d113af21..b0a3173b 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -44,15 +44,6 @@ parts: python-version: python3 python-packages: - poetry - - Click - - Flask - - Flask-HTTPAuth - - pycryptodome - - PySocks - - requests - - stem - - urllib3 - - psutil build-packages: - pyqt5-dev stage-packages: From 9f6691b91d60510a18242ca9a309ebf6ec98a18a Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Tue, 5 May 2020 15:12:13 -0700 Subject: [PATCH 05/15] Start attempting to build Qt5 from source --- snap/snapcraft.yaml | 44 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index b0a3173b..04ec692e 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -17,10 +17,7 @@ apps: onionshare-gui: common-id: org.onionshare.OnionShareGui command: onionshare-gui - extensions: - - kde-neon plugs: - - kde-frameworks-5-plug - home - opengl - network @@ -44,15 +41,50 @@ parts: python-version: python3 python-packages: - poetry - build-packages: - - pyqt5-dev stage-packages: - libatk-bridge2.0-0 - libatspi2.0-0 - libgtk-3-0 - python3-pyqt5 - after: [tor, obfs4] + after: [qt5, tor, obfs4] + # For building Qt5, see: + # https://doc.qt.io/qt-5/linux-building.html + # https://doc.qt.io/qt-5/linux-requirements.html + qt5: + source: https://download.qt.io/archive/qt/5.14/5.14.0/single/qt-everywhere-src-5.14.0.tar.xz + source-checksum: sha256/be9a77cd4e1f9d70b58621d0753be19ea498e6b0da0398753e5038426f76a8ba + source-type: tar + plugin: autotools + build-packages: + - python + - libfontconfig1-dev + - libfreetype6-dev + - libx11-dev + - libxext-dev + - libxfixes-dev + - libxi-dev + - libxrender-dev + - libxcb1-dev + - libx11-xcb-dev + - libxcb-glx0-dev + - libxkbcommon-x11-dev + - libxcb-keysyms1-dev + - libxcb-image0-dev + - libxcb-shm0-dev + - libxcb-icccm4-dev + - libxcb-sync0-dev + - libxcb-xfixes0-dev + - libxcb-shape0-dev + - libxcb-randr0-dev + - libxcb-render-util0-dev + # Using override-build instead of configflags to avoid problem where + # there's the `--prefix=` flag without any way to set the value + override-build: | + ./configure -opensource -confirm-license -no-opengl -nomake examples -nomake tests + make + make install DESTDIR="${SNAPCRAFT_PART_INSTALL}" + tor: source: https://dist.torproject.org/tor-0.4.2.7.tar.gz source-checksum: sha256/06a1d835ddf382f6bca40a62e8fb40b71b2f73d56f0d53523c8bd5caf9b3026d From 35cc59897679587aa099c9c42535cffbd7d581b0 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Tue, 5 May 2020 20:40:32 -0700 Subject: [PATCH 06/15] Switch to installing pre-compiled binaries of Qt5 --- snap/snapcraft.yaml | 49 ++++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 04ec692e..84104cd8 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -48,42 +48,27 @@ parts: - python3-pyqt5 after: [qt5, tor, obfs4] - # For building Qt5, see: - # https://doc.qt.io/qt-5/linux-building.html - # https://doc.qt.io/qt-5/linux-requirements.html + # Install Qt5 pre-compiled binary, because it's much simpler than + # building from source qt5: - source: https://download.qt.io/archive/qt/5.14/5.14.0/single/qt-everywhere-src-5.14.0.tar.xz - source-checksum: sha256/be9a77cd4e1f9d70b58621d0753be19ea498e6b0da0398753e5038426f76a8ba - source-type: tar - plugin: autotools + plugin: nil build-packages: - - python - - libfontconfig1-dev - - libfreetype6-dev - - libx11-dev - - libxext-dev - - libxfixes-dev - - libxi-dev - - libxrender-dev - - libxcb1-dev - - libx11-xcb-dev - - libxcb-glx0-dev + - xvfb + - libdbus-1-3 + - libxkbcommon-x11-0 - libxkbcommon-x11-dev - - libxcb-keysyms1-dev - - libxcb-image0-dev - - libxcb-shm0-dev - - libxcb-icccm4-dev - - libxcb-sync0-dev - - libxcb-xfixes0-dev - - libxcb-shape0-dev - - libxcb-randr0-dev - - libxcb-render-util0-dev - # Using override-build instead of configflags to avoid problem where - # there's the `--prefix=` flag without any way to set the value + - libfontconfig1 + override-pull: | + wget https://download.qt.io/official_releases/qt/5.14/5.14.0/qt-opensource-linux-x64-5.14.0.run + echo "4379f147c6793ec7e7349d2f9ee7d53b8ab6ea4e4edf8ee0574a75586a6a6e0e *qt-opensource-linux-x64-5.14.0.run" | shasum -a 256 --check + chmod +x qt-opensource-linux-x64-5.14.0.run override-build: | - ./configure -opensource -confirm-license -no-opengl -nomake examples -nomake tests - make - make install DESTDIR="${SNAPCRAFT_PART_INSTALL}" + # qt-installer-script.js + echo "function Controller(){installer.installationFinished.connect(proceed)}function logCurrentPage(){var pageName=page().objectName;var pagePrettyTitle=page().title;console.log(\"At page: \"+pageName+\" ('\"+pagePrettyTitle+\"')\")}function page(){return gui.currentPageWidget()}function proceed(button,delay){gui.clickButton(button||buttons.NextButton,delay)}Controller.prototype.WelcomePageCallback=function(){logCurrentPage();proceed(buttons.NextButton,2000)};Controller.prototype.CredentialsPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.IntroductionPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.TargetDirectoryPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.ComponentSelectionPageCallback=function(){logCurrentPage();page().deselectAll();page().selectComponent(\"qt.qt5.5140.gcc_64\");proceed()};Controller.prototype.LicenseAgreementPageCallback=function(){logCurrentPage();page().AcceptLicenseRadioButton.checked=true;gui.clickButton(buttons.NextButton)};Controller.prototype.ReadyForInstallationPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.PerformInstallationPageCallback=function(){logCurrentPage()};Controller.prototype.FinishedPageCallback=function(){logCurrentPage();proceed(buttons.FinishButton)};Controller.prototype.DynamicTelemetryPluginFormCallback=function(){logCurrentPage();console.log(Object.keys(page().TelemetryPluginForm.statisticGroupBox));var radioButtons=page().TelemetryPluginForm.statisticGroupBox;radioButtons.disableStatisticRadioButton.checked=true;proceed()};" > qt-installer-script.js + # Disable Qt installer from phoning home via hosts file + echo "127.0.0.1 iapi.qt.io.herokudns.com" >> /etc/hosts + # Install Qt5 + xvfb-run ./qt-opensource-linux-x64-5.14.0.run --script qt-installer-script.js --verbose tor: source: https://dist.torproject.org/tor-0.4.2.7.tar.gz From e14da9deecb94d70b8dc1118dffe314507b31836 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Tue, 5 May 2020 21:08:41 -0700 Subject: [PATCH 07/15] Change PyQt5 to 5.14.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 87f0d977..6db1a2c4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ macholib = "*" MarkupSafe = "*" pefile = "*" pycryptodome = "*" -PyQt5 = "*" +PyQt5 = "5.14.0" PyQt5-sip = "*" PySocks = "*" requests = "*" From a4fb67315bc329a8b28e3d08728ff9c5b20316bf Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Wed, 6 May 2020 16:05:48 -0700 Subject: [PATCH 08/15] Successfully install Qt5, attempt to get onionshare python deps installed --- poetry.lock | 57 +++++---------------------- pyproject.toml | 12 ------ setup.py | 2 +- snap/qt-installer-script.js | 78 +++++++++++++++++++++++++++++++++++++ snap/snapcraft.yaml | 64 +++++++++++++++++++++++++++--- 5 files changed, 146 insertions(+), 67 deletions(-) create mode 100644 snap/qt-installer-script.js diff --git a/poetry.lock b/poetry.lock index 8f65a9be..723dee80 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,6 +1,7 @@ [[package]] -category = "main" +category = "dev" description = "Python graph (network) package" +marker = "sys_platform == \"darwin\"" name = "altgraph" optional = false python-versions = "*" @@ -100,14 +101,6 @@ version = "4.0.0" [package.dependencies] Flask = "*" -[[package]] -category = "main" -description = "Clean single-source support for Python 3 and 2" -name = "future" -optional = false -python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" -version = "0.18.2" - [[package]] category = "main" description = "Internationalized Domain Names in Applications (IDNA)" @@ -154,17 +147,6 @@ MarkupSafe = ">=0.23" [package.extras] i18n = ["Babel (>=0.8)"] -[[package]] -category = "main" -description = "Mach-O header analysis and editing" -name = "macholib" -optional = false -python-versions = "*" -version = "1.14" - -[package.dependencies] -altgraph = ">=0.15" - [[package]] category = "main" description = "Safely add untrusted strings to HTML/XML markup." @@ -193,17 +175,6 @@ version = "20.3" pyparsing = ">=2.0.2" six = "*" -[[package]] -category = "main" -description = "Python PE parsing module" -name = "pefile" -optional = false -python-versions = "*" -version = "2019.4.18" - -[package.dependencies] -future = "*" - [[package]] category = "dev" description = "plugin and hook calling mechanisms for python" @@ -264,7 +235,7 @@ description = "Python bindings for the Qt cross platform application toolkit" name = "pyqt5" optional = false python-versions = ">=3.5" -version = "5.14.2" +version = "5.14.0" [package.dependencies] PyQt5-sip = ">=12.7,<13" @@ -418,7 +389,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["jaraco.itertools", "func-timeout"] [metadata] -content-hash = "8b05e3708399e2fd51876b0ac9468805989195fc7d322cf0cf6973ec5de49ac8" +content-hash = "be6f59a8ce3099b4205ba5d024284a380912f2caa2bba7765a73b5eddfc7a816" python-versions = "^3.6" [metadata.files] @@ -463,9 +434,6 @@ flask-httpauth = [ {file = "Flask-HTTPAuth-4.0.0.tar.gz", hash = "sha256:47d62edc33ff16798ed28e06a7387ed10a15f21249c5f61515b41351356a6afc"}, {file = "Flask_HTTPAuth-4.0.0-py2.py3-none-any.whl", hash = "sha256:067768dbed7b68b2a0172453eaad64648cd6b004b8a2a3912f363050532d11c3"}, ] -future = [ - {file = "future-0.18.2.tar.gz", hash = "sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d"}, -] idna = [ {file = "idna-2.9-py2.py3-none-any.whl", hash = "sha256:a068a21ceac8a4d63dbfd964670474107f541babbd2250d61922f029858365fa"}, {file = "idna-2.9.tar.gz", hash = "sha256:7588d1c14ae4c77d74036e8c22ff447b26d0fde8f007354fd48a7814db15b7cb"}, @@ -482,10 +450,6 @@ jinja2 = [ {file = "Jinja2-2.11.2-py2.py3-none-any.whl", hash = "sha256:f0a4641d3cf955324a89c04f3d94663aa4d638abe8f733ecd3582848e1c37035"}, {file = "Jinja2-2.11.2.tar.gz", hash = "sha256:89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c651b3bb0"}, ] -macholib = [ - {file = "macholib-1.14-py2.py3-none-any.whl", hash = "sha256:c500f02867515e6c60a27875b408920d18332ddf96b4035ef03beddd782d4281"}, - {file = "macholib-1.14.tar.gz", hash = "sha256:0c436bc847e7b1d9bda0560351bf76d7caf930fb585a828d13608839ef42c432"}, -] markupsafe = [ {file = "MarkupSafe-1.1.1-cp27-cp27m-macosx_10_6_intel.whl", hash = "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161"}, {file = "MarkupSafe-1.1.1-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7"}, @@ -529,9 +493,6 @@ packaging = [ {file = "packaging-20.3-py2.py3-none-any.whl", hash = "sha256:82f77b9bee21c1bafbf35a84905d604d5d1223801d639cf3ed140bd651c08752"}, {file = "packaging-20.3.tar.gz", hash = "sha256:3c292b474fda1671ec57d46d739d072bfd495a4f51ad01a055121d81e952b7a3"}, ] -pefile = [ - {file = "pefile-2019.4.18.tar.gz", hash = "sha256:a5d6e8305c6b210849b47a6174ddf9c452b2888340b8177874b862ba6c207645"}, -] pluggy = [ {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, {file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"}, @@ -580,11 +541,11 @@ pyparsing = [ {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, ] pyqt5 = [ - {file = "PyQt5-5.14.2-5.14.2-cp35.cp36.cp37.cp38-abi3-macosx_10_6_intel.whl", hash = "sha256:a9bdc46ab1f6397770e6b8dca84ac07a0250d26b1a31587f25619cf31a075532"}, - {file = "PyQt5-5.14.2-5.14.2-cp35.cp36.cp37.cp38-abi3-manylinux2014_x86_64.whl", hash = "sha256:ee168a486c9a758511568147815e2959652cd0aabea832fa5e87cf6b241d2180"}, - {file = "PyQt5-5.14.2-5.14.2-cp35.cp36.cp37.cp38-none-win32.whl", hash = "sha256:f61ddc78547d6ca763323ccd4a9e374c71b29feda1f5ce2d3e91e4f8d2cf1942"}, - {file = "PyQt5-5.14.2-5.14.2-cp35.cp36.cp37.cp38-none-win_amd64.whl", hash = "sha256:3b91dd1d0cbfaea85ad057247ba621187e511434b0c9d6d40de69fd5e833b109"}, - {file = "PyQt5-5.14.2.tar.gz", hash = "sha256:bd230c6fd699eabf1ceb51e13a8b79b74c00a80272c622427b80141a22269eb0"}, + {file = "PyQt5-5.14.0-5.14.0-cp35.cp36.cp37.cp38-abi3-macosx_10_6_intel.whl", hash = "sha256:895d4101f7f8c82bc728d7eb9da1c756955ce27a0c945eafe7f234dd03402853"}, + {file = "PyQt5-5.14.0-5.14.0-cp35.cp36.cp37.cp38-abi3-manylinux1_x86_64.whl", hash = "sha256:a757ba71c51f428b52ba404e781e2f19b4436b2c31298b8313339d5817781b65"}, + {file = "PyQt5-5.14.0-5.14.0-cp35.cp36.cp37.cp38-none-win32.whl", hash = "sha256:cc3529c0f7cbbe7491073458d5d15e7518ce544ad8c627f485e5db8a27fcaf61"}, + {file = "PyQt5-5.14.0-5.14.0-cp35.cp36.cp37.cp38-none-win_amd64.whl", hash = "sha256:0dcc128b72f83cce0fc7926c83f05a9b74b652b5eb31a4ab71693ac8829e73c8"}, + {file = "PyQt5-5.14.0.tar.gz", hash = "sha256:0145a6b7de15756366decb736c349a0cb510d706c83fda5b8cd9e0557bc1da72"}, ] pyqt5-sip = [ {file = "PyQt5_sip-12.7.2-cp35-cp35m-macosx_10_6_intel.whl", hash = "sha256:df4f5cdb86f47df5f6fc35be29cc45df7b5a2c171d07dbf377d558b226554ea3"}, diff --git a/pyproject.toml b/pyproject.toml index 6db1a2c4..424930f9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,27 +7,15 @@ license = "GPLv3+" [tool.poetry.dependencies] python = "^3.6" -altgraph = "*" -certifi = "*" -chardet = "*" Click = "*" Flask = "*" Flask-HTTPAuth = "*" -future = "*" -idna = "*" -itsdangerous = "*" -Jinja2 = "*" -macholib = "*" -MarkupSafe = "*" -pefile = "*" pycryptodome = "*" PyQt5 = "5.14.0" PyQt5-sip = "*" PySocks = "*" requests = "*" stem = "*" -urllib3 = "*" -Werkzeug = "*" [tool.poetry.dev-dependencies] atomicwrites = "*" diff --git a/setup.py b/setup.py index c5a00dc8..7ab38916 100644 --- a/setup.py +++ b/setup.py @@ -97,7 +97,7 @@ setup( "onionshare_gui.tab.mode.receive_mode", "onionshare_gui.tab.mode.website_mode", ], - include_package_data=True, + # include_package_data=True, scripts=["install/scripts/onionshare", "install/scripts/onionshare-gui"], data_files=data_files, ) diff --git a/snap/qt-installer-script.js b/snap/qt-installer-script.js new file mode 100644 index 00000000..ab7bccb8 --- /dev/null +++ b/snap/qt-installer-script.js @@ -0,0 +1,78 @@ +// This script is here for convenience. Minify it and copy it into the +// qt5 override-build section of snapcraft.yaml + +function Controller() { + installer.installationFinished.connect(proceed) +} + +function logCurrentPage() { + var pageName = page().objectName + var pagePrettyTitle = page().title + console.log('At page: ' + pageName + ' (' + pagePrettyTitle + ')') +} + +function page() { + return gui.currentPageWidget() +} + +function proceed(button, delay) { + gui.clickButton(button || buttons.NextButton, delay) +} + +Controller.prototype.WelcomePageCallback = function () { + logCurrentPage() + proceed(buttons.NextButton, 2000) +} + +Controller.prototype.CredentialsPageCallback = function () { + logCurrentPage() + proceed() +} + +Controller.prototype.IntroductionPageCallback = function () { + logCurrentPage() + proceed() +} + +Controller.prototype.TargetDirectoryPageCallback = function () { + logCurrentPage() + var dir = installer.environmentVariable('SNAPCRAFT_PART_INSTALL') + '/opt/Qt5.14.0' + console.log('Installing to ' + dir) + page().TargetDirectoryLineEdit.setText(dir) + proceed() +} + +Controller.prototype.ComponentSelectionPageCallback = function () { + logCurrentPage() + page().deselectAll() + page().selectComponent('qt.qt5.5140.gcc_64') + proceed() +} + +Controller.prototype.LicenseAgreementPageCallback = function () { + logCurrentPage() + page().AcceptLicenseRadioButton.checked = true + gui.clickButton(buttons.NextButton) +} + +Controller.prototype.ReadyForInstallationPageCallback = function () { + logCurrentPage() + proceed() +} + +Controller.prototype.PerformInstallationPageCallback = function () { + logCurrentPage() +} + +Controller.prototype.FinishedPageCallback = function () { + logCurrentPage() + proceed(buttons.FinishButton) +} + +Controller.prototype.DynamicTelemetryPluginFormCallback = function () { + logCurrentPage() + console.log(Object.keys(page().TelemetryPluginForm.statisticGroupBox)) + var radioButtons = page().TelemetryPluginForm.statisticGroupBox + radioButtons.disableStatisticRadioButton.checked = true + proceed() +} \ No newline at end of file diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 84104cd8..caa8f884 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -41,34 +41,86 @@ parts: python-version: python3 python-packages: - poetry + - setuptools + - wheel + - Click + - Flask + - Flask-HTTPAuth + - pycryptodome + - PyQt5 == "5.14.0" + - PyQt5-sip + - PySocks + - requests + - stem stage-packages: - libatk-bridge2.0-0 - libatspi2.0-0 - libgtk-3-0 - - python3-pyqt5 after: [qt5, tor, obfs4] # Install Qt5 pre-compiled binary, because it's much simpler than # building from source qt5: plugin: nil + override-pull: | + #wget https://download.qt.io/official_releases/qt/5.14/5.14.0/qt-opensource-linux-x64-5.14.0.run + wget http://10.51.172.1:8000/qt-opensource-linux-x64-5.14.0.run + echo "4379f147c6793ec7e7349d2f9ee7d53b8ab6ea4e4edf8ee0574a75586a6a6e0e *qt-opensource-linux-x64-5.14.0.run" | shasum -a 256 --check + chmod +x qt-opensource-linux-x64-5.14.0.run build-packages: - xvfb - libdbus-1-3 - libxkbcommon-x11-0 - libxkbcommon-x11-dev - libfontconfig1 - override-pull: | - wget https://download.qt.io/official_releases/qt/5.14/5.14.0/qt-opensource-linux-x64-5.14.0.run - echo "4379f147c6793ec7e7349d2f9ee7d53b8ab6ea4e4edf8ee0574a75586a6a6e0e *qt-opensource-linux-x64-5.14.0.run" | shasum -a 256 --check - chmod +x qt-opensource-linux-x64-5.14.0.run override-build: | # qt-installer-script.js - echo "function Controller(){installer.installationFinished.connect(proceed)}function logCurrentPage(){var pageName=page().objectName;var pagePrettyTitle=page().title;console.log(\"At page: \"+pageName+\" ('\"+pagePrettyTitle+\"')\")}function page(){return gui.currentPageWidget()}function proceed(button,delay){gui.clickButton(button||buttons.NextButton,delay)}Controller.prototype.WelcomePageCallback=function(){logCurrentPage();proceed(buttons.NextButton,2000)};Controller.prototype.CredentialsPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.IntroductionPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.TargetDirectoryPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.ComponentSelectionPageCallback=function(){logCurrentPage();page().deselectAll();page().selectComponent(\"qt.qt5.5140.gcc_64\");proceed()};Controller.prototype.LicenseAgreementPageCallback=function(){logCurrentPage();page().AcceptLicenseRadioButton.checked=true;gui.clickButton(buttons.NextButton)};Controller.prototype.ReadyForInstallationPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.PerformInstallationPageCallback=function(){logCurrentPage()};Controller.prototype.FinishedPageCallback=function(){logCurrentPage();proceed(buttons.FinishButton)};Controller.prototype.DynamicTelemetryPluginFormCallback=function(){logCurrentPage();console.log(Object.keys(page().TelemetryPluginForm.statisticGroupBox));var radioButtons=page().TelemetryPluginForm.statisticGroupBox;radioButtons.disableStatisticRadioButton.checked=true;proceed()};" > qt-installer-script.js + echo "function Controller(){installer.installationFinished.connect(proceed)}function logCurrentPage(){var pageName=page().objectName;var pagePrettyTitle=page().title;console.log('At page: '+pageName+' ('+pagePrettyTitle+')')}function page(){return gui.currentPageWidget()}function proceed(button,delay){gui.clickButton(button||buttons.NextButton,delay)}Controller.prototype.WelcomePageCallback=function(){logCurrentPage();proceed(buttons.NextButton,2000)};Controller.prototype.CredentialsPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.IntroductionPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.TargetDirectoryPageCallback=function(){logCurrentPage();var dir=installer.environmentVariable('SNAPCRAFT_PART_INSTALL')+'/opt/Qt5.14.0';console.log('Installing to '+dir);page().TargetDirectoryLineEdit.setText(dir);proceed()};Controller.prototype.ComponentSelectionPageCallback=function(){logCurrentPage();page().deselectAll();page().selectComponent('qt.qt5.5140.gcc_64');proceed()};Controller.prototype.LicenseAgreementPageCallback=function(){logCurrentPage();page().AcceptLicenseRadioButton.checked=true;gui.clickButton(buttons.NextButton)};Controller.prototype.ReadyForInstallationPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.PerformInstallationPageCallback=function(){logCurrentPage()};Controller.prototype.FinishedPageCallback=function(){logCurrentPage();proceed(buttons.FinishButton)};Controller.prototype.DynamicTelemetryPluginFormCallback=function(){logCurrentPage();console.log(Object.keys(page().TelemetryPluginForm.statisticGroupBox));var radioButtons=page().TelemetryPluginForm.statisticGroupBox;radioButtons.disableStatisticRadioButton.checked=true;proceed()};" > qt-installer-script.js # Disable Qt installer from phoning home via hosts file echo "127.0.0.1 iapi.qt.io.herokudns.com" >> /etc/hosts # Install Qt5 + rm -rf $SNAPCRAFT_PART_INSTALL/opt/Qt5.14.0 xvfb-run ./qt-opensource-linux-x64-5.14.0.run --script qt-installer-script.js --verbose + stage-packages: + - libdrm2 + - libfontconfig1 + - libfreetype6 + - libgl1 + - libglvnd0 + - libglx0 + - libpng16-16 + - libx11-6 + - libx11-xcb1 + - libxau6 + - libxcb-glx0 + - libxcb-xkb1 + - libxcb1 + - libxdmcp6 + - libxext6 + - libxkbcommon-x11-0 + - libxkbcommon0 + - libegl1 + - libasound2 + - libbluetooth3 + - libcairo-gobject2 + - libcairo2 + - libcups2 + - libgdk-pixbuf2.0-0 + - libgtk3.0-cil + - libgstreamer-plugins-base1.0-0 + - libodbc1 + - libpango-1.0-0 + - libpangocairo-1.0-0 + - libpq5 + - libpulse-mainloop-glib0 + - libpulse0 + - libspeechd2 + - libwayland-client0 + - libwayland-cursor0 + - libwayland-egl1 + - libxml2 + - libqt5webengine5 + - libqt5webenginecore5 tor: source: https://dist.torproject.org/tor-0.4.2.7.tar.gz From f700212142fc26103af36ef60a14cb79d6737254 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Wed, 6 May 2020 16:07:43 -0700 Subject: [PATCH 09/15] Change how PyQt5 python package is formatted --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index caa8f884..d41db04b 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -47,7 +47,7 @@ parts: - Flask - Flask-HTTPAuth - pycryptodome - - PyQt5 == "5.14.0" + - PyQt5==5.14.0 - PyQt5-sip - PySocks - requests From bf2f6e9474db81cc28369f6ecfa39f71aae78e8f Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Thu, 7 May 2020 17:01:40 -0700 Subject: [PATCH 10/15] Import setup in setup.py from setuptools instead of distutils.core --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7ab38916..9e0ba373 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ along with this program. If not, see . """ import os, sys, platform, tempfile -from distutils.core import setup +from setuptools import setup def file_list(path): From 793a5d3e02828aacc291444a1a6103c3f2ca1814 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Thu, 7 May 2020 17:14:48 -0700 Subject: [PATCH 11/15] Switch from scripts to entrypoints in setup.py; remove python-packages from snap because they are defined in poetry; fix onionshare and onionshare-gui snap apps definition; switch back to download Qt5 from the internet --- install/scripts/onionshare | 22 ---------------------- install/scripts/onionshare-gui | 22 ---------------------- setup.py | 8 ++++++-- snap/snapcraft.yaml | 33 +++++++++++---------------------- 4 files changed, 17 insertions(+), 68 deletions(-) delete mode 100755 install/scripts/onionshare delete mode 100755 install/scripts/onionshare-gui diff --git a/install/scripts/onionshare b/install/scripts/onionshare deleted file mode 100755 index e2205e04..00000000 --- a/install/scripts/onionshare +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -OnionShare | https://onionshare.org/ - -Copyright (C) 2014-2018 Micah Lee - -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 program 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 . -""" -import onionshare -onionshare.main() diff --git a/install/scripts/onionshare-gui b/install/scripts/onionshare-gui deleted file mode 100755 index fed29d83..00000000 --- a/install/scripts/onionshare-gui +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -OnionShare | https://onionshare.org/ - -Copyright (C) 2014-2018 Micah Lee - -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 program 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 . -""" -import onionshare_gui -onionshare_gui.main() diff --git a/setup.py b/setup.py index 9e0ba373..3ffff253 100644 --- a/setup.py +++ b/setup.py @@ -97,7 +97,11 @@ setup( "onionshare_gui.tab.mode.receive_mode", "onionshare_gui.tab.mode.website_mode", ], - # include_package_data=True, - scripts=["install/scripts/onionshare", "install/scripts/onionshare-gui"], + entry_points={ + "console_scripts": [ + "onionshare = onionshare:main", + "onionshare-gui = onionshare_gui:main", + ], + }, data_files=data_files, ) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index d41db04b..5ce700ed 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -18,19 +18,20 @@ apps: common-id: org.onionshare.OnionShareGui command: onionshare-gui plugs: + - desktop - home - - opengl - network - network-bind - - pulseaudio + - removable-media - # onionshare: - # common-id: org.onionshare.OnionShare - # command: onionshare - # plugs: - # - home - # - network - # - network-bind + onionshare: + common-id: org.onionshare.OnionShare + command: onionshare + plugs: + - home + - network + - network-bind + - removable-media parts: onionshare: @@ -41,17 +42,6 @@ parts: python-version: python3 python-packages: - poetry - - setuptools - - wheel - - Click - - Flask - - Flask-HTTPAuth - - pycryptodome - - PyQt5==5.14.0 - - PyQt5-sip - - PySocks - - requests - - stem stage-packages: - libatk-bridge2.0-0 - libatspi2.0-0 @@ -63,8 +53,7 @@ parts: qt5: plugin: nil override-pull: | - #wget https://download.qt.io/official_releases/qt/5.14/5.14.0/qt-opensource-linux-x64-5.14.0.run - wget http://10.51.172.1:8000/qt-opensource-linux-x64-5.14.0.run + wget https://download.qt.io/official_releases/qt/5.14/5.14.0/qt-opensource-linux-x64-5.14.0.run echo "4379f147c6793ec7e7349d2f9ee7d53b8ab6ea4e4edf8ee0574a75586a6a6e0e *qt-opensource-linux-x64-5.14.0.run" | shasum -a 256 --check chmod +x qt-opensource-linux-x64-5.14.0.run build-packages: From 46d69fba1738545c996f5668c06d1316d0ec75aa Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Thu, 7 May 2020 20:19:07 -0700 Subject: [PATCH 12/15] Add include_data_files back to setup call, and ignore built snaps --- .gitignore | 1 + setup.py | 1 + 2 files changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 1fcbaa99..ad8aa021 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ develop-eggs MANIFEST env onionshare-*.tar.gz +snap/onionshare_*.snap # Installer logs pip-log.txt diff --git a/setup.py b/setup.py index 3ffff253..a2c18d0a 100644 --- a/setup.py +++ b/setup.py @@ -104,4 +104,5 @@ setup( ], }, data_files=data_files, + include_data_files=True, ) From d9e95fb1c438a6fa9daf6f17dfd9917c2d21b576 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Tue, 30 Jun 2020 15:13:47 -0700 Subject: [PATCH 13/15] Add snap readme --- snap/README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 snap/README.md diff --git a/snap/README.md b/snap/README.md new file mode 100644 index 00000000..54f80476 --- /dev/null +++ b/snap/README.md @@ -0,0 +1,28 @@ +# Snap package + +This folder contains files to build a [snap package](https://snapcraft.io/). First make sure you install `snap` and `snapcraft` (`snap install snapcraft --classic`). + +To build the snap, cd to the `snap` folder and run: + +```sh +snapcraft +``` + +See your installed snaps: + +```sh +snap list +``` + +Run the OnionShare snap: + +```sh +/snap/bin/onionshare # CLI version +/snap/bin/onionshare-gui # GUI version +``` + +Delete the OnionShare snap: + +```sh +snap remove onionshare +``` From 50c4ea5b4b4810a1c4d18b07b1db2804a5338334 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Tue, 30 Jun 2020 17:45:10 -0700 Subject: [PATCH 14/15] Update snapcraft readme --- snap/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/snap/README.md b/snap/README.md index 54f80476..074cdb13 100644 --- a/snap/README.md +++ b/snap/README.md @@ -6,6 +6,7 @@ To build the snap, cd to the `snap` folder and run: ```sh snapcraft +snap install ./onionshare_*.snap ``` See your installed snaps: @@ -26,3 +27,11 @@ Delete the OnionShare snap: ```sh snap remove onionshare ``` + +## Making a new release + +In `snapcraft.yaml`: + +- Update `version` +- Update the `onionshare` part to use the correct tag +- Update `Qt5`, `tor`, `libevent`, and `obfs4` dependencies, if necessary From 3fdd9eb1dce66997800e05aae1504743d37f98ce Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 5 Jul 2020 10:19:06 -0700 Subject: [PATCH 15/15] Start making snap package pull from source tree instead of git --- .gitignore | 2 +- BUILD.md | 44 ++++++++++++++++++++++++ {snap => install}/qt-installer-script.js | 2 +- snap/README.md | 37 -------------------- snap/snapcraft.yaml | 4 +-- 5 files changed, 47 insertions(+), 42 deletions(-) rename {snap => install}/qt-installer-script.js (97%) delete mode 100644 snap/README.md diff --git a/.gitignore b/.gitignore index ad8aa021..26ee07ad 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,7 @@ develop-eggs MANIFEST env onionshare-*.tar.gz -snap/onionshare_*.snap +onionshare_*.snap # Installer logs pip-log.txt diff --git a/BUILD.md b/BUILD.md index fad1c8fb..2ea2f1ab 100644 --- a/BUILD.md +++ b/BUILD.md @@ -3,6 +3,8 @@ * [Linux](#linux) * [Use newest software](#use-newest-software) * [Use package managers](#use-package-managers) + * [Flatpak packaging](#flatpak-packaging) + * [Snapcraft packaging](#snapcraft-packaging) * [macOS](#macos) * [Windows](#windows) * [Setting up your dev environment](#setting-up-your-dev-environment) @@ -107,6 +109,48 @@ For ArchLinux: There is a PKBUILD available [here](https://www.archlinux.org/pac If you find that these instructions don't work for your Linux distribution or version, consult the [Linux Distribution Support wiki guide](https://github.com/micahflee/onionshare/wiki/Linux-Distribution-Support), which might contain extra instructions. +### Flatpak packaging + +See: https://github.com/micahflee/org.onionshare.OnionShare + +### Snapcraft packaging + +This folder contains files to build a [snap package](https://snapcraft.io/). First make sure you install `snap` and `snapcraft` (`snap install snapcraft --classic`). + +To build the snap, cd to the `onionshare` folder and run: + +```sh +snapcraft +snap install --devmode ./onionshare_*.snap +``` + +See your installed snaps: + +```sh +snap list +``` + +Run the OnionShare snap: + +```sh +/snap/bin/onionshare # CLI version +/snap/bin/onionshare.onionshare-gui # GUI version +``` + +Delete the OnionShare snap: + +```sh +snap remove onionshare +``` + +#### Making a new release + +In `snapcraft.yaml`: + +- Update `version` +- Update the `onionshare` part to use the correct tag +- Update `Qt5`, `tor`, `libevent`, and `obfs4` dependencies, if necessary + ## macOS Install Xcode from the Mac App Store. Once it's installed, run it for the first time to set it up. Also, run this to make sure command line tools are installed: `xcode-select --install`. And finally, open Xcode, go to Preferences > Locations, and make sure under Command Line Tools you select an installed version from the dropdown. (This is required for installing Qt5.) diff --git a/snap/qt-installer-script.js b/install/qt-installer-script.js similarity index 97% rename from snap/qt-installer-script.js rename to install/qt-installer-script.js index ab7bccb8..e68a6005 100644 --- a/snap/qt-installer-script.js +++ b/install/qt-installer-script.js @@ -1,5 +1,5 @@ // This script is here for convenience. Minify it and copy it into the -// qt5 override-build section of snapcraft.yaml +// qt5 override-build section of snap/snapcraft.yaml function Controller() { installer.installationFinished.connect(proceed) diff --git a/snap/README.md b/snap/README.md deleted file mode 100644 index 074cdb13..00000000 --- a/snap/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# Snap package - -This folder contains files to build a [snap package](https://snapcraft.io/). First make sure you install `snap` and `snapcraft` (`snap install snapcraft --classic`). - -To build the snap, cd to the `snap` folder and run: - -```sh -snapcraft -snap install ./onionshare_*.snap -``` - -See your installed snaps: - -```sh -snap list -``` - -Run the OnionShare snap: - -```sh -/snap/bin/onionshare # CLI version -/snap/bin/onionshare-gui # GUI version -``` - -Delete the OnionShare snap: - -```sh -snap remove onionshare -``` - -## Making a new release - -In `snapcraft.yaml`: - -- Update `version` -- Update the `onionshare` part to use the correct tag -- Update `Qt5`, `tor`, `libevent`, and `obfs4` dependencies, if necessary diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 5ce700ed..f42a1f28 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -35,9 +35,7 @@ apps: parts: onionshare: - source: https://github.com/micahflee/onionshare.git - source-type: git - source-branch: 1111_snap + source: . plugin: python python-version: python3 python-packages: