Przeglądaj źródła

Merge remote-tracking branch 'mvo/bugfix/multiarch-upgrade' into debian/sid

Michael Vogt 12 lat temu
rodzic
commit
ea9e09ef91

+ 5 - 0
apt-pkg/depcache.cc

@@ -1258,6 +1258,11 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
 	    if (PkgState[Pkg->ID].InstallVer == 0)
 	    if (PkgState[Pkg->ID].InstallVer == 0)
 	       continue;
 	       continue;
 
 
+            /* Ignore negative dependencies that we are not going to 
+               get installed */
+            if (PkgState[Pkg->ID].InstallVer != *I)
+               continue;
+
 	    if ((Start->Version != 0 || TrgPkg != Pkg) &&
 	    if ((Start->Version != 0 || TrgPkg != Pkg) &&
 		PkgState[Pkg->ID].CandidateVer != PkgState[Pkg->ID].InstallVer &&
 		PkgState[Pkg->ID].CandidateVer != PkgState[Pkg->ID].InstallVer &&
 		PkgState[Pkg->ID].CandidateVer != *I &&
 		PkgState[Pkg->ID].CandidateVer != *I &&

+ 24 - 25
apt-private/private-output.cc

@@ -190,45 +190,44 @@ void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records,	/*{{{*/
       // raring/linux-kernel version [upradable: new-version]
       // raring/linux-kernel version [upradable: new-version]
       //    description
       //    description
       pkgPolicy *policy = CacheFile.GetPolicy();
       pkgPolicy *policy = CacheFile.GetPolicy();
-      out << std::setiosflags(std::ios::left)
-          << _config->Find("APT::Color::Highlight", "")
-          << name_str 
-          << _config->Find("APT::Color::Neutral", "")
-          << "/" << suite
-          << " ";
+      std::string VersionStr = GetVersion(CacheFile, V);
+      std::string CandidateVerStr = GetCandidateVersion(CacheFile, P);
+      std::string InstalledVerStr = GetInstalledVersion(CacheFile, P);
+      std::string StatusStr;
       if(P.CurrentVer() == V && state.Upgradable()) {
       if(P.CurrentVer() == V && state.Upgradable()) {
-         out << GetVersion(CacheFile, V)
-             << " "
-             << "[" << _("installed,upgradable to: ")
-             << GetCandidateVersion(CacheFile, P) << "]";
+         strprintf(StatusStr, _("[installed,upgradable to: %s]"),
+                   CandidateVerStr.c_str());
       } else if (P.CurrentVer() == V) {
       } else if (P.CurrentVer() == V) {
-         out << GetVersion(CacheFile, V)
-             << " ";
          if(!V.Downloadable())
          if(!V.Downloadable())
-            out << _("[installed,local]");
+            StatusStr = _("[installed,local]");
          else
          else
             if(V.Automatic() && state.Garbage)
             if(V.Automatic() && state.Garbage)
-                  out << _("[installed,auto-removable]");
+               StatusStr = _("[installed,auto-removable]");
             else if (state.Flags & pkgCache::Flag::Auto)
             else if (state.Flags & pkgCache::Flag::Auto)
-               out << _("[installed,automatic]");
+               StatusStr = _("[installed,automatic]");
             else
             else
-               out << _("[installed]");
+               StatusStr = _("[installed]");
       } else if (P.CurrentVer() && 
       } else if (P.CurrentVer() && 
                  policy->GetCandidateVer(P) == V && 
                  policy->GetCandidateVer(P) == V && 
                  state.Upgradable()) {
                  state.Upgradable()) {
-         out << GetVersion(CacheFile, V)
-             << " "
-             << _("[upgradable from: ")
-             << GetInstalledVersion(CacheFile, P) << "]";
+            strprintf(StatusStr, _("[upgradable from: %s]"),
+                      InstalledVerStr.c_str());
       } else {
       } else {
          if (V.ParentPkg()->CurrentState == pkgCache::State::ConfigFiles)
          if (V.ParentPkg()->CurrentState == pkgCache::State::ConfigFiles)
-            out << GetVersion(CacheFile, V) 
-                << " "
-                << _("[residual-config]");
+            StatusStr = _("[residual-config]");
          else
          else
-            out << GetVersion(CacheFile, V);
+            StatusStr = "";
       }
       }
-      out << " " << GetArchitecture(CacheFile, P);
+      out << std::setiosflags(std::ios::left)
+          << _config->Find("APT::Color::Highlight", "")
+          << name_str 
+          << _config->Find("APT::Color::Neutral", "")
+          << "/" << suite
+          << " "
+          << VersionStr << " " 
+          << GetArchitecture(CacheFile, P);
+      if (StatusStr != "") 
+         out << " " << StatusStr;
       if (include_summary)
       if (include_summary)
       {
       {
          out << std::endl 
          out << std::endl 

+ 9 - 9
test/integration/test-apt-cli-list

@@ -18,30 +18,30 @@ setupaptarchive
 APTARCHIVE=$(readlink -f ./aptarchive)
 APTARCHIVE=$(readlink -f ./aptarchive)
 
 
 testequal "Listing...
 testequal "Listing...
-bar/now 1.0 [installed,local] i386
+bar/now 1.0 i386 [installed,local]
 foo/unstable 1.0 all
 foo/unstable 1.0 all
-foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list
+foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list
 
 
 testequal "Listing...
 testequal "Listing...
 foo/unstable 1.0 all
 foo/unstable 1.0 all
-foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list "foo*"
+foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list "foo*"
 
 
 testequal "Listing...
 testequal "Listing...
-foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list --upgradable
+foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list --upgradable
 
 
 # FIXME: hm, hm - does it make sense to have this different? shouldn't
 # FIXME: hm, hm - does it make sense to have this different? shouldn't
 #        we use "installed,upgradable" consitently?
 #        we use "installed,upgradable" consitently?
 testequal "Listing...
 testequal "Listing...
-bar/now 1.0 [installed,local] i386
-foobar/now 1.0 [installed,upgradable to: 2.0] i386" apt list --installed
+bar/now 1.0 i386 [installed,local]
+foobar/now 1.0 i386 [installed,upgradable to: 2.0]" apt list --installed
 
 
 testequal "Listing...
 testequal "Listing...
-foobar/unstable 2.0 [upgradable from: 1.0] i386
-foobar/now 1.0 [installed,upgradable to: 2.0] i386
+foobar/unstable 2.0 i386 [upgradable from: 1.0]
+foobar/now 1.0 i386 [installed,upgradable to: 2.0]
 " apt list foobar --all-versions
 " apt list foobar --all-versions
 
 
 testequal "Listing...
 testequal "Listing...
-bar/now 1.0 [installed,local] i386
+bar/now 1.0 i386 [installed,local]
   an autogenerated dummy bar=1.0/installed
   an autogenerated dummy bar=1.0/installed
 " apt list bar --verbose
 " apt list bar --verbose
 
 

+ 29 - 0
test/integration/test-bug-multiarch-upgrade

@@ -0,0 +1,29 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64' 'i386'
+
+insertinstalledpackage 'libcups2' 'amd64' '1' 'Multi-Arch: same'
+insertinstalledpackage 'libcups2' 'i386' '1' 'Multi-Arch: same'
+
+insertpackage 'unstable' 'libcups2' 'amd64' '0' 'Multi-Arch: same'
+insertpackage 'unstable' 'libcups2' 'amd64' '2' 'Multi-Arch: same'
+insertpackage 'unstable' 'libcups2' 'i386' '0' 'Multi-Arch: same'
+insertpackage 'unstable' 'libcups2' 'i386' '2' 'Multi-Arch: same'
+
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+  libcups2
+The following packages will be upgraded:
+  libcups2 libcups2:i386
+2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Inst libcups2 [1] (2 unstable [amd64]) [libcups2:amd64 on libcups2:i386] [libcups2:i386 on libcups2:amd64] [libcups2:i386 ]
+Inst libcups2:i386 [1] (2 unstable [i386])
+Conf libcups2 (2 unstable [amd64])
+Conf libcups2:i386 (2 unstable [i386])' aptget install -s libcups2:i386