Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

Commit

Permalink
support APT::Get::Build-Dep-Automatic again in build-dep
Browse files Browse the repository at this point in the history
In a249b3e I dropped with the manual
first resolver step also the support for installing build-deps as
automatic in such a way that it behaved like this option was enabled by
default.

Restoring support for it means that we go back to mark build-
dependencies as manually installed again by default and provide this
option to keep them as automatically installed.
  • Loading branch information
DonKult committed Mar 6, 2016
1 parent a66e183 commit c97ae2a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
23 changes: 23 additions & 0 deletions apt-private/private-source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,31 @@ bool DoBuildDep(CommandLine &CmdL)
}
if (DoAutomaticRemove(Cache) == false)
return false;

{
pkgDepCache::ActionGroup group(Cache);
if (_config->FindB("APT::Get::Build-Dep-Automatic", false) == false)
{
for (auto const &pkg: removeAgain)
{
auto const instVer = Cache[pkg].InstVerIter(Cache);
if (unlikely(instVer.end() == true))
continue;
for (auto D = instVer.DependsList(); D.end() != true; ++D)
{
if (D->Type != pkgCache::Dep::Depends || D.IsMultiArchImplicit())
continue;
APT::VersionList verlist = APT::VersionList::FromDependency(Cache, D, APT::CacheSetHelper::CANDIDATE);
for (auto const &V : verlist)
{
auto const P = V.ParentPkg();
if (Cache[P].InstallVer != V)
continue;
Cache->MarkAuto(P, false);
}
}
}
}
for (auto const &pkg: removeAgain)
Cache->MarkDelete(pkg, false, 0, true);
}
Expand Down
24 changes: 24 additions & 0 deletions test/integration/test-bug-720597-build-dep-purge
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,27 @@ The following NEW packages will be installed:
Purg pkga [1]
Inst pkgb (1 stable [amd64])
Conf pkgb (1 stable [amd64])' aptget build-dep pkgc -s --purge

testsuccessequal 'Reading package lists...
Building dependency tree...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' apt autoremove -s
testdpkgnotinstalled pkgb
testsuccess apt build-dep pkgc -y -o Debug::pkgDepCache::AutoInstall=1 -o Debug::pkgDepCache::Marker=1
testdpkginstalled pkgb
testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' apt autoremove -s
testsuccess apt purge pkgb pkgc -y
testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' apt autoremove -s
testsuccess apt build-dep pkgc -y -o APT::Get::Build-Dep-Automatic=true
testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
pkgb
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Remv pkgb [1]' apt autoremove -s

0 comments on commit c97ae2a

Please sign in to comment.