noVNC and deps

So that we can host a web based VNC client on dev and test boards. Then
people can get vnc access with no setup.

BUG=b:208727066
TEST=CQ
emerge-$DUT websockify novnc
cros deploy --root=/usr/local ${DUT} novnc websockify

Change-Id: I99ead5b4a857f2d143e70fabd8fc09918f1ac16d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/overlays/portage-stable/+/3428432
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Eric Lok <lokeric@google.com>
Tested-by: Eric Lok <lokeric@google.com>
diff --git a/dev-python/jwcrypto/Manifest b/dev-python/jwcrypto/Manifest
new file mode 100644
index 0000000..84dfa53
--- /dev/null
+++ b/dev-python/jwcrypto/Manifest
@@ -0,0 +1 @@
+DIST jwcrypto-1.0.0.tar.gz 87000 BLAKE2B 6e85d52c26447b07c3d06387ac9e3b7adf585d5dc320c633e80ca2bc1e327f01ac95cec9a0fe2b92f7f8ed7f5650d5ad1a95de500d328b33763d604aaba1bd62 SHA512 12d270219d289041098f875f5b2b0773ffbf9044996a6189b827cafbf3e5dccfc103915275b1a11dce2d50e3510510eea476b024d19cf97fd7c66c25de5b3dbf
diff --git a/dev-python/jwcrypto/OWNERS b/dev-python/jwcrypto/OWNERS
new file mode 100644
index 0000000..031fea8
--- /dev/null
+++ b/dev-python/jwcrypto/OWNERS
@@ -0,0 +1,7 @@
+# Team ownership
+chromeos-velocity@google.com
+
+# Individual reviewers if needed
+lokeric@google.com
+oka@chromium.org
+ttylenda@chromium.org
diff --git a/dev-python/jwcrypto/jwcrypto-1.0.0.ebuild b/dev-python/jwcrypto/jwcrypto-1.0.0.ebuild
new file mode 100644
index 0000000..3b4be2b
--- /dev/null
+++ b/dev-python/jwcrypto/jwcrypto-1.0.0.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( pypy3 python3_{6..9} )
+inherit distutils-r1
+
+DESCRIPTION="Implements JWK,JWS,JWE specifications using python-cryptography"
+
+HOMEPAGE="https://github.com/latchset/jwcrypto"
+SRC_URI="
+	https://github.com/latchset/jwcrypto/archive/v${PV}.tar.gz
+		-> ${P}.tar.gz"
+
+LICENSE="LGPL-3+"
+SLOT="0"
+KEYWORDS="*"
+
+RDEPEND="
+	>=dev-python/cryptography-2.3[${PYTHON_USEDEP}]
+	dev-python/deprecated[${PYTHON_USEDEP}]"
+
+distutils_enable_sphinx docs/source
+distutils_enable_tests pytest
+
+python_prepare_all() {
+	# Do not install doc in non-standard paths
+	sed -i "\|data_files = \[('share/doc/jwcrypto|d" setup.py || die
+	distutils-r1_python_prepare_all
+}
diff --git a/dev-python/jwcrypto/metadata.xml b/dev-python/jwcrypto/metadata.xml
new file mode 100644
index 0000000..dae0099
--- /dev/null
+++ b/dev-python/jwcrypto/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer type="project">
+		<email>python@gentoo.org</email>
+		<name>Python</name>
+	</maintainer>
+	<upstream>
+		<remote-id type="pypi">jwcrypto</remote-id>
+		<remote-id type="github">latchset/jwcrypto</remote-id>
+	</upstream>
+</pkgmetadata>
diff --git a/dev-python/websockify/Manifest b/dev-python/websockify/Manifest
new file mode 100644
index 0000000..4d62257
--- /dev/null
+++ b/dev-python/websockify/Manifest
@@ -0,0 +1 @@
+DIST websockify-0.10.0.gh.tar.gz 53402 BLAKE2B e909dc316d6dd0ee03ee23b07ca2d78cc60994a8f361b3968759c382c704637357848e903fb12af002b5d5b2bec957f9a4c2b0ddb0e6d008ff9b4a462f3e8871 SHA512 262071f4858e5e3b6471c6f3731d8715c5c13fcc5f43738a330323958a8f0cbe7797847bdc676f1c6c34055c6f8afb949d005a5607d6b220b893910ff973ddc5
diff --git a/dev-python/websockify/OWNERS b/dev-python/websockify/OWNERS
new file mode 100644
index 0000000..031fea8
--- /dev/null
+++ b/dev-python/websockify/OWNERS
@@ -0,0 +1,7 @@
+# Team ownership
+chromeos-velocity@google.com
+
+# Individual reviewers if needed
+lokeric@google.com
+oka@chromium.org
+ttylenda@chromium.org
diff --git a/dev-python/websockify/metadata.xml b/dev-python/websockify/metadata.xml
new file mode 100644
index 0000000..8c7f61b
--- /dev/null
+++ b/dev-python/websockify/metadata.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer type="person">
+		<email>prometheanfire@gentoo.org</email>
+		<name>Matthew Thode</name>
+	</maintainer>
+	<maintainer type="project">
+		<email>python@gentoo.org</email>
+		<name>Python</name>
+	</maintainer>
+	<stabilize-allarches/>
+	<upstream>
+		<remote-id type="github">novnc/websockify</remote-id>
+		<remote-id type="pypi">websockify</remote-id>
+	</upstream>
+</pkgmetadata>
diff --git a/dev-python/websockify/websockify-0.10.0.ebuild b/dev-python/websockify/websockify-0.10.0.ebuild
new file mode 100644
index 0000000..e1c6301
--- /dev/null
+++ b/dev-python/websockify/websockify-0.10.0.ebuild
@@ -0,0 +1,34 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6..9} )
+inherit distutils-r1
+
+DESCRIPTION="WebSockets support for any application/server"
+HOMEPAGE="https://github.com/novnc/websockify"
+SRC_URI="
+	https://github.com/novnc/websockify/archive/v${PV}.tar.gz
+		-> ${P}.gh.tar.gz"
+
+LICENSE="LGPL-3"
+SLOT="0"
+KEYWORDS="*"
+
+RDEPEND="dev-python/numpy[${PYTHON_USEDEP}]"
+
+distutils_enable_tests pytest
+
+python_test() {
+	local deselect=(
+		# TODO: incompatible with current jwcrypto? (not a regression)
+		tests/test_token_plugins.py::JWSTokenTestCase::test_asymmetric_jwe_token_plugin
+	)
+	epytest ${deselect[@]/#/--deselect }
+}
+
+python_install_all() {
+	doman docs/${PN}.1
+	distutils-r1_python_install_all
+}
diff --git a/www-apps/novnc/Manifest b/www-apps/novnc/Manifest
new file mode 100644
index 0000000..ac5edf9
--- /dev/null
+++ b/www-apps/novnc/Manifest
@@ -0,0 +1 @@
+DIST novnc-1.2.0.tar.gz 1356408 BLAKE2B a84b767afcdaa641a21943d19ac93c9200074c24c83c899fe2452a82eef526ecd74de92da47b3caa85abe9d51f2fb8d5078f3bf66c0868a241218d22a9088239 SHA512 461490da7bb983e9c94b8ce39f8455ee6609b5a9df8d88254bcc37ebaa5153f5ee9db6afbd88b51762d6d55661bc5cde6fbe70616597583bfce1203e337adf75
diff --git a/www-apps/novnc/OWNERS b/www-apps/novnc/OWNERS
new file mode 100644
index 0000000..031fea8
--- /dev/null
+++ b/www-apps/novnc/OWNERS
@@ -0,0 +1,7 @@
+# Team ownership
+chromeos-velocity@google.com
+
+# Individual reviewers if needed
+lokeric@google.com
+oka@chromium.org
+ttylenda@chromium.org
diff --git a/www-apps/novnc/metadata.xml b/www-apps/novnc/metadata.xml
new file mode 100644
index 0000000..6ee8e62
--- /dev/null
+++ b/www-apps/novnc/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <maintainer type="person">
+    <email>prometheanfire@gentoo.org</email>
+    <name>Matthew Thode</name>
+  </maintainer>
+  <stabilize-allarches/>
+  <upstream>
+    <remote-id type="github">kanaka/noVNC</remote-id>
+  </upstream>
+</pkgmetadata>
diff --git a/www-apps/novnc/novnc-1.2.0.ebuild b/www-apps/novnc/novnc-1.2.0.ebuild
new file mode 100644
index 0000000..6b9bc02
--- /dev/null
+++ b/www-apps/novnc/novnc-1.2.0.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DISTUTILS_USE_SETUPTOOLS=no
+PYTHON_COMPAT=( python3_{6..9} )
+inherit distutils-r1
+
+DESCRIPTION="noVNC is a VNC client implemented using HTML5 technologies"
+HOMEPAGE="https://github.com/novnc/noVNC"
+
+if [[ ${PV} == *9999 ]] ; then
+	inherit git-r3
+	EGIT_REPO_URI="https://github.com/kanaka/noVNC.git"
+else
+	SRC_URI="https://github.com/kanaka/noVNC/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+	KEYWORDS="*"
+	S="${WORKDIR}/noVNC-${PV}"
+fi
+
+LICENSE="LGPL-3"
+SLOT="0"
+
+RDEPEND="
+	dev-python/websockify[${PYTHON_USEDEP}]
+	dev-python/numpy[${PYTHON_USEDEP}]"
+
+python_compile() {
+	:
+}
+
+src_install() {
+	exeinto /usr/share/novnc/utils
+	for f in utils/*; do
+		[[ ! f = utils/README.md ]] && doexe $f
+	done
+
+	dodoc README.md LICENSE.txt
+
+	insinto /usr/share/novnc
+	doins -r vnc.html vnc_lite.html app/ core/ vendor/
+	dosym vnc_lite.html /usr/share/novnc/vnc_auto.html  # for compat
+	dosym ../share/novnc/utils/launch.sh /usr/bin/novnc
+}