]> git.saurik.com Git - apt.git/commitdiff
add a special scenario filename for using stdin
authorDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 31 Mar 2011 09:47:01 +0000 (11:47 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 31 Mar 2011 09:47:01 +0000 (11:47 +0200)
apt-pkg/edsp/edspindexfile.cc
apt-pkg/edsp/edspsystem.cc

index 5a9d5aacd445a7894445ddb5660faa17ae2e2975..366325d0fd334d587d58214cc46a9665f5d70ea5 100644 (file)
@@ -28,7 +28,11 @@ edspIndex::edspIndex(string File) : debStatusIndex(File)
 // StatusIndex::Merge - Load the index file into a cache               /*{{{*/
 bool edspIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
 {
-   FileFd Pkg(File,FileFd::ReadOnlyGzip);
+   FileFd Pkg;
+   if (File != "stdin")
+      Pkg.Open(File, FileFd::ReadOnly);
+   else
+      Pkg.OpenDescriptor(STDIN_FILENO, FileFd::ReadOnly);
    if (_error->PendingError() == true)
       return false;
    edspListParser Parser(&Pkg);
index 579ffc65616ea75fe0b6df21f3b3a29555e0b1e9..c8e417b1d9e7f7079ebcda9aab138a0d9daa12d7 100644 (file)
@@ -86,8 +86,10 @@ bool edspSystem::ArchiveSupported(const char *Type)
 // System::Score - Determine if we should use the edsp system          /*{{{*/
 signed edspSystem::Score(Configuration const &Cnf)
 {
+   if (Cnf.Find("Dir::State::universe", "") == "stdin")
+      return 1000;
    if (FileExists(Cnf.FindFile("Dir::State::universe","")) == true)
-       return 1000;
+      return 1000;
    return -1000;
 }
                                                                        /*}}}*/
@@ -95,7 +97,12 @@ signed edspSystem::Score(Configuration const &Cnf)
 bool edspSystem::AddStatusFiles(vector<pkgIndexFile *> &List)
 {
    if (StatusFile == 0)
-      StatusFile = new edspIndex(_config->FindFile("Dir::State::universe"));
+   {
+      if (_config->Find("Dir::State::universe", "") == "stdin")
+        StatusFile = new edspIndex("stdin");
+      else
+        StatusFile = new edspIndex(_config->FindFile("Dir::State::universe"));
+   }
    List.push_back(StatusFile);
    return true;
 }