PackageKit/PackageKit-remove-transaction-size-limit.patch
Dominique Leuenberger 85f84f477c Accepting request 879289 from home:develop7:branches:GNOME:Factory
- Add PackageKit-remove-transaction-size-limit.patch: Remove large transaction 
  size sanity check (gh#hughsie/PackageKit/commit#ac5c8660)

OBS-URL: https://build.opensuse.org/request/show/879289
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/PackageKit?expand=0&rev=412
2021-03-18 18:31:32 +00:00

273 lines
9.2 KiB
Diff

From ff0181389dc281effbd274f6e1ae01e8905ddf8a Mon Sep 17 00:00:00 2001
From: Richard Hughes <richard@hughsie.com>
Date: Thu, 19 Nov 2020 19:15:08 +0000
Subject: [PATCH] Increase the number of packages that can be processed in one
transaction
Ohh TeX Live, you taunt me.
Fixes https://github.com/hughsie/PackageKit/issues/442
---
src/pk-transaction.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 7cb1ced60..6167f0473 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -77,7 +77,7 @@ static gboolean pk_transaction_is_supported_content_type (PkTransaction *transac
#define PK_TRANSACTION_MAX_ITEMS_TO_RESOLVE 10000
/* maximum number of packages that can be processed in one go */
-#define PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS 5200
+#define PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS 10000
struct PkTransactionPrivate
{
From ac5c8660a82b6df96c9895eb97d242af3b6dac72 Mon Sep 17 00:00:00 2001
From: Nate Graham <nate@kde.org>
Date: Mon, 15 Mar 2021 11:54:14 -0600
Subject: [PATCH] Remove large transaction size sanity check
Some distros regularly push updates of tens of thousands of packages,
causing users to run into this "too many packages" error. This is not
really an error, it's just that the sanity check didn't anticipate that
the world might be insane. :) Let's remove it to avoid these issues.
---
src/pk-transaction.c | 131 +------------------------------------------
1 file changed, 2 insertions(+), 129 deletions(-)
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 0724e5f25..258abb2cb 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -76,9 +76,6 @@ static gboolean pk_transaction_is_supported_content_type (PkTransaction *transac
/* maximum number of items that can be resolved in one go */
#define PK_TRANSACTION_MAX_ITEMS_TO_RESOLVE 10000
-/* maximum number of packages that can be processed in one go */
-#define PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS 10000
-
struct PkTransactionPrivate
{
PkRoleEnum role;
@@ -2791,18 +2788,6 @@ pk_transaction_download_packages (PkTransaction *transaction,
goto out;
}
- /* check for length sanity */
- length = g_strv_length (package_ids);
- if (length > PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS) {
- g_set_error (&error,
- PK_TRANSACTION_ERROR,
- PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
- "Too many packages to process (%i/%i)",
- length, PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS);
- pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR);
- goto out;
- }
-
/* check package_ids */
ret = pk_package_ids_check (package_ids);
if (!ret) {
@@ -2901,18 +2886,6 @@ pk_transaction_depends_on (PkTransaction *transaction,
goto out;
}
- /* check for length sanity */
- length = g_strv_length (package_ids);
- if (length > PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS) {
- g_set_error (&error,
- PK_TRANSACTION_ERROR,
- PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
- "Too many packages to process (%i/%i)",
- length, PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS);
- pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR);
- goto out;
- }
-
/* check package_ids */
ret = pk_package_ids_check (package_ids);
if (!ret) {
@@ -2965,18 +2938,6 @@ pk_transaction_get_details (PkTransaction *transaction,
goto out;
}
- /* check for length sanity */
- length = g_strv_length (package_ids);
- if (length > PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS) {
- g_set_error (&error,
- PK_TRANSACTION_ERROR,
- PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
- "Too many packages to process (%i/%i)",
- length, PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS);
- pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR);
- goto out;
- }
-
/* check package_ids */
ret = pk_package_ids_check (package_ids);
if (!ret) {
@@ -3030,7 +2991,7 @@ pk_transaction_get_details_local (PkTransaction *transaction,
goto out;
}
- /* check for length sanity */
+ /* check for empty package list */
length = g_strv_length (full_paths);
if (length == 0) {
g_set_error_literal (&error,
@@ -3040,14 +3001,6 @@ pk_transaction_get_details_local (PkTransaction *transaction,
pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR);
goto out;
}
- if (length > PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS) {
- g_set_error (&error,
- PK_TRANSACTION_ERROR,
- PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
- "Too many files to process (%i/%i)", length, PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS);
- pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR);
- goto out;
- }
/* check all files exists and are valid */
length = g_strv_length (full_paths);
@@ -3129,7 +3082,7 @@ pk_transaction_get_files_local (PkTransaction *transaction,
goto out;
}
- /* check for length sanity */
+ /* check for empty package list */
length = g_strv_length (full_paths);
if (length == 0) {
g_set_error_literal (&error,
@@ -3139,14 +3092,6 @@ pk_transaction_get_files_local (PkTransaction *transaction,
pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR);
goto out;
}
- if (length > PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS) {
- g_set_error (&error,
- PK_TRANSACTION_ERROR,
- PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
- "Too many files to process (%i/%i)", length, PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS);
- pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR);
- goto out;
- }
/* check all files exists and are valid */
length = g_strv_length (full_paths);
@@ -3256,18 +3201,6 @@ pk_transaction_get_files (PkTransaction *transaction,
goto out;
}
- /* check for length sanity */
- length = g_strv_length (package_ids);
- if (length > PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS) {
- g_set_error (&error,
- PK_TRANSACTION_ERROR,
- PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
- "Too many packages to process (%i/%i)",
- length, PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS);
- pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR);
- goto out;
- }
-
/* check package_ids */
ret = pk_package_ids_check (package_ids);
if (!ret) {
@@ -3466,18 +3399,6 @@ pk_transaction_required_by (PkTransaction *transaction,
goto out;
}
- /* check for length sanity */
- length = g_strv_length (package_ids);
- if (length > PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS) {
- g_set_error (&error,
- PK_TRANSACTION_ERROR,
- PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
- "Too many packages to process (%i/%i)",
- length, PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS);
- pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR);
- goto out;
- }
-
/* check package_ids */
ret = pk_package_ids_check (package_ids);
if (!ret) {
@@ -3530,18 +3451,6 @@ pk_transaction_get_update_detail (PkTransaction *transaction,
goto out;
}
- /* check for length sanity */
- length = g_strv_length (package_ids);
- if (length > PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS) {
- g_set_error (&error,
- PK_TRANSACTION_ERROR,
- PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
- "Too many packages to process (%i/%i)",
- length, PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS);
- pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR);
- goto out;
- }
-
/* check package_ids */
ret = pk_package_ids_check (package_ids);
if (!ret) {
@@ -3770,18 +3679,6 @@ pk_transaction_install_packages (PkTransaction *transaction,
goto out;
}
- /* check for length sanity */
- length = g_strv_length (package_ids);
- if (length > PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS) {
- g_set_error (&error,
- PK_TRANSACTION_ERROR,
- PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
- "Too many packages to process (%i/%i)",
- length, PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS);
- pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR);
- goto out;
- }
-
/* check package_ids */
ret = pk_package_ids_check (package_ids);
if (!ret) {
@@ -3969,18 +3866,6 @@ pk_transaction_remove_packages (PkTransaction *transaction,
goto out;
}
- /* check for length sanity */
- length = g_strv_length (package_ids);
- if (length > PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS) {
- g_set_error (&error,
- PK_TRANSACTION_ERROR,
- PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
- "Too many packages to process (%i/%i)",
- length, PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS);
- pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR);
- goto out;
- }
-
/* check package_ids */
ret = pk_package_ids_check (package_ids);
if (!ret) {
@@ -4659,18 +4544,6 @@ pk_transaction_update_packages (PkTransaction *transaction,
goto out;
}
- /* check for length sanity */
- length = g_strv_length (package_ids);
- if (length > PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS) {
- g_set_error (&error,
- PK_TRANSACTION_ERROR,
- PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
- "Too many packages to process (%i/%i)",
- length, PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS);
- pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR);
- goto out;
- }
-
/* check package_ids */
ret = pk_package_ids_check (package_ids);
if (!ret) {