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 .github/workflows/cooker-monkeyx.yml
*.flatpak *.flatpak
*.flatpak.sha *.flatpak.sha
net.retrodeck.retrodeck.cached.yml
# Python # # Python #
########## ##########

View file

@ -15,10 +15,20 @@ fi
mkdir -vp ${GITHUB_WORKSPACE}/retrodeck-repo mkdir -vp ${GITHUB_WORKSPACE}/retrodeck-repo
mkdir -vp ${GITHUB_WORKSPACE}/"$FOLDER" 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 \
--install-deps-from=flathub-beta \ --install-deps-from=flathub-beta \
--repo=${GITHUB_WORKSPACE}/retrodeck-repo \ --repo=${GITHUB_WORKSPACE}/retrodeck-repo \
--disable-download \ --disable-download \
"${GITHUB_WORKSPACE}/$FOLDER" \ \"${GITHUB_WORKSPACE}/$FOLDER\" \
net.retrodeck.retrodeck.yml 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 # Process the task list
while IFS="^" read -r action placeholder url branch || [[ -n "$action" ]]; do if [ "$use_cached" != "y" ]; then
if [[ ! "$action" == "#"* ]] && [[ -n "$action" ]]; then while IFS="^" read -r action placeholder url branch || [[ -n "$action" ]]; do
case "$action" in if [[ ! "$action" == "#"* ]] && [[ -n "$action" ]]; then
"branch" ) handle_branch "$placeholder" ;; case "$action" in
"hash" ) handle_hash "$placeholder" "$url" ;; "branch" ) handle_branch "$placeholder" ;;
"latestcommit" ) handle_latestcommit "$placeholder" "$url" "$branch" ;; "hash" ) handle_hash "$placeholder" "$url" ;;
"latestghtag" ) handle_latestghtag "$placeholder" "$url" ;; "latestcommit" ) handle_latestcommit "$placeholder" "$url" "$branch" ;;
"latestghrelease" ) handle_latestghrelease "$placeholder" "$url" "$branch" ;; "latestghtag" ) handle_latestghtag "$placeholder" "$url" ;;
"latestghreleasesha" ) handle_latestghreleasesha "$placeholder" "$url" "$branch" ;; "latestghrelease" ) handle_latestghrelease "$placeholder" "$url" "$branch" ;;
"outside_file" ) handle_outside_file "$placeholder" "$url" ;; "latestghreleasesha" ) handle_latestghreleasesha "$placeholder" "$url" "$branch" ;;
"outside_env_var" ) handle_outside_env_var "$placeholder" "$url" ;; "outside_file" ) handle_outside_file "$placeholder" "$url" ;;
"custom_command" ) handle_custom_command "$url" ;; "outside_env_var" ) handle_outside_env_var "$placeholder" "$url" ;;
"url" ) handle_url "$placeholder" "$url" ;; "custom_command" ) handle_custom_command "$url" ;;
"THISREPO" ) handle_thisrepo "$placeholder" ;; "url" ) handle_url "$placeholder" "$url" ;;
esac "THISREPO" ) handle_thisrepo "$placeholder" ;;
fi esac
done < "$automation_task_list" fi
done < "$automation_task_list"
fi

View file

@ -4,8 +4,7 @@
# Check if script is running with elevated privileges # Check if script is running with elevated privileges
if [ "$EUID" -ne 0 ]; then 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 -rp "The build might fail without some superuser permissions, please run me with sudo. Continue without sudo? [y/N] " continue_without_sudo
read -r continue_without_sudo
if [[ "$continue_without_sudo" != "y" ]]; then if [[ "$continue_without_sudo" != "y" ]]; then
exit 1 exit 1
fi fi
@ -18,9 +17,23 @@ export GITHUB_WORKSPACE="."
# Initialize the Flatpak repo # Initialize the Flatpak repo
ostree init --mode=archive-z2 --repo=${GITHUB_WORKSPACE}/retrodeck-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.appdata.xml net.retrodeck.retrodeck.appdata.xml.bak
cp net.retrodeck.retrodeck.yml net.retrodeck.retrodeck.yml.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/install_dependencies.sh
automation_tools/cooker_build_id.sh automation_tools/cooker_build_id.sh
automation_tools/pre_build_automation.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 # THIS SCRIPT IS BROKEN HENCE DISABLED FTM
# automation_tools/appdata_management.sh # automation_tools/appdata_management.sh
automation_tools/flatpak_build_download_only.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 automation_tools/flatpak_build_bundle.sh
rm -f net.retrodeck.retrodeck.appdata.xml rm -f net.retrodeck.retrodeck.appdata.xml