]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/sourcelist.cc
Merge changelog entries from sid-gcc5
[apt.git] / apt-pkg / sourcelist.cc
index 69f7ac0432fabe397fce25eacc195672844dedce..3e714667c63d07814594db9ff1dc463f3412ef44 100644 (file)
@@ -93,23 +93,29 @@ bool pkgSourceList::Type::ParseStanza(vector<metaIndex *> &List,    /*{{{*/
    if (Enabled.empty() == false && StringToBool(Enabled) == false)
       return true;
 
-   std::map<char const * const, char const * const> mapping;
+   std::map<char const * const, std::pair<char const * const, bool> > mapping;
 #define APT_PLUSMINUS(X, Y) \
-   mapping.insert(std::make_pair(X, Y)); \
-   mapping.insert(std::make_pair(X "Add", Y "+")); \
-   mapping.insert(std::make_pair(X "Remove", Y "-"))
+   mapping.insert(std::make_pair(X, std::make_pair(Y, true))); \
+   mapping.insert(std::make_pair(X "Add", std::make_pair(Y "+", true))); \
+   mapping.insert(std::make_pair(X "Remove", std::make_pair(Y "-", true)))
    APT_PLUSMINUS("Architectures", "arch");
    APT_PLUSMINUS("Languages", "lang");
    APT_PLUSMINUS("Targets", "target");
 #undef APT_PLUSMINUS
-   mapping.insert(std::make_pair("Trusted", "trusted"));
-   for (std::map<char const * const, char const * const>::const_iterator m = mapping.begin(); m != mapping.end(); ++m)
+   mapping.insert(std::make_pair("Trusted", std::make_pair("trusted", false)));
+   mapping.insert(std::make_pair("Check-Valid-Until", std::make_pair("check-valid-until", false)));
+   mapping.insert(std::make_pair("Valid-Until-Min", std::make_pair("valid-until-min", false)));
+   mapping.insert(std::make_pair("Valid-Until-Max", std::make_pair("valid-until-max", false)));
+   mapping.insert(std::make_pair("Signed-By", std::make_pair("signed-by", false)));
+
+   for (std::map<char const * const, std::pair<char const * const, bool> >::const_iterator m = mapping.begin(); m != mapping.end(); ++m)
       if (Tags.Exists(m->first))
       {
-         // for deb822 the " " is the delimiter, but the backend expects ","
-         std::string option = Tags.FindS(m->first);
-         std::replace(option.begin(), option.end(), ' ', ',');
-         Options[m->second] = option;
+        std::string option = Tags.FindS(m->first);
+        // for deb822 the " " is the delimiter, but the backend expects ","
+        if (m->second.second == true)
+           std::replace(option.begin(), option.end(), ' ', ',');
+        Options[m->second.first] = option;
       }
 
    // now create one item per suite/section
@@ -268,6 +274,10 @@ pkgSourceList::~pkgSourceList()
 {
    for (const_iterator I = SrcList.begin(); I != SrcList.end(); ++I)
       delete *I;
+   SrcList.clear();
+   for (auto  F = VolatileFiles.begin(); F != VolatileFiles.end(); ++F)
+      delete (*F);
+   VolatileFiles.clear();
 }
                                                                        /*}}}*/
 // SourceList::ReadMainList - Read the main source list from etc       /*{{{*/
@@ -333,7 +343,7 @@ bool pkgSourceList::ReadAppend(string const &File)
    else
       return ParseFileOldStyle(File);
 }
-
+                                                                       /*}}}*/
 // SourceList::ReadFileOldStyle - Read Traditional style sources.list  /*{{{*/
 // ---------------------------------------------------------------------
 /* */
@@ -448,7 +458,15 @@ bool pkgSourceList::FindIndex(pkgCache::PkgFileIterator File,
          }
       }
    }
-
+   for (vector<pkgIndexFile *>::const_iterator J = VolatileFiles.begin();
+        J != VolatileFiles.end(); ++J)
+   {
+      if ((*J)->FindInCache(*File.Cache()) == File)
+      {
+        Found = (*J);
+        return true;
+      }
+   }
    return false;
 }
                                                                        /*}}}*/
@@ -505,4 +523,14 @@ time_t pkgSourceList::GetLastModifiedTime()
    return mtime_sources;
 }
                                                                        /*}}}*/
-
+std::vector<pkgIndexFile*> pkgSourceList::GetVolatileFiles() const     /*{{{*/
+{
+   return VolatileFiles;
+}
+                                                                       /*}}}*/
+void pkgSourceList::AddVolatileFile(pkgIndexFile * const File)         /*{{{*/
+{
+   if (File != NULL)
+      VolatileFiles.push_back(File);
+}
+                                                                       /*}}}*/