summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-07-30 12:53:49 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2010-07-30 12:53:49 +0200
commit7abfcfbe8518d1b5cc79e967c3ac16c2f783d6ea (patch)
treed6134e25dad5550e75768f8c9fbaabe75d81e541
parentc39b587209f2c3993123e40d33c85de12180a70c (diff)
parente3326595301fc7bd1ee025a9dbb09ca51a08f5fa (diff)
merged from http://bzr.debian.org/apt/apt/debian-experimental-ma
-rw-r--r--apt-pkg/cacheset.cc18
-rw-r--r--apt-pkg/cacheset.h16
-rw-r--r--apt-pkg/contrib/error.cc16
-rw-r--r--apt-pkg/contrib/error.h16
-rw-r--r--cmdline/apt-cache.cc82
-rw-r--r--debian/changelog42
-rw-r--r--debian/control2
7 files changed, 130 insertions, 62 deletions
diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc
index 84021a2b7..bbfdfd4f2 100644
--- a/apt-pkg/cacheset.cc
+++ b/apt-pkg/cacheset.cc
@@ -437,21 +437,21 @@ pkgCache::VerIterator VersionSet::getInstalledVer(pkgCacheFile &Cache,
pkgCache::PkgIterator CacheSetHelper::canNotFindPkgName(pkgCacheFile &Cache,
std::string const &str) {
if (ShowError == true)
- _error->Error(_("Unable to locate package %s"), str.c_str());
+ _error->Insert(ErrorType, _("Unable to locate package %s"), str.c_str());
return pkgCache::PkgIterator(Cache, 0);
}
/*}}}*/
// canNotFindTask - handle the case no package is found for a task /*{{{*/
PackageSet CacheSetHelper::canNotFindTask(pkgCacheFile &Cache, std::string pattern) {
if (ShowError == true)
- _error->Error(_("Couldn't find task '%s'"), pattern.c_str());
+ _error->Insert(ErrorType, _("Couldn't find task '%s'"), pattern.c_str());
return PackageSet();
}
/*}}}*/
// canNotFindRegEx - handle the case no package is found by a regex /*{{{*/
PackageSet CacheSetHelper::canNotFindRegEx(pkgCacheFile &Cache, std::string pattern) {
if (ShowError == true)
- _error->Error(_("Couldn't find any package by regex '%s'"), pattern.c_str());
+ _error->Insert(ErrorType, _("Couldn't find any package by regex '%s'"), pattern.c_str());
return PackageSet();
}
/*}}}*/
@@ -464,7 +464,7 @@ PackageSet CacheSetHelper::canNotFindPackage(pkgCacheFile &Cache, std::string co
VersionSet CacheSetHelper::canNotFindAllVer(pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg) {
if (ShowError == true)
- _error->Notice(_("Can't select versions from package '%s' as it purely virtual"), Pkg.FullName(true).c_str());
+ _error->Insert(ErrorType, _("Can't select versions from package '%s' as it purely virtual"), Pkg.FullName(true).c_str());
return VersionSet();
}
/*}}}*/
@@ -472,7 +472,7 @@ VersionSet CacheSetHelper::canNotFindAllVer(pkgCacheFile &Cache,
VersionSet CacheSetHelper::canNotFindInstCandVer(pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg) {
if (ShowError == true)
- _error->Error(_("Can't select installed nor candidate version from package '%s' as it has neither of them"), Pkg.FullName(true).c_str());
+ _error->Insert(ErrorType, _("Can't select installed nor candidate version from package '%s' as it has neither of them"), Pkg.FullName(true).c_str());
return VersionSet();
}
/*}}}*/
@@ -480,7 +480,7 @@ VersionSet CacheSetHelper::canNotFindInstCandVer(pkgCacheFile &Cache,
VersionSet CacheSetHelper::canNotFindCandInstVer(pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg) {
if (ShowError == true)
- _error->Error(_("Can't select installed nor candidate version from package '%s' as it has neither of them"), Pkg.FullName(true).c_str());
+ _error->Insert(ErrorType, _("Can't select installed nor candidate version from package '%s' as it has neither of them"), Pkg.FullName(true).c_str());
return VersionSet();
}
/*}}}*/
@@ -488,7 +488,7 @@ VersionSet CacheSetHelper::canNotFindCandInstVer(pkgCacheFile &Cache,
pkgCache::VerIterator CacheSetHelper::canNotFindNewestVer(pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg) {
if (ShowError == true)
- _error->Error(_("Can't select newest version from package '%s' as it is purely virtual"), Pkg.FullName(true).c_str());
+ _error->Insert(ErrorType, _("Can't select newest version from package '%s' as it is purely virtual"), Pkg.FullName(true).c_str());
return pkgCache::VerIterator(Cache, 0);
}
/*}}}*/
@@ -496,7 +496,7 @@ pkgCache::VerIterator CacheSetHelper::canNotFindNewestVer(pkgCacheFile &Cache,
pkgCache::VerIterator CacheSetHelper::canNotFindCandidateVer(pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg) {
if (ShowError == true)
- _error->Error(_("Can't select candidate version from package %s as it has no candidate"), Pkg.FullName(true).c_str());
+ _error->Insert(ErrorType, _("Can't select candidate version from package %s as it has no candidate"), Pkg.FullName(true).c_str());
return pkgCache::VerIterator(Cache, 0);
}
/*}}}*/
@@ -504,7 +504,7 @@ pkgCache::VerIterator CacheSetHelper::canNotFindCandidateVer(pkgCacheFile &Cache
pkgCache::VerIterator CacheSetHelper::canNotFindInstalledVer(pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg) {
if (ShowError == true)
- _error->Error(_("Can't select installed version from package %s as it is not installed"), Pkg.FullName(true).c_str());
+ _error->Insert(ErrorType, _("Can't select installed version from package %s as it is not installed"), Pkg.FullName(true).c_str());
return pkgCache::VerIterator(Cache, 0);
}
/*}}}*/
diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h
index c8c3dd096..3f4f0066b 100644
--- a/apt-pkg/cacheset.h
+++ b/apt-pkg/cacheset.h
@@ -32,7 +32,9 @@ class CacheSetHelper { /*{{{*/
printed out.
*/
public: /*{{{*/
- CacheSetHelper(bool const &ShowError = true) : ShowError(ShowError) {};
+ CacheSetHelper(bool const &ShowError = true,
+ GlobalError::MsgType ErrorType = GlobalError::ERROR) :
+ ShowError(ShowError), ErrorType(ErrorType) {};
virtual ~CacheSetHelper() {};
virtual void showTaskSelection(PackageSet const &pkgset, string const &pattern) {};
@@ -58,9 +60,21 @@ public: /*{{{*/
bool showErrors() const { return ShowError; };
bool showErrors(bool const &newValue) { if (ShowError == newValue) return ShowError; else return ((ShowError = newValue) == false); };
+ GlobalError::MsgType errorType() const { return ErrorType; };
+ GlobalError::MsgType errorType(GlobalError::MsgType const &newValue)
+ {
+ if (ErrorType == newValue) return ErrorType;
+ else {
+ GlobalError::MsgType const &oldValue = ErrorType;
+ ErrorType = newValue;
+ return oldValue;
+ }
+ };
+
/*}}}*/
protected:
bool ShowError;
+ GlobalError::MsgType ErrorType;
}; /*}}}*/
class PackageSet : public std::set<pkgCache::PkgIterator> { /*{{{*/
/** \class APT::PackageSet
diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc
index d63b06d13..e2e8d6e57 100644
--- a/apt-pkg/contrib/error.cc
+++ b/apt-pkg/contrib/error.cc
@@ -92,6 +92,14 @@ bool GlobalError::DebugE(const char *Function,const char *Description,...) {
return InsertErrno(DEBUG, Function, Description, args);
}
/*}}}*/
+// GlobalError::InsertErrno - Get part of the errortype string from errno/*{{{*/
+bool GlobalError::InsertErrno(MsgType const &type, const char *Function,
+ const char *Description,...) {
+ va_list args;
+ va_start(args,Description);
+ return InsertErrno(type, Function, Description, args);
+}
+ /*}}}*/
// GlobalError::InsertErrno - formats an error message with the errno /*{{{*/
bool GlobalError::InsertErrno(MsgType type, const char* Function,
const char* Description, va_list &args) {
@@ -138,6 +146,14 @@ bool GlobalError::Debug(const char *Description,...)
return Insert(DEBUG, Description, args);
}
/*}}}*/
+// GlobalError::Insert - Add a errotype message to the list /*{{{*/
+bool GlobalError::Insert(MsgType const &type, const char *Description,...)
+{
+ va_list args;
+ va_start(args,Description);
+ return Insert(type, Description, args);
+}
+ /*}}}*/
// GlobalError::Insert - Insert a new item at the end /*{{{*/
bool GlobalError::Insert(MsgType type, const char* Description,
va_list &args) {
diff --git a/apt-pkg/contrib/error.h b/apt-pkg/contrib/error.h
index 4af0302c0..ae756dbc4 100644
--- a/apt-pkg/contrib/error.h
+++ b/apt-pkg/contrib/error.h
@@ -114,6 +114,15 @@ public: /*{{{*/
*/
bool DebugE(const char *Function,const char *Description,...) __like_printf(3) __cold;
+ /** \brief adds an errno message with the given type
+ *
+ * \param type of the error message
+ * \param Function which failed
+ * \param Description of the error
+ */
+ bool InsertErrno(MsgType const &type, const char* Function,
+ const char* Description,...) __like_printf(4) __cold;
+
/** \brief add an fatal error message to the list
*
* Most of the stuff we consider as "error" is also "fatal" for
@@ -169,6 +178,13 @@ public: /*{{{*/
*/
bool Debug(const char *Description,...) __like_printf(2) __cold;
+ /** \brief adds an error message with the given type
+ *
+ * \param type of the error message
+ * \param Description of the error
+ */
+ bool Insert(MsgType const &type, const char* Description,...) __like_printf(3) __cold;
+
/** \brief is an error in the list?
*
* \return \b true if an error is included in the list, \b false otherwise
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index 70732e4d0..6813d2978 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -46,6 +46,29 @@
using namespace std;
+// CacheSetHelper saving virtual packages /*{{{*/
+class CacheSetHelperVirtuals: public APT::CacheSetHelper {
+public:
+ APT::PackageSet virtualPkgs;
+
+ virtual pkgCache::VerIterator canNotFindCandidateVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) {
+ virtualPkgs.insert(Pkg);
+ return CacheSetHelper::canNotFindCandidateVer(Cache, Pkg);
+ }
+
+ virtual pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) {
+ virtualPkgs.insert(Pkg);
+ return CacheSetHelper::canNotFindNewestVer(Cache, Pkg);
+ }
+
+ virtual APT::VersionSet canNotFindAllVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) {
+ virtualPkgs.insert(Pkg);
+ return CacheSetHelper::canNotFindAllVer(Cache, Pkg);
+ }
+
+ CacheSetHelperVirtuals(bool const &ShowErrors = true, GlobalError::MsgType const &ErrorType = GlobalError::NOTICE) : CacheSetHelper(ShowErrors, ErrorType) {}
+};
+ /*}}}*/
// LocalitySort - Sort a version list by package file locality /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -173,7 +196,9 @@ bool UnMet(CommandLine &CmdL)
}
else
{
- APT::VersionSet verset = APT::VersionSet::FromCommandLine(CacheFile, CmdL.FileList + 1);
+ CacheSetHelperVirtuals helper(true, GlobalError::NOTICE);
+ APT::VersionSet verset = APT::VersionSet::FromCommandLine(CacheFile, CmdL.FileList + 1,
+ APT::VersionSet::CANDIDATE, helper);
for (APT::VersionSet::iterator V = verset.begin(); V != verset.end(); ++V)
if (ShowUnMet(V, Important) == false)
return false;
@@ -187,7 +212,8 @@ bool UnMet(CommandLine &CmdL)
bool DumpPackage(CommandLine &CmdL)
{
pkgCacheFile CacheFile;
- APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1);
+ APT::CacheSetHelper helper(true, GlobalError::NOTICE);
+ APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1, helper);
for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
{
@@ -552,22 +578,6 @@ bool DumpAvail(CommandLine &Cmd)
}
/*}}}*/
// ShowDepends - Helper for printing out a dependency tree /*{{{*/
-class CacheSetHelperDepends: public APT::CacheSetHelper {
-public:
- APT::PackageSet virtualPkgs;
-
- virtual pkgCache::VerIterator canNotFindCandidateVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) {
- virtualPkgs.insert(Pkg);
- return pkgCache::VerIterator(Cache, 0);
- }
-
- virtual pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) {
- virtualPkgs.insert(Pkg);
- return pkgCache::VerIterator(Cache, 0);
- }
-
- CacheSetHelperDepends() : CacheSetHelper(false) {}
-};
bool ShowDepends(CommandLine &CmdL, bool const RevDepends)
{
pkgCacheFile CacheFile;
@@ -575,7 +585,7 @@ bool ShowDepends(CommandLine &CmdL, bool const RevDepends)
if (unlikely(Cache == NULL))
return false;
- CacheSetHelperDepends helper;
+ CacheSetHelperVirtuals helper(false);
APT::VersionSet verset = APT::VersionSet::FromCommandLine(CacheFile, CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper);
if (verset.empty() == true && helper.virtualPkgs.empty() == true)
return false;
@@ -754,11 +764,12 @@ bool XVcg(CommandLine &CmdL)
}
// Load the list of packages from the command line into the show list
+ APT::CacheSetHelper helper(true, GlobalError::NOTICE);
std::list<APT::PackageSet::Modifier> mods;
mods.push_back(APT::PackageSet::Modifier(0, ",", APT::PackageSet::Modifier::POSTFIX));
mods.push_back(APT::PackageSet::Modifier(1, "^", APT::PackageSet::Modifier::POSTFIX));
std::map<unsigned short, APT::PackageSet> pkgsets =
- APT::PackageSet::GroupedFromCommandLine(CacheFile, CmdL.FileList + 1, mods, 0);
+ APT::PackageSet::GroupedFromCommandLine(CacheFile, CmdL.FileList + 1, mods, 0, helper);
for (APT::PackageSet::const_iterator Pkg = pkgsets[0].begin();
Pkg != pkgsets[0].end(); ++Pkg)
@@ -968,11 +979,12 @@ bool Dotty(CommandLine &CmdL)
}
// Load the list of packages from the command line into the show list
+ APT::CacheSetHelper helper(true, GlobalError::NOTICE);
std::list<APT::PackageSet::Modifier> mods;
mods.push_back(APT::PackageSet::Modifier(0, ",", APT::PackageSet::Modifier::POSTFIX));
mods.push_back(APT::PackageSet::Modifier(1, "^", APT::PackageSet::Modifier::POSTFIX));
std::map<unsigned short, APT::PackageSet> pkgsets =
- APT::PackageSet::GroupedFromCommandLine(CacheFile, CmdL.FileList + 1, mods, 0);
+ APT::PackageSet::GroupedFromCommandLine(CacheFile, CmdL.FileList + 1, mods, 0, helper);
for (APT::PackageSet::const_iterator Pkg = pkgsets[0].begin();
Pkg != pkgsets[0].end(); ++Pkg)
@@ -1403,16 +1415,22 @@ bool ShowAuto(CommandLine &CmdL)
bool ShowPackage(CommandLine &CmdL)
{
pkgCacheFile CacheFile;
+ CacheSetHelperVirtuals helper(true, GlobalError::NOTICE);
APT::VersionSet::Version const select = _config->FindB("APT::Cache::AllVersions", true) ?
APT::VersionSet::ALL : APT::VersionSet::CANDIDATE;
- APT::VersionSet const verset = APT::VersionSet::FromCommandLine(CacheFile, CmdL.FileList + 1, select);
+ APT::VersionSet const verset = APT::VersionSet::FromCommandLine(CacheFile, CmdL.FileList + 1, select, helper);
for (APT::VersionSet::const_iterator Ver = verset.begin(); Ver != verset.end(); ++Ver)
if (DisplayRecord(CacheFile, Ver) == false)
return false;
- if (verset.empty() == false)
- return true;
- return _error->Error(_("No packages found"));
+ if (verset.empty() == true)
+ {
+ if (helper.virtualPkgs.empty() == true)
+ return _error->Error(_("No packages found"));
+ else
+ _error->Notice(_("No packages found"));
+ }
+ return true;
}
/*}}}*/
// ShowPkgNames - Show package names /*{{{*/
@@ -1485,10 +1503,10 @@ bool ShowSrcPackage(CommandLine &CmdL)
_error->Warning(_("Unable to locate package %s"),*I);
continue;
}
- }
- if (found > 0)
- return true;
- return _error->Error(_("No packages found"));
+ }
+ if (found == 0)
+ _error->Notice(_("No packages found"));
+ return true;
}
/*}}}*/
// Policy - Show the results of the preferences file /*{{{*/
@@ -1564,7 +1582,8 @@ bool Policy(CommandLine &CmdL)
(InstalledLessCandidate > 0 ? (InstalledLessCandidate) : 0) - 1;
// Print out detailed information for each package
- APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1);
+ APT::CacheSetHelper helper(true, GlobalError::NOTICE);
+ APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1, helper);
for (APT::PackageSet::const_iterator I = pkgset.begin(); I != pkgset.end(); ++I)
{
pkgCache::PkgIterator Pkg = I.Group().FindPkg("any");
@@ -1644,7 +1663,8 @@ bool Madison(CommandLine &CmdL)
if (_error->PendingError() == true)
_error->Discard();
- APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1);
+ APT::CacheSetHelper helper(true, GlobalError::NOTICE);
+ APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1, helper);
for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
{
if (Pkg.end() == false)
diff --git a/debian/changelog b/debian/changelog
index 928a4b3d8..5f80dfb0c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,22 +1,4 @@
-apt (0.7.26~exp11ubuntu3) maverick; urgency=low
-
- * debian/control:
- - add dependency on zlib-dev for libapt-pkg-dev
- * apt-pkg/cacheset.cc:
- - make CacheSetHelper::canNotFindAllVer display a notice
- only (for compat reasons). Otherwise tools like sbuild
- blow up
-
- -- Michael Vogt <michael.vogt@ubuntu.com> Fri, 30 Jul 2010 08:57:15 +0200
-
-apt (0.7.26~exp11ubuntu2) maverick; urgency=low
-
- * remove debian-archive-keyring dependency and readd
- recommends to the ubuntu-keyring
-
- -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 29 Jul 2010 20:02:39 +0200
-
-apt (0.7.26~exp11ubuntu1) maverick; urgency=low
+apt (0.7.26~exp12ubuntu1) maverick; urgency=low
* ABI break upload
* merged from debian/experimental, remaining changes:
@@ -28,7 +10,27 @@ apt (0.7.26~exp11ubuntu1) maverick; urgency=low
* debian/apt.postinst
- drop set_apt_proxy_from_gconf(), no longer needed in maverick
- -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 29 Jul 2010 17:03:48 +0200
+ -- Michael Vogt <michael.vogt@ubuntu.com> Fri, 30 Jul 2010 12:53:21 +0200
+
+apt (0.7.26~exp12) experimental; urgency=low
+
+ [ Michael Vogt ]
+ * debian/control:
+ - add dependency on zlib-dev for libapt-pkg-dev
+
+ [ David Kalnischkies ]
+ * apt-pkg/cacheset.cc:
+ - [ABI BREAK] add an ErrorType option to CacheSetHelper
+ * cmdline/apt-cache.cc:
+ - use Notice instead of Error in the CacheSetHelper messages
+ for compat reasons. Otherwise tools like sbuild blow up
+ - return success in show if a virtual package was given
+ * debian/control:
+ - remove libcurl3-gnutls-dev alternative as the package is gone
+ - increase needed version of libcurl4-gnutls-dev to >= 7.19.0
+ as we use CURLOPT_{ISSUERCERT,CRLFILE} (Closes: #589642)
+
+ -- Michael Vogt <mvo@debian.org> Fri, 30 Jul 2010 11:55:48 +0200
apt (0.7.26~exp11) experimental; urgency=low
diff --git a/debian/control b/debian/control
index 7b3292ffb..534473a29 100644
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,7 @@ Uploaders: Michael Vogt <mvo@debian.org>, Otavio Salvador <otavio@debian.org>,
Christian Perrier <bubulle@debian.org>, Daniel Burrows <dburrows@debian.org>,
Luca Bruno <lethalman88@gmail.com>, Julian Andres Klode <jak@debian.org>
Standards-Version: 3.9.0
-Build-Depends: debhelper (>= 5.0), libdb-dev, gettext (>= 0.12), libcurl4-gnutls-dev | libcurl3-gnutls-dev (>= 7.15.5), zlib1g-dev | libz-dev, debiandoc-sgml, xsltproc, docbook-xsl, po4a (>= 0.34-2), autotools-dev, autoconf, automake, doxygen
+Build-Depends: debhelper (>= 5.0), libdb-dev, gettext (>= 0.12), libcurl4-gnutls-dev (>= 7.19.0), zlib1g-dev | libz-dev, debiandoc-sgml, xsltproc, docbook-xsl, po4a (>= 0.34-2), autotools-dev, autoconf, automake, doxygen
Build-Conflicts: autoconf2.13, automake1.4
Vcs-Bzr: http://bzr.debian.org/apt/debian-sid/