[Flatpak SDK] update-webkitgtk-libs fails
https://bugs.webkit.org/show_bug.cgi?id=209546

Reviewed by Žan Doberšek.

Simplify the code a bit, add a `--assumeyes` argument to the
`flatpak update` command to make it non-interactive and improve
error handling/reporting a bit as well.

* flatpak/flatpakutils.py:
(FlatpakObject.flatpak):
(WebkitFlatpak.main):
(WebkitFlatpak.run):
(WebkitFlatpak.install_all):
(WebkitFlatpak.update_all): Deleted.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@259039 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index 1c0a5b4..21380f5 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,5 +1,23 @@
 2020-03-26  Philippe Normand  <pnormand@igalia.com>
 
+        [Flatpak SDK] update-webkitgtk-libs fails
+        https://bugs.webkit.org/show_bug.cgi?id=209546
+
+        Reviewed by Žan Doberšek.
+
+        Simplify the code a bit, add a `--assumeyes` argument to the
+        `flatpak update` command to make it non-interactive and improve
+        error handling/reporting a bit as well.
+
+        * flatpak/flatpakutils.py:
+        (FlatpakObject.flatpak):
+        (WebkitFlatpak.main):
+        (WebkitFlatpak.run):
+        (WebkitFlatpak.install_all):
+        (WebkitFlatpak.update_all): Deleted.
+
+2020-03-26  Philippe Normand  <pnormand@igalia.com>
+
         [Flatpak SDK] Crash post-mortem debugging is broken
         https://bugs.webkit.org/show_bug.cgi?id=209537
 
diff --git a/Tools/flatpak/flatpakutils.py b/Tools/flatpak/flatpakutils.py
index 52a0bfb..938b7b5 100644
--- a/Tools/flatpak/flatpakutils.py
+++ b/Tools/flatpak/flatpakutils.py
@@ -135,6 +135,8 @@
             res = subprocess.check_output(command + ["--help"]).decode("utf-8")
             if "--user" in res:
                 command.append("--user")
+            if "--assumeyes" in res:
+                command.append("--assumeyes")
         command.extend(args)
 
         if not show_output:
@@ -696,7 +698,7 @@
 
         return 0
 
-    def run(self):
+    def main(self):
         if self.check_available:
             return 0
 
@@ -712,10 +714,19 @@
         if self.update:
             Console.message("Updating Flatpak %s environment" % self.build_type)
             if not self.no_flatpak_update:
-                self.update_all()
+                self.sdk_repo.flatpak("update")
 
         return self.setup_dev_env()
 
+    def run(self):
+        try:
+            return self.main()
+        except subprocess.CalledProcessError as error:
+            Console.message("\n%sThe following command returned a non-zero exit status: %s\n"
+                            "Output: %s%s", Colors.FAIL, ' '.join(error.cmd), error.output, Colors.ENDC)
+            return error.returncode
+        return 0
+
     def has_environment(self):
         return os.path.exists(self.flatpak_build_path)
 
@@ -802,9 +813,6 @@
             if not package.is_installed(self.sdk_branch):
                 package.install()
 
-    def update_all(self):
-        self.sdk_repo.flatpak("update")
-
     def run_gdb(self):
         with disable_signals():
             try: