1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- 2 * 3 * Copyright (C) 2014-2015 Richard Hughes <richard@hughsie.com> 4 * 5 * Licensed under the GNU Lesser General Public License Version 2.1 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2.1 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 */ 21 22 #ifndef __DNF_TRANSACTION_H 23 #define __DNF_TRANSACTION_H 24 25 #include <glib-object.h> 26 #include <gio/gio.h> 27 28 #include "hy-goal.h" 29 #include "dnf-types.h" 30 #include "dnf-context.h" 31 #include "dnf-state.h" 32 33 G_BEGIN_DECLS 34 35 #define DNF_TYPE_TRANSACTION (dnf_transaction_get_type ()) 36 G_DECLARE_DERIVABLE_TYPE (DnfTransaction, dnf_transaction, DNF, TRANSACTION, GObject) 37 38 struct _DnfTransactionClass 39 { 40 GObjectClass parent_class; 41 /*< private >*/ 42 void (*_dnf_reserved1) (void); 43 void (*_dnf_reserved2) (void); 44 void (*_dnf_reserved3) (void); 45 void (*_dnf_reserved4) (void); 46 void (*_dnf_reserved5) (void); 47 void (*_dnf_reserved6) (void); 48 void (*_dnf_reserved7) (void); 49 void (*_dnf_reserved8) (void); 50 }; 51 52 /** 53 * DnfTransactionFlag: 54 * @DNF_TRANSACTION_FLAG_NONE: No flags 55 * @DNF_TRANSACTION_FLAG_ONLY_TRUSTED: Only install trusted packages 56 * @DNF_TRANSACTION_FLAG_ALLOW_REINSTALL: Allow package reinstallation 57 * @DNF_TRANSACTION_FLAG_ALLOW_DOWNGRADE: Allow package downrades 58 * @DNF_TRANSACTION_FLAG_NODOCS: Don't install documentation 59 * @DNF_TRANSACTION_FLAG_TEST: Only do a transaction test 60 * 61 * The transaction flags. 62 **/ 63 typedef enum { 64 DNF_TRANSACTION_FLAG_NONE = 0, 65 DNF_TRANSACTION_FLAG_ONLY_TRUSTED = 1 << 0, 66 DNF_TRANSACTION_FLAG_ALLOW_REINSTALL = 1 << 1, 67 DNF_TRANSACTION_FLAG_ALLOW_DOWNGRADE = 1 << 2, 68 DNF_TRANSACTION_FLAG_NODOCS = 1 << 3, 69 DNF_TRANSACTION_FLAG_TEST = 1 << 4, 70 /*< private >*/ 71 DNF_TRANSACTION_FLAG_LAST 72 } DnfTransactionFlag; 73 74 DnfTransaction *dnf_transaction_new (DnfContext *context); 75 76 /* getters */ 77 guint64 dnf_transaction_get_flags (DnfTransaction *transaction); 78 GPtrArray *dnf_transaction_get_remote_pkgs (DnfTransaction *transaction); 79 DnfDb *dnf_transaction_get_db (DnfTransaction *transaction); 80 81 /* setters */ 82 void dnf_transaction_set_repos (DnfTransaction *transaction, 83 GPtrArray *repos); 84 void dnf_transaction_set_uid (DnfTransaction *transaction, 85 guint uid); 86 void dnf_transaction_set_flags (DnfTransaction *transaction, 87 guint64 flags); 88 void dnf_transaction_set_dont_solve_goal (DnfTransaction *transaction, 89 gboolean dont_solve_goal); 90 91 /* object methods */ 92 gboolean dnf_transaction_depsolve (DnfTransaction *transaction, 93 HyGoal goal, 94 DnfState *state, 95 GError **error); 96 gboolean dnf_transaction_download (DnfTransaction *transaction, 97 DnfState *state, 98 GError **error); 99 100 gboolean dnf_transaction_import_keys (DnfTransaction *transaction, 101 GError **error); 102 103 gboolean dnf_transaction_gpgcheck_package (DnfTransaction *transaction, 104 DnfPackage *pkg, 105 GError **error); 106 gboolean dnf_transaction_check_untrusted (DnfTransaction *transaction, 107 HyGoal goal, 108 GError **error); 109 110 gboolean dnf_transaction_commit (DnfTransaction *transaction, 111 HyGoal goal, 112 DnfState *state, 113 GError **error); 114 gboolean dnf_transaction_ensure_repo (DnfTransaction *transaction, 115 DnfPackage * pkg, 116 GError **error); 117 gboolean dnf_transaction_ensure_repo_list (DnfTransaction *transaction, 118 GPtrArray * pkglist, 119 GError **error); 120 121 G_END_DECLS 122 123 #endif /* __DNF_TRANSACTION_H */ 124