summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2022-07-24 15:44:13 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2022-07-24 15:44:13 +0200
commit518746f7e03115eb7bdf894d23e74ae115c8717b (patch)
treedf3080a1e3c03bb6257cbca2607fe089cacdebbb
parentc4bab3c93567fd5a17652e453d4a65d7c83eb4fb (diff)
Add flag to disable upgrade by source and test case
-rw-r--r--apt-pkg/depcache.cc4
-rw-r--r--doc/examples/configure-index1
-rwxr-xr-xtest/integration/test-apt-get-upgrade-by-source53
3 files changed, 58 insertions, 0 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 6aa1fe946..bc5843153 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1497,6 +1497,10 @@ static bool MarkInstall_UpgradeOrRemoveConflicts(pkgDepCache &Cache, bool const
static bool MarkInstall_UpgradeOtherBinaries(pkgDepCache &Cache, bool const DebugAutoInstall, unsigned long Depth, bool const ForceImportantDeps, pkgCache::PkgIterator Pkg, pkgCache::VerIterator Ver) /*{{{*/
{
APT::PackageSet toUpgrade;
+
+ if (not _config->FindB("APT::Get::Upgrade-By-Source-Package", true))
+ return true;
+
auto SrcGrp = Cache.FindGrp(Ver.SourcePkgName());
for (auto OtherBinary = SrcGrp.VersionsInSource(); not OtherBinary.end(); OtherBinary = OtherBinary.NextInSource())
{
diff --git a/doc/examples/configure-index b/doc/examples/configure-index
index 07feea4dc..b3deccaaf 100644
--- a/doc/examples/configure-index
+++ b/doc/examples/configure-index
@@ -103,6 +103,7 @@ APT
Upgrade "<BOOL>";
Only-Upgrade "<BOOL>";
Upgrade-Allow-New "<BOOL>";
+ Upgrade-By-Source-Package "<BOOL>";
Always-Include-Phased-Updates "<BOOL>";
Never-Include-Phased-Updates "<BOOL>";
Phase-Policy "<BOOL>"; // internal
diff --git a/test/integration/test-apt-get-upgrade-by-source b/test/integration/test-apt-get-upgrade-by-source
new file mode 100755
index 000000000..0f87005d3
--- /dev/null
+++ b/test/integration/test-apt-get-upgrade-by-source
@@ -0,0 +1,53 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+
+setupenvironment
+
+insertinstalledpackage 'pkg' 'all' '1' 'Source: pkg'
+insertinstalledpackage 'pkg-foo' 'all' '1' 'Source: pkg'
+insertinstalledpackage 'pkg-bar' 'all' '1' 'Source: pkg'
+insertpackage 'unstable' 'pkg' 'all' '2' 'Source: pkg'
+insertpackage 'unstable' 'pkg-foo' 'all' '2' 'Source: pkg'
+insertpackage 'unstable' 'pkg-bar' 'all' '2' 'Source: pkg'
+
+configarchitecture 'arm64'
+setupaptarchive
+
+noprogress() {
+ "$@" | sed /^Progress/d
+}
+
+testsuccessequal "Reading package lists...
+Building dependency tree...
+ MarkInstall pkg:arm64 < 1 -> 2 @ii puU > FU=1
+ Upgrading pkg-bar:arm64 < 1 | 2 @ii uH > due to pkg:arm64
+ Upgrading pkg-foo:arm64 < 1 | 2 @ii uH > due to pkg:arm64
+Starting pkgProblemResolver with broken count: 0
+Starting 2 pkgProblemResolver with broken count: 0
+Done
+The following additional packages will be installed:
+ pkg-bar pkg-foo
+The following packages will be upgraded:
+ pkg pkg-bar pkg-foo
+3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Inst pkg [1] (2 unstable [all])
+Inst pkg-bar [1] (2 unstable [all])
+Inst pkg-foo [1] (2 unstable [all])
+Conf pkg (2 unstable [all])
+Conf pkg-bar (2 unstable [all])
+Conf pkg-foo (2 unstable [all])" aptget install pkg -o debug::pkgdepcache::marker=1 -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::AutoInstall=1 -s
+
+testsuccessequal "Reading package lists...
+Building dependency tree...
+ MarkInstall pkg:arm64 < 1 -> 2 @ii puU > FU=1
+Starting pkgProblemResolver with broken count: 0
+Starting 2 pkgProblemResolver with broken count: 0
+Done
+The following packages will be upgraded:
+ pkg
+1 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
+Inst pkg [1] (2 unstable [all])
+Conf pkg (2 unstable [all])" aptget install pkg -o debug::pkgdepcache::marker=1 -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::AutoInstall=1 -o APT::Get::Upgrade-By-Source-Package=0 -s