]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/sourcelist.cc
string_view: Drop constexpr constructor for standard compatibility
[apt.git] / apt-pkg / sourcelist.cc
index 56df976e82eb495ec80a6a4b788eaad23d174440..82d2ed3c662dd13c56ed3de992656a21155167ce 100644 (file)
@@ -418,16 +418,16 @@ bool pkgSourceList::ParseFileOldStyle(std::string const &File)
 /* Returns: the number of stanzas parsed*/
 bool pkgSourceList::ParseFileDeb822(string const &File)
 {
-   pkgUserTagSection Tags;
    unsigned int i = 1;
 
    // see if we can read the file
    FileFd Fd(File, FileFd::ReadOnly);
-   pkgTagFile Sources(&Fd);
+   pkgTagFile Sources(&Fd, pkgTagFile::SUPPORT_COMMENTS);
    if (Fd.IsOpen() == false || Fd.Failed())
       return _error->Error(_("Malformed stanza %u in source list %s (type)"),i,File.c_str());
 
    // read step by step
+   pkgTagSection Tags;
    while (Sources.Step(Tags) == true)
    {
       if(Tags.Exists("Types") == false)
@@ -544,11 +544,17 @@ void pkgSourceList::AddVolatileFile(pkgIndexFile * const File)            /*{{{*/
                                                                        /*}}}*/
 bool pkgSourceList::AddVolatileFile(std::string const &File)           /*{{{*/
 {
+   // Note: FileExists matches directories and links, too!
    if (File.empty() || FileExists(File) == false)
       return false;
 
-   if (flExtension(File) == "deb")
+   std::string const ext = flExtension(File);
+   if (ext == "deb")
       AddVolatileFile(new debDebPkgFileIndex(File));
+   else if (ext == "dsc")
+      AddVolatileFile(new debDscFileIndex(File));
+   else if (FileExists(flCombine(File, "debian/control")))
+      AddVolatileFile(new debDscFileIndex(flCombine(File, "debian/control")));
    else
       return false;
 
@@ -558,7 +564,7 @@ bool pkgSourceList::AddVolatileFile(std::string const &File)                /*{{{*/
 void pkgSourceList::AddVolatileFiles(CommandLine &CmdL, std::vector<const char*> * const VolatileCmdL)/*{{{*/
 {
    std::remove_if(CmdL.FileList + 1, CmdL.FileList + 1 + CmdL.FileSize(), [&](char const * const I) {
-      if (I != nullptr && (I[0] == '/' || (I[0] == '.' && I[1] == '/')))
+      if (I != nullptr && (I[0] == '/' || (I[0] == '.' && ((I[1] == '.' && I[2] == '/') || I[1] == '/'))))
       {
         if (AddVolatileFile(I))
         {