Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Lachu:SystemServices
PackageKit
n-0089-aptcc-Attempt-to-fix-broken-packages-aga...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File n-0089-aptcc-Attempt-to-fix-broken-packages-again-when-syst.patch of Package PackageKit
From 5259b154a5fa8dffbe80187a0b67d9371e4b24b3 Mon Sep 17 00:00:00 2001 From: Matthias Klumpp <matthias@tenstral.net> Date: Wed, 16 Feb 2022 23:35:12 +0100 Subject: [PATCH 089/102] aptcc: Attempt to fix broken packages again when system repair is requested This will not be used much, as aptcc will always attempt to auto-repair the installation, but there may be some cases where this feature may still be useful to be called explicitly. It also makes the code a bit less confusing. Resolves: #152 diff --git a/backends/aptcc/apt-cache-file.cpp b/backends/aptcc/apt-cache-file.cpp index ceb5f39b7..3216f320d 100644 --- a/backends/aptcc/apt-cache-file.cpp +++ b/backends/aptcc/apt-cache-file.cpp @@ -485,10 +485,21 @@ std::string AptCacheFile::getLongDescriptionParsed(const pkgCache::VerIterator & bool AptCacheFile::tryToInstall(pkgProblemResolver &Fix, const PkgInfo &pki, - bool BrokenFix, bool autoInst, - bool preserveAuto) + bool preserveAuto, + bool fixBroken) { + // attempt to fix broken packages, if requested + if (fixBroken) { + if (!CheckDeps(false)) { + pk_backend_job_error_code(m_job, + PK_ERROR_ENUM_INTERNAL_ERROR, + "Unable to resolve broken packages. Please attempt to resolve this manually, or try " + "`sudo apt -f install`."); + return false; + } + } + pkgCache::PkgIterator Pkg = pki.ver.ParentPkg(); // Check if there is something at all to install diff --git a/backends/aptcc/apt-cache-file.h b/backends/aptcc/apt-cache-file.h index 31337ad49..2deb8f1e9 100644 --- a/backends/aptcc/apt-cache-file.h +++ b/backends/aptcc/apt-cache-file.h @@ -145,7 +145,9 @@ public: bool tryToInstall(pkgProblemResolver &Fix, const PkgInfo &pki, - bool BrokenFix, bool autoInst, bool preserveAuto); + bool autoInst, + bool preserveAuto, + bool fixBroken = false); void tryToRemove(pkgProblemResolver &Fix, const PkgInfo &pki); diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp index d2bd1baa2..0918c7f3c 100644 --- a/backends/aptcc/apt-intf.cpp +++ b/backends/aptcc/apt-intf.cpp @@ -364,7 +364,7 @@ PkgList AptIntf::filterPackages(const PkgList &packages, PkBitfield filters) if (m_cancel) break; - m_cache->tryToInstall(Fix, pki, false, autoInst, false); + m_cache->tryToInstall(Fix, pki, autoInst, false); } } } @@ -2189,9 +2189,9 @@ bool AptIntf::runTransaction(const PkgList &install, const PkgList &remove, cons // Enter the special broken fixing mode if the user specified arguments // THIS mode will run if fixBroken is false and the cache has broken packages - bool BrokenFix = false; + bool attemptFixBroken = false; if ((*m_cache)->BrokenCount() != 0) { - BrokenFix = true; + attemptFixBroken = true; } pkgProblemResolver Fix(*m_cache); @@ -2231,7 +2231,11 @@ bool AptIntf::runTransaction(const PkgList &install, const PkgList &remove, cons if (m_cancel) { break; } - if (!m_cache->tryToInstall(Fix, pkInfo, BrokenFix, autoInst, op.preserveAuto)) { + if (!m_cache->tryToInstall(Fix, + pkInfo, + autoInst, + op.preserveAuto, + attemptFixBroken)) { return false; } } -- 2.35.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor