summaryrefslogtreecommitdiff
path: root/apt-pkg/deb
diff options
context:
space:
mode:
authorMichael Vogt <mvo@ubuntu.com>2014-11-03 08:59:19 +0100
committerMichael Vogt <mvo@ubuntu.com>2014-11-03 08:59:19 +0100
commit26f6e9b4c32c937d5a138404a9c1b94809c3afd6 (patch)
tree5208d66e39a8c61ba9e9ade61dc1c03f0711d475 /apt-pkg/deb
parent0c535a8aedc34705ed115754796856a2b5d92a08 (diff)
parent28460cb27846b2437010b08adf10bde18e370974 (diff)
Merge branch 'debian/sid' into ubuntu/master
Conflicts: debian/changelog
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r--apt-pkg/deb/deblistparser.cc130
-rw-r--r--apt-pkg/deb/dpkgpm.cc23
2 files changed, 94 insertions, 59 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 7d4fd52cf..4eef66c2b 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -338,13 +338,9 @@ unsigned short debListParser::VersionHash()
/* Status lines are of the form,
Status: want flag status
want = unknown, install, hold, deinstall, purge
- flag = ok, reinstreq, hold, hold-reinstreq
- status = not-installed, unpacked, half-configured,
- half-installed, config-files, post-inst-failed,
- removal-failed, installed
-
- Some of the above are obsolete (I think?) flag = hold-* and
- status = post-inst-failed, removal-failed at least.
+ flag = ok, reinstreq
+ status = not-installed, config-files, half-installed, unpacked,
+ half-configured, triggers-awaited, triggers-pending, installed
*/
bool debListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
pkgCache::VerIterator &Ver)
@@ -401,15 +397,13 @@ bool debListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
// Process the flag field
WordList StatusList[] = {{"not-installed",pkgCache::State::NotInstalled},
+ {"config-files",pkgCache::State::ConfigFiles},
+ {"half-installed",pkgCache::State::HalfInstalled},
{"unpacked",pkgCache::State::UnPacked},
{"half-configured",pkgCache::State::HalfConfigured},
- {"installed",pkgCache::State::Installed},
- {"half-installed",pkgCache::State::HalfInstalled},
- {"config-files",pkgCache::State::ConfigFiles},
{"triggers-awaited",pkgCache::State::TriggersAwaited},
{"triggers-pending",pkgCache::State::TriggersPending},
- {"post-inst-failed",pkgCache::State::HalfConfigured},
- {"removal-failed",pkgCache::State::HalfInstalled},
+ {"installed",pkgCache::State::Installed},
{NULL, 0}};
if (GrabWord(string(Start,I-Start),StatusList,Pkg->CurrentState) == false)
return _error->Error("Malformed 3rd word in the Status line");
@@ -635,72 +629,94 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
if (ParseRestrictionsList == true)
{
- // Parse a restrictions list
- if (I != Stop && *I == '<')
+ // Parse a restrictions formula which is in disjunctive normal form:
+ // (foo AND bar) OR (blub AND bla)
+
+ std::vector<string> const profiles = APT::Configuration::getBuildProfiles();
+
+ // if the next character is a restriction list, then by default the
+ // dependency does not apply and the conditions have to be checked
+ // if the next character is not a restriction list, then by default the
+ // dependency applies
+ bool applies1 = (*I != '<');
+ while (I != Stop)
{
+ if (*I != '<')
+ break;
+
++I;
// malformed
if (unlikely(I == Stop))
return 0;
- std::vector<string> const profiles = APT::Configuration::getBuildProfiles();
-
const char *End = I;
- bool Found = false;
- bool NegRestriction = false;
- while (I != Stop)
- {
- // look for whitespace or ending '>'
- for (;End != Stop && !isspace(*End) && *End != '>'; ++End);
-
- if (unlikely(End == Stop))
- return 0;
- if (*I == '!')
+ // if of the prior restriction list is already fulfilled, then
+ // we can just skip to the end of the current list
+ if (applies1) {
+ for (;End != Stop && *End != '>'; ++End);
+ I = ++End;
+ // skip whitespace
+ for (;I != Stop && isspace(*I) != 0; I++);
+ } else {
+ bool applies2 = true;
+ // all the conditions inside a restriction list have to be
+ // met so once we find one that is not met, we can skip to
+ // the end of this list
+ while (I != Stop)
{
- NegRestriction = true;
- ++I;
- }
+ // look for whitespace or ending '>'
+ // End now points to the character after the current term
+ for (;End != Stop && !isspace(*End) && *End != '>'; ++End);
- std::string restriction(I, End);
+ if (unlikely(End == Stop))
+ return 0;
- std::string prefix = "profile.";
- // only support for "profile" prefix, ignore others
- if (restriction.size() > prefix.size() &&
- restriction.substr(0, prefix.size()) == prefix)
- {
- // get the name of the profile
- restriction = restriction.substr(prefix.size());
+ bool NegRestriction = false;
+ if (*I == '!')
+ {
+ NegRestriction = true;
+ ++I;
+ }
+
+ std::string restriction(I, End);
if (restriction.empty() == false && profiles.empty() == false &&
- std::find(profiles.begin(), profiles.end(), restriction) != profiles.end())
+ std::find(profiles.begin(), profiles.end(), restriction) != profiles.end())
{
- Found = true;
- if (I[-1] != '!')
- NegRestriction = false;
- // we found a match, so fast-forward to the end of the wildcards
- for (; End != Stop && *End != '>'; ++End);
+ if (NegRestriction) {
+ applies2 = false;
+ // since one of the terms does not apply we don't have to check the others
+ for (; End != Stop && *End != '>'; ++End);
+ }
+ } else {
+ if (!NegRestriction) {
+ applies2 = false;
+ // since one of the terms does not apply we don't have to check the others
+ for (; End != Stop && *End != '>'; ++End);
+ }
+ }
+
+ if (*End++ == '>') {
+ I = End;
+ // skip whitespace
+ for (;I != Stop && isspace(*I) != 0; I++);
+ break;
}
- }
- if (*End++ == '>') {
I = End;
- break;
+ // skip whitespace
+ for (;I != Stop && isspace(*I) != 0; I++);
+ }
+ if (applies2) {
+ applies1 = true;
}
-
- I = End;
- for (;I != Stop && isspace(*I) != 0; I++);
}
-
- if (NegRestriction == true)
- Found = !Found;
-
- if (Found == false)
- Package = ""; /* not for this restriction */
}
- // Skip whitespace
- for (;I != Stop && isspace(*I) != 0; I++);
+ if (applies1 == false) {
+ Package = ""; //not for this restriction
+ }
}
if (I != Stop && *I == '|')
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 04a13a86c..7bbf18cba 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -55,6 +55,18 @@
using namespace std;
+APT_PURE static unsigned int
+EnvironmentSize()
+{
+ unsigned int size = 0;
+ char **envp = environ;
+
+ while (*envp != NULL)
+ size += strlen (*envp++) + 1;
+
+ return size;
+}
+
class pkgDPkgPMPrivate
{
public:
@@ -1236,8 +1248,15 @@ bool pkgDPkgPM::GoNoABIBreak(APT::Progress::PackageManager *progress)
fd_set rfds;
struct timespec tv;
- unsigned int const MaxArgs = _config->FindI("Dpkg::MaxArgs",8*1024);
- unsigned int const MaxArgBytes = _config->FindI("Dpkg::MaxArgBytes",32*1024);
+ // FIXME: do we really need this limit when we have MaxArgBytes?
+ unsigned int const MaxArgs = _config->FindI("Dpkg::MaxArgs",32*1024);
+
+ // try to figure out the max environment size
+ int OSArgMax = sysconf(_SC_ARG_MAX);
+ if(OSArgMax < 0)
+ OSArgMax = 32*1024;
+ OSArgMax -= EnvironmentSize() - 2*1024;
+ unsigned int const MaxArgBytes = _config->FindI("Dpkg::MaxArgBytes", OSArgMax);
bool const NoTriggers = _config->FindB("DPkg::NoTriggers", false);
if (RunScripts("DPkg::Pre-Invoke") == false)