{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.OSTree.Objects.SysrootUpgrader
    ( 

-- * Exported types
    SysrootUpgrader(..)                     ,
    IsSysrootUpgrader                       ,
    toSysrootUpgrader                       ,
    noSysrootUpgrader                       ,


 -- * Methods
-- ** checkTimestamps #method:checkTimestamps#
    sysrootUpgraderCheckTimestamps          ,


-- ** deploy #method:deploy#
    SysrootUpgraderDeployMethodInfo         ,
    sysrootUpgraderDeploy                   ,


-- ** dupOrigin #method:dupOrigin#
    SysrootUpgraderDupOriginMethodInfo      ,
    sysrootUpgraderDupOrigin                ,


-- ** getOrigin #method:getOrigin#
    SysrootUpgraderGetOriginMethodInfo      ,
    sysrootUpgraderGetOrigin                ,


-- ** getOriginDescription #method:getOriginDescription#
    SysrootUpgraderGetOriginDescriptionMethodInfo,
    sysrootUpgraderGetOriginDescription     ,


-- ** new #method:new#
    sysrootUpgraderNew                      ,


-- ** newForOs #method:newForOs#
    sysrootUpgraderNewForOs                 ,


-- ** newForOsWithFlags #method:newForOsWithFlags#
    sysrootUpgraderNewForOsWithFlags        ,


-- ** pull #method:pull#
    SysrootUpgraderPullMethodInfo           ,
    sysrootUpgraderPull                     ,


-- ** pullOneDir #method:pullOneDir#
    SysrootUpgraderPullOneDirMethodInfo     ,
    sysrootUpgraderPullOneDir               ,


-- ** setOrigin #method:setOrigin#
    SysrootUpgraderSetOriginMethodInfo      ,
    sysrootUpgraderSetOrigin                ,




 -- * Properties
-- ** flags #attr:flags#
    SysrootUpgraderFlagsPropertyInfo        ,
    constructSysrootUpgraderFlags           ,
    getSysrootUpgraderFlags                 ,
    sysrootUpgraderFlags                    ,


-- ** osname #attr:osname#
    SysrootUpgraderOsnamePropertyInfo       ,
    constructSysrootUpgraderOsname          ,
    getSysrootUpgraderOsname                ,
    sysrootUpgraderOsname                   ,


-- ** sysroot #attr:sysroot#
    SysrootUpgraderSysrootPropertyInfo      ,
    constructSysrootUpgraderSysroot         ,
    getSysrootUpgraderSysroot               ,
    sysrootUpgraderSysroot                  ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GLib.Structs.KeyFile as GLib.KeyFile
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Interfaces.Initable as Gio.Initable
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.OSTree.Flags as OSTree.Flags
import {-# SOURCE #-} qualified GI.OSTree.Objects.AsyncProgress as OSTree.AsyncProgress
import {-# SOURCE #-} qualified GI.OSTree.Objects.Repo as OSTree.Repo
import {-# SOURCE #-} qualified GI.OSTree.Objects.Sysroot as OSTree.Sysroot

newtype SysrootUpgrader = SysrootUpgrader (ManagedPtr SysrootUpgrader)
foreign import ccall "ostree_sysroot_upgrader_get_type"
    c_ostree_sysroot_upgrader_get_type :: IO GType

instance GObject SysrootUpgrader where
    gobjectType _ = c_ostree_sysroot_upgrader_get_type
    

class GObject o => IsSysrootUpgrader o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError SysrootUpgrader a) =>
    IsSysrootUpgrader a
#endif
instance IsSysrootUpgrader SysrootUpgrader
instance GObject.Object.IsObject SysrootUpgrader
instance Gio.Initable.IsInitable SysrootUpgrader

toSysrootUpgrader :: IsSysrootUpgrader o => o -> IO SysrootUpgrader
toSysrootUpgrader = unsafeCastTo SysrootUpgrader

noSysrootUpgrader :: Maybe SysrootUpgrader
noSysrootUpgrader = Nothing

type family ResolveSysrootUpgraderMethod (t :: Symbol) (o :: *) :: * where
    ResolveSysrootUpgraderMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveSysrootUpgraderMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveSysrootUpgraderMethod "deploy" o = SysrootUpgraderDeployMethodInfo
    ResolveSysrootUpgraderMethod "dupOrigin" o = SysrootUpgraderDupOriginMethodInfo
    ResolveSysrootUpgraderMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveSysrootUpgraderMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveSysrootUpgraderMethod "init" o = Gio.Initable.InitableInitMethodInfo
    ResolveSysrootUpgraderMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveSysrootUpgraderMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveSysrootUpgraderMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveSysrootUpgraderMethod "pull" o = SysrootUpgraderPullMethodInfo
    ResolveSysrootUpgraderMethod "pullOneDir" o = SysrootUpgraderPullOneDirMethodInfo
    ResolveSysrootUpgraderMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveSysrootUpgraderMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveSysrootUpgraderMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveSysrootUpgraderMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveSysrootUpgraderMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveSysrootUpgraderMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveSysrootUpgraderMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveSysrootUpgraderMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveSysrootUpgraderMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveSysrootUpgraderMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveSysrootUpgraderMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveSysrootUpgraderMethod "getOrigin" o = SysrootUpgraderGetOriginMethodInfo
    ResolveSysrootUpgraderMethod "getOriginDescription" o = SysrootUpgraderGetOriginDescriptionMethodInfo
    ResolveSysrootUpgraderMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveSysrootUpgraderMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveSysrootUpgraderMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveSysrootUpgraderMethod "setOrigin" o = SysrootUpgraderSetOriginMethodInfo
    ResolveSysrootUpgraderMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveSysrootUpgraderMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveSysrootUpgraderMethod t SysrootUpgrader, O.MethodInfo info SysrootUpgrader p) => O.IsLabelProxy t (SysrootUpgrader -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveSysrootUpgraderMethod t SysrootUpgrader, O.MethodInfo info SysrootUpgrader p) => O.IsLabel t (SysrootUpgrader -> p) where
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

-- VVV Prop "flags"
   -- Type: TInterface (Name {namespace = "OSTree", name = "SysrootUpgraderFlags"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

getSysrootUpgraderFlags :: (MonadIO m, IsSysrootUpgrader o) => o -> m [OSTree.Flags.SysrootUpgraderFlags]
getSysrootUpgraderFlags obj = liftIO $ getObjectPropertyFlags obj "flags"

constructSysrootUpgraderFlags :: (IsSysrootUpgrader o) => [OSTree.Flags.SysrootUpgraderFlags] -> IO (GValueConstruct o)
constructSysrootUpgraderFlags val = constructObjectPropertyFlags "flags" val

data SysrootUpgraderFlagsPropertyInfo
instance AttrInfo SysrootUpgraderFlagsPropertyInfo where
    type AttrAllowedOps SysrootUpgraderFlagsPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SysrootUpgraderFlagsPropertyInfo = (~) [OSTree.Flags.SysrootUpgraderFlags]
    type AttrBaseTypeConstraint SysrootUpgraderFlagsPropertyInfo = IsSysrootUpgrader
    type AttrGetType SysrootUpgraderFlagsPropertyInfo = [OSTree.Flags.SysrootUpgraderFlags]
    type AttrLabel SysrootUpgraderFlagsPropertyInfo = "flags"
    type AttrOrigin SysrootUpgraderFlagsPropertyInfo = SysrootUpgrader
    attrGet _ = getSysrootUpgraderFlags
    attrSet _ = undefined
    attrConstruct _ = constructSysrootUpgraderFlags
    attrClear _ = undefined

-- VVV Prop "osname"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

getSysrootUpgraderOsname :: (MonadIO m, IsSysrootUpgrader o) => o -> m (Maybe T.Text)
getSysrootUpgraderOsname obj = liftIO $ getObjectPropertyString obj "osname"

constructSysrootUpgraderOsname :: (IsSysrootUpgrader o) => T.Text -> IO (GValueConstruct o)
constructSysrootUpgraderOsname val = constructObjectPropertyString "osname" (Just val)

data SysrootUpgraderOsnamePropertyInfo
instance AttrInfo SysrootUpgraderOsnamePropertyInfo where
    type AttrAllowedOps SysrootUpgraderOsnamePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SysrootUpgraderOsnamePropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint SysrootUpgraderOsnamePropertyInfo = IsSysrootUpgrader
    type AttrGetType SysrootUpgraderOsnamePropertyInfo = (Maybe T.Text)
    type AttrLabel SysrootUpgraderOsnamePropertyInfo = "osname"
    type AttrOrigin SysrootUpgraderOsnamePropertyInfo = SysrootUpgrader
    attrGet _ = getSysrootUpgraderOsname
    attrSet _ = undefined
    attrConstruct _ = constructSysrootUpgraderOsname
    attrClear _ = undefined

-- VVV Prop "sysroot"
   -- Type: TInterface (Name {namespace = "OSTree", name = "Sysroot"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

getSysrootUpgraderSysroot :: (MonadIO m, IsSysrootUpgrader o) => o -> m (Maybe OSTree.Sysroot.Sysroot)
getSysrootUpgraderSysroot obj = liftIO $ getObjectPropertyObject obj "sysroot" OSTree.Sysroot.Sysroot

constructSysrootUpgraderSysroot :: (IsSysrootUpgrader o, OSTree.Sysroot.IsSysroot a) => a -> IO (GValueConstruct o)
constructSysrootUpgraderSysroot val = constructObjectPropertyObject "sysroot" (Just val)

data SysrootUpgraderSysrootPropertyInfo
instance AttrInfo SysrootUpgraderSysrootPropertyInfo where
    type AttrAllowedOps SysrootUpgraderSysrootPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SysrootUpgraderSysrootPropertyInfo = OSTree.Sysroot.IsSysroot
    type AttrBaseTypeConstraint SysrootUpgraderSysrootPropertyInfo = IsSysrootUpgrader
    type AttrGetType SysrootUpgraderSysrootPropertyInfo = (Maybe OSTree.Sysroot.Sysroot)
    type AttrLabel SysrootUpgraderSysrootPropertyInfo = "sysroot"
    type AttrOrigin SysrootUpgraderSysrootPropertyInfo = SysrootUpgrader
    attrGet _ = getSysrootUpgraderSysroot
    attrSet _ = undefined
    attrConstruct _ = constructSysrootUpgraderSysroot
    attrClear _ = undefined

instance O.HasAttributeList SysrootUpgrader
type instance O.AttributeList SysrootUpgrader = SysrootUpgraderAttributeList
type SysrootUpgraderAttributeList = ('[ '("flags", SysrootUpgraderFlagsPropertyInfo), '("osname", SysrootUpgraderOsnamePropertyInfo), '("sysroot", SysrootUpgraderSysrootPropertyInfo)] :: [(Symbol, *)])

sysrootUpgraderFlags :: AttrLabelProxy "flags"
sysrootUpgraderFlags = AttrLabelProxy

sysrootUpgraderOsname :: AttrLabelProxy "osname"
sysrootUpgraderOsname = AttrLabelProxy

sysrootUpgraderSysroot :: AttrLabelProxy "sysroot"
sysrootUpgraderSysroot = AttrLabelProxy

type instance O.SignalList SysrootUpgrader = SysrootUpgraderSignalList
type SysrootUpgraderSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method SysrootUpgrader::new
-- method type : Constructor
-- Args : [Arg {argCName = "sysroot", argType = TInterface (Name {namespace = "OSTree", name = "Sysroot"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "An #OstreeSysroot", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "OSTree", name = "SysrootUpgrader"}))
-- throws : True
-- Skip return : False

foreign import ccall "ostree_sysroot_upgrader_new" ostree_sysroot_upgrader_new :: 
    Ptr OSTree.Sysroot.Sysroot ->           -- sysroot : TInterface (Name {namespace = "OSTree", name = "Sysroot"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr SysrootUpgrader)

{- |
/No description available in the introspection data./
-}
sysrootUpgraderNew ::
    (B.CallStack.HasCallStack, MonadIO m, OSTree.Sysroot.IsSysroot a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@sysroot@/: An 'GI.OSTree.Objects.Sysroot.Sysroot' -}
    -> Maybe (b)
    -> m SysrootUpgrader
    {- ^ __Returns:__ An upgrader /(Can throw 'Data.GI.Base.GError.GError')/ -}
sysrootUpgraderNew sysroot cancellable = liftIO $ do
    sysroot' <- unsafeManagedPtrCastPtr sysroot
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        result <- propagateGError $ ostree_sysroot_upgrader_new sysroot' maybeCancellable
        checkUnexpectedReturnNULL "sysrootUpgraderNew" result
        result' <- (wrapObject SysrootUpgrader) result
        touchManagedPtr sysroot
        whenJust cancellable touchManagedPtr
        return result'
     ) (do
        return ()
     )

-- method SysrootUpgrader::new_for_os
-- method type : Constructor
-- Args : [Arg {argCName = "sysroot", argType = TInterface (Name {namespace = "OSTree", name = "Sysroot"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "An #OstreeSysroot", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "osname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Operating system name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "OSTree", name = "SysrootUpgrader"}))
-- throws : True
-- Skip return : False

foreign import ccall "ostree_sysroot_upgrader_new_for_os" ostree_sysroot_upgrader_new_for_os :: 
    Ptr OSTree.Sysroot.Sysroot ->           -- sysroot : TInterface (Name {namespace = "OSTree", name = "Sysroot"})
    CString ->                              -- osname : TBasicType TUTF8
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr SysrootUpgrader)

{- |
/No description available in the introspection data./
-}
sysrootUpgraderNewForOs ::
    (B.CallStack.HasCallStack, MonadIO m, OSTree.Sysroot.IsSysroot a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@sysroot@/: An 'GI.OSTree.Objects.Sysroot.Sysroot' -}
    -> Maybe (T.Text)
    {- ^ /@osname@/: Operating system name -}
    -> Maybe (b)
    -> m SysrootUpgrader
    {- ^ __Returns:__ An upgrader /(Can throw 'Data.GI.Base.GError.GError')/ -}
sysrootUpgraderNewForOs sysroot osname cancellable = liftIO $ do
    sysroot' <- unsafeManagedPtrCastPtr sysroot
    maybeOsname <- case osname of
        Nothing -> return nullPtr
        Just jOsname -> do
            jOsname' <- textToCString jOsname
            return jOsname'
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        result <- propagateGError $ ostree_sysroot_upgrader_new_for_os sysroot' maybeOsname maybeCancellable
        checkUnexpectedReturnNULL "sysrootUpgraderNewForOs" result
        result' <- (wrapObject SysrootUpgrader) result
        touchManagedPtr sysroot
        whenJust cancellable touchManagedPtr
        freeMem maybeOsname
        return result'
     ) (do
        freeMem maybeOsname
     )

-- method SysrootUpgrader::new_for_os_with_flags
-- method type : Constructor
-- Args : [Arg {argCName = "sysroot", argType = TInterface (Name {namespace = "OSTree", name = "Sysroot"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "An #OstreeSysroot", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "osname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Operating system name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "OSTree", name = "SysrootUpgraderFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Flags", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "OSTree", name = "SysrootUpgrader"}))
-- throws : True
-- Skip return : False

foreign import ccall "ostree_sysroot_upgrader_new_for_os_with_flags" ostree_sysroot_upgrader_new_for_os_with_flags :: 
    Ptr OSTree.Sysroot.Sysroot ->           -- sysroot : TInterface (Name {namespace = "OSTree", name = "Sysroot"})
    CString ->                              -- osname : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface (Name {namespace = "OSTree", name = "SysrootUpgraderFlags"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr SysrootUpgrader)

{- |
/No description available in the introspection data./
-}
sysrootUpgraderNewForOsWithFlags ::
    (B.CallStack.HasCallStack, MonadIO m, OSTree.Sysroot.IsSysroot a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@sysroot@/: An 'GI.OSTree.Objects.Sysroot.Sysroot' -}
    -> Maybe (T.Text)
    {- ^ /@osname@/: Operating system name -}
    -> [OSTree.Flags.SysrootUpgraderFlags]
    {- ^ /@flags@/: Flags -}
    -> Maybe (b)
    -> m SysrootUpgrader
    {- ^ __Returns:__ An upgrader /(Can throw 'Data.GI.Base.GError.GError')/ -}
sysrootUpgraderNewForOsWithFlags sysroot osname flags cancellable = liftIO $ do
    sysroot' <- unsafeManagedPtrCastPtr sysroot
    maybeOsname <- case osname of
        Nothing -> return nullPtr
        Just jOsname -> do
            jOsname' <- textToCString jOsname
            return jOsname'
    let flags' = gflagsToWord flags
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        result <- propagateGError $ ostree_sysroot_upgrader_new_for_os_with_flags sysroot' maybeOsname flags' maybeCancellable
        checkUnexpectedReturnNULL "sysrootUpgraderNewForOsWithFlags" result
        result' <- (wrapObject SysrootUpgrader) result
        touchManagedPtr sysroot
        whenJust cancellable touchManagedPtr
        freeMem maybeOsname
        return result'
     ) (do
        freeMem maybeOsname
     )

-- method SysrootUpgrader::deploy
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "SysrootUpgrader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Self", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Cancellable", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_sysroot_upgrader_deploy" ostree_sysroot_upgrader_deploy :: 
    Ptr SysrootUpgrader ->                  -- self : TInterface (Name {namespace = "OSTree", name = "SysrootUpgrader"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Write the new deployment to disk, perform a configuration merge
with \/etc, and update the bootloader configuration.
-}
sysrootUpgraderDeploy ::
    (B.CallStack.HasCallStack, MonadIO m, IsSysrootUpgrader a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@self@/: Self -}
    -> Maybe (b)
    {- ^ /@cancellable@/: Cancellable -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
sysrootUpgraderDeploy self cancellable = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ ostree_sysroot_upgrader_deploy self' maybeCancellable
        touchManagedPtr self
        whenJust cancellable touchManagedPtr
        return ()
     ) (do
        return ()
     )

data SysrootUpgraderDeployMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsSysrootUpgrader a, Gio.Cancellable.IsCancellable b) => O.MethodInfo SysrootUpgraderDeployMethodInfo a signature where
    overloadedMethod _ = sysrootUpgraderDeploy

-- method SysrootUpgrader::dup_origin
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "SysrootUpgrader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Sysroot", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "KeyFile"}))
-- throws : False
-- Skip return : False

foreign import ccall "ostree_sysroot_upgrader_dup_origin" ostree_sysroot_upgrader_dup_origin :: 
    Ptr SysrootUpgrader ->                  -- self : TInterface (Name {namespace = "OSTree", name = "SysrootUpgrader"})
    IO (Ptr GLib.KeyFile.KeyFile)

{- |
/No description available in the introspection data./
-}
sysrootUpgraderDupOrigin ::
    (B.CallStack.HasCallStack, MonadIO m, IsSysrootUpgrader a) =>
    a
    {- ^ /@self@/: Sysroot -}
    -> m GLib.KeyFile.KeyFile
    {- ^ __Returns:__ A copy of the origin file, or 'Nothing' if unknown -}
sysrootUpgraderDupOrigin self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- ostree_sysroot_upgrader_dup_origin self'
    checkUnexpectedReturnNULL "sysrootUpgraderDupOrigin" result
    result' <- (wrapBoxed GLib.KeyFile.KeyFile) result
    touchManagedPtr self
    return result'

data SysrootUpgraderDupOriginMethodInfo
instance (signature ~ (m GLib.KeyFile.KeyFile), MonadIO m, IsSysrootUpgrader a) => O.MethodInfo SysrootUpgraderDupOriginMethodInfo a signature where
    overloadedMethod _ = sysrootUpgraderDupOrigin

-- method SysrootUpgrader::get_origin
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "SysrootUpgrader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Sysroot", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "KeyFile"}))
-- throws : False
-- Skip return : False

foreign import ccall "ostree_sysroot_upgrader_get_origin" ostree_sysroot_upgrader_get_origin :: 
    Ptr SysrootUpgrader ->                  -- self : TInterface (Name {namespace = "OSTree", name = "SysrootUpgrader"})
    IO (Ptr GLib.KeyFile.KeyFile)

{- |
/No description available in the introspection data./
-}
sysrootUpgraderGetOrigin ::
    (B.CallStack.HasCallStack, MonadIO m, IsSysrootUpgrader a) =>
    a
    {- ^ /@self@/: Sysroot -}
    -> m GLib.KeyFile.KeyFile
    {- ^ __Returns:__ The origin file, or 'Nothing' if unknown -}
sysrootUpgraderGetOrigin self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- ostree_sysroot_upgrader_get_origin self'
    checkUnexpectedReturnNULL "sysrootUpgraderGetOrigin" result
    result' <- (newBoxed GLib.KeyFile.KeyFile) result
    touchManagedPtr self
    return result'

data SysrootUpgraderGetOriginMethodInfo
instance (signature ~ (m GLib.KeyFile.KeyFile), MonadIO m, IsSysrootUpgrader a) => O.MethodInfo SysrootUpgraderGetOriginMethodInfo a signature where
    overloadedMethod _ = sysrootUpgraderGetOrigin

-- method SysrootUpgrader::get_origin_description
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "SysrootUpgrader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Upgrader", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "ostree_sysroot_upgrader_get_origin_description" ostree_sysroot_upgrader_get_origin_description :: 
    Ptr SysrootUpgrader ->                  -- self : TInterface (Name {namespace = "OSTree", name = "SysrootUpgrader"})
    IO CString

{- |
/No description available in the introspection data./
-}
sysrootUpgraderGetOriginDescription ::
    (B.CallStack.HasCallStack, MonadIO m, IsSysrootUpgrader a) =>
    a
    {- ^ /@self@/: Upgrader -}
    -> m T.Text
    {- ^ __Returns:__ A one-line descriptive summary of the origin, or 'Nothing' if unknown -}
sysrootUpgraderGetOriginDescription self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- ostree_sysroot_upgrader_get_origin_description self'
    checkUnexpectedReturnNULL "sysrootUpgraderGetOriginDescription" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr self
    return result'

data SysrootUpgraderGetOriginDescriptionMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsSysrootUpgrader a) => O.MethodInfo SysrootUpgraderGetOriginDescriptionMethodInfo a signature where
    overloadedMethod _ = sysrootUpgraderGetOriginDescription

-- method SysrootUpgrader::pull
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "SysrootUpgrader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Upgrader", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "OSTree", name = "RepoPullFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Flags controlling pull behavior", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "upgrader_flags", argType = TInterface (Name {namespace = "OSTree", name = "SysrootUpgraderPullFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Flags controlling upgrader behavior", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "progress", argType = TInterface (Name {namespace = "OSTree", name = "AsyncProgress"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Progress", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out_changed", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Whether or not the origin changed", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Cancellable", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_sysroot_upgrader_pull" ostree_sysroot_upgrader_pull :: 
    Ptr SysrootUpgrader ->                  -- self : TInterface (Name {namespace = "OSTree", name = "SysrootUpgrader"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "OSTree", name = "RepoPullFlags"})
    CUInt ->                                -- upgrader_flags : TInterface (Name {namespace = "OSTree", name = "SysrootUpgraderPullFlags"})
    Ptr OSTree.AsyncProgress.AsyncProgress -> -- progress : TInterface (Name {namespace = "OSTree", name = "AsyncProgress"})
    Ptr CInt ->                             -- out_changed : TBasicType TBoolean
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Perform a pull from the origin.  First check if the ref has
changed, if so download the linked objects, and store the updated
ref locally.  Then /@outChanged@/ will be 'True'.

If the origin remote is unchanged, /@outChanged@/ will be set to
'False'.
-}
sysrootUpgraderPull ::
    (B.CallStack.HasCallStack, MonadIO m, IsSysrootUpgrader a, OSTree.AsyncProgress.IsAsyncProgress b, Gio.Cancellable.IsCancellable c) =>
    a
    {- ^ /@self@/: Upgrader -}
    -> [OSTree.Flags.RepoPullFlags]
    {- ^ /@flags@/: Flags controlling pull behavior -}
    -> [OSTree.Flags.SysrootUpgraderPullFlags]
    {- ^ /@upgraderFlags@/: Flags controlling upgrader behavior -}
    -> Maybe (b)
    {- ^ /@progress@/: Progress -}
    -> Maybe (c)
    {- ^ /@cancellable@/: Cancellable -}
    -> m (Bool)
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
sysrootUpgraderPull self flags upgraderFlags progress cancellable = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    let flags' = gflagsToWord flags
    let upgraderFlags' = gflagsToWord upgraderFlags
    maybeProgress <- case progress of
        Nothing -> return nullPtr
        Just jProgress -> do
            jProgress' <- unsafeManagedPtrCastPtr jProgress
            return jProgress'
    outChanged <- allocMem :: IO (Ptr CInt)
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ ostree_sysroot_upgrader_pull self' flags' upgraderFlags' maybeProgress outChanged maybeCancellable
        outChanged' <- peek outChanged
        let outChanged'' = (/= 0) outChanged'
        touchManagedPtr self
        whenJust progress touchManagedPtr
        whenJust cancellable touchManagedPtr
        freeMem outChanged
        return outChanged''
     ) (do
        freeMem outChanged
     )

data SysrootUpgraderPullMethodInfo
instance (signature ~ ([OSTree.Flags.RepoPullFlags] -> [OSTree.Flags.SysrootUpgraderPullFlags] -> Maybe (b) -> Maybe (c) -> m (Bool)), MonadIO m, IsSysrootUpgrader a, OSTree.AsyncProgress.IsAsyncProgress b, Gio.Cancellable.IsCancellable c) => O.MethodInfo SysrootUpgraderPullMethodInfo a signature where
    overloadedMethod _ = sysrootUpgraderPull

-- method SysrootUpgrader::pull_one_dir
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "SysrootUpgrader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dir_to_pull", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "OSTree", name = "RepoPullFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "upgrader_flags", argType = TInterface (Name {namespace = "OSTree", name = "SysrootUpgraderPullFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "progress", argType = TInterface (Name {namespace = "OSTree", name = "AsyncProgress"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out_changed", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_sysroot_upgrader_pull_one_dir" ostree_sysroot_upgrader_pull_one_dir :: 
    Ptr SysrootUpgrader ->                  -- self : TInterface (Name {namespace = "OSTree", name = "SysrootUpgrader"})
    CString ->                              -- dir_to_pull : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface (Name {namespace = "OSTree", name = "RepoPullFlags"})
    CUInt ->                                -- upgrader_flags : TInterface (Name {namespace = "OSTree", name = "SysrootUpgraderPullFlags"})
    Ptr OSTree.AsyncProgress.AsyncProgress -> -- progress : TInterface (Name {namespace = "OSTree", name = "AsyncProgress"})
    CInt ->                                 -- out_changed : TBasicType TBoolean
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Like 'GI.OSTree.Objects.SysrootUpgrader.sysrootUpgraderPull', but allows retrieving just a
subpath of the tree.  This can be used to download metadata files
from inside the tree such as package databases.
-}
sysrootUpgraderPullOneDir ::
    (B.CallStack.HasCallStack, MonadIO m, IsSysrootUpgrader a, OSTree.AsyncProgress.IsAsyncProgress b, Gio.Cancellable.IsCancellable c) =>
    a
    -> T.Text
    -> [OSTree.Flags.RepoPullFlags]
    -> [OSTree.Flags.SysrootUpgraderPullFlags]
    -> b
    -> Bool
    -> Maybe (c)
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
sysrootUpgraderPullOneDir self dirToPull flags upgraderFlags progress outChanged cancellable = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    dirToPull' <- textToCString dirToPull
    let flags' = gflagsToWord flags
    let upgraderFlags' = gflagsToWord upgraderFlags
    progress' <- unsafeManagedPtrCastPtr progress
    let outChanged' = (fromIntegral . fromEnum) outChanged
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ ostree_sysroot_upgrader_pull_one_dir self' dirToPull' flags' upgraderFlags' progress' outChanged' maybeCancellable
        touchManagedPtr self
        touchManagedPtr progress
        whenJust cancellable touchManagedPtr
        freeMem dirToPull'
        return ()
     ) (do
        freeMem dirToPull'
     )

data SysrootUpgraderPullOneDirMethodInfo
instance (signature ~ (T.Text -> [OSTree.Flags.RepoPullFlags] -> [OSTree.Flags.SysrootUpgraderPullFlags] -> b -> Bool -> Maybe (c) -> m ()), MonadIO m, IsSysrootUpgrader a, OSTree.AsyncProgress.IsAsyncProgress b, Gio.Cancellable.IsCancellable c) => O.MethodInfo SysrootUpgraderPullOneDirMethodInfo a signature where
    overloadedMethod _ = sysrootUpgraderPullOneDir

-- method SysrootUpgrader::set_origin
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "SysrootUpgrader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Sysroot", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "origin", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The new origin", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Cancellable", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_sysroot_upgrader_set_origin" ostree_sysroot_upgrader_set_origin :: 
    Ptr SysrootUpgrader ->                  -- self : TInterface (Name {namespace = "OSTree", name = "SysrootUpgrader"})
    Ptr GLib.KeyFile.KeyFile ->             -- origin : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Replace the origin with /@origin@/.
-}
sysrootUpgraderSetOrigin ::
    (B.CallStack.HasCallStack, MonadIO m, IsSysrootUpgrader a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@self@/: Sysroot -}
    -> Maybe (GLib.KeyFile.KeyFile)
    {- ^ /@origin@/: The new origin -}
    -> Maybe (b)
    {- ^ /@cancellable@/: Cancellable -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
sysrootUpgraderSetOrigin self origin cancellable = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    maybeOrigin <- case origin of
        Nothing -> return nullPtr
        Just jOrigin -> do
            jOrigin' <- unsafeManagedPtrGetPtr jOrigin
            return jOrigin'
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ ostree_sysroot_upgrader_set_origin self' maybeOrigin maybeCancellable
        touchManagedPtr self
        whenJust origin touchManagedPtr
        whenJust cancellable touchManagedPtr
        return ()
     ) (do
        return ()
     )

data SysrootUpgraderSetOriginMethodInfo
instance (signature ~ (Maybe (GLib.KeyFile.KeyFile) -> Maybe (b) -> m ()), MonadIO m, IsSysrootUpgrader a, Gio.Cancellable.IsCancellable b) => O.MethodInfo SysrootUpgraderSetOriginMethodInfo a signature where
    overloadedMethod _ = sysrootUpgraderSetOrigin

-- method SysrootUpgrader::check_timestamps
-- method type : MemberFunction
-- Args : [Arg {argCName = "repo", argType = TInterface (Name {namespace = "OSTree", name = "Repo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Repo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "from_rev", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "From revision", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "to_rev", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "To revision", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_sysroot_upgrader_check_timestamps" ostree_sysroot_upgrader_check_timestamps :: 
    Ptr OSTree.Repo.Repo ->                 -- repo : TInterface (Name {namespace = "OSTree", name = "Repo"})
    CString ->                              -- from_rev : TBasicType TUTF8
    CString ->                              -- to_rev : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Check that the timestamp on /@toRev@/ is equal to or newer than
/@fromRev@/.  This protects systems against man-in-the-middle
attackers which provide a client with an older commit.
-}
sysrootUpgraderCheckTimestamps ::
    (B.CallStack.HasCallStack, MonadIO m, OSTree.Repo.IsRepo a) =>
    a
    {- ^ /@repo@/: Repo -}
    -> T.Text
    {- ^ /@fromRev@/: From revision -}
    -> T.Text
    {- ^ /@toRev@/: To revision -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
sysrootUpgraderCheckTimestamps repo fromRev toRev = liftIO $ do
    repo' <- unsafeManagedPtrCastPtr repo
    fromRev' <- textToCString fromRev
    toRev' <- textToCString toRev
    onException (do
        _ <- propagateGError $ ostree_sysroot_upgrader_check_timestamps repo' fromRev' toRev'
        touchManagedPtr repo
        freeMem fromRev'
        freeMem toRev'
        return ()
     ) (do
        freeMem fromRev'
        freeMem toRev'
     )