core: Split out a -private.h header with struct

Prep for doing the "single object, multiple .c files" pattern like is done in
e.g. libostree with OstreeRepo and `ostree-repo-{refs,commit.c}` etc. For jigdo
we'll need to split things up (see what I did there?).

Closes: #1168
Approved by: jlebon
This commit is contained in:
Colin Walters 2017-12-21 12:29:30 +01:00 committed by Atomic Bot
parent 8f9be2e54b
commit a55e923eae
3 changed files with 68 additions and 42 deletions

View File

@ -30,6 +30,7 @@ librpmostreepriv_la_SOURCES = \
src/libpriv/rpmostree-refts.c \
src/libpriv/rpmostree-core.c \
src/libpriv/rpmostree-core.h \
src/libpriv/rpmostree-core-private.h \
src/libpriv/rpmostree-bwrap.c \
src/libpriv/rpmostree-bwrap.h \
src/libpriv/rpmostree-kernel.c \

View File

@ -0,0 +1,66 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (C) 2017 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2 of the licence or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
#pragma once
#include "libglnx.h"
#include "rpmostree-jigdo-core.h"
#include "rpmostree-core.h"
struct _RpmOstreeContext {
GObject parent;
RpmOstreeTreespec *spec;
gboolean empty;
/* jigdo-mode data */
const char *jigdo_spec; /* The jigdo spec like: repoid:package */
const char *jigdo_version; /* Optional */
gboolean jigdo_pure; /* There is only jigdo */
DnfPackage *jigdo_pkg;
char *jigdo_checksum;
gboolean pkgcache_only;
DnfContext *dnfctx;
OstreeRepo *ostreerepo;
OstreeRepo *pkgcache_repo;
OstreeRepoDevInoCache *devino_cache;
gboolean unprivileged;
OstreeSePolicy *sepolicy;
char *passwd_dir;
gboolean async_running;
GCancellable *async_cancellable;
GError *async_error;
GPtrArray *pkgs_to_download;
GPtrArray *pkgs_to_import;
guint n_async_pkgs_imported;
GPtrArray *pkgs_to_relabel;
guint n_async_pkgs_relabeled;
GHashTable *pkgs_to_remove; /* pkgname --> gv_nevra */
GHashTable *pkgs_to_replace; /* new gv_nevra --> old gv_nevra */
GLnxTmpDir tmpdir;
int tmprootfs_dfd; /* Borrowed */
GLnxTmpDir repo_tmpdir; /* Used to assemble+commit if no base rootfs provided */
};

View File

@ -32,7 +32,7 @@
#include <libdnf/libdnf.h>
#include <librepo/librepo.h>
#include "rpmostree-core.h"
#include "rpmostree-core-private.h"
#include "rpmostree-jigdo-core.h"
#include "rpmostree-postprocess.h"
#include "rpmostree-rpm-util.h"
@ -253,47 +253,6 @@ rpmostree_treespec_to_variant (RpmOstreeTreespec *spec)
* RpmOstreeContext *
***********************************************************
*/
struct _RpmOstreeContext {
GObject parent;
RpmOstreeTreespec *spec;
gboolean empty;
/* jigdo-mode data */
const char *jigdo_spec; /* The jigdo spec like: repoid:package */
const char *jigdo_version; /* Optional */
gboolean jigdo_pure; /* There is only jigdo */
DnfPackage *jigdo_pkg;
char *jigdo_checksum;
gboolean pkgcache_only;
DnfContext *dnfctx;
OstreeRepo *ostreerepo;
OstreeRepo *pkgcache_repo;
OstreeRepoDevInoCache *devino_cache;
gboolean unprivileged;
OstreeSePolicy *sepolicy;
char *passwd_dir;
gboolean async_running;
GCancellable *async_cancellable;
GError *async_error;
GPtrArray *pkgs_to_download;
GPtrArray *pkgs_to_import;
guint n_async_pkgs_imported;
GPtrArray *pkgs_to_relabel;
guint n_async_pkgs_relabeled;
GHashTable *pkgs_to_remove; /* pkgname --> gv_nevra */
GHashTable *pkgs_to_replace; /* new gv_nevra --> old gv_nevra */
GLnxTmpDir tmpdir;
int tmprootfs_dfd; /* Borrowed */
GLnxTmpDir repo_tmpdir; /* Used to assemble+commit if no base rootfs provided */
};
G_DEFINE_TYPE (RpmOstreeContext, rpmostree_context, G_TYPE_OBJECT)
static void