From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 72F5C158041 for ; Sat, 23 Mar 2024 13:16:18 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 24D32E29CF; Sat, 23 Mar 2024 13:16:17 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0965FE2A10 for ; Sat, 23 Mar 2024 13:16:16 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id ED97734300D for ; Sat, 23 Mar 2024 13:16:15 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 33BA5156A for ; Sat, 23 Mar 2024 13:16:14 +0000 (UTC) From: "Julien Roy" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Julien Roy" Message-ID: <1711146856.727961fbdcfa8bf980d7d11b6db5f8c27cd5db69.julien@gentoo> Subject: [gentoo-commits] repo/proj/guru:master commit in: app-containers/waydroid-images/ X-VCS-Repository: repo/proj/guru X-VCS-Files: app-containers/waydroid-images/metadata.xml app-containers/waydroid-images/waydroid-images-9999.ebuild X-VCS-Directories: app-containers/waydroid-images/ X-VCS-Committer: julien X-VCS-Committer-Name: Julien Roy X-VCS-Revision: 727961fbdcfa8bf980d7d11b6db5f8c27cd5db69 X-VCS-Branch: master Date: Sat, 23 Mar 2024 13:16:14 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: e41b5151-2dfb-48f2-b6ab-609ea4431e65 X-Archives-Hash: 821ed0314eb19da674b885ddb1db3c5b commit: 727961fbdcfa8bf980d7d11b6db5f8c27cd5db69 Author: Esteve Varela Colominas gmail com> AuthorDate: Fri Mar 22 22:24:09 2024 +0000 Commit: Julien Roy jroy ca> 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 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 @@ + + + + + esteve.varela@gmail.com + Esteve Varela Colominas + + + Use the VANILLA variant of system.img + Use the GAPPS variant of system.img + Use the MAINLINE variant of vendor.img + Use the HALIUM_11 variant of vendor.img + + + waydroid/waydroid + waydroid + + 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 +}