Build x86_64 with MindTheGappsBuilder (#94)

Co-authored-by: Howard Wu <40033067+Howard20181@users.noreply.github.com>
This commit is contained in:
Syuugo 2022-09-10 15:40:21 +09:00 committed by GitHub
parent 29c373b9fd
commit 37b59237d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 28 deletions

View File

@ -306,8 +306,8 @@ if [ -z "${OFFLINE+x}" ]; then
if [ -z "${CUSTOM_MAGISK+x}" ]; then if [ -z "${CUSTOM_MAGISK+x}" ]; then
python3 generateMagiskLink.py "$MAGISK_VER" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort python3 generateMagiskLink.py "$MAGISK_VER" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
fi fi
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then if [ "$GAPPS_BRAND" != "none" ]; then
python3 generateGappsLink.py "$ARCH" "$GAPPS_VARIANT" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort python3 generateGappsLink.py "$ARCH" "$GAPPS_BRAND" "$GAPPS_VARIANT" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
fi fi
echo "Download Artifacts" echo "Download Artifacts"

View File

@ -27,31 +27,43 @@ import re
from pathlib import Path from pathlib import Path
arch = sys.argv[1] arch = sys.argv[1]
variant = sys.argv[2] brand = sys.argv[2]
download_dir = Path.cwd().parent / "download" if sys.argv[3] == "" else Path(sys.argv[3]).resolve() variant = sys.argv[3]
tempScript = sys.argv[4] download_dir = Path.cwd().parent / \
print(f"Generating OpenGApps download link: arch={arch} variant={variant}", flush=True) "download" if sys.argv[4] == "" else Path(sys.argv[4]).resolve()
tempScript = sys.argv[5]
print(
f"Generating {brand} download link: arch={arch} variant={variant}", flush=True)
abi_map = {"x64": "x86_64", "arm64": "arm64"} abi_map = {"x64": "x86_64", "arm64": "arm64"}
# TODO: keep it 11.0 since opengapps does not support 12+ yet # 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 # As soon as opengapps is available for 12+, we need to get the sdk/release from build.prop and
# download the corresponding version # download the corresponding version
release = "11.0" release = "11.0"
try: if brand == "OpenGApps":
try:
res = requests.get(f"https://api.opengapps.org/list") res = requests.get(f"https://api.opengapps.org/list")
j = json.loads(res.content) j = json.loads(res.content)
link = {i["name"]: i for i in j["archs"][abi_map[arch]] link = {i["name"]: i for i in j["archs"][abi_map[arch]]
["apis"][release]["variants"]}[variant]["zip"] ["apis"][release]["variants"]}[variant]["zip"]
except Exception: except Exception:
print("Failed to fetch from OpenGApps API, fallbacking to SourceForge RSS...") print("Failed to fetch from OpenGApps API, fallbacking to SourceForge RSS...")
res = requests.get( res = requests.get(
f'https://sourceforge.net/projects/opengapps/rss?path=/{abi_map[arch]}&limit=100') f'https://sourceforge.net/projects/opengapps/rss?path=/{abi_map[arch]}&limit=100')
link = re.search(f'https://.*{abi_map[arch]}/.*{release}.*{variant}.*\.zip/download', res.text).group().replace( 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') '.zip/download', '.zip').replace('sourceforge.net/projects/opengapps/files', 'downloads.sourceforge.net/project/opengapps')
elif brand == "MindTheGapps":
res = requests.get(
f'https://sourceforge.net/projects/wsa-mtg/rss?path=/{abi_map[arch]}&limit=100')
link = re.search(f'https://.*{abi_map[arch]}/.*\.zip/download', res.text).group().replace(
'.zip/download', '.zip').replace('sourceforge.net/projects/wsa-mtg/files', 'downloads.sourceforge.net/project/wsa-mtg')
print(f"download link: {link}", flush=True) print(f"download link: {link}", flush=True)
with open(download_dir/tempScript, 'a') as f: with open(download_dir/tempScript, 'a') as f:
f.writelines(f'{link}\n') f.writelines(f'{link}\n')
f.writelines(f' dir={download_dir}\n') f.writelines(f' dir={download_dir}\n')
f.writelines(f' out=OpenGApps-{arch}-{variant}.zip\n') if brand == "OpenGApps":
f.writelines(f' out={brand}-{arch}-{variant}.zip\n')
elif brand == "MindTheGapps":
f.writelines(f' out={brand}-{arch}.zip\n')
f.close f.close

View File

@ -145,7 +145,6 @@ else
fi fi
if (YesNoBox '([title]="Install GApps" [text]="Do you want to install GApps?")'); then if (YesNoBox '([title]="Install GApps" [text]="Do you want to install GApps?")'); then
if [ -f "$DOWNLOAD_DIR"/MindTheGapps-"$ARCH".zip ]; then
GAPPS_BRAND=$( GAPPS_BRAND=$(
Radiolist '([title]="Which GApps do you want to install?" Radiolist '([title]="Which GApps do you want to install?"
[default]="OpenGApps")' \ [default]="OpenGApps")' \
@ -153,9 +152,6 @@ if (YesNoBox '([title]="Install GApps" [text]="Do you want to install GApps?")')
'OpenGApps' "" 'on' \ 'OpenGApps' "" 'on' \
'MindTheGapps' "" 'off' 'MindTheGapps' "" 'off'
) )
else
GAPPS_BRAND="OpenGApps"
fi
else else
GAPPS_BRAND="none" GAPPS_BRAND="none"
fi fi