546 lines
23 KiB
Diff
546 lines
23 KiB
Diff
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
|
|
index 491f044..896d32b 100755
|
|
--- a/backends/yum/yumBackend.py
|
|
+++ b/backends/yum/yumBackend.py
|
|
@@ -1787,7 +1787,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
|
|
return
|
|
self._show_package(pkg, INFO_UNTRUSTED)
|
|
try:
|
|
- self._runYumTransaction(allow_skip_broken=True, only_simulate=TRANSACTION_FLAG_SIMULATE in transaction_flags)
|
|
+ self._runYumTransaction(transaction_flags, allow_skip_broken=True)
|
|
except PkError, e:
|
|
self.error(e.code, e.details, exit=False)
|
|
else:
|
|
@@ -2020,7 +2020,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
|
|
return
|
|
self._show_package(pkg, INFO_UNTRUSTED)
|
|
try:
|
|
- self._runYumTransaction(only_simulate=TRANSACTION_FLAG_SIMULATE in transaction_flags)
|
|
+ self._runYumTransaction(transaction_flags)
|
|
except PkError, e:
|
|
self.error(e.code, e.details, exit=False)
|
|
else:
|
|
@@ -2203,7 +2203,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
|
|
return
|
|
|
|
try:
|
|
- self._runYumTransaction(only_simulate=TRANSACTION_FLAG_SIMULATE in transaction_flags)
|
|
+ self._runYumTransaction(transaction_flags)
|
|
except PkError, e:
|
|
self.error(e.code, e.details, exit=False)
|
|
return
|
|
@@ -2231,7 +2231,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
|
|
if not self.yumbase.tsInfo.pkgSack:
|
|
self.yumbase.tsInfo.pkgSack = MetaSack()
|
|
try:
|
|
- self._runYumTransaction(only_simulate=TRANSACTION_FLAG_SIMULATE in transaction_flags)
|
|
+ self._runYumTransaction(transaction_flags)
|
|
except PkError, e:
|
|
self.error(e.code, e.details, exit=False)
|
|
return
|
|
@@ -2344,7 +2344,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
|
|
return
|
|
self._show_package(pkg, INFO_UNTRUSTED)
|
|
try:
|
|
- self._runYumTransaction(allow_skip_broken=True, only_simulate=TRANSACTION_FLAG_SIMULATE in transaction_flags)
|
|
+ self._runYumTransaction(transaction_flags, allow_skip_broken=True)
|
|
except PkError, e:
|
|
self.error(e.code, e.details, exit=False)
|
|
else:
|
|
@@ -2361,7 +2361,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
|
|
or (notice and notice.get_metadata().has_key('reboot_suggested') and notice['reboot_suggested'])):
|
|
self.require_restart(RESTART_SYSTEM, self._pkg_to_id(pkg))
|
|
|
|
- def _runYumTransaction(self, allow_remove_deps=None, allow_skip_broken=False, only_simulate=False):
|
|
+ def _runYumTransaction(self, transaction_flags, allow_remove_deps=None, allow_skip_broken=False):
|
|
'''
|
|
Run the yum Transaction
|
|
This will only work with yum 3.2.4 or higher
|
|
@@ -2409,7 +2409,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
|
|
raise PkError(ERROR_TRANSACTION_ERROR, message)
|
|
|
|
# abort now we have the package list
|
|
- if only_simulate:
|
|
+ if TRANSACTION_FLAG_SIMULATE in transaction_flags:
|
|
package_list = []
|
|
for txmbr in self.yumbase.tsInfo:
|
|
if txmbr.output_state in TransactionsInfoMap.keys():
|
|
@@ -2421,6 +2421,20 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
|
|
self.percentage(100)
|
|
return
|
|
|
|
+ if TRANSACTION_FLAG_ONLY_DOWNLOAD in transaction_flags:
|
|
+ package_list = []
|
|
+ for txmbr in self.yumbase.tsInfo:
|
|
+ if txmbr.output_state in (TS_UPDATE, TS_INSTALL):
|
|
+ self._show_package(txmbr.po, INFO_DOWNLOADING)
|
|
+ repo = self.yumbase.repos.getRepo(txmbr.po.repoid)
|
|
+ try:
|
|
+ path = repo.getPackage(txmbr.po)
|
|
+ except IOError, e:
|
|
+ self.error(ERROR_PACKAGE_DOWNLOAD_FAILED, "Cannot write to file", exit=False)
|
|
+ return
|
|
+ self.percentage(100)
|
|
+ return
|
|
+
|
|
try:
|
|
rpmDisplay = PackageKitCallback(self)
|
|
callback = ProcessTransPackageKitCallback(self)
|
|
@@ -2529,9 +2543,9 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
|
|
return
|
|
try:
|
|
if not allowdep:
|
|
- self._runYumTransaction(allow_remove_deps=False, only_simulate=TRANSACTION_FLAG_SIMULATE in transaction_flags)
|
|
+ self._runYumTransaction(transaction_flags, allow_remove_deps=False)
|
|
else:
|
|
- self._runYumTransaction(allow_remove_deps=True, only_simulate=TRANSACTION_FLAG_SIMULATE in transaction_flags)
|
|
+ self._runYumTransaction(transaction_flags, allow_remove_deps=True)
|
|
except PkError, e:
|
|
self.error(e.code, e.details, exit=False)
|
|
else:
|
|
@@ -3173,6 +3187,9 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
|
|
# default to 100% unless method overrides
|
|
self.yumbase.conf.throttle = "90%"
|
|
|
|
+ # do not use parallel downloading
|
|
+ self.yumbase.conf.async = False
|
|
+
|
|
def _setup_yum(self):
|
|
try:
|
|
# setup Yum Config
|
|
@@ -3349,17 +3366,18 @@ class PackageKitCallback(RPMBaseCallback):
|
|
self.base.message(MESSAGE_BACKEND_ERROR, "The constant '%s' was unknown, please report. details: %s" % (action, _to_unicode(e)))
|
|
|
|
# set item percentage
|
|
- #if package and te_total > 0:
|
|
- # val = (te_current*100L)/te_total
|
|
- # if self.curpkg:
|
|
- # self.base.item_percentage(self.base._pkg_to_id(self.curpkg), val)
|
|
+ if package and te_total > 0:
|
|
+ val = (te_current*100L)/te_total
|
|
+ if self.curpkg:
|
|
+ self.base.item_percentage(self.base._pkg_to_id(self.curpkg), val)
|
|
|
|
- # find out the offset
|
|
+ # find out the start offset
|
|
pct_start = StatusPercentageMap[STATUS_INSTALL]
|
|
|
|
# do percentage
|
|
if ts_total > 0:
|
|
div = (100 - pct_start) / ts_total
|
|
+ val = (te_current*100L)/te_total
|
|
pct = div * (ts_current - 1) + pct_start + ((div / 100.0) * val)
|
|
self.base.percentage(pct)
|
|
|
|
diff --git a/lib/packagekit-glib2/pk-client.c b/lib/packagekit-glib2/pk-client.c
|
|
index 5613f3e..4af44a7 100644
|
|
--- a/lib/packagekit-glib2/pk-client.c
|
|
+++ b/lib/packagekit-glib2/pk-client.c
|
|
@@ -1204,7 +1204,7 @@ pk_client_signal_cb (GDBusProxy *proxy,
|
|
if (g_strcmp0 (signal_name, "Transaction") == 0) {
|
|
PkTransactionPast *item;
|
|
g_variant_get (parameters,
|
|
- "(&o&sb&su&su&s)",
|
|
+ "(&o&sbuu&su&s)",
|
|
&tmp_str[0],
|
|
&tmp_str[1],
|
|
&tmp_bool,
|
|
diff --git a/lib/packagekit-glib2/pk-progress.c b/lib/packagekit-glib2/pk-progress.c
|
|
index d1b7ff4..aa1b94f 100644
|
|
--- a/lib/packagekit-glib2/pk-progress.c
|
|
+++ b/lib/packagekit-glib2/pk-progress.c
|
|
@@ -266,6 +266,10 @@ pk_progress_set_role (PkProgress *progress, PkRoleEnum role)
|
|
{
|
|
g_return_val_if_fail (PK_IS_PROGRESS (progress), FALSE);
|
|
|
|
+ /* ignore unknown as we don't want to replace a valid value */
|
|
+ if (role == PK_ROLE_ENUM_UNKNOWN)
|
|
+ return FALSE;
|
|
+
|
|
/* the same as before? */
|
|
if (progress->priv->role == role)
|
|
return FALSE;
|
|
diff --git a/src/pk-backend.c b/src/pk-backend.c
|
|
index b9ae2b8..477552f 100644
|
|
--- a/src/pk-backend.c
|
|
+++ b/src/pk-backend.c
|
|
@@ -1109,6 +1109,8 @@ pk_backend_set_item_progress (PkBackend *backend,
|
|
const gchar *package_id,
|
|
guint percentage)
|
|
{
|
|
+ PkItemProgress *item;
|
|
+
|
|
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
|
|
g_return_val_if_fail (backend->priv->loaded, FALSE);
|
|
|
|
@@ -1125,9 +1127,15 @@ pk_backend_set_item_progress (PkBackend *backend,
|
|
}
|
|
|
|
/* emit */
|
|
+ item = pk_item_progress_new ();
|
|
+ g_object_set (item,
|
|
+ "package-id", package_id,
|
|
+ "percentage", percentage,
|
|
+ NULL);
|
|
pk_backend_call_vfunc (backend,
|
|
PK_BACKEND_SIGNAL_ITEM_PROGRESS,
|
|
- (gpointer) package_id); //FIXME
|
|
+ item);
|
|
+ g_object_unref (item);
|
|
return TRUE;
|
|
}
|
|
|
|
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
|
|
index afdd563..d30aaac 100644
|
|
--- a/src/pk-transaction.c
|
|
+++ b/src/pk-transaction.c
|
|
@@ -689,23 +689,24 @@ pk_transaction_category_cb (PkBackend *backend,
|
|
**/
|
|
static void
|
|
pk_transaction_item_progress_cb (PkBackend *backend,
|
|
- const gchar *package_id,
|
|
- guint percentage,
|
|
+ PkItemProgress *item_progress,
|
|
PkTransaction *transaction)
|
|
{
|
|
g_return_if_fail (PK_IS_TRANSACTION (transaction));
|
|
g_return_if_fail (transaction->priv->tid != NULL);
|
|
|
|
/* emit */
|
|
- g_debug ("emitting item-progress %s, %u", package_id, percentage);
|
|
+ g_debug ("emitting item-progress %s, %u",
|
|
+ pk_item_progress_get_package_id (item_progress),
|
|
+ pk_item_progress_get_percentage (item_progress));
|
|
g_dbus_connection_emit_signal (transaction->priv->connection,
|
|
NULL,
|
|
transaction->priv->tid,
|
|
PK_DBUS_INTERFACE_TRANSACTION,
|
|
"ItemProgress",
|
|
g_variant_new ("(su)",
|
|
- package_id,
|
|
- percentage),
|
|
+ pk_item_progress_get_package_id (item_progress),
|
|
+ pk_item_progress_get_percentage (item_progress)),
|
|
NULL);
|
|
}
|
|
|
|
@@ -1751,7 +1752,7 @@ pk_transaction_transaction_cb (PkTransactionDb *tdb,
|
|
transaction->priv->tid,
|
|
PK_DBUS_INTERFACE_TRANSACTION,
|
|
"Transaction",
|
|
- g_variant_new ("(osbsusus)",
|
|
+ g_variant_new ("(osbuusus)",
|
|
tid,
|
|
timespec,
|
|
succeeded,
|
|
@@ -3029,6 +3030,18 @@ pk_transaction_get_role (PkTransaction *transaction)
|
|
}
|
|
|
|
/**
|
|
+ * pk_transaction_set_role:
|
|
+ **/
|
|
+static void
|
|
+pk_transaction_set_role (PkTransaction *transaction, PkRoleEnum role)
|
|
+{
|
|
+ transaction->priv->role = role;
|
|
+ pk_transaction_emit_property_changed (transaction,
|
|
+ "Role",
|
|
+ g_variant_new_uint32 (role));
|
|
+}
|
|
+
|
|
+/**
|
|
* pk_transaction_dbus_return:
|
|
**/
|
|
static void
|
|
@@ -3065,7 +3078,6 @@ pk_transaction_accept_eula (PkTransaction *transaction,
|
|
|
|
g_return_if_fail (PK_IS_TRANSACTION (transaction));
|
|
g_return_if_fail (transaction->priv->tid != NULL);
|
|
- transaction->priv->role = PK_ROLE_ENUM_ACCEPT_EULA;
|
|
|
|
g_variant_get (params, "(&s)",
|
|
&eula_id);
|
|
@@ -3077,6 +3089,8 @@ pk_transaction_accept_eula (PkTransaction *transaction,
|
|
goto out;
|
|
}
|
|
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_ACCEPT_EULA);
|
|
+
|
|
/* try to get authorization */
|
|
ret = pk_transaction_obtain_authorization (transaction,
|
|
PK_ROLE_ENUM_ACCEPT_EULA,
|
|
@@ -3319,7 +3333,7 @@ pk_transaction_download_packages (PkTransaction *transaction,
|
|
/* save so we can run later */
|
|
transaction->priv->cached_package_ids = g_strdupv (package_ids);
|
|
transaction->priv->cached_directory = g_strdup (directory);
|
|
- transaction->priv->role = PK_ROLE_ENUM_DOWNLOAD_PACKAGES;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_DOWNLOAD_PACKAGES);
|
|
|
|
/* try to commit this */
|
|
ret = pk_transaction_commit (transaction);
|
|
@@ -3360,7 +3374,7 @@ pk_transaction_get_categories (PkTransaction *transaction,
|
|
goto out;
|
|
}
|
|
|
|
- transaction->priv->role = PK_ROLE_ENUM_GET_CATEGORIES;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_CATEGORIES);
|
|
|
|
/* try to commit this */
|
|
ret = pk_transaction_commit (transaction);
|
|
@@ -3434,7 +3448,7 @@ pk_transaction_get_depends (PkTransaction *transaction,
|
|
transaction->priv->cached_filters = filter;
|
|
transaction->priv->cached_package_ids = g_strdupv (package_ids);
|
|
transaction->priv->cached_force = recursive;
|
|
- transaction->priv->role = PK_ROLE_ENUM_GET_DEPENDS;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_DEPENDS);
|
|
|
|
/* try to commit this */
|
|
ret = pk_transaction_commit (transaction);
|
|
@@ -3504,7 +3518,7 @@ pk_transaction_get_details (PkTransaction *transaction,
|
|
|
|
/* save so we can run later */
|
|
transaction->priv->cached_package_ids = g_strdupv (package_ids);
|
|
- transaction->priv->role = PK_ROLE_ENUM_GET_DETAILS;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_DETAILS);
|
|
|
|
/* try to commit this */
|
|
ret = pk_transaction_commit (transaction);
|
|
@@ -3545,7 +3559,7 @@ pk_transaction_get_distro_upgrades (PkTransaction *transaction,
|
|
}
|
|
|
|
/* save so we can run later */
|
|
- transaction->priv->role = PK_ROLE_ENUM_GET_DISTRO_UPGRADES;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_DISTRO_UPGRADES);
|
|
|
|
/* try to commit this */
|
|
ret = pk_transaction_commit (transaction);
|
|
@@ -3613,7 +3627,7 @@ pk_transaction_get_files (PkTransaction *transaction,
|
|
|
|
/* save so we can run later */
|
|
transaction->priv->cached_package_ids = g_strdupv (package_ids);
|
|
- transaction->priv->role = PK_ROLE_ENUM_GET_FILES;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_FILES);
|
|
|
|
/* try to commit this */
|
|
ret = pk_transaction_commit (transaction);
|
|
@@ -3659,7 +3673,7 @@ pk_transaction_get_packages (PkTransaction *transaction,
|
|
|
|
/* save so we can run later */
|
|
transaction->priv->cached_filters = filter;
|
|
- transaction->priv->role = PK_ROLE_ENUM_GET_PACKAGES;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_PACKAGES);
|
|
|
|
/* try to commit this */
|
|
ret = pk_transaction_commit (transaction);
|
|
@@ -3692,7 +3706,7 @@ pk_transaction_get_old_transactions (PkTransaction *transaction,
|
|
|
|
g_debug ("GetOldTransactions method called");
|
|
|
|
- transaction->priv->role = PK_ROLE_ENUM_GET_OLD_TRANSACTIONS;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_OLD_TRANSACTIONS);
|
|
pk_transaction_db_get_list (transaction->priv->transaction_db, number);
|
|
idle_id = g_idle_add ((GSourceFunc) pk_transaction_finished_idle_cb, transaction);
|
|
g_source_set_name_by_id (idle_id, "[PkTransaction] finished from get-old-transactions");
|
|
@@ -3731,7 +3745,7 @@ pk_transaction_get_repo_list (PkTransaction *transaction,
|
|
|
|
/* save so we can run later */
|
|
transaction->priv->cached_filters = filter;
|
|
- transaction->priv->role = PK_ROLE_ENUM_GET_REPO_LIST;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_REPO_LIST);
|
|
|
|
/* try to commit this */
|
|
ret = pk_transaction_commit (transaction);
|
|
@@ -3806,7 +3820,7 @@ pk_transaction_get_requires (PkTransaction *transaction,
|
|
transaction->priv->cached_filters = filter;
|
|
transaction->priv->cached_package_ids = g_strdupv (package_ids);
|
|
transaction->priv->cached_force = recursive;
|
|
- transaction->priv->role = PK_ROLE_ENUM_GET_REQUIRES;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_REQUIRES);
|
|
|
|
/* try to commit this */
|
|
ret = pk_transaction_commit (transaction);
|
|
@@ -3875,7 +3889,7 @@ pk_transaction_get_update_detail (PkTransaction *transaction,
|
|
|
|
/* save so we can run later */
|
|
transaction->priv->cached_package_ids = g_strdupv (package_ids);
|
|
- transaction->priv->role = PK_ROLE_ENUM_GET_UPDATE_DETAIL;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_UPDATE_DETAIL);
|
|
|
|
/* try to commit this */
|
|
ret = pk_transaction_commit (transaction);
|
|
@@ -4004,7 +4018,7 @@ pk_transaction_get_updates (PkTransaction *transaction,
|
|
|
|
/* save so we can run later */
|
|
transaction->priv->cached_filters = filter;
|
|
- transaction->priv->role = PK_ROLE_ENUM_GET_UPDATES;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_UPDATES);
|
|
|
|
/* try and reuse cache */
|
|
ret = pk_transaction_try_emit_cache (transaction);
|
|
@@ -4166,7 +4180,7 @@ pk_transaction_install_files (PkTransaction *transaction,
|
|
/* save so we can run later */
|
|
transaction->priv->cached_transaction_flags = transaction_flags;
|
|
transaction->priv->cached_full_paths = g_strdupv (full_paths);
|
|
- transaction->priv->role = PK_ROLE_ENUM_INSTALL_FILES;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_INSTALL_FILES);
|
|
|
|
/* try to get authorization */
|
|
ret = pk_transaction_obtain_authorization (transaction,
|
|
@@ -4239,7 +4253,7 @@ pk_transaction_install_packages (PkTransaction *transaction,
|
|
/* save so we can run later */
|
|
transaction->priv->cached_transaction_flags = transaction_flags;
|
|
transaction->priv->cached_package_ids = g_strdupv (package_ids);
|
|
- transaction->priv->role = PK_ROLE_ENUM_INSTALL_PACKAGES;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_INSTALL_PACKAGES);
|
|
|
|
/* try to get authorization */
|
|
ret = pk_transaction_obtain_authorization (transaction,
|
|
@@ -4309,7 +4323,7 @@ pk_transaction_install_signature (PkTransaction *transaction,
|
|
/* save so we can run later */
|
|
transaction->priv->cached_package_id = g_strdup (package_id);
|
|
transaction->priv->cached_key_id = g_strdup (key_id);
|
|
- transaction->priv->role = PK_ROLE_ENUM_INSTALL_SIGNATURE;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_INSTALL_SIGNATURE);
|
|
|
|
/* try to get authorization */
|
|
ret = pk_transaction_obtain_authorization (transaction,
|
|
@@ -4357,7 +4371,7 @@ pk_transaction_refresh_cache (PkTransaction *transaction,
|
|
|
|
/* save so we can run later */
|
|
transaction->priv->cached_force = force;
|
|
- transaction->priv->role = PK_ROLE_ENUM_REFRESH_CACHE;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_REFRESH_CACHE);
|
|
|
|
/* try to get authorization */
|
|
ret = pk_transaction_obtain_authorization (transaction,
|
|
@@ -4435,7 +4449,7 @@ pk_transaction_remove_packages (PkTransaction *transaction,
|
|
transaction->priv->cached_package_ids = g_strdupv (package_ids);
|
|
transaction->priv->cached_allow_deps = allow_deps;
|
|
transaction->priv->cached_autoremove = autoremove;
|
|
- transaction->priv->role = PK_ROLE_ENUM_REMOVE_PACKAGES;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_REMOVE_PACKAGES);
|
|
|
|
/* try to get authorization */
|
|
ret = pk_transaction_obtain_authorization (transaction,
|
|
@@ -4491,7 +4505,7 @@ pk_transaction_repo_enable (PkTransaction *transaction,
|
|
/* save so we can run later */
|
|
transaction->priv->cached_repo_id = g_strdup (repo_id);
|
|
transaction->priv->cached_enabled = enabled;
|
|
- transaction->priv->role = PK_ROLE_ENUM_REPO_ENABLE;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_REPO_ENABLE);
|
|
|
|
/* try to get authorization */
|
|
ret = pk_transaction_obtain_authorization (transaction,
|
|
@@ -4550,7 +4564,7 @@ pk_transaction_repo_set_data (PkTransaction *transaction,
|
|
transaction->priv->cached_repo_id = g_strdup (repo_id);
|
|
transaction->priv->cached_parameter = g_strdup (parameter);
|
|
transaction->priv->cached_value = g_strdup (value);
|
|
- transaction->priv->role = PK_ROLE_ENUM_REPO_SET_DATA;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_REPO_SET_DATA);
|
|
|
|
/* try to get authorization */
|
|
ret = pk_transaction_obtain_authorization (transaction,
|
|
@@ -4630,7 +4644,7 @@ pk_transaction_resolve (PkTransaction *transaction,
|
|
/* save so we can run later */
|
|
transaction->priv->cached_package_ids = g_strdupv (packages);
|
|
transaction->priv->cached_filters = filter;
|
|
- transaction->priv->role = PK_ROLE_ENUM_RESOLVE;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_RESOLVE);
|
|
|
|
/* try to commit this */
|
|
ret = pk_transaction_commit (transaction);
|
|
@@ -4687,7 +4701,7 @@ pk_transaction_search_details (PkTransaction *transaction,
|
|
/* save so we can run later */
|
|
transaction->priv->cached_filters = filter;
|
|
transaction->priv->cached_values = g_strdupv (values);
|
|
- transaction->priv->role = PK_ROLE_ENUM_SEARCH_DETAILS;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_SEARCH_DETAILS);
|
|
|
|
/* try to commit this */
|
|
ret = pk_transaction_commit (transaction);
|
|
@@ -4754,7 +4768,7 @@ pk_transaction_search_files (PkTransaction *transaction,
|
|
/* save so we can run later */
|
|
transaction->priv->cached_filters = filter;
|
|
transaction->priv->cached_values = g_strdupv (values);
|
|
- transaction->priv->role = PK_ROLE_ENUM_SEARCH_FILE;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_SEARCH_FILE);
|
|
|
|
/* try to commit this */
|
|
ret = pk_transaction_commit (transaction);
|
|
@@ -4821,7 +4835,7 @@ pk_transaction_search_groups (PkTransaction *transaction,
|
|
/* save so we can run later */
|
|
transaction->priv->cached_filters = filter;
|
|
transaction->priv->cached_values = g_strdupv (values);
|
|
- transaction->priv->role = PK_ROLE_ENUM_SEARCH_GROUP;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_SEARCH_GROUP);
|
|
|
|
/* try to commit this */
|
|
ret = pk_transaction_commit (transaction);
|
|
@@ -4877,7 +4891,7 @@ pk_transaction_search_names (PkTransaction *transaction,
|
|
/* save so we can run later */
|
|
transaction->priv->cached_filters = filter;
|
|
transaction->priv->cached_values = g_strdupv (values);
|
|
- transaction->priv->role = PK_ROLE_ENUM_SEARCH_NAME;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_SEARCH_NAME);
|
|
|
|
/* try to commit this */
|
|
ret = pk_transaction_commit (transaction);
|
|
@@ -5112,7 +5126,7 @@ pk_transaction_update_packages (PkTransaction *transaction,
|
|
/* save so we can run later */
|
|
transaction->priv->cached_transaction_flags = transaction_flags;
|
|
transaction->priv->cached_package_ids = g_strdupv (package_ids);
|
|
- transaction->priv->role = PK_ROLE_ENUM_UPDATE_PACKAGES;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_UPDATE_PACKAGES);
|
|
|
|
/* try to get authorization */
|
|
ret = pk_transaction_obtain_authorization (transaction,
|
|
@@ -5165,7 +5179,7 @@ pk_transaction_update_system (PkTransaction *transaction,
|
|
}
|
|
|
|
transaction->priv->cached_transaction_flags = transaction_flags;
|
|
- transaction->priv->role = PK_ROLE_ENUM_UPDATE_SYSTEM;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_UPDATE_SYSTEM);
|
|
|
|
/* try to get authorization */
|
|
ret = pk_transaction_obtain_authorization (transaction,
|
|
@@ -5225,7 +5239,7 @@ pk_transaction_what_provides (PkTransaction *transaction,
|
|
transaction->priv->cached_filters = filter;
|
|
transaction->priv->cached_values = g_strdupv (values);
|
|
transaction->priv->cached_provides = provides;
|
|
- transaction->priv->role = PK_ROLE_ENUM_WHAT_PROVIDES;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_WHAT_PROVIDES);
|
|
|
|
/* try to commit this */
|
|
ret = pk_transaction_commit (transaction);
|
|
@@ -5274,7 +5288,7 @@ pk_transaction_upgrade_system (PkTransaction *transaction,
|
|
/* save so we can run later */
|
|
transaction->priv->cached_value = g_strdup (distro_id);
|
|
transaction->priv->cached_provides = upgrade_kind;
|
|
- transaction->priv->role = PK_ROLE_ENUM_UPGRADE_SYSTEM;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_UPGRADE_SYSTEM);
|
|
|
|
/* try to get authorization */
|
|
ret = pk_transaction_obtain_authorization (transaction,
|
|
@@ -5319,7 +5333,7 @@ pk_transaction_repair_system (PkTransaction *transaction,
|
|
|
|
/* save so we can run later */
|
|
transaction->priv->cached_transaction_flags = transaction_flags;
|
|
- transaction->priv->role = PK_ROLE_ENUM_REPAIR_SYSTEM;
|
|
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_REPAIR_SYSTEM);
|
|
|
|
/* try to get authorization */
|
|
ret = pk_transaction_obtain_authorization (transaction,
|
|
diff --git a/src/plugins/pk-plugin-clear-firmware-requests.c b/src/plugins/pk-plugin-clear-firmware-requests.c
|
|
index 8b4216a..f9326f4 100644
|
|
--- a/src/plugins/pk-plugin-clear-firmware-requests.c
|
|
+++ b/src/plugins/pk-plugin-clear-firmware-requests.c
|
|
@@ -51,6 +51,8 @@ pk_plugin_transaction_finished_end (PkPlugin *plugin,
|
|
|
|
/* clear the firmware requests directory */
|
|
filename = g_build_filename (LOCALSTATEDIR, "run", "PackageKit", "udev", NULL);
|
|
+ if (!g_file_test (filename, G_FILE_TEST_EXISTS))
|
|
+ goto out;
|
|
g_debug ("clearing udev firmware requests at %s", filename);
|
|
ret = pk_directory_remove_contents (filename);
|
|
if (!ret)
|