[gnome-build-meta/valentindavid/ostree-workaround: 2/2] ostree: Work around issue with newer glib




commit 07bfc8f5cd7d0be49beb0ea4189c9cf15644da7d
Author: Valentin David <me valentindavid com>
Date:   Tue Nov 2 19:46:03 2021 +0100

    ostree: Work around issue with newer glib
    
    A new assert in glib breaks a broken call to `g_file_get_child`
    
    Fixes #447

 elements/core-deps/libostree.bst         |  2 ++
 files/ostree/glib-absolute-subpath.patch | 25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+)
---
diff --git a/elements/core-deps/libostree.bst b/elements/core-deps/libostree.bst
index 192b46321..a1fd476c8 100644
--- a/elements/core-deps/libostree.bst
+++ b/elements/core-deps/libostree.bst
@@ -5,6 +5,8 @@ sources:
   url: github_com:ostreedev/ostree/releases/download/v2021.5/libostree-2021.5.tar.xz
 - kind: patch
   path: files/ostree/no-boot-symlink.patch
+- kind: patch
+  path: files/ostree/glib-absolute-subpath.patch
 
 build-depends:
 - sdk/gobject-introspection.bst
diff --git a/files/ostree/glib-absolute-subpath.patch b/files/ostree/glib-absolute-subpath.patch
new file mode 100644
index 000000000..d20bb5e68
--- /dev/null
+++ b/files/ostree/glib-absolute-subpath.patch
@@ -0,0 +1,25 @@
+diff -ur ostree.old/src/libostree/ostree-repo-checkout.c ostree/src/libostree/ostree-repo-checkout.c
+--- ostree.old/src/libostree/ostree-repo-checkout.c    2021-08-30 19:35:53.000000000 +0200
++++ ostree/src/libostree/ostree-repo-checkout.c        2021-11-02 09:34:34.911442592 +0100
+@@ -1388,10 +1388,18 @@
+ 
+   g_autoptr(GFile) target_dir = NULL;
+ 
+-  if (strcmp (options->subpath, "/") != 0)
+-    target_dir = g_file_get_child (commit_root, options->subpath);
+-  else
++  if (strcmp (options->subpath, "/") != 0) {
++    if (options->subpath[0] == '/') {
++      g_autoptr(GFile) abs_root_dir = g_file_new_for_path ("/");
++      g_autoptr(GFile) subpath = g_file_new_for_path (options->subpath);
++      g_autofree char* rel_subpath = g_file_get_relative_path (abs_root_dir, subpath);
++      target_dir = g_file_get_child (commit_root, rel_subpath);
++    } else {
++      target_dir = g_file_get_child (commit_root, options->subpath);
++    }
++  } else {
+     target_dir = g_object_ref (commit_root);
++  }
+   g_autoptr(GFileInfo) target_info =
+     g_file_query_info (target_dir, OSTREE_GIO_FAST_QUERYINFO,
+                        G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]