Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Competent build script #3324

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Competent build script #3324

wants to merge 3 commits into from

Conversation

loopyd
Copy link

@loopyd loopyd commented Mar 28, 2024

Description

Increase the reliability of the build script. The goal of this commit is easier builds in the shell using org.flatpak.Builder, either on a host or in a container.

Code Clean-Up

  • Focus on improving build.sh.
  • The script has been moved from sh to bash shebang.
  • Script now includes clear documentation with shdoc annotations.
  • Formatting has been cleaned up and standardized with shellcheck

Stability improvements

  • Moved from a temporary solution to a more permanent one that can have you kicking off the build anywhere.
  • Including an error trap and proper exiting the script for syntax errors.
  • A exec_flatpak function that automatically performs actions based upon if running in a container or not.
  • Cleaner build output with formatting and message levels.
  • Sanity checking for the existence of needed commands.

CLI Improvements

  • Command-line parser for build.sh
  • Help pages for the script (via: <action> -h|--help)
  • Flatpak-style argument pass-through with -a|--arg for the run action.
  • Addition of optionally running the script with the -u|--user flag passed through to flatpak to avoid making changes to the system.
  • Support for the -c|--command flag, which allows access to bottles-cli.

Community TODOs:

  • Sandboxing via --sandbox flag.
  • Passthrough of environment variables and other lesser-used flatpak arguments (see: flatpak --help for further details), that may be useful to bottles users.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.
Provide instructions so we can reproduce.

  • Test A - On the Host System: Ran on my host machine (Linux Mint Virginia) and got a working build of Bottles flatpak master (Development Build)
  • Test B - In a Docker Container: Ran in a ubuntu:jammy docker container and got a working build of Bottles flatpak master (Development Build)
  • Test C - Command-Line Argument Invocations: Variants of command-line options tested: ./build.sh build -r -u -c bottles-cli -a --help, ./build.sh run -r -u -c bottles, ./build.sh, ./build.sh -h and other common invocations users may have interest in.
  • Test D - User and Non-User: Build success with the -u|--user flag, and without the -u|--user flag working, on systems that are configured to support flatpak running as root (not recommended).

This improvement adds command line arguments
and help pages to the build script, extending
its functionality.

Arguments can now be passed through to the
flatpak, to gain access to bottles-cli at
runtime.

Additionally, the script now has help pages:

The help page can be accessed by running
`./build.sh --help` or `./build.sh -h`.

From there help on actions and options can be
viewed by running `./build.sh <action> --help.

NOTE: This script is almost generic enough
to be used for any flatpak builder project, but
it is still tailored to bottles as the
package name is hardcoded in the script.

It does not fully support all arguments of
flatpak itself (yet), but it is a good start.
This commit adds complex filters to the ``-f|--filter``
parameter of the list action in bottles-cli.

The expanded functionality allows you to filter
by multiple fields and values, and to use
glob patterns to match.

Additionally, added the missing ability to
``list dependencies``, and migrated the programs
action over to the list action, where the
complex filter ``bottle:`` can be used to
target listing programs only found in a
single bottle (or multiple with glob match)
Copy link

fab-sonarqube bot commented Mar 28, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant