]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/edsp.cc
do not inline virtual destructors with d-pointers
[apt.git] / apt-pkg / edsp.cc
index 52556c1edb60bf1c9549801a443a61db9bb7c83e..2ba914b16ee8e14d7655de1d644c74da2c2aca3c 100644 (file)
@@ -26,6 +26,7 @@
 #include <time.h>
 #include <unistd.h>
 #include <stdio.h>
+#include <algorithm>
 #include <iostream>
 #include <vector>
 #include <limits>
@@ -50,7 +51,12 @@ bool EDSP::WriteScenario(pkgDepCache &Cache, FILE* output, OpProgress *Progress)
    if (Progress != NULL)
       Progress->SubProgress(Cache.Head().VersionCount, _("Send scenario to solver"));
    unsigned long p = 0;
+   std::vector<std::string> archs = APT::Configuration::getArchitectures();
    for (pkgCache::PkgIterator Pkg = Cache.PkgBegin(); Pkg.end() == false; ++Pkg)
+   {
+      std::string const arch = Pkg.Arch();
+      if (std::find(archs.begin(), archs.end(), arch) == archs.end())
+        continue;
       for (pkgCache::VerIterator Ver = Pkg.VersionList(); Ver.end() == false; ++Ver, ++p)
       {
         WriteScenarioVersion(Cache, output, Pkg, Ver);
@@ -59,6 +65,7 @@ bool EDSP::WriteScenario(pkgDepCache &Cache, FILE* output, OpProgress *Progress)
         if (Progress != NULL && p % 100 == 0)
            Progress->Progress(p);
       }
+   }
    return true;
 }
                                                                        /*}}}*/
@@ -88,12 +95,8 @@ bool EDSP::WriteLimitedScenario(pkgDepCache &Cache, FILE* output,
 void EDSP::WriteScenarioVersion(pkgDepCache &Cache, FILE* output, pkgCache::PkgIterator const &Pkg,
                                pkgCache::VerIterator const &Ver)
 {
-   pkgRecords Recs(Cache);
-   pkgRecords::Parser &rec = Recs.Lookup(Ver.FileList());
-   string srcpkg = rec.SourcePkg().empty() ? Pkg.Name() : rec.SourcePkg();
-
    fprintf(output, "Package: %s\n", Pkg.Name());
-   fprintf(output, "Source: %s\n", srcpkg.c_str());
+   fprintf(output, "Source: %s\n", Ver.SourcePkgName());
    fprintf(output, "Architecture: %s\n", Ver.Arch());
    fprintf(output, "Version: %s\n", Ver.VerStr());
    if (Pkg.CurrentVer() == Ver)
@@ -438,6 +441,13 @@ bool EDSP::ReadRequest(int const input, std::list<std::string> &install,
            distUpgrade = EDSP::StringToBool(line.c_str() + 14, false);
         else if (line.compare(0, 11, "Autoremove:") == 0)
            autoRemove = EDSP::StringToBool(line.c_str() + 12, false);
+        else if (line.compare(0, 13, "Architecture:") == 0)
+           _config->Set("APT::Architecture", line.c_str() + 14);
+        else if (line.compare(0, 14, "Architectures:") == 0)
+        {
+           std::string const archs = line.c_str() + 15;
+           _config->Set("APT::Architectures", SubstVar(archs, " ", ","));
+        }
         else
            _error->Warning("Unknown line in EDSP Request stanza: %s", line.c_str());