fix: android 12.1 system and vendor size

This commit is contained in:
Peter Njeim 2022-05-20 15:21:22 -03:00
parent 70a6c19103
commit 41d53dd299

View File

@ -3,7 +3,7 @@ on:
workflow_dispatch:
inputs:
arch:
description: "Build arch"
description: "Build architecture"
required: true
default: "x64"
type: choice
@ -31,7 +31,7 @@ on:
- beta
- canary
gapps_variant:
description: "Variants of gapps"
description: "Variants of GApps"
required: true
default: "full"
type: choice
@ -46,6 +46,14 @@ on:
- pico
- tvstock
- tvmini
gapps_version:
description: "Android version of GApps"
required: true
default: "11.0"
type: choice
options:
- 11.0
- 12.1
root_sol:
description: "Root solution"
required: true
@ -235,14 +243,18 @@ jobs:
arch = "${{ matrix.arch }}"
variant = "${{ github.event.inputs.gapps_variant }}"
abi_map = {"x64" : "x86_64", "arm64": "arm64"}
# TODO: keep it 11.0 since opengapps does not support 12+ yet
# As soon as opengapps is available for 12+, we need to get the sdk/release from build.prop and
# download the corresponding version
release = "${{ github.event.inputs.gapps_version }}"
try:
res = requests.get(f"https://api.opengapps.org/list")
j = json.loads(res.content)
link = {i["name"]: i for i in j["archs"][abi_map[arch]]["apis"]["11.0"]["variants"]}[variant]["zip"]
link = {i["name"]: i for i in j["archs"][abi_map[arch]]["apis"][release]["variants"]}[variant]["zip"]
except Exception:
print("Failed to fetch from opengapps api, fallbacking to sourceforge rss...")
res = requests.get(f'https://sourceforge.net/projects/opengapps/rss?path=/{abi_map[arch]}&limit=100')
link = re.search(f'https://.*{abi_map[arch]}/.*{variant}.*\.zip/download', res.text).group().replace('.zip/download', '.zip').replace('sourceforge.net/projects/opengapps/files', 'downloads.sourceforge.net/project/opengapps')
link = re.search(f'https://.*{abi_map[arch]}/.*{release}.*{variant}.*\.zip/download', res.text).group().replace('.zip/download', '.zip').replace('sourceforge.net/projects/opengapps/files', 'downloads.sourceforge.net/project/opengapps')
print(f"downloading link: {link}", flush=True)
@ -260,14 +272,15 @@ jobs:
e2fsck -yf ${{ matrix.arch }}/system.img
resize2fs ${{ matrix.arch }}/system.img $(( $(du -sB512 gapps | cut -f1) + $(du -sB512 ${{ matrix.arch }}/system.img | cut -f1) ))s
# TODO: calculate the size dynamically for better compatibility
e2fsck -yf ${{ matrix.arch }}/product.img
resize2fs ${{ matrix.arch }}/product.img 1024M
e2fsck -yf ${{ matrix.arch }}/system_ext.img
resize2fs ${{ matrix.arch }}/system_ext.img 108M
resize2fs ${{ matrix.arch }}/system_ext.img 200M
- name: Expand vendor
run: |
e2fsck -yf ${{ matrix.arch }}/vendor.img
resize2fs ${{ matrix.arch }}/vendor.img 320M
resize2fs ${{ matrix.arch }}/vendor.img 400M
- name: Mount images
run: |
sudo mkdir system
@ -419,7 +432,7 @@ jobs:
run: |
from __future__ import annotations
from io import TextIOWrapper
from os import system
from os import system, path
from typing import OrderedDict
@ -461,6 +474,9 @@ jobs:
def fix_prop(sec, prop):
if not path.exists(prop):
return
print(f"fixing {prop}", flush=True)
with open(prop, 'r') as f:
p = Prop(f)