Commit f281b4ea authored by Alexandru Băluț's avatar Alexandru Băluț Committed by Thibault Saunier

flatpak: Check the required runtimes when specifically asked

This adds the --init flag which can be used to quickly check the dev env
is set up.

Ideally we should check each component individually whether it should be
installed or set up, not all or nothing.
parent c94abb45
......@@ -22,7 +22,7 @@ alias ptvenv="$PITIVI_REPO_DIR/build/flatpak/pitivi-flatpak"
echo "-> Setting up the prefix for the sandbox..."
# This builds the local flatpak repo if it is not yet built.
ptvenv echo Setting up the sandbox prefix...
ptvenv --init
if [ "$?" = "0" ];
then
echo Sandbox ready.
......
......@@ -347,6 +347,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
self.sdk = None
self.packs = []
self.init = False
self.update = False
self.json = None
self.args = []
......@@ -436,16 +437,23 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
def run(self):
if self.clean:
Console.message("Removing prefix")
try:
shutil.rmtree(self.prefix)
except FileNotFoundError:
pass
fresh_install = not os.path.exists(self.prefix)
if fresh_install or self.update:
missing_prefix = not os.path.exists(self.prefix)
if self.init or self.update:
self.install_flatpak_runtimes()
self.setup_sandbox()
if missing_prefix or self.update:
self.setup_sandbox()
self.install_development_tools()
else:
if missing_prefix:
Console.message("%sPrefix missing, create it with: %s --init%s",
Colors.FAIL, __file__, Colors.ENDC)
exit(1)
if self.check:
self.run_in_sandbox("gst-validate-launcher",
......@@ -457,7 +465,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
if self.bundle:
self.update_bundle()
if not self.check and not self.update and not self.bundle:
if not self.check and not self.init and not self.update and not self.bundle:
assert self.args
self.run_in_sandbox(*self.args, exit_on_failure=True)
......@@ -608,7 +616,9 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
if not runtime.is_installed():
runtime.install()
else:
runtime.update()
# Update only if requested.
if self.update:
runtime.update()
if __name__ == "__main__":
......@@ -617,9 +627,12 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(prog="pitivi-flatpak")
general = parser.add_argument_group("General")
general.add_argument("--init", dest="init",
action="store_true",
help="Initialize the runtime/sdk/app and build the development environment if needed")
general.add_argument("--update", dest="update",
action="store_true",
help="Update the runtime/sdk/app and rebuild the development environment if needed")
help="Update the runtime/sdk/app and rebuild the development environment")
general.add_argument("--installer", dest="installer",
action="store_true",
help="Wait for Enter to be pressed when the script exits because something failed")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment