]> git.saurik.com Git - apt.git/commitdiff
merged from lp:~donkult/apt/sid 0.8.15.3
authorMichael Vogt <egon@debian-devbox>
Mon, 25 Jul 2011 13:54:03 +0000 (15:54 +0200)
committerMichael Vogt <egon@debian-devbox>
Mon, 25 Jul 2011 13:54:03 +0000 (15:54 +0200)
1  2 
cmdline/apt-get.cc
debian/changelog

diff --combined cmdline/apt-get.cc
index 1e7fee96b2c8169031ce42b0512edd0234dd238e,8eda29362010d587f9eebb91e0b4ca2ac5a6c8dc..9de341df02f754fd62ea6c5b6df321b245bfd752
@@@ -1388,6 -1388,14 +1388,14 @@@ bool TryToInstallBuildDep(pkgCache::Pkg
         return AllowFail;
     }
  
+    if (_config->FindB("Debug::BuildDeps",false) == true)
+    {
+       if (Remove == true)
+        cout << "  Trying to remove " << Pkg << endl;
+       else
+        cout << "  Trying to install " << Pkg << endl;
+    }
     if (Remove == true)
     {
        TryToRemove RemoveAction(Cache, &Fix);
@@@ -2273,7 -2281,7 +2281,7 @@@ bool DoDownload(CommandLine &CmdL
  
     pkgAcquire Fetcher;
     AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0));
 -   if (_config->FindB("APT::Get::Print-URIs") == true)
 +   if (_config->FindB("APT::Get::Print-URIs") == false)
        Fetcher.Setup(&Stat);
  
     pkgRecords Recs(Cache);
@@@ -2612,12 -2620,17 +2620,17 @@@ bool DoSource(CommandLine &CmdL
         // Try to compile it with dpkg-buildpackage
         if (_config->FindB("APT::Get::Compile",false) == true)
         {
+           string buildopts = _config->Find("APT::Get::Host-Architecture");
+           if (buildopts.empty() == false)
+              buildopts = "-a " + buildopts + " ";
+           buildopts.append(_config->Find("DPkg::Build-Options","-b -uc"));
            // Call dpkg-buildpackage
            char S[500];
            snprintf(S,sizeof(S),"cd %s && %s %s",
                     Dir.c_str(),
                     _config->Find("Dir::Bin::dpkg-buildpackage","dpkg-buildpackage").c_str(),
-                    _config->Find("DPkg::Build-Options","-b -uc").c_str());
+                    buildopts.c_str());
            
            if (system(S) != 0)
            {
@@@ -2679,8 -2692,19 +2692,19 @@@ bool DoBuildDep(CommandLine &CmdL
     if (Fetcher.Setup(&Stat) == false)
        return false;
  
+    bool StripMultiArch;
+    string hostArch = _config->Find("APT::Get::Host-Architecture");
+    if (hostArch.empty() == false)
+    {
+       std::vector<std::string> archs = APT::Configuration::getArchitectures();
+       if (std::find(archs.begin(), archs.end(), hostArch) == archs.end())
+        return _error->Error(_("No architecture information available for %s. See apt.conf(5) APT::Architectures for setup"), hostArch.c_str());
+       StripMultiArch = false;
+    }
+    else
+       StripMultiArch = true;
     unsigned J = 0;
-    bool const StripMultiArch = APT::Configuration::getArchitectures().size() <= 1;
     for (const char **I = CmdL.FileList + 1; *I != 0; I++, J++)
     {
        string Src;
         ioprintf(c1out,_("%s has no build depends.\n"),Src.c_str());
         continue;
        }
-       
        // Install the requested packages
        vector <pkgSrcRecords::Parser::BuildDepRec>::iterator D;
        pkgProblemResolver Fix(Cache);
  
           if (skipAlternatives == true)
           {
+             /*
+              * if there are alternatives, we've already picked one, so skip
+              * the rest
+              *
+              * TODO: this means that if there's a build-dep on A|B and B is
+              * installed, we'll still try to install A; more importantly,
+              * if A is currently broken, we cannot go back and try B. To fix 
+              * this would require we do a Resolve cycle for each package we 
+              * add to the install list. Ugh
+              */
              if (!hasAlternatives)
                 skipAlternatives = false; // end of or group
              continue;
           if ((*D).Type == pkgSrcRecords::Parser::BuildConflict ||
             (*D).Type == pkgSrcRecords::Parser::BuildConflictIndep)
           {
-             pkgCache::PkgIterator Pkg = Cache->FindPkg((*D).Package);
+             pkgCache::GrpIterator Grp = Cache->FindGrp((*D).Package);
              // Build-conflicts on unknown packages are silently ignored
-             if (Pkg.end() == true)
+             if (Grp.end() == true)
                 continue;
  
-             pkgCache::VerIterator IV = (*Cache)[Pkg].InstVerIter(*Cache);
-             /* 
-              * Remove if we have an installed version that satisfies the 
-              * version criteria
-              */
-             if (IV.end() == false && 
-                 Cache->VS().CheckDep(IV.VerStr(),(*D).Op,(*D).Version.c_str()) == true)
-                TryToInstallBuildDep(Pkg,Cache,Fix,true,false);
+           for (pkgCache::PkgIterator Pkg = Grp.PackageList(); Pkg.end() == false; Pkg = Grp.NextPkg(Pkg))
+           {
+              pkgCache::VerIterator IV = (*Cache)[Pkg].InstVerIter(*Cache);
+              /*
+               * Remove if we have an installed version that satisfies the
+               * version criteria
+               */
+              if (IV.end() == false &&
+                  Cache->VS().CheckDep(IV.VerStr(),(*D).Op,(*D).Version.c_str()) == true)
+                 TryToInstallBuildDep(Pkg,Cache,Fix,true,false);
+           }
           }
         else // BuildDep || BuildDepIndep
           {
-           pkgCache::PkgIterator Pkg = Cache->FindPkg((*D).Package);
              if (_config->FindB("Debug::BuildDeps",false) == true)
                   cout << "Looking for " << (*D).Package << "...\n";
  
+           pkgCache::PkgIterator Pkg;
+           // Cross-Building?
+           if (StripMultiArch == false)
+           {
+              size_t const colon = D->Package.find(":");
+              if (colon != string::npos &&
+                  (strcmp(D->Package.c_str() + colon, ":any") == 0 || strcmp(D->Package.c_str() + colon, ":native") == 0))
+                 Pkg = Cache->FindPkg(D->Package.substr(0,colon));
+              else
+                 Pkg = Cache->FindPkg(D->Package);
+              // We need to decide if host or build arch, so find a version we can look at
+              pkgCache::VerIterator Ver;
+              // a bad version either is invalid or doesn't satify dependency
+              #define BADVER(Ver) Ver.end() == true || \
+                                  (Ver.end() == false && D->Version.empty() == false && \
+                                   Cache->VS().CheckDep(Ver.VerStr(),D->Op,D->Version.c_str()) == false)
+              if (Pkg.end() == false)
+              {
+                 Ver = (*Cache)[Pkg].InstVerIter(*Cache);
+                 if (BADVER(Ver))
+                    Ver = (*Cache)[Pkg].CandidateVerIter(*Cache);
+              }
+              if (BADVER(Ver))
+              {
+                 pkgCache::PkgIterator HostPkg = Cache->FindPkg(D->Package, hostArch);
+                 if (HostPkg.end() == false)
+                 {
+                    Ver = (*Cache)[HostPkg].InstVerIter(*Cache);
+                    if (BADVER(Ver))
+                       Ver = (*Cache)[HostPkg].CandidateVerIter(*Cache);
+                 }
+              }
+              if ((BADVER(Ver)) == false)
+              {
+                 string forbidden;
+                 if (Ver->MultiArch == pkgCache::Version::None || Ver->MultiArch == pkgCache::Version::All);
+                 else if (Ver->MultiArch == pkgCache::Version::Same)
+                 {
+                    if (colon != string::npos)
+                       Pkg = Ver.ParentPkg().Group().FindPkg(hostArch);
+                    else if (strcmp(D->Package.c_str() + colon, ":any") == 0)
+                       forbidden = "Multi-Arch: same";
+                    // :native gets the buildArch
+                 }
+                 else if (Ver->MultiArch == pkgCache::Version::Foreign || Ver->MultiArch == pkgCache::Version::AllForeign)
+                 {
+                    if (colon != string::npos)
+                       forbidden = "Multi-Arch: foreign";
+                 }
+                 else if (Ver->MultiArch == pkgCache::Version::Allowed || Ver->MultiArch == pkgCache::Version::AllAllowed)
+                 {
+                    if (colon == string::npos)
+                       Pkg = Ver.ParentPkg().Group().FindPkg(hostArch);
+                    else if (strcmp(D->Package.c_str() + colon, ":any") == 0)
+                    {
+                       // prefer any installed over preferred non-installed architectures
+                       pkgCache::GrpIterator Grp = Ver.ParentPkg().Group();
+                       // we don't check for version here as we are better of with upgrading than remove and install
+                       for (Pkg = Grp.PackageList(); Pkg.end() == false; Pkg = Grp.NextPkg(Pkg))
+                          if (Pkg.CurrentVer().end() == false)
+                             break;
+                       if (Pkg.end() == true)
+                          Pkg = Grp.FindPreferredPkg(true);
+                    }
+                    // native gets buildArch
+                 }
+                 if (forbidden.empty() == false)
+                 {
+                    if (_config->FindB("Debug::BuildDeps",false) == true)
+                       cout << " :any is not allowed from M-A: same package " << (*D).Package << endl;
+                    if (hasAlternatives)
+                       continue;
+                    return _error->Error(_("%s dependency for %s can't be satisfied "
+                                           "because %s is not allowed on '%s' packages"),
+                                         Last->BuildDepType(D->Type), Src.c_str(),
+                                         D->Package.c_str(), "Multi-Arch: same");
+                 }
+              }
+              else if (_config->FindB("Debug::BuildDeps",false) == true)
+                 cout << " No multiarch info as we have no satisfying installed nor candidate for " << D->Package << " on build or host arch" << endl;
+              #undef BADVER
+           }
+           else
+              Pkg = Cache->FindPkg(D->Package);
            if (Pkg.end() == true)
              {
                 if (_config->FindB("Debug::BuildDeps",false) == true)
                                      (*D).Package.c_str());
              }
  
-             /*
-              * if there are alternatives, we've already picked one, so skip
-              * the rest
-              *
-              * TODO: this means that if there's a build-dep on A|B and B is
-              * installed, we'll still try to install A; more importantly,
-              * if A is currently broken, we cannot go back and try B. To fix 
-              * this would require we do a Resolve cycle for each package we 
-              * add to the install list. Ugh
-              */
-                        
-           /* 
-            * If this is a virtual package, we need to check the list of
-            * packages that provide it and see if any of those are
-            * installed
-            */
-             pkgCache::PrvIterator Prv = Pkg.ProvidesList();
-             for (; Prv.end() != true; Prv++)
-           {
-                if (_config->FindB("Debug::BuildDeps",false) == true)
-                     cout << "  Checking provider " << Prv.OwnerPkg().FullName() << endl;
-              if ((*Cache)[Prv.OwnerPkg()].InstVerIter(*Cache).end() == false)
-                 break;
-             }
-             
-             // Get installed version and version we are going to install
            pkgCache::VerIterator IV = (*Cache)[Pkg].InstVerIter(*Cache);
+           if (IV.end() == false)
+           {
+              if (_config->FindB("Debug::BuildDeps",false) == true)
+                 cout << "  Is installed\n";
  
-             if ((*D).Version[0] != '\0') {
-                  // Versioned dependency
-                  pkgCache::VerIterator CV = (*Cache)[Pkg].CandidateVerIter(*Cache);
-                  for (; CV.end() != true; CV++)
-                  {
-                       if (Cache->VS().CheckDep(CV.VerStr(),(*D).Op,(*D).Version.c_str()) == true)
-                            break;
-                  }
-                  if (CV.end() == true)
-                {
-                  if (hasAlternatives)
-                  {
-                     continue;
-                  }
-                  else
-                  {
-                       return _error->Error(_("%s dependency for %s cannot be satisfied "
-                                              "because no available versions of package %s "
-                                              "can satisfy version requirements"),
-                                            Last->BuildDepType((*D).Type),Src.c_str(),
-                                            (*D).Package.c_str());
-                  }
-                }
-             }
-             else
-             {
-                // Only consider virtual packages if there is no versioned dependency
-                if (Prv.end() == false)
-                {
-                   if (_config->FindB("Debug::BuildDeps",false) == true)
-                      cout << "  Is provided by installed package " << Prv.OwnerPkg().FullName() << endl;
-                   skipAlternatives = hasAlternatives;
-                   continue;
-                }
-             }
+              if (D->Version.empty() == true ||
+                  Cache->VS().CheckDep(IV.VerStr(),(*D).Op,(*D).Version.c_str()) == true)
+              {
+                 skipAlternatives = hasAlternatives;
+                 continue;
+              }
  
-             if (IV.end() == false)
-             {
-                if (_config->FindB("Debug::BuildDeps",false) == true)
-                   cout << "  Is installed\n";
+              if (_config->FindB("Debug::BuildDeps",false) == true)
+                 cout << "    ...but the installed version doesn't meet the version requirement\n";
  
-                if (Cache->VS().CheckDep(IV.VerStr(),(*D).Op,(*D).Version.c_str()) == true)
-                {
-                   skipAlternatives = hasAlternatives;
-                   continue;
-                }
+              if (((*D).Op & pkgCache::Dep::LessEq) == pkgCache::Dep::LessEq)
+                 return _error->Error(_("Failed to satisfy %s dependency for %s: Installed package %s is too new"),
+                                       Last->BuildDepType((*D).Type), Src.c_str(), Pkg.FullName(true).c_str());
+           }
  
-                if (_config->FindB("Debug::BuildDeps",false) == true)
-                   cout << "    ...but the installed version doesn't meet the version requirement\n";
-                if (((*D).Op & pkgCache::Dep::LessEq) == pkgCache::Dep::LessEq)
-                {
-                   return _error->Error(_("Failed to satisfy %s dependency for %s: Installed package %s is too new"),
-                                        Last->BuildDepType((*D).Type),
-                                        Src.c_str(),
-                                        Pkg.FullName(true).c_str());
-                }
-             }
+           // Only consider virtual packages if there is no versioned dependency
+           if ((*D).Version.empty() == true)
+           {
+              /*
+               * If this is a virtual package, we need to check the list of
+               * packages that provide it and see if any of those are
+               * installed
+               */
+              pkgCache::PrvIterator Prv = Pkg.ProvidesList();
+              for (; Prv.end() != true; Prv++)
+              {
+                 if (_config->FindB("Debug::BuildDeps",false) == true)
+                    cout << "  Checking provider " << Prv.OwnerPkg().FullName() << endl;
  
+                 if ((*Cache)[Prv.OwnerPkg()].InstVerIter(*Cache).end() == false)
+                    break;
+              }
  
-             if (_config->FindB("Debug::BuildDeps",false) == true)
-                cout << "  Trying to install " << (*D).Package << endl;
+              if (Prv.end() == false)
+              {
+                 if (_config->FindB("Debug::BuildDeps",false) == true)
+                    cout << "  Is provided by installed package " << Prv.OwnerPkg().FullName() << endl;
+                 skipAlternatives = hasAlternatives;
+                 continue;
+              }
+           }
+           else // versioned dependency
+           {
+              pkgCache::VerIterator CV = (*Cache)[Pkg].CandidateVerIter(*Cache);
+              if (CV.end() == true ||
+                  Cache->VS().CheckDep(CV.VerStr(),(*D).Op,(*D).Version.c_str()) == false)
+              {
+                 if (hasAlternatives)
+                    continue;
+                 else if (CV.end() == false)
+                    return _error->Error(_("%s dependency for %s cannot be satisfied "
+                                           "because candidate version of package %s "
+                                           "can't satisfy version requirements"),
+                                         Last->BuildDepType(D->Type), Src.c_str(),
+                                         D->Package.c_str());
+                 else
+                    return _error->Error(_("%s dependency for %s cannot be satisfied "
+                                           "because package %s has no candidate version"),
+                                         Last->BuildDepType(D->Type), Src.c_str(),
+                                         D->Package.c_str());
+              }
+           }
  
              if (TryToInstallBuildDep(Pkg,Cache,Fix,false,false) == true)
              {
@@@ -3246,6 -3345,7 +3345,7 @@@ int main(int argc,const char *argv[]
        {'m',"ignore-missing","APT::Get::Fix-Missing",0},
        {'t',"target-release","APT::Default-Release",CommandLine::HasArg},
        {'t',"default-release","APT::Default-Release",CommandLine::HasArg},
+       {'a',"host-architecture","APT::Get::Host-Architecture",CommandLine::HasArg},
        {0,"download","APT::Get::Download",0},
        {0,"fix-missing","APT::Get::Fix-Missing",0},
        {0,"ignore-hold","APT::Ignore-Hold",0},      
diff --combined debian/changelog
index 1ceeebfc540634a9ed874d6b63700ad488b0f49f,c32edc4adb986138c239e41f9113ed733ec74d44..18b59ec4e5747d67a9d257fc9eb1e422540d8777
@@@ -1,4 -1,4 +1,4 @@@
--apt (0.8.15.3) UNRELEASED; urgency=low
++apt (0.8.15.3) unstable; urgency=low
  
    [ Michael Vogt ]
    * apt-pkg/acquire-item.cc:
@@@ -6,8 -6,6 +6,8 @@@
    * apt-pkg/algorithms.cc:
      - Hold back packages that would enter "policy-broken" state on upgrade
        when doing a "apt-get upgrade"
 +  * cmdline/apt-get.cc:
 +    - fix missing download progress in apt-get download
  
    [ David Kalnischkies ]
    * apt-pkg/pkgcachegen.cc:
@@@ -20,6 -18,8 +20,8 @@@
    * cmdline/apt-get.cc:
      - restore all important dependencies for garbage packages (LP: #806274)
      - do not require unused partial dirs in 'source' (Closes: #633510)
+     - buildconflicts effect all architectures
+     - implement MultiarchCross for build-dep and source (Closes: #632221)
    * apt-pkg/init.cc:
      - use CndSet in pkgInitConfig (Closes: #629617)
    * apt-pkg/depcache.cc:
      - apply madison typofix from John Feuerstein, thanks! (Closes: #633455)
    * apt-pkg/policy.cc:
      - emit an error on unknown APT::Default-Release value (Closes: #407511)
+   * apt-pkg/aptconfiguration.cc:
+     - ensure that native architecture is if not specified otherwise the
+       first architecture in the Architectures vector
+   * apt-pkg/deb/deblistparser.cc:
+     - Strip only :any and :native if MultiArch should be stripped as it is
+       save to ignore them in non-MultiArch contexts but if the dependency
+       is a specific architecture (and not the native) do not strip
  
-  -- David Kalnischkies <kalnischkies@gmail.com>  Sat, 16 Jul 2011 16:43:37 +0200
 - -- David Kalnischkies <kalnischkies@gmail.com>  Mon, 25 Jul 2011 14:40:00 +0200
++ -- Michael Vogt <mvo@debian.org>  Mon, 25 Jul 2011 15:04:43 +0200
  
  apt (0.8.15.2) unstable; urgency=high