[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#793360: apt: APT::Never-MarkAuto-Sections not working as advertised



Control: tag -1 patch

On Thu, 23 Jul 2015, Raphaël Hertzog wrote:
> So this is all matching packages not based on the parent that brough the packages in the
> set of packages to install but on the package itself.
> 
> We want direct dependencies of metapackages to be marked as manually installed:
> - when they are installed for the first time
> - when they were already installed formerly as automatic dependency
> - also when they are pulled by a metapackage which is itself a dependency of
>   another metapackage

Here's a possible patch that takes care of at least the first and last
points above. There a certainly cleaner ways to do this test... I used
"P.InstallVer" but one might prefer to use the package owning the
relationship being analyzed too. In any case, testing "InstVer" was
wrong as this refer to the package solving the dependency and not the
package declaring the dependency.

diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 16282df..0b2f71d 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1226,7 +1226,7 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
 	       continue;
 	    }
 	    // now check if we should consider it a automatic dependency or not
-	    if(InstPkg->CurrentVer == 0 && InstVer->Section != 0 && ConfigValueInSubTree("APT::Never-MarkAuto-Sections", InstVer.Section()))
+	    if(P.InstallVer->Section != 0 && ConfigValueInSubTree("APT::Never-MarkAuto-Sections", P.InstVerIter(*this).Section()))
 	    {
 	       if(DebugAutoInstall == true)
 		  std::clog << OutputInDepth(Depth) << "Setting NOT as auto-installed (direct "

I checked that it would not however mark as manually installed a
dependency which is already installed and mark as auto-installed.

It would probably require changes around line 1121 of pt-pkg/depcache.cc
where the dependency analysis is interrupted when the dependency is
satisfied:
      // Dep is satisfied okay.
      if (Result == false)
         continue;

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Support Debian LTS: http://www.freexian.com/services/debian-lts.html
Learn to master Debian: http://debian-handbook.info/get/


Reply to: