public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/proj/guru:dev commit in: app-containers/waydroid-images/
@ 2024-03-22 22:34 Esteve Varela Colominas
  0 siblings, 0 replies; 2+ messages in thread
From: Esteve Varela Colominas @ 2024-03-22 22:34 UTC (permalink / raw
  To: gentoo-commits

commit:     727961fbdcfa8bf980d7d11b6db5f8c27cd5db69
Author:     Esteve Varela Colominas <esteve.varela <AT> gmail <DOT> com>
AuthorDate: Fri Mar 22 22:24:09 2024 +0000
Commit:     Esteve Varela Colominas <esteve.varela <AT> gmail <DOT> com>
CommitDate: Fri Mar 22 22:34:16 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=727961fb

app-containers/waydroid-images: new package, add 9999

Signed-off-by: Esteve Varela Colominas <esteve.varela <AT> gmail.com>

 app-containers/waydroid-images/metadata.xml        |  18 ++
 .../waydroid-images/waydroid-images-9999.ebuild    | 184 +++++++++++++++++++++
 2 files changed, 202 insertions(+)

diff --git a/app-containers/waydroid-images/metadata.xml b/app-containers/waydroid-images/metadata.xml
new file mode 100644
index 0000000000..850f77c386
--- /dev/null
+++ b/app-containers/waydroid-images/metadata.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <maintainer type="person">
+    <email>esteve.varela@gmail.com</email>
+    <name>Esteve Varela Colominas</name>
+  </maintainer>
+  <use>
+    <flag name="system-vanilla">Use the VANILLA variant of system.img</flag>
+    <flag name="system-gapps">Use the GAPPS variant of system.img</flag>
+    <flag name="vendor-mainline">Use the MAINLINE variant of vendor.img</flag>
+    <flag name="vendor-halium">Use the HALIUM_11 variant of vendor.img</flag>
+  </use>
+  <upstream>
+    <remote-id type="github">waydroid/waydroid</remote-id>
+    <remote-id type="sourceforge">waydroid</remote-id>
+  </upstream>
+</pkgmetadata>

diff --git a/app-containers/waydroid-images/waydroid-images-9999.ebuild b/app-containers/waydroid-images/waydroid-images-9999.ebuild
new file mode 100644
index 0000000000..62fa9c3f4a
--- /dev/null
+++ b/app-containers/waydroid-images/waydroid-images-9999.ebuild
@@ -0,0 +1,184 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{8..12} )
+
+inherit python-any-r1
+
+DESCRIPTION="Manage images for app-containers/waydroid using portage"
+HOMEPAGE="https://sourceforge.net/projects/waydroid/files/images"
+
+if [[ ${PV} == 9999 ]]; then
+	PROPERTIES="live"
+else
+	# Generate using:
+	# WAYDROID_GEN_SRC_URI=y ebuild waydroid-images-9999.ebuild clean unpack
+	#SRC_URI=""
+	KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+fi
+S="${WORKDIR}"
+
+# https://source.android.com/docs/setup/about/faqs#what-kind-of-open-source-project-is-android
+LICENSE="Apache-2.0"
+
+SLOT="0"
+IUSE="+system-vanilla system-gapps +vendor-mainline vendor-halium"
+REQUIRED_USE="
+	^^ ( system-vanilla system-gapps )
+	^^ ( vendor-mainline vendor-halium )
+"
+
+RDEPEND="app-containers/waydroid"
+
+if [[ ${PV} == 9999 ]]; then
+	BDEPEND+="
+		net-misc/wget
+		${PYTHON_DEPS}
+	"
+fi
+
+waydroid_arch() {
+	case "${1:-${ARCH}}" in
+		amd64) echo "x86_64" ;;
+		arm) echo "arm" ;;
+		arm64) echo "arm64" ;;
+		x86) echo "x86" ;;
+		*) die "Unsupported architecture"
+	esac
+}
+
+waydroid_ota_info() {
+	local ota_url="${1}"
+	local ota_file="${2}"
+
+	[[ ${EVCS_OFFLINE} ]] || wget -q -O "${ota_file}" "${ota_url}" || die
+	[[ -f ${ota_file} ]] || die "OTA information unavailable: ${ota_file}"
+
+	cat "${ota_file}" | \
+		python3 -c 'import sys,json;j=json.load(sys.stdin)["response"][0];\
+		print(*(j[x] for x in ["filename","id","url"]),sep="\0",end="")' || die
+}
+
+waydroid_ota_info_system() {
+	local system_channel="https://ota.waydro.id/system"
+	local rom_type="lineage"
+	local system_type="${1}"
+	local system_ota="${system_channel}/${rom_type}/waydroid_${MY_ARCH}/${system_type}.json"
+	local system_file="${WAYDROID_STORE_DIR}/system_${rom_type}_${system_type}_${MY_ARCH}.json"
+
+	waydroid_ota_info "${system_ota}" "${system_file}"
+}
+
+waydroid_ota_info_vendor() {
+	local vendor_channel="https://ota.waydro.id/vendor"
+	local vendor_type="${1}"
+	local vendor_ota="${vendor_channel}/waydroid_${MY_ARCH}/${vendor_type}.json"
+	local vendor_file="${WAYDROID_STORE_DIR}/vendor_${vendor_type}_${MY_ARCH}.json"
+
+	waydroid_ota_info "${vendor_ota}" "${vendor_file}"
+}
+
+waydroid_download_image() {
+	local dl_file="${1}"
+	local dl_filename="${2}"
+	local dl_hash="${3}"
+	local dl_url="${4}"
+
+	local newhash=""
+	if [[ -f ${dl_file} ]]; then
+		ebegin "${dl_filename} SHA256"
+		newhash="$(sha256sum "${dl_file}" 2>/dev/null | cut -f1 -d\ )"
+		if [[ ${newhash} == ${dl_hash} ]]; then
+			eend 0
+			return
+		fi
+		eend 1
+	fi
+
+	if [[ ! ${EVCS_OFFLINE} ]]; then
+		wget -O "${dl_file}" "${dl_url}" || die
+
+		ebegin "${dl_filename} SHA256"
+		newhash="$(sha256sum "${dl_file}" 2>/dev/null | cut -f1 -d\ )"
+		if [[ ${newhash} == ${dl_hash} ]]; then
+			eend 0
+			return
+		fi
+		eend 1
+	fi
+
+	[[ -f ${dl_file} ]] || die "File not available: ${dl_file}"
+	eerror "Expected: ${newhash}"
+	eerror "Got: ${dl_hash}"
+	die "Checksum mismatch for ${dl_file}"
+}
+
+waydroid_download_system() {
+	declare -a ota_info
+	readarray -d '' ota_info < <(waydroid_ota_info_system "$@")
+	local file="${WAYDROID_STORE_DIR}/${ota_info[0]}"
+	MY_A+=( "${file}" )
+	waydroid_download_image "$file" "${ota_info[@]}"
+}
+
+waydroid_download_vendor() {
+	declare -a ota_info
+	readarray -d '' ota_info < <(waydroid_ota_info_vendor "$@")
+	local file="${WAYDROID_STORE_DIR}/${ota_info[0]}"
+	MY_A+=( "${file}" )
+	waydroid_download_image "${file}" "${ota_info[@]}"
+}
+
+waydroid_gen_src_uri() {
+	for arch in amd64 arm arm64 x86; do
+		MY_ARCH="$(waydroid_arch "${arch}")"
+		printf "\n\t%s? (" "${arch}"
+
+		declare -a ota_info
+		readarray -d '' ota_info < <(waydroid_ota_info_system VANILLA)
+		printf "\n\t\tsystem-vanilla? ( %s -> %s )" "${ota_info[2]}" "${ota_info[0]}"
+		readarray -d '' ota_info < <(waydroid_ota_info_system GAPPS)
+		printf "\n\t\tsystem-gapps? ( %s -> %s )" "${ota_info[2]}" "${ota_info[0]}"
+		readarray -d '' ota_info < <(waydroid_ota_info_vendor MAINLINE)
+		printf "\n\t\tvendor-mainline? ( %s -> %s )" "${ota_info[2]}" "${ota_info[0]}"
+		readarray -d '' ota_info < <(waydroid_ota_info_vendor HALIUM_11)
+		printf "\n\t\tvendor-halium? ( %s -> %s )" "${ota_info[2]}" "${ota_info[0]}"
+
+		printf "\n\t)"
+	done
+	printf "\n\n"
+}
+
+if [[ ${PV} == 9999 ]]; then
+src_unpack() {
+	local distdir=${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}
+	: "${WAYDROID_STORE_DIR:=${distdir}/waydroid}"
+	if [[ ! -d ${WAYDROID_STORE_DIR} && ! ${EVCS_OFFLINE} ]]; then
+		(
+			addwrite /
+			mkdir -p "${WAYDROID_STORE_DIR}"
+		) || die "Unable to create ${WAYDROID_STORE_DIR}"
+	fi
+	addwrite "${WAYDROID_STORE_DIR}"
+
+	if [[ ${WAYDROID_GEN_SRC_URI} ]]; then
+		waydroid_gen_src_uri
+		die
+	fi
+
+	MY_ARCH="$(waydroid_arch)"
+	MY_A=()
+	use system-vanilla && waydroid_download_system VANILLA
+	use system-gapps && waydroid_download_system GAPPS
+	use vendor-mainline && waydroid_download_vendor MAINLINE
+	use vendor-halium && waydroid_download_vendor HALIUM_11
+	unpack "${MY_A[@]}"
+}
+fi
+
+src_install() {
+	insinto /usr/share/waydroid-extra/images
+	doins system.img vendor.img
+}


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/proj/guru:dev commit in: app-containers/waydroid-images/
@ 2024-04-22 12:03 Esteve Varela Colominas
  0 siblings, 0 replies; 2+ messages in thread
From: Esteve Varela Colominas @ 2024-04-22 12:03 UTC (permalink / raw
  To: gentoo-commits

commit:     6a7ac2a3fb18324019b80c76b8a183e1049a4f03
Author:     Esteve Varela Colominas <esteve.varela <AT> gmail <DOT> com>
AuthorDate: Mon Apr 22 12:01:02 2024 +0000
Commit:     Esteve Varela Colominas <esteve.varela <AT> gmail <DOT> com>
CommitDate: Mon Apr 22 12:03:16 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=6a7ac2a3

app-containers/waydroid-images: Add unzip as a BDEPEND

Signed-off-by: Esteve Varela Colominas <esteve.varela <AT> gmail.com>

 app-containers/waydroid-images/waydroid-images-9999.ebuild | 1 +
 1 file changed, 1 insertion(+)

diff --git a/app-containers/waydroid-images/waydroid-images-9999.ebuild b/app-containers/waydroid-images/waydroid-images-9999.ebuild
index 62fa9c3f4a..b9f54c5ad7 100644
--- a/app-containers/waydroid-images/waydroid-images-9999.ebuild
+++ b/app-containers/waydroid-images/waydroid-images-9999.ebuild
@@ -31,6 +31,7 @@ REQUIRED_USE="
 "
 
 RDEPEND="app-containers/waydroid"
+BDEPEND="app-arch/unzip"
 
 if [[ ${PV} == 9999 ]]; then
 	BDEPEND+="


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-22 12:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-22 22:34 [gentoo-commits] repo/proj/guru:dev commit in: app-containers/waydroid-images/ Esteve Varela Colominas
  -- strict thread matches above, loose matches on Subject: below --
2024-04-22 12:03 Esteve Varela Colominas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox