diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2012-02-18 21:20:57 +0100 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2012-02-18 21:20:57 +0100 |
commit | ca5e41fdced7a5566b07dfc2d6adc67d74fa2d93 (patch) | |
tree | 03a16086dcfb3447189c6577cd0606ce412fed93 /cmdline | |
parent | 0c73b84b001028338c0862c045c0cc4e6b191fcb (diff) | |
download | apt-ca5e41fdced7a5566b07dfc2d6adc67d74fa2d93.tar.gz |
improve 'error' message for packages which are only referenced
e.g. in a Depends line and are now requested for removal
Diffstat (limited to 'cmdline')
-rw-r--r-- | cmdline/apt-get.cc | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 42a3929d6..f4ad75d1c 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -713,11 +713,32 @@ public: } virtual pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) { - APT::VersionSet const verset = tryVirtualPackage(Cache, Pkg, APT::VersionSet::NEWEST); - if (verset.empty() == false) - return *(verset.begin()); - if (ShowError == true) - ioprintf(out, _("Virtual packages like '%s' can't be removed\n"), Pkg.FullName(true).c_str()); + if (Pkg->ProvidesList != 0) + { + APT::VersionSet const verset = tryVirtualPackage(Cache, Pkg, APT::VersionSet::NEWEST); + if (verset.empty() == false) + return *(verset.begin()); + if (ShowError == true) + ioprintf(out, _("Virtual packages like '%s' can't be removed\n"), Pkg.FullName(true).c_str()); + } + else + { + pkgCache::GrpIterator Grp = Pkg.Group(); + pkgCache::PkgIterator P = Grp.PackageList(); + for (; P.end() != true; P = Grp.NextPkg(P)) + { + if (P == Pkg) + continue; + if (P->CurrentVer != 0) { + // TRANSLATORS: Note, this is not an interactive question + ioprintf(c1out,_("Package '%s' is not installed, so not removed. Did you mean '%s'?\n"), + Pkg.FullName(true).c_str(), P.FullName(true).c_str()); + break; + } + } + if (P.end() == true) + ioprintf(c1out,_("Package '%s' is not installed, so not removed\n"),Pkg.FullName(true).c_str()); + } return pkgCache::VerIterator(Cache, 0); } |