Start using libglnx
The high level goal is to deprecate libgsystem. I was trying to share code between ostree/rpm-ostree, but it was too painful to commit to forver frozen ABI for new utility APIs. The git submodule approach will much more easily allow breaking API/ABI, and iterate on APIs until they either land in GLib or not. Note that libglnx will not use GFile*, so a full port to it will involve also not using that. Thus, it will be necessarily incremental; in the meantime we'll link to both libgsystem and libglnx.
This commit is contained in:
parent
99d3b5d792
commit
3190eff276
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "libglnx"]
|
||||||
|
path = libglnx
|
||||||
|
url = https://git.gnome.org/browse/libglnx
|
@ -46,8 +46,8 @@ librpmostree_la_SOURCES += \
|
|||||||
src/rpmostree-treepkgdiff.h \
|
src/rpmostree-treepkgdiff.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
librpmostree_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src -DPKGLIBDIR=\"$(pkglibdir)\" $(PKGDEP_RPMOSTREE_CFLAGS)
|
librpmostree_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src -I$(libglnx_srcpath) -DPKGLIBDIR=\"$(pkglibdir)\" $(PKGDEP_RPMOSTREE_CFLAGS)
|
||||||
librpmostree_la_LIBADD = $(AM_LDFLAGS) $(PKGDEP_RPMOSTREE_LIBS) $(CAP_LIBS)
|
librpmostree_la_LIBADD = $(AM_LDFLAGS) $(PKGDEP_RPMOSTREE_LIBS) libglnx.la $(CAP_LIBS)
|
||||||
|
|
||||||
rpm_ostree_SOURCES = src/main.c \
|
rpm_ostree_SOURCES = src/main.c \
|
||||||
src/rpmostree-builtins.h \
|
src/rpmostree-builtins.h \
|
||||||
@ -70,7 +70,7 @@ rpm_ostree_SOURCES += \
|
|||||||
$(NULL)
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
rpm_ostree_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src -DPKGLIBDIR=\"$(pkglibdir)\" $(PKGDEP_RPMOSTREE_CFLAGS)
|
rpm_ostree_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src -I$(libglnx_srcpath) -DPKGLIBDIR=\"$(pkglibdir)\" $(PKGDEP_RPMOSTREE_CFLAGS)
|
||||||
rpm_ostree_LDADD = $(AM_LDFLAGS) $(PKGDEP_RPMOSTREE_LIBS) librpmostree.la
|
rpm_ostree_LDADD = $(AM_LDFLAGS) $(PKGDEP_RPMOSTREE_LIBS) librpmostree.la
|
||||||
|
|
||||||
privdatadir=$(pkglibdir)
|
privdatadir=$(pkglibdir)
|
||||||
|
@ -29,6 +29,12 @@ AM_CFLAGS += $(WARN_CFLAGS)
|
|||||||
|
|
||||||
EXTRA_DIST += autogen.sh COPYING
|
EXTRA_DIST += autogen.sh COPYING
|
||||||
|
|
||||||
|
libglnx_srcpath := $(srcdir)/libglnx
|
||||||
|
libglnx_cflags := $(PKGDEP_GIO_UNIX_CFLAGS) -I$(libglnx_srcpath)
|
||||||
|
libglnx_libs := $(PKGDEP_GIO_UNIX_LIBS)
|
||||||
|
|
||||||
|
include libglnx/Makefile-libglnx.am
|
||||||
|
noinst_LTLIBRARIES += libglnx.la
|
||||||
include Makefile-rpm-ostree.am
|
include Makefile-rpm-ostree.am
|
||||||
include Makefile-tests.am
|
include Makefile-tests.am
|
||||||
include Makefile-man.am
|
include Makefile-man.am
|
||||||
|
1
libglnx
Submodule
1
libglnx
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit ba67dd39a7d5cc779f83bb22512740cdb4c61b33
|
@ -34,6 +34,7 @@
|
|||||||
#include "rpmostree-util.h"
|
#include "rpmostree-util.h"
|
||||||
|
|
||||||
#include "libgsystem.h"
|
#include "libgsystem.h"
|
||||||
|
#include "libglnx.h"
|
||||||
|
|
||||||
GS_DEFINE_CLEANUP_FUNCTION0(HySack, _cleanup_hy_sack_free, hy_sack_free);
|
GS_DEFINE_CLEANUP_FUNCTION0(HySack, _cleanup_hy_sack_free, hy_sack_free);
|
||||||
GS_DEFINE_CLEANUP_FUNCTION0(HyQuery, _cleanup_hy_query_free, hy_query_free);
|
GS_DEFINE_CLEANUP_FUNCTION0(HyQuery, _cleanup_hy_query_free, hy_query_free);
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <libhif.h>
|
#include <libhif.h>
|
||||||
#include <libhif/hif-utils.h>
|
#include <libhif/hif-utils.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <libglnx.h>
|
||||||
#include <rpm/rpmmacro.h>
|
#include <rpm/rpmmacro.h>
|
||||||
|
|
||||||
#include "rpmostree-compose-builtins.h"
|
#include "rpmostree-compose-builtins.h"
|
||||||
@ -87,6 +88,7 @@ typedef struct {
|
|||||||
GPtrArray *treefile_context_dirs;
|
GPtrArray *treefile_context_dirs;
|
||||||
|
|
||||||
GFile *workdir;
|
GFile *workdir;
|
||||||
|
int workdir_dfd;
|
||||||
OstreeRepo *repo;
|
OstreeRepo *repo;
|
||||||
char *previous_checksum;
|
char *previous_checksum;
|
||||||
|
|
||||||
@ -595,7 +597,6 @@ rpmostree_compose_builtin_tree (int argc,
|
|||||||
gs_unref_object GFile *previous_root = NULL;
|
gs_unref_object GFile *previous_root = NULL;
|
||||||
gs_free char *previous_checksum = NULL;
|
gs_free char *previous_checksum = NULL;
|
||||||
gs_unref_object GFile *yumroot = NULL;
|
gs_unref_object GFile *yumroot = NULL;
|
||||||
gs_unref_object GFile *targetroot = NULL;
|
|
||||||
gs_unref_object GFile *yumroot_varcache = NULL;
|
gs_unref_object GFile *yumroot_varcache = NULL;
|
||||||
gs_unref_object OstreeRepo *repo = NULL;
|
gs_unref_object OstreeRepo *repo = NULL;
|
||||||
gs_unref_ptrarray GPtrArray *bootstrap_packages = NULL;
|
gs_unref_ptrarray GPtrArray *bootstrap_packages = NULL;
|
||||||
@ -703,6 +704,10 @@ rpmostree_compose_builtin_tree (int argc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!glnx_opendirat (AT_FDCWD, gs_file_get_path_cached (self->workdir),
|
||||||
|
FALSE, &self->workdir_dfd, error))
|
||||||
|
goto out;
|
||||||
|
|
||||||
if (opt_cachedir)
|
if (opt_cachedir)
|
||||||
{
|
{
|
||||||
cachedir = g_file_new_for_path (opt_cachedir);
|
cachedir = g_file_new_for_path (opt_cachedir);
|
||||||
@ -717,12 +722,9 @@ rpmostree_compose_builtin_tree (int argc,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chdir (gs_file_get_path_cached (self->workdir)) != 0)
|
if (fchdir (self->workdir_dfd) != 0)
|
||||||
{
|
{
|
||||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
glnx_set_error_from_errno (error);
|
||||||
"Failed to chdir to '%s': %s",
|
|
||||||
gs_file_get_path_cached (self->workdir),
|
|
||||||
strerror (errno));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -782,9 +784,8 @@ rpmostree_compose_builtin_tree (int argc,
|
|||||||
self->previous_checksum = previous_checksum;
|
self->previous_checksum = previous_checksum;
|
||||||
|
|
||||||
yumroot = g_file_get_child (self->workdir, "rootfs.tmp");
|
yumroot = g_file_get_child (self->workdir, "rootfs.tmp");
|
||||||
if (!gs_shutil_rm_rf (yumroot, cancellable, error))
|
if (!glnx_shutil_rm_rf_at (self->workdir_dfd, "rootfs.tmp", cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
targetroot = g_file_get_child (self->workdir, "rootfs");
|
|
||||||
|
|
||||||
if (json_object_has_member (treefile, "automatic_version_prefix") &&
|
if (json_object_has_member (treefile, "automatic_version_prefix") &&
|
||||||
!compose_strv_contains_prefix (opt_metadata_strings, "version="))
|
!compose_strv_contains_prefix (opt_metadata_strings, "version="))
|
||||||
|
Loading…
Reference in New Issue
Block a user