summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-08-30 11:57:14 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2010-08-30 11:57:14 +0200
commit4cb0cd1648e4a2623cb00a11b2db2649e286706d (patch)
treef629993a945f63f26629affba9feac011e594eb3 /apt-pkg
parent61110beb5f398b7f83fa8135bd4e04294ea408b4 (diff)
parentba91b1518a1208fecc1ca076fd9cfbd28344b5b3 (diff)
merged lp:~donkult/apt/sid
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/configuration.cc14
-rw-r--r--apt-pkg/contrib/configuration.h1
-rw-r--r--apt-pkg/contrib/fileutl.cc3
-rw-r--r--apt-pkg/depcache.cc11
-rw-r--r--apt-pkg/depcache.h2
-rw-r--r--apt-pkg/versionmatch.cc9
6 files changed, 31 insertions, 9 deletions
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc
index 81cc87d15..cc7093fe2 100644
--- a/apt-pkg/contrib/configuration.cc
+++ b/apt-pkg/contrib/configuration.cc
@@ -857,19 +857,27 @@ Configuration::MatchAgainstConfig::MatchAgainstConfig(char const * Config)
{
regfree(p);
delete p;
+ clearPatterns();
_error->Warning("Regex compilation error for '%s' in configuration option '%s'",
s->c_str(), Config);
+ return;
}
- }
-
+ }
+ if (strings.size() == 0)
+ patterns.push_back(NULL);
}
/*}}}*/
// MatchAgainstConfig Destructor /*{{{*/
Configuration::MatchAgainstConfig::~MatchAgainstConfig()
{
+ clearPatterns();
+}
+void Configuration::MatchAgainstConfig::clearPatterns()
+{
for(std::vector<regex_t *>::const_iterator p = patterns.begin();
p != patterns.end(); ++p)
{
+ if (*p == NULL) continue;
regfree(*p);
delete *p;
}
@@ -880,7 +888,7 @@ bool Configuration::MatchAgainstConfig::Match(char const * str) const
{
for(std::vector<regex_t *>::const_iterator p = patterns.begin();
p != patterns.end(); ++p)
- if (regexec(*p, str, 0, 0, 0) == 0)
+ if (*p != NULL && regexec(*p, str, 0, 0, 0) == 0)
return true;
return false;
diff --git a/apt-pkg/contrib/configuration.h b/apt-pkg/contrib/configuration.h
index cbe18e4e5..175c1bef3 100644
--- a/apt-pkg/contrib/configuration.h
+++ b/apt-pkg/contrib/configuration.h
@@ -109,6 +109,7 @@ class Configuration
class MatchAgainstConfig
{
std::vector<regex_t *> patterns;
+ void clearPatterns();
public:
MatchAgainstConfig(char const * Config);
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 91aecee65..2b73d1424 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -309,7 +309,8 @@ std::vector<string> GetListOfFilesInDir(string const &Dir, std::vector<string> c
{
if (Debug == true)
std::clog << "Bad file: " << Ent->d_name << " → no extension" << std::endl;
- _error->Notice("Ignoring file '%s' in directory '%s' as it has no filename extension", Ent->d_name, Dir.c_str());
+ if (SilentIgnore.Match(Ent->d_name) == false)
+ _error->Notice("Ignoring file '%s' in directory '%s' as it has no filename extension", Ent->d_name, Dir.c_str());
continue;
}
}
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 00bf68af1..018b05e65 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1149,7 +1149,7 @@ void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge,
return;
if (DebugMarker == true)
- std::clog << OutputInDepth(Depth) << "MarkDelete " << Pkg << " FU=" << FromUser << std::endl;
+ std::clog << OutputInDepth(Depth) << (rPurge ? "MarkPurge " : "MarkDelete ") << Pkg << " FU=" << FromUser << std::endl;
RemoveSizes(Pkg);
RemoveStates(Pkg);
@@ -1167,6 +1167,15 @@ void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge,
// if we remove the pseudo package, we also need to remove the "real"
if (Pkg->CurrentVer != 0 && Pkg.CurrentVer().Pseudo() == true)
MarkDelete(Pkg.Group().FindPkg("all"), rPurge, Depth+1, FromUser);
+ else if (rPurge == true && Pkg->CurrentVer == 0 &&
+ Pkg->CurrentState != pkgCache::State::NotInstalled &&
+ strcmp(Pkg.Arch(), "all") != 0)
+ {
+ PkgIterator const allPkg = Pkg.Group().FindPkg("all");
+ if (allPkg.end() == false && allPkg->CurrentVer == 0 &&
+ allPkg->CurrentState != pkgCache::State::NotInstalled)
+ MarkDelete(allPkg, rPurge, Depth+1, FromUser);
+ }
}
/*}}}*/
// DepCache::IsDeleteOk - check if it is ok to remove this package /*{{{*/
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h
index 45276dc95..08e683558 100644
--- a/apt-pkg/depcache.h
+++ b/apt-pkg/depcache.h
@@ -186,7 +186,7 @@ class pkgDepCache : protected pkgCache::Namespace
class DefaultRootSetFunc : public InRootSetFunc, public Configuration::MatchAgainstConfig
{
public:
- DefaultRootSetFunc() : Configuration::MatchAgainstConfig("APT::NeverRemove") {};
+ DefaultRootSetFunc() : Configuration::MatchAgainstConfig("APT::NeverAutoRemove") {};
virtual ~DefaultRootSetFunc() {};
bool InRootSet(const pkgCache::PkgIterator &pkg) { return pkg.end() == true && Match(pkg.Name()); };
diff --git a/apt-pkg/versionmatch.cc b/apt-pkg/versionmatch.cc
index 093180f9b..17a54bc4c 100644
--- a/apt-pkg/versionmatch.cc
+++ b/apt-pkg/versionmatch.cc
@@ -118,7 +118,10 @@ pkgVersionMatch::pkgVersionMatch(string Data,MatchType Type) : Type(Type)
if (Type == Origin)
{
- OrSite = Data;
+ if (Data[0] == '"' && Data.end()[-1] == '"')
+ OrSite = Data.substr(1, Data.length() - 2);
+ else
+ OrSite = Data;
return;
}
}
@@ -259,10 +262,10 @@ bool pkgVersionMatch::FileMatch(pkgCache::PkgFileIterator File)
if (Type == Origin)
{
if (OrSite.empty() == false) {
- if (File->Site == 0 || !ExpressionMatches(OrSite, File.Site()))
+ if (File->Site == 0)
return false;
} else // so we are talking about file:// or status file
- if (strcmp(File.Site(),"") == 0 && File->Archive != 0) // skip the status file
+ if (strcmp(File.Site(),"") == 0 && File->Archive != 0 && strcmp(File.Archive(),"now") == 0) // skip the status file
return false;
return (ExpressionMatches(OrSite, File.Site())); /* both strings match */
}