rpm-ostree/src/daemon/rpmostree-sysroot-upgrader.h
Colin Walters b6705f3feb daemon: Check for updated rpms when upgrading
This closes a longstanding bug - since package layering first
landed, we only checked for newer RPMs if the base tree changed.
In some scenarios like RHELAH, this doesn't matter much by default
since they move at the same cadence.  Except if you use EPEL for example.
In Fedora, today the FAH releases are async of the rpm-md repos, and
there's also COPR which can update more than once a day even.

We should check for both update sources. Luckily we'd already introduced logic
for this in the treecompose case (checksumming the depsolved package sack). We
just need to start using it for client side assembly too.

Closes: https://github.com/projectatomic/rpm-ostree/issues/391

Closes: #911
Approved by: jlebon
2017-08-16 15:33:11 +00:00

121 lines
5.4 KiB
C

/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (C) 2014 Colin Walters <walters@verbum.org>
*
* This library 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 License, 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 <ostree.h>
#include "rpmostree-origin.h"
#include "rpmostree-sysroot-core.h"
G_BEGIN_DECLS
#define RPMOSTREE_TYPE_SYSROOT_UPGRADER rpmostree_sysroot_upgrader_get_type()
#define RPMOSTREE_SYSROOT_UPGRADER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), RPMOSTREE_TYPE_SYSROOT_UPGRADER, RpmOstreeSysrootUpgrader))
#define RPMOSTREE_IS_SYSROOT_UPGRADER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), RPMOSTREE_TYPE_SYSROOT_UPGRADER))
typedef struct RpmOstreeSysrootUpgrader RpmOstreeSysrootUpgrader;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RpmOstreeSysrootUpgrader, g_object_unref)
/**
* RpmOstreeSysrootUpgraderFlags:
* @RPMOSTREE_SYSROOT_UPGRADER_FLAGS_NONE: No options
* @RPMOSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED: Do not error if the origin has an unconfigured-state key
* @RPMOSTREE_SYSROOT_UPGRADER_FLAGS_ALLOW_OLDER: Do not error if the new deployment was composed earlier than the current deployment
* @RPMOSTREE_SYSROOT_UPGRADER_FLAGS_DRY_RUN: Don't deploy new base. If layering packages, only print the transaction
* @RPMOSTREE_SYSROOT_UPGRADER_FLAGS_PKGOVERLAY_NOSCRIPTS: Do not run RPM scripts
*
* Flags controlling operation of an #RpmOstreeSysrootUpgrader.
*/
typedef enum {
RPMOSTREE_SYSROOT_UPGRADER_FLAGS_NONE = (1 << 0),
RPMOSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED = (1 << 1),
RPMOSTREE_SYSROOT_UPGRADER_FLAGS_ALLOW_OLDER = (1 << 2),
RPMOSTREE_SYSROOT_UPGRADER_FLAGS_DRY_RUN = (1 << 3),
RPMOSTREE_SYSROOT_UPGRADER_FLAGS_PKGOVERLAY_NOSCRIPTS = (1 << 4)
} RpmOstreeSysrootUpgraderFlags;
/* _NONE means we're doing pure ostree, no client-side computation.
* _LOCAL is just e.g. rpm-ostree initramfs
* _RPMMD_REPOS is where we're downloading data from /etc/yum.repos.d
*/
typedef enum {
RPMOSTREE_SYSROOT_UPGRADER_LAYERING_NONE = 0,
RPMOSTREE_SYSROOT_UPGRADER_LAYERING_LOCAL = 1,
RPMOSTREE_SYSROOT_UPGRADER_LAYERING_RPMMD_REPOS = 2,
} RpmOstreeSysrootUpgraderLayeringType;
GType rpmostree_sysroot_upgrader_get_type (void);
GType rpmostree_sysroot_upgrader_flags_get_type (void);
RpmOstreeSysrootUpgrader *rpmostree_sysroot_upgrader_new (OstreeSysroot *sysroot,
const char *osname,
RpmOstreeSysrootUpgraderFlags flags,
GCancellable *cancellable,
GError **error);
OstreeDeployment* rpmostree_sysroot_upgrader_get_merge_deployment (RpmOstreeSysrootUpgrader *self);
RpmOstreeOrigin *
rpmostree_sysroot_upgrader_dup_origin (RpmOstreeSysrootUpgrader *self);
void
rpmostree_sysroot_upgrader_set_origin (RpmOstreeSysrootUpgrader *self,
RpmOstreeOrigin *origin);
const char *
rpmostree_sysroot_upgrader_get_base (RpmOstreeSysrootUpgrader *self);
gboolean
rpmostree_sysroot_upgrader_pull_base (RpmOstreeSysrootUpgrader *self,
const char *dir_to_pull,
OstreeRepoPullFlags flags,
OstreeAsyncProgress *progress,
gboolean *out_changed,
GCancellable *cancellable,
GError **error);
gboolean
rpmostree_sysroot_upgrader_prep_layering (RpmOstreeSysrootUpgrader *self,
RpmOstreeSysrootUpgraderLayeringType *out_layering,
gboolean *out_changed,
GCancellable *cancellable,
GError **error);
gboolean
rpmostree_sysroot_upgrader_pull_repos (RpmOstreeSysrootUpgrader *self,
const char *dir_to_pull,
OstreeRepoPullFlags flags,
OstreeAsyncProgress *progress,
gboolean *out_changed,
GCancellable *cancellable,
GError **error);
gboolean
rpmostree_sysroot_upgrader_deploy (RpmOstreeSysrootUpgrader *self,
GCancellable *cancellable,
GError **error);
G_END_DECLS