diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2007-03-14 13:10:42 +0100 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2007-03-14 13:10:42 +0100 |
commit | 7db98f31498a85da22cc00e446bce8ac8c319554 (patch) | |
tree | a2800f5c2018c6543a0f3af260988816526dc778 /cmdline | |
parent | e6065cfcf0b5c6a57aa582cb3c2bd2b3fafe64b7 (diff) |
* cmdline/apt-get.cc:
- "apt-get install foo" on a already installed package foo will
clean the automatic installed flag
Diffstat (limited to 'cmdline')
-rw-r--r-- | cmdline/apt-get.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 4ffb9414b..430b1bccb 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1556,6 +1556,7 @@ bool DoInstall(CommandLine &CmdL) if (Cache->BrokenCount() != 0) BrokenFix = true; + unsigned int AutoMarkChanged = 0; unsigned int ExpectedInst = 0; unsigned int Packages = 0; pkgProblemResolver Fix(Cache); @@ -1692,6 +1693,18 @@ bool DoInstall(CommandLine &CmdL) return false; if (TryToInstall(Pkg,Cache,Fix,Remove,BrokenFix,ExpectedInst) == false) return false; + + // see if we need to fix the auto-mark flag + // e.g. apt-get install foo + // where foo is marked automatic + if(Cache[Pkg].Install() == false && + (Cache[Pkg].Flags & pkgCache::Flag::Auto)) + { + ioprintf(c1out,_("%s set to manual installed.\n"), + Pkg.Name()); + Cache->MarkAuto(Pkg,false); + AutoMarkChanged++; + } } } @@ -1854,6 +1867,14 @@ bool DoInstall(CommandLine &CmdL) } + // if nothing changed in the cache, but only the automark information + // we write the StateFile here, otherwise it will be written in + // cache.commit() + if (AutoMarkChanged > 0 && + Cache->DelCount() == 0 && Cache->InstCount() == 0 && + Cache->BadCount() == 0) + Cache->writeStateFile(NULL); + // See if we need to prompt if (Cache->InstCount() == ExpectedInst && Cache->DelCount() == 0) return InstallPackages(Cache,false,false); |