2015-02-11 21:06:43 +03:00
/* -*- 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>
2017-01-11 22:05:18 +03:00
# include "rpmostree-origin.h"
2017-03-27 21:12:05 +03:00
# include "rpmostree-sysroot-core.h"
2015-02-11 21:06:43 +03:00
G_BEGIN_DECLS
2016-02-25 20:42:56 +03:00
# define RPMOSTREE_TYPE_SYSROOT_UPGRADER rpmostree_sysroot_upgrader_get_type()
2015-02-11 21:06:43 +03:00
# 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 ;
/**
2016-02-25 20:42:56 +03:00
* 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
2016-05-20 21:21:06 +03:00
* @ RPMOSTREE_SYSROOT_UPGRADER_FLAGS_ALLOW_OLDER : Do not error if the new deployment was composed earlier than the current deployment
2017-03-31 16:07:28 +03:00
* @ RPMOSTREE_SYSROOT_UPGRADER_FLAGS_DRY_RUN : Don ' t deploy new base . If layering packages , only print the transaction
2016-06-10 04:08:51 +03:00
* @ RPMOSTREE_SYSROOT_UPGRADER_FLAGS_PKGOVERLAY_NOSCRIPTS : Do not run RPM scripts
2015-02-11 21:06:43 +03:00
*
* Flags controlling operation of an # RpmOstreeSysrootUpgrader .
*/
typedef enum {
2016-05-20 21:21:06 +03:00
RPMOSTREE_SYSROOT_UPGRADER_FLAGS_NONE = ( 1 < < 0 ) ,
RPMOSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED = ( 1 < < 1 ) ,
RPMOSTREE_SYSROOT_UPGRADER_FLAGS_ALLOW_OLDER = ( 1 < < 2 ) ,
2017-03-31 16:07:28 +03:00
RPMOSTREE_SYSROOT_UPGRADER_FLAGS_DRY_RUN = ( 1 < < 3 ) ,
daemon/upgrader: Rework layer tracking
Working on initramfs, I hit a subtle issue with the fact that
I was trying to "redeploy", but with the origin file changed
during the process.
Previously, it was a bit unclear which parts of the upgrader logic are operating
on the *new* origin versus the "original origin".
The package layering code in the upgrader explicitly carries a delta on top in
the "add/remove" hash sets, which means it isn't visible to
`rpmostree_origin_is_locally_assembled()`.
Whereas for initramfs, I set a new origin. This broke things since we were
expecting to find a parent commit, but the original origin wasn't locally
assembled.
When looking more at this, I realized there's a far simpler model -
rather than keeping track of commit + origin, and using the origin
to try to determine whether or not the commit is layered, we can
keep track of `base_revision` and `final_revision`, and the latter
is only set if we're doing layering.
The diff speaks for itself here - a lot of fragile logic looking at the origin
drops away.
The next step here is probably to drop away the package layering hash sets, but
I'm trying to not change everything at once.
Closes: #579
Approved by: jlebon
2017-01-17 20:25:28 +03:00
RPMOSTREE_SYSROOT_UPGRADER_FLAGS_PKGOVERLAY_NOSCRIPTS = ( 1 < < 4 )
2015-02-11 21:06:43 +03:00
} RpmOstreeSysrootUpgraderFlags ;
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 ) ;
2016-05-20 21:21:06 +03:00
OstreeDeployment * rpmostree_sysroot_upgrader_get_merge_deployment ( RpmOstreeSysrootUpgrader * self ) ;
2015-02-11 21:06:43 +03:00
2017-02-15 20:41:38 +03:00
RpmOstreeOrigin *
rpmostree_sysroot_upgrader_dup_origin ( RpmOstreeSysrootUpgrader * self ) ;
2015-02-11 21:06:43 +03:00
2017-02-15 20:41:38 +03:00
void
rpmostree_sysroot_upgrader_set_origin ( RpmOstreeSysrootUpgrader * self ,
RpmOstreeOrigin * origin ) ;
2016-05-20 21:21:06 +03:00
2015-02-11 21:06:43 +03:00
gboolean
rpmostree_sysroot_upgrader_pull ( 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