diff options
Diffstat (limited to 'cmdline')
-rw-r--r-- | cmdline/apt-get.cc | 1 | ||||
-rw-r--r-- | cmdline/apt-mark.cc | 30 |
2 files changed, 21 insertions, 10 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 5d81c08a4..efb5cfd73 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -42,7 +42,6 @@ #include <apt-pkg/indexfile.h> #include <apt-pkg/init.h> #include <apt-pkg/macros.h> -#include <apt-pkg/md5.h> #include <apt-pkg/metaindex.h> #include <apt-pkg/pkgcache.h> #include <apt-pkg/pkgrecords.h> diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc index 942f58f0f..92efa0c81 100644 --- a/cmdline/apt-mark.cc +++ b/cmdline/apt-mark.cc @@ -56,7 +56,8 @@ static bool DoAuto(CommandLine &CmdL) return _error->Error(_("No packages found")); bool MarkAuto = strcasecmp(CmdL.FileList[0],"auto") == 0; - int AutoMarkChanged = 0; + + vector<string> PackagesMarked; for (APT::PackageList::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg) { @@ -74,16 +75,27 @@ static bool DoAuto(CommandLine &CmdL) continue; } - if (MarkAuto == false) - ioprintf(c1out,_("%s set to manually installed.\n"), Pkg.FullName(true).c_str()); - else - ioprintf(c1out,_("%s set to automatically installed.\n"), Pkg.FullName(true).c_str()); - + PackagesMarked.push_back(Pkg.FullName(true)); DepCache->MarkAuto(Pkg, MarkAuto); - ++AutoMarkChanged; } - if (AutoMarkChanged > 0 && _config->FindB("APT::Mark::Simulate", false) == false) - return DepCache->writeStateFile(NULL); + + bool MarkWritten = false; + bool IsSimulation = _config->FindB("APT::Mark::Simulate", false); + if (PackagesMarked.size() > 0 && !IsSimulation) { + MarkWritten = DepCache->writeStateFile(NULL); + if(!MarkWritten) { + return MarkWritten; + } + } + + if(IsSimulation || MarkWritten) { + for (vector<string>::const_iterator I = PackagesMarked.begin(); I != PackagesMarked.end(); ++I) { + if (MarkAuto == false) + ioprintf(c1out,_("%s set to manually installed.\n"), (*I).c_str()); + else + ioprintf(c1out,_("%s set to automatically installed.\n"), (*I).c_str()); + } + } return true; } /*}}}*/ |