Hello community,

here is the log from the commit of package flatpak-builder for openSUSE:Factory 
checked in at 2019-06-01 09:56:13
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/flatpak-builder (Old)
 and      /work/SRC/openSUSE:Factory/.flatpak-builder.new.5148 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "flatpak-builder"

Sat Jun  1 09:56:13 2019 rev:11 rq:706390 version:1.0.7

Changes:
--------
--- /work/SRC/openSUSE:Factory/flatpak-builder/flatpak-builder.changes  
2019-02-14 14:33:29.103649166 +0100
+++ 
/work/SRC/openSUSE:Factory/.flatpak-builder.new.5148/flatpak-builder.changes    
    2019-06-01 09:56:19.711184406 +0200
@@ -1,0 +2,21 @@
+Wed May 29 07:18:44 UTC 2019 - Bjørn Lie <[email protected]>
+
+- Update to version 1.0.7:
+  + Use the new die-with-parent feature of HostCommand when build
+    to run in a flatpak.
+  + Fix some details in how we create platform commits to fix font
+    cache mtime issues.
+- Changes from version 1.0.6:
+  + Pass --noninteractive when installing for flatpak >= 1.2.0.
+  + Doc fixes.
+- Changes from version 1.0.5:
+  + Due to a change in the output of "flatpak info" the support for
+    loading default build options from the sdk regressed with
+    flatpak 1.2.x. This is fixed and everyone who built flatpaks
+    with 1.2.x are recommended to update to this release and
+    re-build.
+- Changes from version 1.0.4:
+  + Add --add/remove-tag options
+  + Allow using a full ref as sdk and use the branch from that.
+
+-------------------------------------------------------------------

Old:
----
  flatpak-builder-1.0.3.tar.xz

New:
----
  flatpak-builder-1.0.7.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ flatpak-builder.spec ++++++
--- /var/tmp/diff_new_pack.BkyHZc/_old  2019-06-01 09:56:20.531184126 +0200
+++ /var/tmp/diff_new_pack.BkyHZc/_new  2019-06-01 09:56:20.535184125 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           flatpak-builder
-Version:        1.0.3
+Version:        1.0.7
 Release:        0
 Summary:        Tool to build flatpaks from source
 License:        LGPL-2.1-or-later

++++++ flatpak-builder-1.0.3.tar.xz -> flatpak-builder-1.0.7.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flatpak-builder-1.0.3/NEWS 
new/flatpak-builder-1.0.7/NEWS
--- old/flatpak-builder-1.0.3/NEWS      2019-01-28 12:52:14.000000000 +0100
+++ new/flatpak-builder-1.0.7/NEWS      2019-05-10 09:28:17.000000000 +0200
@@ -1,3 +1,29 @@
+Changes in 1.0.7
+================
+
+ * Use the new die-with-parent feature of HostCommand when build to run in a 
flatpak
+ * Fix some details in how we create platform commits to fix font cache mtime 
issues.
+
+Changes in 1.0.6
+================
+
+ * Pass --noninteractive when installing for flatpak >= 1.2.0
+ * Doc fixes
+
+Changes in 1.0.5
+================
+
+Due to a change in the output of "flatpak info" the support for
+loading default build options from the sdk regressed with flatpak
+1.2.x. This is fixed and everyone who built flatpaks with 1.2.x are
+recommended to update to this release and re-build.
+
+Changes in 1.0.4
+================
+
+ * Add --add/remove-tag options
+ * Allow using a full ref as sdk and use the branch from that.
+
 Changes in 1.0.3
 ================
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flatpak-builder-1.0.3/configure 
new/flatpak-builder-1.0.7/configure
--- old/flatpak-builder-1.0.3/configure 2019-01-28 12:52:42.000000000 +0100
+++ new/flatpak-builder-1.0.7/configure 2019-05-10 09:28:51.000000000 +0200
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for flatpak-builder 1.0.3.
+# Generated by GNU Autoconf 2.69 for flatpak-builder 1.0.7.
 #
 # Report bugs to <https://github.com/flatpak/flatpak-builder/issues>.
 #
@@ -590,8 +590,8 @@
 # Identity of this package.
 PACKAGE_NAME='flatpak-builder'
 PACKAGE_TARNAME='flatpak-builder'
-PACKAGE_VERSION='1.0.3'
-PACKAGE_STRING='flatpak-builder 1.0.3'
+PACKAGE_VERSION='1.0.7'
+PACKAGE_STRING='flatpak-builder 1.0.7'
 PACKAGE_BUGREPORT='https://github.com/flatpak/flatpak-builder/issues'
 PACKAGE_URL='http://flatpak.org/'
 
@@ -1394,7 +1394,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures flatpak-builder 1.0.3 to adapt to many kinds of 
systems.
+\`configure' configures flatpak-builder 1.0.7 to adapt to many kinds of 
systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1464,7 +1464,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of flatpak-builder 1.0.3:";;
+     short | recursive ) echo "Configuration of flatpak-builder 1.0.7:";;
    esac
   cat <<\_ACEOF
 
@@ -1615,7 +1615,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-flatpak-builder configure 1.0.3
+flatpak-builder configure 1.0.7
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2030,7 +2030,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by flatpak-builder $as_me 1.0.3, which was
+It was created by flatpak-builder $as_me 1.0.7, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -13249,7 +13249,7 @@
 
 # Define the identity of the package.
  PACKAGE='flatpak-builder'
- VERSION='1.0.3'
+ VERSION='1.0.7'
 
 
 # Some tools Automake needs.
@@ -16935,7 +16935,7 @@
   fi
 
 
-FLATPAK_BUILDER_VERSION=1.0.3
+FLATPAK_BUILDER_VERSION=1.0.7
 
 
 ac_config_files="$ac_config_files Makefile doc/Makefile 
doc/flatpak-builder-docs.xml"
@@ -17494,7 +17494,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by flatpak-builder $as_me 1.0.3, which was
+This file was extended by flatpak-builder $as_me 1.0.7, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -17561,7 +17561,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-flatpak-builder config.status 1.0.3
+flatpak-builder config.status 1.0.7
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flatpak-builder-1.0.3/configure.ac 
new/flatpak-builder-1.0.7/configure.ac
--- old/flatpak-builder-1.0.3/configure.ac      2019-01-28 12:51:04.000000000 
+0100
+++ new/flatpak-builder-1.0.7/configure.ac      2019-05-10 09:26:53.000000000 
+0200
@@ -15,7 +15,7 @@
 
 m4_define([flatpak_builder_major_version], [1])
 m4_define([flatpak_builder_minor_version], [0])
-m4_define([flatpak_builder_micro_version], [3])
+m4_define([flatpak_builder_micro_version], [7])
 m4_define([flatpak_builder_version],
           
[flatpak_builder_major_version.flatpak_builder_minor_version.flatpak_builder_micro_version])
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flatpak-builder-1.0.3/doc/flatpak-builder.xml 
new/flatpak-builder-1.0.7/doc/flatpak-builder.xml
--- old/flatpak-builder-1.0.3/doc/flatpak-builder.xml   2019-01-11 
16:15:29.000000000 +0100
+++ new/flatpak-builder-1.0.7/doc/flatpak-builder.xml   2019-02-04 
10:46:06.000000000 +0100
@@ -535,6 +535,24 @@
             </varlistentry>
 
             <varlistentry>
+                <term><option>--add-tag=TAG</option></term>
+
+                <listitem><para>
+                  Add this tag to the tags list of the manifest before 
building.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--remove-tag=TAG</option></term>
+
+                <listitem><para>
+                  Remove this tag to the tags list of the manifest before 
building. The remove
+                  happen before processing the --add-tag option, so if both 
are specified, then
+                  --app-tag wins.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
                 <term><option>--install-deps-from=REMOTE</option></term>
 
                 <listitem><para>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flatpak-builder-1.0.3/doc/flatpak-manifest.xml 
new/flatpak-builder-1.0.7/doc/flatpak-manifest.xml
--- old/flatpak-builder-1.0.3/doc/flatpak-manifest.xml  2019-01-25 
16:50:51.000000000 +0100
+++ new/flatpak-builder-1.0.7/doc/flatpak-manifest.xml  2019-03-12 
15:28:47.000000000 +0100
@@ -824,7 +824,7 @@
                     </varlistentry>
                     <varlistentry>
                         <term><option>dest-filename</option> (string)</term>
-                        <listitem><para>Filename to use inside the source dir, 
default to the basename of path.</para></listitem>
+                        <listitem><para>Filename to use inside the source dir, 
default to autogen.sh.</para></listitem>
                     </varlistentry>
                 </variablelist>
             </refsect3>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flatpak-builder-1.0.3/src/builder-flatpak-utils.h 
new/flatpak-builder-1.0.7/src/builder-flatpak-utils.h
--- old/flatpak-builder-1.0.3/src/builder-flatpak-utils.h       2018-10-04 
14:48:07.000000000 +0200
+++ new/flatpak-builder-1.0.7/src/builder-flatpak-utils.h       2019-05-06 
13:03:25.000000000 +0200
@@ -33,6 +33,7 @@
 
 typedef enum {
   FLATPAK_HOST_COMMAND_FLAGS_CLEAR_ENV = 1 << 0,
+  FLATPAK_HOST_COMMAND_FLAGS_WATCH_BUS = 1 << 1,
 } FlatpakHostCommandFlags;
 
 typedef void (*FlatpakLoadUriProgress) (guint64 downloaded_bytes,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flatpak-builder-1.0.3/src/builder-git.c 
new/flatpak-builder-1.0.7/src/builder-git.c
--- old/flatpak-builder-1.0.3/src/builder-git.c 2018-03-27 15:12:56.000000000 
+0200
+++ new/flatpak-builder-1.0.7/src/builder-git.c 2019-02-08 11:18:07.000000000 
+0100
@@ -822,44 +822,6 @@
 }
 
 gboolean
-builder_git_checkout_dir (const char     *repo_location,
-                          const char     *branch,
-                          const char     *dir,
-                          GFile          *dest,
-                          BuilderContext *context,
-                          GError        **error)
-{
-  g_autoptr(GFile) mirror_dir = NULL;
-  g_autofree char *mirror_dir_path = NULL;
-  g_autofree char *dest_path = NULL;
-  g_autofree char *dest_path_git = NULL;
-
-  mirror_dir = git_get_mirror_dir (repo_location, context);
-
-  mirror_dir_path = g_file_get_path (mirror_dir);
-  dest_path = g_file_get_path (dest);
-  dest_path_git = g_build_filename (dest_path, ".git", NULL);
-
-  g_mkdir_with_parents (dest_path, 0755);
-
-  if (!cp (error,
-           "-al",
-           mirror_dir_path, dest_path_git, NULL))
-    return FALSE;
-
-  /* Then we need to convert to regular */
-  if (!git (dest, NULL, 0, error,
-            "config", "--bool", "core.bare", "false", NULL))
-    return FALSE;
-
-  if (!git (dest, NULL, 0, error,
-            "checkout", branch, "--", dir ? dir : ".", NULL))
-    return FALSE;
-
-  return TRUE;
-}
-
-gboolean
 builder_git_checkout (const char     *repo_location,
                       const char     *branch,
                       GFile          *dest,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flatpak-builder-1.0.3/src/builder-git.h 
new/flatpak-builder-1.0.7/src/builder-git.h
--- old/flatpak-builder-1.0.3/src/builder-git.h 2017-11-06 13:46:11.000000000 
+0100
+++ new/flatpak-builder-1.0.7/src/builder-git.h 2019-02-08 11:18:07.000000000 
+0100
@@ -49,12 +49,6 @@
                                          GFile           *dest,
                                          BuilderContext  *context,
                                          GError         **error);
-gboolean builder_git_checkout_dir       (const char      *repo_location,
-                                         const char      *branch,
-                                         const char      *dir,
-                                         GFile           *dest,
-                                         BuilderContext  *context,
-                                         GError         **error);
 gboolean builder_git_shallow_mirror_ref (const char     *repo_location,
                                          const char     *destination_path,
                                          const char     *ref,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flatpak-builder-1.0.3/src/builder-main.c 
new/flatpak-builder-1.0.7/src/builder-main.c
--- old/flatpak-builder-1.0.3/src/builder-main.c        2019-01-25 
17:13:41.000000000 +0100
+++ new/flatpak-builder-1.0.7/src/builder-main.c        2019-02-15 
09:01:30.000000000 +0100
@@ -74,6 +74,8 @@
 static char **opt_key_ids;
 static char **opt_sources_dirs;
 static char **opt_sources_urls;
+static char **opt_add_tags;
+static char **opt_remove_tags;
 static int opt_jobs;
 static char *opt_mirror_screenshots_url;
 static char *opt_install_deps_from;
@@ -89,6 +91,8 @@
   { "version", 0, 0, G_OPTION_ARG_NONE, &opt_version, "Print version 
information and exit", NULL },
   { "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, "Architecture to build for 
(must be host compatible)", "ARCH" },
   { "default-branch", 0, 0, G_OPTION_ARG_STRING, &opt_default_branch, "Change 
the default branch", "BRANCH" },
+  { "add-tag", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_add_tags, "Add a tag to 
the build", "TAG"},
+  { "remove-tag", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_remove_tags, "Remove a 
tag from the build", "TAG"},
   { "run", 0, 0, G_OPTION_ARG_NONE, &opt_run, "Run a command in the build 
directory (see --run --help)", NULL },
   { "ccache", 0, 0, G_OPTION_ARG_NONE, &opt_ccache, "Use ccache", NULL },
   { "disable-cache", 0, 0, G_OPTION_ARG_NONE, &opt_disable_cache, "Disable 
cache lookups", NULL },
@@ -253,46 +257,6 @@
 }
 
 static gboolean
-flatpak_version_check (int major,
-                       int minor,
-                       int micro)
-{
-  static int flatpak_major = 0;
-  static int flatpak_minor = 0;
-  static int flatpak_micro = 0;
-
-  if (flatpak_major == 0 &&
-      flatpak_minor == 0 &&
-      flatpak_micro == 0)
-    {
-      const char * argv[] = { "flatpak", "--version", NULL };
-      g_autoptr(GSubprocess) subp = NULL;
-      g_autofree char *out = NULL;
- 
-      subp = g_subprocess_newv (argv, G_SUBPROCESS_FLAGS_STDOUT_PIPE, NULL);
-      g_subprocess_communicate_utf8 (subp, NULL, NULL, &out, NULL, NULL);
-
-      if (sscanf (out, "Flatpak %d.%d.%d", &flatpak_major, &flatpak_minor, 
&flatpak_micro) != 3)
-        g_warning ("Failed to get flatpak version");
-
-      g_debug ("Using Flatpak version %d.%d.%d", flatpak_major, flatpak_minor, 
flatpak_micro);
-    }
-
-  if (flatpak_major > major)
-    return TRUE;
-  if (flatpak_major < major)
-    return FALSE;
-  if (flatpak_minor > minor)
-    return TRUE;
-  if (flatpak_minor < minor)
-    return FALSE;
-  if (flatpak_micro >= micro)
-    return TRUE;
-
-  return FALSE;
-}
-
-static gboolean
 do_install (BuilderContext *build_context,
             const gchar    *repodir,
             const gchar    *id,
@@ -623,21 +587,27 @@
 
       cleanup_manifest_dir = g_object_ref (build_subdir);
 
+      int mirror_flags = FLATPAK_GIT_MIRROR_FLAGS_MIRROR_SUBMODULES;
+
+      if (opt_disable_updates)
+        {
+          mirror_flags |= FLATPAK_GIT_MIRROR_FLAGS_UPDATE;
+       }
+
       if (!builder_git_mirror_repo (opt_from_git,
                                     NULL,
-                                    
opt_disable_updates?0:FLATPAK_GIT_MIRROR_FLAGS_UPDATE,
+                                    mirror_flags,
                                     git_branch, build_context, &error))
         {
           g_printerr ("Can't clone manifest repo: %s\n", error->message);
           return 1;
         }
 
-      if (!builder_git_checkout_dir (opt_from_git,
-                                     git_branch,
-                                     manifest_dirname,
-                                     build_subdir,
-                                     build_context,
-                                     &error))
+      if (!builder_git_checkout (opt_from_git,
+                                 git_branch,
+                                 build_subdir,
+                                 build_context,
+                                 &error))
         {
           g_printerr ("Can't check out manifest repo: %s\n", error->message);
           return 1;
@@ -689,6 +659,12 @@
       return 1;
     }
 
+  if (opt_remove_tags)
+    builder_manifest_remove_tags (manifest, (const char **)opt_remove_tags);
+
+  if (opt_add_tags)
+    builder_manifest_add_tags (manifest, (const char **)opt_add_tags);
+
   if (opt_default_branch)
     builder_context_set_default_branch (build_context, opt_default_branch);
 
@@ -708,7 +684,7 @@
     {
       if (!builder_manifest_show_deps (manifest, build_context, &error))
         {
-          g_printerr ("Error running %s: %s\n", argv[3], error->message);
+          g_printerr ("Error calculating deps: %s\n", error->message);
           return 1;
         }
 
@@ -720,7 +696,7 @@
       if (!builder_manifest_install_deps (manifest, build_context, 
opt_install_deps_from, opt_user, opt_installation,
                                           opt_yes, &error))
         {
-          g_printerr ("Error running %s: %s\n", argv[3], error->message);
+          g_printerr ("Error installing deps: %s\n", error->message);
           return 1;
         }
       if (opt_install_deps_only)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flatpak-builder-1.0.3/src/builder-manifest.c 
new/flatpak-builder-1.0.7/src/builder-manifest.c
--- old/flatpak-builder-1.0.3/src/builder-manifest.c    2019-01-25 
17:15:59.000000000 +0100
+++ new/flatpak-builder-1.0.7/src/builder-manifest.c    2019-05-06 
10:46:06.000000000 +0200
@@ -1415,6 +1415,56 @@
     self->collection_id = g_strdup (default_collection_id);
 }
 
+void
+builder_manifest_add_tags (BuilderManifest *self,
+                          const char      **add_tags)
+{
+  GPtrArray *new_tags = g_ptr_array_new ();
+  int i;
+
+  for (i = 0; self->tags != NULL && self->tags[i] != NULL; i++)
+    g_ptr_array_add (new_tags, self->tags[i]);
+
+  for (i = 0; add_tags[i] != NULL; i++)
+    {
+      const char *new_tag = add_tags[i];
+      if (self->tags == NULL || !g_strv_contains ((const char **)self->tags, 
new_tag))
+        g_ptr_array_add (new_tags, g_strdup (new_tag));
+    }
+
+  g_ptr_array_add (new_tags, NULL);
+
+  g_free (self->tags);
+  self->tags = (char **)g_ptr_array_free (new_tags, FALSE);
+
+}
+
+void
+builder_manifest_remove_tags (BuilderManifest *self,
+                             const char      **remove_tags)
+{
+  GPtrArray *new_tags = g_ptr_array_new ();
+  int i;
+
+  if (self->tags)
+    {
+      for (i = 0; self->tags[i] != NULL; i++)
+        {
+          char *old_tag = self->tags[i];
+          if (g_strv_contains (remove_tags, old_tag))
+            g_free (old_tag);
+          else
+            g_ptr_array_add (new_tags, old_tag);
+        }
+    }
+
+  g_ptr_array_add (new_tags, NULL);
+
+  g_free (self->tags);
+  self->tags = (char **)g_ptr_array_free (new_tags, FALSE);
+}
+
+
 const char *
 builder_manifest_get_extension_tag (BuilderManifest *self)
 {
@@ -1508,27 +1558,17 @@
                         const char *branch,
                         BuilderContext  *context)
 {
-  g_autofree char *sdk_info = NULL;
+  g_autofree char *output = NULL;
   g_autofree char *arch_option = NULL;
-  g_auto(GStrv) sdk_info_lines = NULL;
-  int i;
-
-  /* Unfortunately there is not flatpak info --show-path, so we have to look 
at the full flatpak info output */
 
   arch_option = g_strdup_printf ("--arch=%s", builder_context_get_arch 
(context));
 
-  sdk_info = flatpak (NULL, "info", arch_option, id, branch, NULL);
-  if (sdk_info == NULL)
+  output = flatpak (NULL, "info", "--show-location", arch_option, id, branch, 
NULL);
+  if (output == NULL)
     return NULL;
 
-  sdk_info_lines = g_strsplit (sdk_info, "\n", -1);
-  for (i = 0; sdk_info_lines[i] != NULL; i++)
-    {
-      if (g_str_has_prefix (sdk_info_lines[i], "Location:"))
-        return g_strstrip (g_strdup (sdk_info_lines[i] + strlen 
("Location:")));
-    }
-
-  return NULL;
+  g_strchomp (output);
+  return g_steal_pointer (&output);
 }
 
 gboolean
@@ -1829,20 +1869,15 @@
 }
 
 static void
-builder_manifest_checksum_for_platform (BuilderManifest *self,
-                                        BuilderCache    *cache,
-                                        BuilderContext  *context)
+builder_manifest_checksum_for_platform_base (BuilderManifest *self,
+                                             BuilderCache    *cache,
+                                             BuilderContext  *context)
 {
-  GList *l;
-
   builder_cache_checksum_str (cache, 
BUILDER_MANIFEST_CHECKSUM_PLATFORM_VERSION);
   builder_cache_checksum_str (cache, self->id_platform);
   builder_cache_checksum_str (cache, self->runtime_commit);
-  builder_cache_checksum_str (cache, self->metadata_platform);
-  builder_cache_checksum_strv (cache, self->cleanup_platform);
-  builder_cache_checksum_strv (cache, self->cleanup_platform_commands);
-  builder_cache_checksum_strv (cache, self->prepare_platform_commands);
   builder_cache_checksum_strv (cache, self->platform_extensions);
+  builder_cache_checksum_str (cache, self->metadata_platform);
 
   if (self->metadata_platform)
     {
@@ -1857,14 +1892,32 @@
       else
         g_warning ("Can't load metadata-platform file %s: %s", 
self->metadata_platform, my_error->message);
     }
+}
+
+static void
+builder_manifest_checksum_for_platform_prepare (BuilderManifest *self,
+                                                BuilderCache    *cache,
+                                                BuilderContext  *context)
+{
+  GList *l;
 
+  builder_cache_checksum_strv (cache, self->prepare_platform_commands);
+  builder_cache_checksum_strv (cache, self->cleanup_platform);
   for (l = self->expanded_modules; l != NULL; l = l->next)
     {
       BuilderModule *m = l->data;
-      builder_module_checksum_for_platform (m, cache, context);
+      builder_module_checksum_for_platform_cleanup (m, cache, context);
     }
 }
 
+static void
+builder_manifest_checksum_for_platform_finish (BuilderManifest *self,
+                                               BuilderCache    *cache,
+                                               BuilderContext  *context)
+{
+  builder_cache_checksum_strv (cache, self->cleanup_platform_commands);
+}
+
 gboolean
 builder_manifest_download (BuilderManifest *self,
                            gboolean         update_vcs,
@@ -3111,49 +3164,33 @@
   return TRUE;
 }
 
-gboolean
-builder_manifest_create_platform (BuilderManifest *self,
-                                  BuilderCache    *cache,
-                                  BuilderContext  *context,
-                                  GError         **error)
+/* Creates the platform directory based on the base platform (with
+ * locales moved in place if needed), and the metadata.platform file
+ * for it */
+static gboolean
+builder_manifest_create_platform_base (BuilderManifest *self,
+                                       BuilderCache    *cache,
+                                       BuilderContext  *context,
+                                       GError         **error)
 {
-  g_autofree char *commandline = NULL;
-
-  g_autoptr(GFile) locale_dir = NULL;
-  int i;
-
-  if (!self->build_runtime ||
-      self->id_platform == NULL)
-    return TRUE;
-
-  builder_manifest_checksum_for_platform (self, cache, context);
-  if (!builder_cache_lookup (cache, "platform"))
+  builder_manifest_checksum_for_platform_base (self, cache, context);
+  if (!builder_cache_lookup (cache, "platform-base"))
     {
-      g_autoptr(GHashTable) to_remove_ht = g_hash_table_new_full (g_str_hash, 
g_str_equal, g_free, NULL);
-      g_autoptr(GPtrArray) changes = NULL;
-      GList *l;
+      GFile *app_dir = NULL;
       g_autoptr(GFile) platform_dir = NULL;
       g_autoptr(GSubprocess) subp = NULL;
       g_autoptr(GPtrArray) args = NULL;
-      GFile *app_dir = NULL;
-      g_autofree char *ref = NULL;
-      g_autoptr(GPtrArray) sub_ids = g_ptr_array_new_with_free_func (g_free);
+      g_autofree char *commandline = NULL;
+      int i;
 
       g_print ("Creating platform based on %s\n", self->runtime);
-
-      builder_set_term_title (_("Creating platform for %s"), self->id);
+      builder_set_term_title (_("Creating platform base for %s"), self->id);
 
       if (!builder_context_enable_rofiles (context, error))
         return FALSE;
 
       /* Call after enabling rofiles */
       app_dir = builder_context_get_app_dir (context);
-
-      ref = flatpak_compose_ref (!self->build_runtime && 
!self->build_extension,
-                                 builder_manifest_get_id_platform (self),
-                                 builder_manifest_get_branch (self, context),
-                                 builder_context_get_arch (context));
-
       platform_dir = g_file_get_child (app_dir, "platform");
 
       args = g_ptr_array_new_with_free_func (g_free);
@@ -3193,14 +3230,8 @@
 
       if (self->separate_locales)
         {
-          g_autoptr(GFile) root_dir = NULL;
-
-          root_dir = g_file_get_child (app_dir, "platform");
-
-          if (!builder_migrate_locale_dirs (root_dir, error))
+          if (!builder_migrate_locale_dirs (platform_dir, error))
             return FALSE;
-
-          locale_dir = g_file_resolve_relative_path (root_dir, 
LOCALES_SEPARATE_DIR);
         }
 
       if (self->metadata_platform)
@@ -3266,6 +3297,49 @@
             }
         }
 
+      if (!builder_context_disable_rofiles (context, error))
+        return FALSE;
+
+      if (!builder_cache_commit (cache, "Created platform base", error))
+        return FALSE;
+    }
+  else
+    {
+      g_print ("Cache hit for create platform base, skipping\n");
+    }
+
+  return TRUE;
+}
+
+/* Run the prepare-platform commands, then layer on top all the
+ * changes from the sdk build, except any new files mentioned by
+ * cleanup-platform */
+static gboolean
+builder_manifest_prepare_platform (BuilderManifest *self,
+                                   BuilderCache    *cache,
+                                   BuilderContext  *context,
+                                   GError         **error)
+{
+  builder_manifest_checksum_for_platform_prepare (self, cache, context);
+  if (!builder_cache_lookup (cache, "platform-prepare"))
+    {
+      GFile *app_dir = NULL;
+      g_autoptr(GFile) platform_dir = NULL;
+      g_autoptr(GHashTable) to_remove_ht = g_hash_table_new_full (g_str_hash, 
g_str_equal, g_free, NULL);
+      g_autoptr(GPtrArray) changes = NULL;
+      GList *l;
+      int i;
+
+      g_print ("Preparing platform with new changes\n");
+      builder_set_term_title (_("Preparing platform for %s"), self->id);
+
+      if (!builder_context_enable_rofiles (context, error))
+        return FALSE;
+
+      /* Call after enabling rofiles */
+      app_dir = builder_context_get_app_dir (context);
+      platform_dir = g_file_get_child (app_dir, "platform");
+
       if (self->prepare_platform_commands)
         {
           g_auto(GStrv) env = builder_options_get_env (self->build_options, 
context);
@@ -3289,7 +3363,7 @@
           builder_module_cleanup_collect (m, TRUE, context, to_remove_ht);
         }
 
-      /* This returns both additiona and removals */
+      /* This returns both additions and removals */
       changes = builder_cache_get_all_changes (cache, error);
       if (changes == NULL)
         return FALSE;
@@ -3384,6 +3458,54 @@
             }
         }
 
+      if (!builder_context_disable_rofiles (context, error))
+        return FALSE;
+
+      if (!builder_cache_commit (cache, "Prepared platform", error))
+        return FALSE;
+    }
+  else
+    {
+      g_print ("Cache hit for prepare platform, skipping\n");
+    }
+
+  return TRUE;
+}
+
+/* Run the cleanup-platform-commands (which we want to run in a new cache 
state to ensure it gets freshly zeroed mtimes)
+ * and other finishing touches that need to happen after that, such as adding 
separate locale metadata. */
+static gboolean
+builder_manifest_finish_platform (BuilderManifest *self,
+                                  BuilderCache    *cache,
+                                  BuilderContext  *context,
+                                  GError         **error)
+{
+  builder_manifest_checksum_for_platform_finish (self, cache, context);
+  if (!builder_cache_lookup (cache, "platform-finish"))
+    {
+      GFile *app_dir = NULL;
+      g_autoptr(GFile) platform_dir = NULL;
+      g_autoptr(GFile) locale_dir = NULL;
+      g_autofree char *ref = NULL;
+      g_autoptr(GPtrArray) sub_ids = g_ptr_array_new_with_free_func (g_free);
+      int i;
+
+      g_print ("Finishing platform\n");
+      builder_set_term_title (_("Finishing up platform for %s"), self->id);
+
+      if (!builder_context_enable_rofiles (context, error))
+        return FALSE;
+
+      /* Call after enabling rofiles */
+      app_dir = builder_context_get_app_dir (context);
+      platform_dir = g_file_get_child (app_dir, "platform");
+      locale_dir = g_file_resolve_relative_path (platform_dir, 
LOCALES_SEPARATE_DIR);
+
+      ref = flatpak_compose_ref (!self->build_runtime && 
!self->build_extension,
+                                 builder_manifest_get_id_platform (self),
+                                 builder_manifest_get_branch (self, context),
+                                 builder_context_get_arch (context));
+
       if (self->cleanup_platform_commands)
         {
           g_auto(GStrv) env = builder_options_get_env (self->build_options, 
context);
@@ -3400,7 +3522,7 @@
             }
         }
 
-      if (self->separate_locales && locale_dir && g_file_query_exists 
(locale_dir, NULL))
+      if (self->separate_locales && g_file_query_exists (locale_dir, NULL))
         {
           g_autoptr(GFile) metadata_file = NULL;
           g_autofree char *extension_contents = NULL;
@@ -3419,6 +3541,8 @@
                                                 locale_id,
                                                 LOCALES_SEPARATE_DIR);
 
+          if (!flatpak_break_hardlink (metadata_file, error))
+            return FALSE;
           output = g_file_append_to (metadata_file, G_FILE_CREATE_NONE, NULL, 
error);
           if (output == NULL)
             return FALSE;
@@ -3456,8 +3580,9 @@
               g_string_append (extension_contents, (const char 
*)sub_ids->pdata[i]);
               g_string_append (extension_contents, ";");
             }
-
           metadata_file = g_file_get_child (app_dir, "metadata.platform");
+          if (!flatpak_break_hardlink (metadata_file, error))
+            return FALSE;
           output = g_file_append_to (metadata_file, G_FILE_CREATE_NONE, NULL, 
error);
           if (output == NULL)
             return FALSE;
@@ -3471,17 +3596,40 @@
       if (!builder_context_disable_rofiles (context, error))
         return FALSE;
 
-      if (!builder_cache_commit (cache, "Created platform", error))
+      if (!builder_cache_commit (cache, "Platform finish", error))
         return FALSE;
     }
   else
     {
-      g_print ("Cache hit for create platform, skipping\n");
+      g_print ("Cache hit for platform finish, skipping\n");
     }
 
   return TRUE;
 }
 
+
+gboolean
+builder_manifest_create_platform (BuilderManifest *self,
+                                  BuilderCache    *cache,
+                                  BuilderContext  *context,
+                                  GError         **error)
+{
+  if (!self->build_runtime ||
+      self->id_platform == NULL)
+    return TRUE;
+
+  if (!builder_manifest_create_platform_base (self, cache, context, error))
+    return FALSE;
+
+  if (!builder_manifest_prepare_platform (self, cache, context, error))
+    return FALSE;
+
+  if (!builder_manifest_finish_platform (self, cache, context, error))
+    return FALSE;
+
+  return TRUE;
+}
+
 gboolean
 builder_manifest_bundle_sources (BuilderManifest *self,
                                  const char      *json,
@@ -3646,12 +3794,18 @@
     }
 
   g_ptr_array_add (args, g_strdup ("-y"));
+  if (flatpak_version_check (1, 2, 0))
+    g_ptr_array_add (args, g_strdup ("--noninteractive"));
 
   g_ptr_array_add (args, g_strdup (ref));
   g_ptr_array_add (args, NULL);
 
   if (!builder_maybe_host_spawnv (NULL, NULL, 0, error, (const char * const 
*)args->pdata))
-    return FALSE;
+    {
+      g_autofree char *commandline = flatpak_quote_argv ((const char 
**)args->pdata);
+      g_prefix_error (error, "running `%s`: ", commandline);
+      return FALSE;
+    }
 
   return TRUE;
 }
@@ -3660,6 +3814,7 @@
 builder_manifest_install_extension_deps (BuilderManifest *self,
                                          BuilderContext  *context,
                                          const char *runtime,
+                                         const char *runtime_version,
                                          char **runtime_extensions,
                                          const char *remote,
                                          gboolean opt_user,
@@ -3667,7 +3822,7 @@
                                          gboolean opt_yes,
                                          GError **error)
 {
-  g_autofree char *runtime_ref = flatpak_build_runtime_ref (runtime, 
builder_manifest_get_runtime_version (self),
+  g_autofree char *runtime_ref = flatpak_build_runtime_ref (runtime, 
runtime_version,
                                                             
builder_context_get_arch (context));
   g_autofree char *metadata = NULL;
   g_autoptr(GKeyFile) keyfile = g_key_file_new ();
@@ -3706,7 +3861,7 @@
 
       extension_version = g_key_file_get_string (keyfile, extension_group, 
"version", NULL);
       if (extension_version == NULL)
-        extension_version = g_strdup (builder_manifest_get_runtime_version 
(self));
+        extension_version = g_strdup (runtime_version);
 
       g_print ("Dependency Extension: %s %s\n", runtime_extensions[i], 
extension_version);
       if (!builder_manifest_install_dep (self, context, remote, opt_user, 
opt_installation,
@@ -3730,10 +3885,25 @@
 {
   GList *l;
 
+  const char *sdk = NULL;
+  const char *sdk_branch = NULL;
+  g_auto(GStrv) sdk_parts = g_strsplit (self->sdk, "/", 3);
+
+  if (g_strv_length (sdk_parts) >= 3)
+    {
+      sdk = sdk_parts[0];
+      sdk_branch = sdk_parts[2];
+    }
+  else
+    {
+      sdk = self->sdk;
+      sdk_branch = builder_manifest_get_runtime_version (self);
+    }
+
   /* Sdk */
-  g_print ("Dependency Sdk: %s %s\n", self->sdk, 
builder_manifest_get_runtime_version (self));
+  g_print ("Dependency Sdk: %s %s\n", sdk, sdk_branch);
   if (!builder_manifest_install_dep (self, context, remote, opt_user, 
opt_installation,
-                                     self->sdk, 
builder_manifest_get_runtime_version (self),
+                                     sdk, sdk_branch,
                                      opt_yes,
                                      error))
     return FALSE;
@@ -3757,14 +3927,15 @@
     }
 
   if (!builder_manifest_install_extension_deps (self, context,
-                                                self->sdk, 
self->sdk_extensions,
+                                                sdk, sdk_branch, 
self->sdk_extensions,
                                                 remote,opt_user, 
opt_installation,
                                                 opt_yes,
                                                 error))
     return FALSE;
 
   if (!builder_manifest_install_extension_deps (self, context,
-                                                self->runtime, 
self->platform_extensions,
+                                                self->runtime, 
builder_manifest_get_runtime_version (self),
+                                                self->platform_extensions,
                                                 remote, opt_user, 
opt_installation,
                                                 opt_yes,
                                                 error))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flatpak-builder-1.0.3/src/builder-manifest.h 
new/flatpak-builder-1.0.7/src/builder-manifest.h
--- old/flatpak-builder-1.0.3/src/builder-manifest.h    2019-01-25 
17:11:56.000000000 +0100
+++ new/flatpak-builder-1.0.7/src/builder-manifest.h    2019-02-04 
10:33:14.000000000 +0100
@@ -66,6 +66,11 @@
 void            builder_manifest_set_default_collection_id (BuilderManifest 
*self,
                                                             const char      
*default_collection_id);
 
+void            builder_manifest_add_tags (BuilderManifest *self,
+                                           const char      **add_tags);
+void            builder_manifest_remove_tags (BuilderManifest *self,
+                                              const char      **remove_tags);
+
 
 char **         builder_manifest_get_exclude_dirs (BuilderManifest *self);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flatpak-builder-1.0.3/src/builder-module.c 
new/flatpak-builder-1.0.7/src/builder-module.c
--- old/flatpak-builder-1.0.3/src/builder-module.c      2018-10-04 
14:48:07.000000000 +0200
+++ new/flatpak-builder-1.0.7/src/builder-module.c      2019-04-03 
10:36:50.000000000 +0200
@@ -2010,9 +2010,9 @@
 }
 
 void
-builder_module_checksum_for_platform (BuilderModule  *self,
-                                      BuilderCache   *cache,
-                                      BuilderContext *context)
+builder_module_checksum_for_platform_cleanup (BuilderModule  *self,
+                                              BuilderCache   *cache,
+                                              BuilderContext *context)
 {
   builder_cache_checksum_strv (cache, self->cleanup_platform);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flatpak-builder-1.0.3/src/builder-module.h 
new/flatpak-builder-1.0.7/src/builder-module.h
--- old/flatpak-builder-1.0.3/src/builder-module.h      2018-10-04 
14:48:07.000000000 +0200
+++ new/flatpak-builder-1.0.7/src/builder-module.h      2019-04-03 
10:36:42.000000000 +0200
@@ -89,9 +89,9 @@
 void     builder_module_checksum_for_cleanup (BuilderModule  *self,
                                               BuilderCache   *cache,
                                               BuilderContext *context);
-void     builder_module_checksum_for_platform (BuilderModule  *self,
-                                               BuilderCache   *cache,
-                                               BuilderContext *context);
+void     builder_module_checksum_for_platform_cleanup (BuilderModule  *self,
+                                                       BuilderCache   *cache,
+                                                       BuilderContext 
*context);
 void     builder_module_cleanup_collect (BuilderModule  *self,
                                          gboolean        platform,
                                          BuilderContext *context,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flatpak-builder-1.0.3/src/builder-utils.c 
new/flatpak-builder-1.0.7/src/builder-utils.c
--- old/flatpak-builder-1.0.3/src/builder-utils.c       2019-01-25 
14:55:29.000000000 +0100
+++ new/flatpak-builder-1.0.7/src/builder-utils.c       2019-05-06 
13:03:25.000000000 +0200
@@ -1619,6 +1619,7 @@
                      GError              **error,
                      const gchar * const  *argv)
 {
+  static FlatpakHostCommandFlags cmd_flags = 
FLATPAK_HOST_COMMAND_FLAGS_CLEAR_ENV | FLATPAK_HOST_COMMAND_FLAGS_WATCH_BUS;
   guint32 client_pid;
   GVariantBuilder *fd_builder = g_variant_builder_new 
(G_VARIANT_TYPE("a{uh}"));
   GVariantBuilder *env_builder = g_variant_builder_new 
(G_VARIANT_TYPE("a{ss}"));
@@ -1634,11 +1635,15 @@
   g_autofree gchar *commandline = NULL;
   g_autoptr(GOutputStream) out = NULL;
   g_autoptr(GFile) cwd = NULL;
+  g_autoptr(GError) local_error = NULL;
   glnx_fd_close int blocking_stdin_fd = -1;
   int pipefd[2];
   int stdin_fd;
   int i;
 
+  if (error == NULL)
+    error = &local_error;
+
   if (dir == NULL)
     {
       g_autofree char *current_dir = g_get_current_dir ();
@@ -1740,6 +1745,7 @@
   sigterm_id = g_unix_signal_add (SIGTERM, sigterm_handler, &data);
   sigint_id = g_unix_signal_add (SIGINT, sigint_handler, &data);
 
+try_again:
   ret = g_dbus_connection_call_with_unix_fd_list_sync (connection,
                                                        
"org.freedesktop.Flatpak",
                                                        
"/org/freedesktop/Flatpak/Development",
@@ -1750,14 +1756,28 @@
                                                                       argv,
                                                                       
g_variant_builder_end (fd_builder),
                                                                       
g_variant_builder_end (env_builder),
-                                                                      
FLATPAK_HOST_COMMAND_FLAGS_CLEAR_ENV),
+                                                                      
cmd_flags),
                                                        G_VARIANT_TYPE ("(u)"),
                                                        G_DBUS_CALL_FLAGS_NONE, 
-1,
                                                        fd_list, NULL,
                                                        NULL, error);
 
   if (ret == NULL)
-    return FALSE;
+    {
+      /* If we are talking to a session-helper that is pre-1.2 we wont have
+       * access to FLATPAK_HOST_COMMAND_FLAGS_WATCH_BUS and will get an
+       * invalid-args reply. Try again without the flag.
+       */
+      if ((cmd_flags & FLATPAK_HOST_COMMAND_FLAGS_WATCH_BUS) != 0 &&
+          g_error_matches (*error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS))
+        {
+          cmd_flags &= ~FLATPAK_HOST_COMMAND_FLAGS_WATCH_BUS;
+          g_clear_error (error);
+          goto try_again;
+        }
+
+      return FALSE;
+    }
 
 
   g_variant_get (ret, "(u)", &client_pid);
@@ -2607,3 +2627,43 @@
 
   return g_variant_ref_sink (g_variant_new_from_bytes 
(G_VARIANT_TYPE_BYTESTRING, compressed_bytes, TRUE));
 }
+
+gboolean
+flatpak_version_check (int major,
+                       int minor,
+                       int micro)
+{
+  static int flatpak_major = 0;
+  static int flatpak_minor = 0;
+  static int flatpak_micro = 0;
+
+  if (flatpak_major == 0 &&
+      flatpak_minor == 0 &&
+      flatpak_micro == 0)
+    {
+      const char * argv[] = { "flatpak", "--version", NULL };
+      g_autoptr(GSubprocess) subp = NULL;
+      g_autofree char *out = NULL;
+
+      subp = g_subprocess_newv (argv, G_SUBPROCESS_FLAGS_STDOUT_PIPE, NULL);
+      g_subprocess_communicate_utf8 (subp, NULL, NULL, &out, NULL, NULL);
+
+      if (sscanf (out, "Flatpak %d.%d.%d", &flatpak_major, &flatpak_minor, 
&flatpak_micro) != 3)
+        g_warning ("Failed to get flatpak version");
+
+      g_debug ("Using Flatpak version %d.%d.%d", flatpak_major, flatpak_minor, 
flatpak_micro);
+    }
+
+  if (flatpak_major > major)
+    return TRUE;
+  if (flatpak_major < major)
+    return FALSE;
+  if (flatpak_minor > minor)
+    return TRUE;
+  if (flatpak_minor < minor)
+    return FALSE;
+  if (flatpak_micro >= micro)
+    return TRUE;
+
+  return FALSE;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flatpak-builder-1.0.3/src/builder-utils.h 
new/flatpak-builder-1.0.7/src/builder-utils.h
--- old/flatpak-builder-1.0.3/src/builder-utils.h       2019-01-25 
14:54:53.000000000 +0100
+++ new/flatpak-builder-1.0.7/src/builder-utils.h       2019-02-15 
09:02:00.000000000 +0100
@@ -177,6 +177,10 @@
 GVariant * flatpak_variant_uncompress (GVariant *variant, const GVariantType 
*type);
 
 
+gboolean flatpak_version_check (int major,
+                                int minor,
+                                int micro);
+
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakXml, flatpak_xml_free);
 
 G_END_DECLS


Reply via email to