[gentoo-commits] repo/proj/guru:dev commit in: app-containers/waydroid-images/

2024-04-22 Thread Esteve Varela Colominas
commit: 6a7ac2a3fb18324019b80c76b8a183e1049a4f03
Author: Esteve Varela Colominas  gmail  com>
AuthorDate: Mon Apr 22 12:01:02 2024 +
Commit: Esteve Varela Colominas  gmail  com>
CommitDate: Mon Apr 22 12:03:16 2024 +
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  gmail.com>

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

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



[gentoo-commits] repo/proj/guru:dev commit in: app-containers/waydroid-images/

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

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

Signed-off-by: Esteve Varela Colominas  gmail.com>

 app-containers/waydroid-images/metadata.xml|  18 ++
 .../waydroid-images/waydroid-images-.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 00..850f77c386
--- /dev/null
+++ b/app-containers/waydroid-images/metadata.xml
@@ -0,0 +1,18 @@
+
+https://www.gentoo.org/dtd/metadata.dtd;>
+
+  
+esteve.var...@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-.ebuild 
b/app-containers/waydroid-images/waydroid-images-.ebuild
new file mode 100644
index 00..62fa9c3f4a
--- /dev/null
+++ b/app-containers/waydroid-images/waydroid-images-.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} ==  ]]; then
+   PROPERTIES="live"
+else
+   # Generate using:
+   # WAYDROID_GEN_SRC_URI=y ebuild waydroid-images-.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} ==  ]]; 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}"
+