summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2024-04-26 11:01:17 +0000
committerJulian Andres Klode <jak@debian.org>2024-04-26 11:01:17 +0000
commit05a1ee0cf4d5948ec2a084629bb9712af7d9c475 (patch)
tree91bab74096260d12d8f4a2300bcd84f3bdb17b99 /apt-pkg
parentedfbc3869361f709d70794a794199ac2076ea9f1 (diff)
parent7a1063e81b855ac7ff9ee54f115843c3af6dd1bf (diff)
Merge branch 'fix/mixed' into 'main'
Split out of mostly independent fixes: cmake execute errors, removed rev-deps, protected garbage & co See merge request apt-team/apt!345
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/CMakeLists.txt12
-rw-r--r--apt-pkg/depcache.cc7
2 files changed, 13 insertions, 6 deletions
diff --git a/apt-pkg/CMakeLists.txt b/apt-pkg/CMakeLists.txt
index d13aed96c..63052faad 100644
--- a/apt-pkg/CMakeLists.txt
+++ b/apt-pkg/CMakeLists.txt
@@ -3,7 +3,8 @@ include_directories(${PROJECT_BINARY_DIR}/include/apt-pkg)
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/include/apt-pkg/)
execute_process(COMMAND grep -v "^#" "${CMAKE_CURRENT_SOURCE_DIR}/tagfile-keys.list"
- OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/tagfile-keys.clean.list")
+ OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/tagfile-keys.clean.list"
+ COMMAND_ERROR_IS_FATAL ANY)
execute_process(COMMAND ${TRIEHASH_EXECUTABLE}
--ignore-case
--header ${PROJECT_BINARY_DIR}/include/apt-pkg/tagfile-keys.h
@@ -13,7 +14,8 @@ execute_process(COMMAND ${TRIEHASH_EXECUTABLE}
--function-name pkgTagHash
--include "<apt-pkg/tagfile.h>"
--include "<apt-pkg/header-is-private.h>"
- "${CMAKE_CURRENT_BINARY_DIR}/tagfile-keys.clean.list")
+ "${CMAKE_CURRENT_BINARY_DIR}/tagfile-keys.clean.list"
+ COMMAND_ERROR_IS_FATAL ANY)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "tagfile-keys.list")
set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/tagfile-keys.cc" PROPERTIES COMPILE_DEFINITIONS APT_COMPILING_APT)
@@ -22,11 +24,13 @@ set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/tagfile-keys.cc" PROPER
execute_process(COMMAND awk -v ORS=. "/^\#define APT_PKG_M/ {print \$3}"
COMMAND sed "s/\\.\$//"
INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/contrib/macros.h
- OUTPUT_VARIABLE MAJOR OUTPUT_STRIP_TRAILING_WHITESPACE)
+ OUTPUT_VARIABLE MAJOR OUTPUT_STRIP_TRAILING_WHITESPACE
+ COMMAND_ERROR_IS_FATAL ANY)
execute_process(COMMAND grep "^#define APT_PKG_RELEASE"
COMMAND cut -d " " -f 3
INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/contrib/macros.h
- OUTPUT_VARIABLE MINOR OUTPUT_STRIP_TRAILING_WHITESPACE)
+ OUTPUT_VARIABLE MINOR OUTPUT_STRIP_TRAILING_WHITESPACE
+ COMMAND_ERROR_IS_FATAL ANY)
message(STATUS "Building libapt-pkg ${MAJOR} (release ${MINOR})")
set(APT_PKG_MAJOR ${MAJOR} PARENT_SCOPE) # exporting for methods/CMakeLists.txt
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 76a5c09ba..72cbf8dcc 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1463,7 +1463,7 @@ static bool MarkInstall_RemoveConflictsIfNotUpgradeable(pkgDepCache &Cache, bool
return not failedToRemoveSomething;
}
/*}}}*/
-static bool MarkInstall_CollectReverseDepends(pkgDepCache &Cache, bool const DebugAutoInstall, pkgCache::VerIterator const &PV, unsigned long Depth, APT::PackageVector &toUpgrade) /*{{{*/
+static bool MarkInstall_CollectReverseDepends(pkgDepCache &Cache, bool const DebugAutoInstall, pkgCache::VerIterator const &PV, unsigned long Depth, APT::PackageVector &toUpgrade, APT::PackageVector const &delayedRemove) /*{{{*/
{
auto CurrentVer = PV.ParentPkg().CurrentVer();
if (CurrentVer.end())
@@ -1474,6 +1474,9 @@ static bool MarkInstall_CollectReverseDepends(pkgDepCache &Cache, bool const Deb
// Skip non-installed versions and packages already marked for upgrade
if (ParentPkg.CurrentVer() != D.ParentVer() || Cache[ParentPkg].Install())
continue;
+ // Skip rev-depends we already tagged for removal
+ if (Cache[ParentPkg].Delete() || std::find(delayedRemove.begin(), delayedRemove.end(), ParentPkg) != delayedRemove.end())
+ continue;
// We only handle important positive dependencies, RemoveConflictsIfNotUpgradeable handles negative
if (not Cache.IsImportantDep(D) || D.IsNegative())
continue;
@@ -1722,7 +1725,7 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg, bool AutoInst,
return false;
hasFailed = true;
}
- if (not MarkInstall_CollectReverseDepends(*this, DebugAutoInstall, PV, Depth, toUpgrade))
+ if (not MarkInstall_CollectReverseDepends(*this, DebugAutoInstall, PV, Depth, toUpgrade, delayedRemove))
{
if (failEarly)
return false;