summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-07-28 13:57:40 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-07-28 13:57:40 +0200
commitd3d8ed4a439ffaa0cdec7053001f5810016a4c44 (patch)
tree87c15dc6eee06474f151928f863899cdc0403f97 /apt-pkg
parentc6ec544822a6a5db9f8a507b08381f19c8787761 (diff)
parentb20c16833e20da8e367221b32764889cafe5b4c1 (diff)
merged from debian-experimental2
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire-item.cc10
-rw-r--r--apt-pkg/acquire-item.h25
-rw-r--r--apt-pkg/deb/debrecords.cc9
-rw-r--r--apt-pkg/deb/debrecords.h3
-rw-r--r--apt-pkg/depcache.cc4
-rw-r--r--apt-pkg/depcache.h10
-rw-r--r--apt-pkg/pkgrecords.h5
7 files changed, 47 insertions, 19 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index aa77824f8..df83d1481 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -2071,13 +2071,3 @@ string pkgAcqFile::Custom600Headers()
return "";
}
/*}}}*/
-bool IndexTarget::IsOptional() const {
- if (strncmp(ShortDesc.c_str(), "Translation", 11) != 0)
- return false;
- return true;
-}
-bool IndexTarget::IsSubIndex() const {
- if (ShortDesc != "TranslationIndex")
- return false;
- return true;
-}
diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h
index e6916a834..f39a90c0b 100644
--- a/apt-pkg/acquire-item.h
+++ b/apt-pkg/acquire-item.h
@@ -646,8 +646,9 @@ class pkgAcqIndexTrans : public pkgAcqIndex
};
/*}}}*/
/** \brief Information about an index file. */ /*{{{*/
-struct IndexTarget
+class IndexTarget
{
+ public:
/** \brief A URI from which the index file can be downloaded. */
string URI;
@@ -662,14 +663,28 @@ struct IndexTarget
*/
string MetaKey;
- //FIXME: We should use virtual methods here instead…
- bool IsOptional() const;
- bool IsSubIndex() const;
+ virtual bool IsOptional() const {
+ return false;
+ }
+ virtual bool IsSubIndex() const {
+ return false;
+ }
};
/*}}}*/
/** \brief Information about an optional index file. */ /*{{{*/
-struct OptionalIndexTarget : public IndexTarget
+class OptionalIndexTarget : public IndexTarget
+{
+ virtual bool IsOptional() const {
+ return true;
+ }
+};
+ /*}}}*/
+/** \brief Information about an subindex index file. */ /*{{{*/
+class SubIndexTarget : public IndexTarget
{
+ virtual bool IsSubIndex() const {
+ return true;
+ }
};
/*}}}*/
diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc
index 1ca9ae1d2..f323c03c2 100644
--- a/apt-pkg/deb/debrecords.cc
+++ b/apt-pkg/deb/debrecords.cc
@@ -101,6 +101,15 @@ string debRecordParser::Maintainer()
return Section.FindS("Maintainer");
}
/*}}}*/
+// RecordParser::RecordField - Return the value of an arbitrary field /*{{*/
+// ---------------------------------------------------------------------
+/* */
+string debRecordParser::RecordField(const char *fieldName)
+{
+ return Section.FindS(fieldName);
+}
+
+ /*}}}*/
// RecordParser::ShortDesc - Return a 1 line description /*{{{*/
// ---------------------------------------------------------------------
/* */
diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h
index 9692ac94c..7868bfa3d 100644
--- a/apt-pkg/deb/debrecords.h
+++ b/apt-pkg/deb/debrecords.h
@@ -50,6 +50,9 @@ class debRecordParser : public pkgRecords::Parser
virtual string Name();
virtual string Homepage();
+ // An arbitrary custom field
+ virtual string RecordField(const char *fieldName);
+
virtual void GetRec(const char *&Start,const char *&Stop);
debRecordParser(string FileName,pkgCache &Cache);
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 6943dcfcd..9123b1c12 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1512,7 +1512,7 @@ bool pkgDepCache::Policy::IsImportantDep(DepIterator const &Dep)
return true;
else if(Dep->Type == pkgCache::Dep::Recommends)
{
- if ( _config->FindB("APT::Install-Recommends", false))
+ if (InstallRecommends)
return true;
// we suport a special mode to only install-recommends for certain
// sections
@@ -1523,7 +1523,7 @@ bool pkgDepCache::Policy::IsImportantDep(DepIterator const &Dep)
return true;
}
else if(Dep->Type == pkgCache::Dep::Suggests)
- return _config->FindB("APT::Install-Suggests", false);
+ return InstallSuggests;
return false;
}
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h
index adc010c28..d935c1887 100644
--- a/apt-pkg/depcache.h
+++ b/apt-pkg/depcache.h
@@ -258,13 +258,21 @@ class pkgDepCache : protected pkgCache::Namespace
class Policy
{
public:
-
+ Policy() {
+ InstallRecommends = _config->FindB("APT::Install-Recommends", false);
+ InstallSuggests = _config->FindB("APT::Install-Suggests", false);
+ }
+
virtual VerIterator GetCandidateVer(PkgIterator const &Pkg);
virtual bool IsImportantDep(DepIterator const &Dep);
virtual signed short GetPriority(PkgIterator const &Pkg);
virtual signed short GetPriority(PkgFileIterator const &File);
virtual ~Policy() {};
+
+ private:
+ bool InstallRecommends;
+ bool InstallSuggests;
};
private:
diff --git a/apt-pkg/pkgrecords.h b/apt-pkg/pkgrecords.h
index 78e39e577..ce92cacc4 100644
--- a/apt-pkg/pkgrecords.h
+++ b/apt-pkg/pkgrecords.h
@@ -69,7 +69,10 @@ class pkgRecords::Parser /*{{{*/
virtual string LongDesc() {return string();};
virtual string Name() {return string();};
virtual string Homepage() {return string();}
-
+
+ // An arbitrary custom field
+ virtual string RecordField(const char *fieldName) { return string();};
+
// The record in binary form
virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;};