LOCAL_BUILD: added manifest caching and experimental args for flatpak-builder [skip ci]

This commit is contained in:
XargonWan 2024-12-11 14:53:38 +09:00
parent a51b66ed9d
commit a11e1bbf39
4 changed files with 49 additions and 24 deletions

1
.gitignore vendored
View file

@ -25,6 +25,7 @@ incconfigs/
.github/workflows/cooker-monkeyx.yml
*.flatpak
*.flatpak.sha
net.retrodeck.retrodeck.cached.yml
# Python #
##########

View file

@ -15,10 +15,20 @@ fi
mkdir -vp ${GITHUB_WORKSPACE}/retrodeck-repo
mkdir -vp ${GITHUB_WORKSPACE}/"$FOLDER"
flatpak-builder --user --force-clean \
# Pass the args to Flatpak Builder
FLATPAK_BUILD_EXTRA_ARGS="${@}"
echo "Passing additional args to flatpak builder: $FLATPAK_BUILD_EXTRA_ARGS"
command="flatpak-builder --user --force-clean $FLATPAK_BUILD_EXTRA_ARGS \
--install-deps-from=flathub \
--install-deps-from=flathub-beta \
--repo=${GITHUB_WORKSPACE}/retrodeck-repo \
--disable-download \
"${GITHUB_WORKSPACE}/$FOLDER" \
net.retrodeck.retrodeck.yml
\"${GITHUB_WORKSPACE}/$FOLDER\" \
net.retrodeck.retrodeck.yml"
# Echo the command for verification
echo -e "Executing command:\n$command"
# Execute the command
eval $command

View file

@ -189,21 +189,22 @@ handle_thisrepo() {
}
# Process the task list
while IFS="^" read -r action placeholder url branch || [[ -n "$action" ]]; do
if [[ ! "$action" == "#"* ]] && [[ -n "$action" ]]; then
case "$action" in
"branch" ) handle_branch "$placeholder" ;;
"hash" ) handle_hash "$placeholder" "$url" ;;
"latestcommit" ) handle_latestcommit "$placeholder" "$url" "$branch" ;;
"latestghtag" ) handle_latestghtag "$placeholder" "$url" ;;
"latestghrelease" ) handle_latestghrelease "$placeholder" "$url" "$branch" ;;
"latestghreleasesha" ) handle_latestghreleasesha "$placeholder" "$url" "$branch" ;;
"outside_file" ) handle_outside_file "$placeholder" "$url" ;;
"outside_env_var" ) handle_outside_env_var "$placeholder" "$url" ;;
"custom_command" ) handle_custom_command "$url" ;;
"url" ) handle_url "$placeholder" "$url" ;;
"THISREPO" ) handle_thisrepo "$placeholder" ;;
esac
fi
done < "$automation_task_list"
if [ "$use_cached" != "y" ]; then
while IFS="^" read -r action placeholder url branch || [[ -n "$action" ]]; do
if [[ ! "$action" == "#"* ]] && [[ -n "$action" ]]; then
case "$action" in
"branch" ) handle_branch "$placeholder" ;;
"hash" ) handle_hash "$placeholder" "$url" ;;
"latestcommit" ) handle_latestcommit "$placeholder" "$url" "$branch" ;;
"latestghtag" ) handle_latestghtag "$placeholder" "$url" ;;
"latestghrelease" ) handle_latestghrelease "$placeholder" "$url" "$branch" ;;
"latestghreleasesha" ) handle_latestghreleasesha "$placeholder" "$url" "$branch" ;;
"outside_file" ) handle_outside_file "$placeholder" "$url" ;;
"outside_env_var" ) handle_outside_env_var "$placeholder" "$url" ;;
"custom_command" ) handle_custom_command "$url" ;;
"url" ) handle_url "$placeholder" "$url" ;;
"THISREPO" ) handle_thisrepo "$placeholder" ;;
esac
fi
done < "$automation_task_list"
fi

View file

@ -4,8 +4,7 @@
# Check if script is running with elevated privileges
if [ "$EUID" -ne 0 ]; then
echo "The build might fail without some superuser permissions, please run me with sudo. Continue without sudo? [y/N]"
read -r continue_without_sudo
read -rp "The build might fail without some superuser permissions, please run me with sudo. Continue without sudo? [y/N] " continue_without_sudo
if [[ "$continue_without_sudo" != "y" ]]; then
exit 1
fi
@ -18,9 +17,23 @@ export GITHUB_WORKSPACE="."
# Initialize the Flatpak repo
ostree init --mode=archive-z2 --repo=${GITHUB_WORKSPACE}/retrodeck-repo
# Backing up original manifest
cp net.retrodeck.retrodeck.appdata.xml net.retrodeck.retrodeck.appdata.xml.bak
cp net.retrodeck.retrodeck.yml net.retrodeck.retrodeck.yml.bak
if [[ -f "net.retrodeck.retrodeck.cached.yml" ]]; then
read -rp "A cached manifest file with placeholder substitutions already exists. Do you want to use it? [y/N] " use_cached
if [[ "${use_cached,,}" == "y" ]]; then
cp net.retrodeck.retrodeck.cached.yml net.retrodeck.retrodeck.yml
else
use_cached="n"
fi
else
use_cached="n"
fi
export use_cached
automation_tools/install_dependencies.sh
automation_tools/cooker_build_id.sh
automation_tools/pre_build_automation.sh
@ -28,7 +41,7 @@ automation_tools/cooker_flatpak_portal_add.sh
# THIS SCRIPT IS BROKEN HENCE DISABLED FTM
# automation_tools/appdata_management.sh
automation_tools/flatpak_build_download_only.sh
automation_tools/flatpak_build_only.sh
automation_tools/flatpak_build_only.sh "${@}"
automation_tools/flatpak_build_bundle.sh
rm -f net.retrodeck.retrodeck.appdata.xml