Просмотр исходного кода

* merged the apt-breaks-iwj branch
* pulled in the other remaining ubuntu changes

Michael Vogt лет назад: 19
Родитель
Сommit
6ca714d551

+ 13 - 7
apt-pkg/acquire-item.cc

@@ -78,7 +78,7 @@ void pkgAcquire::Item::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
 	 Dequeue();
 	 Dequeue();
 	 return;
 	 return;
       }
       }
-      
+
       Status = StatError;
       Status = StatError;
       Dequeue();
       Dequeue();
    }   
    }   
@@ -773,8 +773,9 @@ pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire *Owner,
    DestFile = _config->FindDir("Dir::State::lists") + "partial/";
    DestFile = _config->FindDir("Dir::State::lists") + "partial/";
    DestFile += URItoFileName(URI);
    DestFile += URItoFileName(URI);
 
 
-   // remove any partial downloaded sig-file. it may confuse proxies
-   // and is too small to warrant a partial download anyway
+   // remove any partial downloaded sig-file in partial/. 
+   // it may confuse proxies and is too small to warrant a 
+   // partial download anyway
    unlink(DestFile.c_str());
    unlink(DestFile.c_str());
 
 
    // Create the item
    // Create the item
@@ -841,17 +842,22 @@ void pkgAcqMetaSig::Done(string Message,unsigned long Size,string MD5,
 									/*}}}*/
 									/*}}}*/
 void pkgAcqMetaSig::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
 void pkgAcqMetaSig::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
 {
 {
+   string Final = _config->FindDir("Dir::State::lists") + URItoFileName(RealURI);
 
 
    // if we get a network error we fail gracefully
    // if we get a network error we fail gracefully
-   if(LookupTag(Message,"FailReason") == "Timeout" || 
-      LookupTag(Message,"FailReason") == "TmpResolveFailure" ||
-      LookupTag(Message,"FailReason") == "ConnectionRefused") {
+   if(Status == StatTransientNetworkError)
+   {
       Item::Failed(Message,Cnf);
       Item::Failed(Message,Cnf);
+      // move the sigfile back on network failures (and re-authenticated?)
+      if(FileExists(DestFile))
+ 	 Rename(DestFile,Final);
+
+      // set the status back to , Item::Failed likes to reset it
+      Status = pkgAcquire::Item::StatTransientNetworkError;
       return;
       return;
    }
    }
 
 
    // Delete any existing sigfile when the acquire failed
    // Delete any existing sigfile when the acquire failed
-   string Final = _config->FindDir("Dir::State::lists") + URItoFileName(RealURI);
    unlink(Final.c_str());
    unlink(Final.c_str());
 
 
    // queue a pkgAcqMetaIndex with no sigfile
    // queue a pkgAcqMetaIndex with no sigfile

+ 6 - 1
apt-pkg/acquire-item.h

@@ -97,7 +97,12 @@ class pkgAcquire::Item
        /** \brief The item was downloaded but its authenticity could
        /** \brief The item was downloaded but its authenticity could
 	*  not be verified.
 	*  not be verified.
 	*/
 	*/
-       StatAuthError
+       StatAuthError,
+
+       /** \brief The item was could not be downloaded because of 
+	*  a transient network error (e.g. network down)
+	*/
+       StatTransientNetworkError
      } Status;
      } Status;
 
 
    /** \brief Contains a textual description of the error encountered
    /** \brief Contains a textual description of the error encountered

+ 7 - 0
apt-pkg/acquire-worker.cc

@@ -307,6 +307,13 @@ bool pkgAcquire::Worker::RunMessages()
 	    pkgAcquire::Item *Owner = Itm->Owner;
 	    pkgAcquire::Item *Owner = Itm->Owner;
 	    pkgAcquire::ItemDesc Desc = *Itm;
 	    pkgAcquire::ItemDesc Desc = *Itm;
 	    OwnerQ->ItemDone(Itm);
 	    OwnerQ->ItemDone(Itm);
+
+	    // set some status
+	    if(LookupTag(Message,"FailReason") == "Timeout" || 
+	       LookupTag(Message,"FailReason") == "TmpResolveFailure" ||
+	       LookupTag(Message,"FailReason") == "ConnectionRefused") 
+	       Owner->Status = pkgAcquire::Item::StatTransientNetworkError;
+
 	    Owner->Failed(Message,Config);
 	    Owner->Failed(Message,Config);
 	    ItemDone();
 	    ItemDone();
 
 

+ 23 - 1
apt-pkg/algorithms.cc

@@ -102,6 +102,7 @@ bool pkgSimulate::Install(PkgIterator iPkg,string /*File*/)
 	 DepIterator End;
 	 DepIterator End;
 	 D.GlobOr(Start,End);
 	 D.GlobOr(Start,End);
 	 if (Start->Type == pkgCache::Dep::Conflicts ||
 	 if (Start->Type == pkgCache::Dep::Conflicts ||
+	     Start->Type == pkgCache::Dep::DpkgBreaks ||
 	     Start->Type == pkgCache::Dep::Obsoletes ||
 	     Start->Type == pkgCache::Dep::Obsoletes ||
 	     End->Type == pkgCache::Dep::PreDepends)
 	     End->Type == pkgCache::Dep::PreDepends)
          {
          {
@@ -151,6 +152,8 @@ bool pkgSimulate::Configure(PkgIterator iPkg)
 	    cout << " Obsoletes:" << D.TargetPkg().Name();
 	    cout << " Obsoletes:" << D.TargetPkg().Name();
 	 else if (D->Type == pkgCache::Dep::Conflicts)
 	 else if (D->Type == pkgCache::Dep::Conflicts)
 	    cout << " Conflicts:" << D.TargetPkg().Name();
 	    cout << " Conflicts:" << D.TargetPkg().Name();
+	 else if (D->Type == pkgCache::Dep::DpkgBreaks)
+	    cout << " Breaks:" << D.TargetPkg().Name();
 	 else
 	 else
 	    cout << " Depends:" << D.TargetPkg().Name();
 	    cout << " Depends:" << D.TargetPkg().Name();
       }	    
       }	    
@@ -651,6 +654,7 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg)
 	       /* We let the algorithm deal with conflicts on its next iteration,
 	       /* We let the algorithm deal with conflicts on its next iteration,
 		it is much smarter than us */
 		it is much smarter than us */
 	       if (Start->Type == pkgCache::Dep::Conflicts || 
 	       if (Start->Type == pkgCache::Dep::Conflicts || 
+		   Start->Type == pkgCache::Dep::DpkgBreaks || 
 		   Start->Type == pkgCache::Dep::Obsoletes)
 		   Start->Type == pkgCache::Dep::Obsoletes)
 		   break;
 		   break;
 	       
 	       
@@ -873,6 +877,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
 	    SPtrArray<pkgCache::Version *> VList = Start.AllTargets();
 	    SPtrArray<pkgCache::Version *> VList = Start.AllTargets();
 	    if (*VList == 0 && (Flags[I->ID] & Protected) != Protected &&
 	    if (*VList == 0 && (Flags[I->ID] & Protected) != Protected &&
 		Start->Type != pkgCache::Dep::Conflicts &&
 		Start->Type != pkgCache::Dep::Conflicts &&
+		Start->Type != pkgCache::Dep::DpkgBreaks &&
 		Start->Type != pkgCache::Dep::Obsoletes &&
 		Start->Type != pkgCache::Dep::Obsoletes &&
 		Cache[I].NowBroken() == false)
 		Cache[I].NowBroken() == false)
 	    {	       
 	    {	       
@@ -903,6 +908,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
 	       if (Scores[I->ID] <= Scores[Pkg->ID] ||
 	       if (Scores[I->ID] <= Scores[Pkg->ID] ||
 		   ((Cache[Start] & pkgDepCache::DepNow) == 0 &&
 		   ((Cache[Start] & pkgDepCache::DepNow) == 0 &&
 		    End->Type != pkgCache::Dep::Conflicts &&
 		    End->Type != pkgCache::Dep::Conflicts &&
+		    End->Type != pkgCache::Dep::DpkgBreaks &&
 		    End->Type != pkgCache::Dep::Obsoletes))
 		    End->Type != pkgCache::Dep::Obsoletes))
 	       {
 	       {
 		  // Try a little harder to fix protected packages..
 		  // Try a little harder to fix protected packages..
@@ -968,7 +974,22 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
 		      (Start->Type == pkgCache::Dep::Conflicts ||
 		      (Start->Type == pkgCache::Dep::Conflicts ||
 		       Start->Type == pkgCache::Dep::Obsoletes))
 		       Start->Type == pkgCache::Dep::Obsoletes))
 		     continue;
 		     continue;
-		  
+
+		  if (Start->Type == pkgCache::Dep::DpkgBreaks)
+		  {
+		     /* Would it help if we upgraded? */
+		     if (Cache[End] & pkgDepCache::DepGCVer) {
+			if (Debug)
+			   clog << "  Upgrading " << Pkg.Name() << " due to Breaks field in " << I.Name() << endl;
+			Cache.MarkInstall(Pkg, false, 0, false);
+			continue;
+		     }
+		     if (Debug)
+			clog << "  Will not break " << Pkg.Name() << " as stated in Breaks field in " << I.Name() <<endl;
+		     Cache.MarkKeep(I, false, false);
+		     continue;
+		  }
+
 		  // Skip adding to the kill list if it is protected
 		  // Skip adding to the kill list if it is protected
 		  if ((Flags[Pkg->ID] & Protected) != 0)
 		  if ((Flags[Pkg->ID] & Protected) != 0)
 		     continue;
 		     continue;
@@ -989,6 +1010,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
 	    // Hm, nothing can possibly satisify this dep. Nuke it.
 	    // Hm, nothing can possibly satisify this dep. Nuke it.
 	    if (VList[0] == 0 && 
 	    if (VList[0] == 0 && 
 		Start->Type != pkgCache::Dep::Conflicts &&
 		Start->Type != pkgCache::Dep::Conflicts &&
+		Start->Type != pkgCache::Dep::DpkgBreaks &&
 		Start->Type != pkgCache::Dep::Obsoletes &&
 		Start->Type != pkgCache::Dep::Obsoletes &&
 		(Flags[I->ID] & Protected) != Protected)
 		(Flags[I->ID] & Protected) != Protected)
 	    {
 	    {

+ 3 - 0
apt-pkg/deb/deblistparser.cc

@@ -105,6 +105,8 @@ bool debListParser::NewVersion(pkgCache::VerIterator Ver)
       return false;
       return false;
    if (ParseDepends(Ver,"Conflicts",pkgCache::Dep::Conflicts) == false)
    if (ParseDepends(Ver,"Conflicts",pkgCache::Dep::Conflicts) == false)
       return false;
       return false;
+   if (ParseDepends(Ver,"Breaks",pkgCache::Dep::DpkgBreaks) == false)
+      return false;
    if (ParseDepends(Ver,"Replaces",pkgCache::Dep::Replaces) == false)
    if (ParseDepends(Ver,"Replaces",pkgCache::Dep::Replaces) == false)
       return false;
       return false;
 
 
@@ -193,6 +195,7 @@ unsigned short debListParser::VersionHash()
 //                            "Suggests",
 //                            "Suggests",
 //                            "Recommends",
 //                            "Recommends",
                             "Conflicts",
                             "Conflicts",
+                            "Breaks",
                             "Replaces",0};
                             "Replaces",0};
    unsigned long Result = INIT_FCS;
    unsigned long Result = INIT_FCS;
    char S[1024];
    char S[1024];

+ 1 - 1
apt-pkg/deb/debsrcrecords.cc

@@ -40,7 +40,7 @@ const char **debSrcRecordParser::Binaries()
    {
    {
       delete [] Buffer;
       delete [] Buffer;
       // allocate new size based on buffer (but never smaller than 4000)
       // allocate new size based on buffer (but never smaller than 4000)
-      BufSize = max((unsigned long)4000, max((unsigned long)Bins.length()+1,2*BufSize));
+      BufSize = max((unsigned int)4000, max((unsigned int)Bins.length()+1,2*BufSize));
       Buffer = new char[BufSize];
       Buffer = new char[BufSize];
    }
    }
 
 

+ 1 - 1
apt-pkg/deb/debsrcrecords.h

@@ -24,7 +24,7 @@ class debSrcRecordParser : public pkgSrcRecords::Parser
    char *StaticBinList[400];
    char *StaticBinList[400];
    unsigned long iOffset;
    unsigned long iOffset;
    char *Buffer;
    char *Buffer;
-   unsigned long BufSize;
+   unsigned int BufSize;
    
    
    public:
    public:
 
 

+ 2 - 0
apt-pkg/deb/dpkgpm.cc

@@ -474,6 +474,8 @@ bool pkgDPkgPM::Go(int OutStatusFd)
 	 case Item::Install:
 	 case Item::Install:
 	 Args[n++] = "--unpack";
 	 Args[n++] = "--unpack";
 	 Size += strlen(Args[n-1]);
 	 Size += strlen(Args[n-1]);
+	 Args[n++] = "--auto-deconfigure";
+	 Size += strlen(Args[n-1]);
 	 break;
 	 break;
       }
       }
       
       

+ 33 - 13
apt-pkg/depcache.cc

@@ -270,7 +270,7 @@ bool pkgDepCache::CheckDep(DepIterator Dep,int Type,PkgIterator &Res)
       we allow it anyhow because dpkg does. Technically it is a packaging
       we allow it anyhow because dpkg does. Technically it is a packaging
       bug. Conflicts may never self match */
       bug. Conflicts may never self match */
    if (Dep.TargetPkg() != Dep.ParentPkg() || 
    if (Dep.TargetPkg() != Dep.ParentPkg() || 
-       (Dep->Type != Dep::Conflicts && Dep->Type != Dep::Obsoletes))
+       (Dep->Type != Dep::Conflicts && Dep->Type != Dep::DpkgBreaks && Dep->Type != Dep::Obsoletes))
    {
    {
       PkgIterator Pkg = Dep.TargetPkg();
       PkgIterator Pkg = Dep.TargetPkg();
       // Check the base package
       // Check the base package
@@ -300,7 +300,8 @@ bool pkgDepCache::CheckDep(DepIterator Dep,int Type,PkgIterator &Res)
    {
    {
       /* Provides may never be applied against the same package if it is
       /* Provides may never be applied against the same package if it is
          a conflicts. See the comment above. */
          a conflicts. See the comment above. */
-      if (P.OwnerPkg() == Pkg && Dep->Type == Dep::Conflicts)
+      if (P.OwnerPkg() == Pkg &&
+	  (Dep->Type == Dep::Conflicts || Dep->Type == Dep::DpkgBreaks))
 	 continue;
 	 continue;
       
       
       // Check if the provides is a hit
       // Check if the provides is a hit
@@ -454,7 +455,9 @@ void pkgDepCache::BuildGroupOrs(VerIterator const &V)
 
 
       /* Invert for Conflicts. We have to do this twice to get the
       /* Invert for Conflicts. We have to do this twice to get the
          right sense for a conflicts group */
          right sense for a conflicts group */
-      if (D->Type == Dep::Conflicts || D->Type == Dep::Obsoletes)
+      if (D->Type == Dep::Conflicts ||
+	  D->Type == Dep::DpkgBreaks ||
+	  D->Type == Dep::Obsoletes)
 	 State = ~State;
 	 State = ~State;
       
       
       // Add to the group if we are within an or..
       // Add to the group if we are within an or..
@@ -465,7 +468,9 @@ void pkgDepCache::BuildGroupOrs(VerIterator const &V)
 	 Group = 0;
 	 Group = 0;
       
       
       // Invert for Conflicts
       // Invert for Conflicts
-      if (D->Type == Dep::Conflicts || D->Type == Dep::Obsoletes)
+      if (D->Type == Dep::Conflicts ||
+	  D->Type == Dep::DpkgBreaks ||
+	  D->Type == Dep::Obsoletes)
 	 State = ~State;
 	 State = ~State;
    }	 
    }	 
 }
 }
@@ -598,7 +603,9 @@ void pkgDepCache::Update(OpProgress *Prog)
 	       Group = 0;
 	       Group = 0;
 
 
 	    // Invert for Conflicts
 	    // Invert for Conflicts
-	    if (D->Type == Dep::Conflicts || D->Type == Dep::Obsoletes)
+	    if (D->Type == Dep::Conflicts ||
+		D->Type == Dep::DpkgBreaks ||
+		D->Type == Dep::Obsoletes)
 	       State = ~State;
 	       State = ~State;
 	 }	 
 	 }	 
       }
       }
@@ -628,7 +635,9 @@ void pkgDepCache::Update(DepIterator D)
       State = DependencyState(D);
       State = DependencyState(D);
     
     
       // Invert for Conflicts
       // Invert for Conflicts
-      if (D->Type == Dep::Conflicts || D->Type == Dep::Obsoletes)
+      if (D->Type == Dep::Conflicts ||
+	  D->Type == Dep::DpkgBreaks ||
+	  D->Type == Dep::Obsoletes)
 	 State = ~State;
 	 State = ~State;
 
 
       RemoveStates(D.ParentPkg());
       RemoveStates(D.ParentPkg());
@@ -901,7 +910,8 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
       /* This bit is for processing the possibilty of an install/upgrade
       /* This bit is for processing the possibilty of an install/upgrade
          fixing the problem */
          fixing the problem */
       SPtrArray<Version *> List = Start.AllTargets();
       SPtrArray<Version *> List = Start.AllTargets();
-      if ((DepState[Start->ID] & DepCVer) == DepCVer)
+      if (Start->Type != Dep::DpkgBreaks &&
+	  (DepState[Start->ID] & DepCVer) == DepCVer)
       {
       {
 	 // Right, find the best version to install..
 	 // Right, find the best version to install..
 	 Version **Cur = List;
 	 Version **Cur = List;
@@ -938,21 +948,31 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
 	       std::clog << "Installing " << InstPkg.Name() 
 	       std::clog << "Installing " << InstPkg.Name() 
 			 << " as dep of " << Pkg.Name() 
 			 << " as dep of " << Pkg.Name() 
 			 << std::endl;
 			 << std::endl;
-	   MarkInstall(InstPkg, true, Depth + 1, false, ForceImportantDeps);
+	    MarkInstall(InstPkg,true,Depth + 1, false, ForceImportantDeps);
+
+	    // Set the autoflag, after MarkInstall because MarkInstall unsets it
+	    if (P->CurrentVer == 0)
+	       PkgState[InstPkg->ID].Flags |= Flag::Auto;
 	 }
 	 }
 	 continue;
 	 continue;
       }
       }
-      
+
       /* For conflicts we just de-install the package and mark as auto,
       /* For conflicts we just de-install the package and mark as auto,
-         Conflicts may not have or groups */
-      if (Start->Type == Dep::Conflicts || Start->Type == Dep::Obsoletes)
+         Conflicts may not have or groups.  For dpkg's Breaks we try to
+         upgrade the package. */
+      if (Start->Type == Dep::Conflicts || Start->Type == Dep::Obsoletes ||
+	  Start->Type == Dep::DpkgBreaks)
       {
       {
 	 for (Version **I = List; *I != 0; I++)
 	 for (Version **I = List; *I != 0; I++)
 	 {
 	 {
 	    VerIterator Ver(*this,*I);
 	    VerIterator Ver(*this,*I);
 	    PkgIterator Pkg = Ver.ParentPkg();
 	    PkgIterator Pkg = Ver.ParentPkg();
-      
-	    MarkDelete(Pkg);
+
+	    if (Start->Type != Dep::DpkgBreaks)
+	       MarkDelete(Pkg);
+	    else
+	       if (PkgState[Pkg->ID].CandidateVer != *I)
+		  MarkInstall(Pkg,true,Depth + 1, false, ForceImportantDeps);
 	 }
 	 }
 	 continue;
 	 continue;
       }      
       }      

+ 16 - 1
apt-pkg/orderlist.cc

@@ -491,11 +491,13 @@ bool pkgOrderList::VisitProvides(DepIterator D,bool Critical)
 	 continue;
 	 continue;
       
       
       if (D->Type != pkgCache::Dep::Conflicts &&
       if (D->Type != pkgCache::Dep::Conflicts &&
+	  D->Type != pkgCache::Dep::DpkgBreaks &&
 	  D->Type != pkgCache::Dep::Obsoletes &&
 	  D->Type != pkgCache::Dep::Obsoletes &&
 	  Cache[Pkg].InstallVer != *I)
 	  Cache[Pkg].InstallVer != *I)
 	 continue;
 	 continue;
       
       
       if ((D->Type == pkgCache::Dep::Conflicts ||
       if ((D->Type == pkgCache::Dep::Conflicts ||
+	   D->Type == pkgCache::Dep::DpkgBreaks ||
 	   D->Type == pkgCache::Dep::Obsoletes) &&
 	   D->Type == pkgCache::Dep::Obsoletes) &&
 	  (Version *)Pkg.CurrentVer() != *I)
 	  (Version *)Pkg.CurrentVer() != *I)
 	 continue;
 	 continue;
@@ -630,6 +632,7 @@ bool pkgOrderList::DepUnPackCrit(DepIterator D)
 	 /* Forward critical dependencies MUST be correct before the 
 	 /* Forward critical dependencies MUST be correct before the 
 	    package can be unpacked. */
 	    package can be unpacked. */
 	 if (D->Type != pkgCache::Dep::Conflicts &&
 	 if (D->Type != pkgCache::Dep::Conflicts &&
+	     D->Type != pkgCache::Dep::DpkgBreaks &&
 	     D->Type != pkgCache::Dep::Obsoletes &&
 	     D->Type != pkgCache::Dep::Obsoletes &&
 	     D->Type != pkgCache::Dep::PreDepends)
 	     D->Type != pkgCache::Dep::PreDepends)
 	    continue;
 	    continue;
@@ -668,7 +671,7 @@ bool pkgOrderList::DepUnPackCrit(DepIterator D)
    }   
    }   
    return true;
    return true;
 }
 }
-									/*}}}*/
+
 // OrderList::DepUnPackPreD - Critical UnPacking ordering with depends	/*{{{*/
 // OrderList::DepUnPackPreD - Critical UnPacking ordering with depends	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* Critical PreDepends (also configure immediate and essential) strives to
 /* Critical PreDepends (also configure immediate and essential) strives to
@@ -803,9 +806,20 @@ bool pkgOrderList::DepUnPackDep(DepIterator D)
 	       return false;
 	       return false;
 	 }
 	 }
 	 else
 	 else
+	 {
 	    if (D->Type == pkgCache::Dep::Depends)
 	    if (D->Type == pkgCache::Dep::Depends)
 	       if (VisitProvides(D,false) == false)
 	       if (VisitProvides(D,false) == false)
 		  return false;
 		  return false;
+
+	    if (D->Type == pkgCache::Dep::DpkgBreaks)
+	    {
+	       if (CheckDep(D) == true)
+		 continue;
+
+	       if (VisitNode(D.TargetPkg()) == false)
+		 return false;
+	    }
+	 }
       }
       }
    return true;
    return true;
 }
 }
@@ -953,6 +967,7 @@ bool pkgOrderList::CheckDep(DepIterator D)
       /* Conflicts requires that all versions are not present, depends
       /* Conflicts requires that all versions are not present, depends
          just needs one */
          just needs one */
       if (D->Type != pkgCache::Dep::Conflicts && 
       if (D->Type != pkgCache::Dep::Conflicts && 
+	  D->Type != pkgCache::Dep::DpkgBreaks && 
 	  D->Type != pkgCache::Dep::Obsoletes)
 	  D->Type != pkgCache::Dep::Obsoletes)
       {
       {
 	 /* Try to find something that does not have the after flag set
 	 /* Try to find something that does not have the after flag set

+ 7 - 4
apt-pkg/pkgcache.cc

@@ -49,7 +49,7 @@ pkgCache::Header::Header()
    
    
    /* Whenever the structures change the major version should be bumped,
    /* Whenever the structures change the major version should be bumped,
       whenever the generator changes the minor version should be bumped. */
       whenever the generator changes the minor version should be bumped. */
-   MajorVersion = 5;
+   MajorVersion = 6;
    MinorVersion = 0;
    MinorVersion = 0;
    Dirty = false;
    Dirty = false;
    
    
@@ -223,8 +223,8 @@ const char *pkgCache::DepType(unsigned char Type)
 {
 {
    const char *Types[] = {"",_("Depends"),_("PreDepends"),_("Suggests"),
    const char *Types[] = {"",_("Depends"),_("PreDepends"),_("Suggests"),
                           _("Recommends"),_("Conflicts"),_("Replaces"),
                           _("Recommends"),_("Conflicts"),_("Replaces"),
-                          _("Obsoletes")};
-   if (Type < 8)
+                          _("Obsoletes"),_("Breaks")};
+   if (Type < sizeof(Types)/sizeof(*Types))
       return Types[Type];
       return Types[Type];
    return "";
    return "";
 }
 }
@@ -287,10 +287,11 @@ pkgCache::PkgIterator::OkState pkgCache::PkgIterator::State() const
 // DepIterator::IsCritical - Returns true if the dep is important	/*{{{*/
 // DepIterator::IsCritical - Returns true if the dep is important	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* Currently critical deps are defined as depends, predepends and
 /* Currently critical deps are defined as depends, predepends and
-   conflicts. */
+   conflicts (including dpkg's Breaks fields). */
 bool pkgCache::DepIterator::IsCritical()
 bool pkgCache::DepIterator::IsCritical()
 {
 {
    if (Dep->Type == pkgCache::Dep::Conflicts ||
    if (Dep->Type == pkgCache::Dep::Conflicts ||
+       Dep->Type == pkgCache::Dep::DpkgBreaks ||
        Dep->Type == pkgCache::Dep::Obsoletes ||
        Dep->Type == pkgCache::Dep::Obsoletes ||
        Dep->Type == pkgCache::Dep::Depends ||
        Dep->Type == pkgCache::Dep::Depends ||
        Dep->Type == pkgCache::Dep::PreDepends)
        Dep->Type == pkgCache::Dep::PreDepends)
@@ -376,6 +377,7 @@ pkgCache::Version **pkgCache::DepIterator::AllTargets()
 	    continue;
 	    continue;
 
 
 	 if ((Dep->Type == pkgCache::Dep::Conflicts ||
 	 if ((Dep->Type == pkgCache::Dep::Conflicts ||
+	      Dep->Type == pkgCache::Dep::DpkgBreaks ||
 	      Dep->Type == pkgCache::Dep::Obsoletes) &&
 	      Dep->Type == pkgCache::Dep::Obsoletes) &&
 	     ParentPkg() == I.ParentPkg())
 	     ParentPkg() == I.ParentPkg())
 	    continue;
 	    continue;
@@ -392,6 +394,7 @@ pkgCache::Version **pkgCache::DepIterator::AllTargets()
 	    continue;
 	    continue;
 	 
 	 
 	 if ((Dep->Type == pkgCache::Dep::Conflicts ||
 	 if ((Dep->Type == pkgCache::Dep::Conflicts ||
+	      Dep->Type == pkgCache::Dep::DpkgBreaks ||
 	      Dep->Type == pkgCache::Dep::Obsoletes) &&
 	      Dep->Type == pkgCache::Dep::Obsoletes) &&
 	     ParentPkg() == I.OwnerPkg())
 	     ParentPkg() == I.OwnerPkg())
 	    continue;
 	    continue;

+ 5 - 1
apt-pkg/pkgcache.h

@@ -63,10 +63,14 @@ class pkgCache
    class Namespace;
    class Namespace;
    
    
    // These are all the constants used in the cache structures
    // These are all the constants used in the cache structures
+
+   // WARNING - if you change these lists you must also edit
+   // the stringification in pkgcache.cc and also consider whether
+   // the cache file will become incompatible.
    struct Dep
    struct Dep
    {
    {
       enum DepType {Depends=1,PreDepends=2,Suggests=3,Recommends=4,
       enum DepType {Depends=1,PreDepends=2,Suggests=3,Recommends=4,
-	 Conflicts=5,Replaces=6,Obsoletes=7};
+	 Conflicts=5,Replaces=6,Obsoletes=7,DpkgBreaks=8};
       enum DepCompareOp {Or=0x10,NoOp=0,LessEq=0x1,GreaterEq=0x2,Less=0x3,
       enum DepCompareOp {Or=0x10,NoOp=0,LessEq=0x1,GreaterEq=0x2,Less=0x3,
 	 Greater=0x4,Equals=0x5,NotEquals=0x6};
 	 Greater=0x4,Equals=0x5,NotEquals=0x6};
    };
    };

+ 4 - 2
apt-pkg/pkgcachegen.cc

@@ -678,8 +678,10 @@ static bool CheckValidity(const string &CacheFile, FileIterator Start,
     
     
       if ((*Start)->Exists() == false)
       if ((*Start)->Exists() == false)
       {
       {
+#if 0 // mvo: we no longer give a message here (Default Sources spec)
 	 _error->WarningE("stat",_("Couldn't stat source package list %s"),
 	 _error->WarningE("stat",_("Couldn't stat source package list %s"),
 			  (*Start)->Describe().c_str());
 			  (*Start)->Describe().c_str());
+#endif
 	 continue;
 	 continue;
       }
       }
 
 
@@ -783,7 +785,7 @@ static bool BuildCache(pkgCacheGenerator &Gen,
 bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
 bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
 			MMap **OutMap,bool AllowMem)
 			MMap **OutMap,bool AllowMem)
 {
 {
-   unsigned long MapSize = _config->FindI("APT::Cache-Limit",12*1024*1024);
+   unsigned long MapSize = _config->FindI("APT::Cache-Limit",16*1024*1024);
    
    
    vector<pkgIndexFile *> Files;
    vector<pkgIndexFile *> Files;
    for (vector<metaIndex *>::const_iterator i = List.begin();
    for (vector<metaIndex *>::const_iterator i = List.begin();
@@ -930,7 +932,7 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
 /* */
 /* */
 bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap)
 bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap)
 {
 {
-   unsigned long MapSize = _config->FindI("APT::Cache-Limit",8*1024*1024);
+   unsigned long MapSize = _config->FindI("APT::Cache-Limit",12*1024*1024);
    vector<pkgIndexFile *> Files;
    vector<pkgIndexFile *> Files;
    unsigned long EndOfSource = Files.size();
    unsigned long EndOfSource = Files.size();
    if (_system->AddStatusFiles(Files) == false)
    if (_system->AddStatusFiles(Files) == false)

+ 1 - 0
apt-pkg/tagfile.cc

@@ -423,6 +423,7 @@ static const char *iTFRewritePackageOrder[] = {
                           "Recommends",
                           "Recommends",
                           "Suggests",
                           "Suggests",
                           "Conflicts",
                           "Conflicts",
+                          "Breaks",
                           "Conffiles",
                           "Conffiles",
                           "Filename",
                           "Filename",
                           "Size",
                           "Size",

+ 8 - 2
cmdline/apt-cache.cc

@@ -102,13 +102,15 @@ bool UnMet(CommandLine &CmdL)
 	    if (End->Type != pkgCache::Dep::PreDepends &&
 	    if (End->Type != pkgCache::Dep::PreDepends &&
 		End->Type != pkgCache::Dep::Depends && 
 		End->Type != pkgCache::Dep::Depends && 
 		End->Type != pkgCache::Dep::Suggests &&
 		End->Type != pkgCache::Dep::Suggests &&
-		End->Type != pkgCache::Dep::Recommends)
+		End->Type != pkgCache::Dep::Recommends &&
+		End->Type != pkgCache::Dep::DpkgBreaks)
 	       continue;
 	       continue;
 
 
 	    // Important deps only
 	    // Important deps only
 	    if (Important == true)
 	    if (Important == true)
 	       if (End->Type != pkgCache::Dep::PreDepends &&
 	       if (End->Type != pkgCache::Dep::PreDepends &&
-		   End->Type != pkgCache::Dep::Depends)
+		   End->Type != pkgCache::Dep::Depends &&
+		   End->Type != pkgCache::Dep::DpkgBreaks)
 		  continue;
 		  continue;
 	    
 	    
 	    // Verify the or group
 	    // Verify the or group
@@ -869,6 +871,7 @@ bool XVcg(CommandLine &CmdL)
 		     then show the relation but do not recurse */
 		     then show the relation but do not recurse */
 		  if (Hit == false && 
 		  if (Hit == false && 
 		      (D->Type == pkgCache::Dep::Conflicts ||
 		      (D->Type == pkgCache::Dep::Conflicts ||
+		       D->Type == pkgCache::Dep::DpkgBreaks ||
 		       D->Type == pkgCache::Dep::Obsoletes))
 		       D->Type == pkgCache::Dep::Obsoletes))
 		  {
 		  {
 		     if (Show[D.TargetPkg()->ID] == None && 
 		     if (Show[D.TargetPkg()->ID] == None && 
@@ -890,6 +893,9 @@ bool XVcg(CommandLine &CmdL)
 		  case pkgCache::Dep::Conflicts:
 		  case pkgCache::Dep::Conflicts:
 		    printf("label: \"conflicts\" color: lightgreen }\n");
 		    printf("label: \"conflicts\" color: lightgreen }\n");
 		    break;
 		    break;
+		  case pkgCache::Dep::DpkgBreaks:
+		    printf("label: \"breaks\" color: lightgreen }\n");
+		    break;
 		  case pkgCache::Dep::Obsoletes:
 		  case pkgCache::Dep::Obsoletes:
 		    printf("label: \"obsoletes\" color: lightgreen }\n");
 		    printf("label: \"obsoletes\" color: lightgreen }\n");
 		    break;
 		    break;

+ 19 - 5
cmdline/apt-get.cc

@@ -1372,20 +1372,29 @@ bool DoUpdate(CommandLine &CmdL)
       return false;
       return false;
 
 
    bool Failed = false;
    bool Failed = false;
+   bool TransientNetworkFailure = false;
    for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++)
    for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++)
    {
    {
       if ((*I)->Status == pkgAcquire::Item::StatDone)
       if ((*I)->Status == pkgAcquire::Item::StatDone)
 	 continue;
 	 continue;
 
 
       (*I)->Finished();
       (*I)->Finished();
-      
+
       fprintf(stderr,_("Failed to fetch %s  %s\n"),(*I)->DescURI().c_str(),
       fprintf(stderr,_("Failed to fetch %s  %s\n"),(*I)->DescURI().c_str(),
 	      (*I)->ErrorText.c_str());
 	      (*I)->ErrorText.c_str());
+
+      if ((*I)->Status == pkgAcquire::Item::StatTransientNetworkError) 
+      {
+	 TransientNetworkFailure = true;
+	 continue;
+      }
+
       Failed = true;
       Failed = true;
    }
    }
    
    
    // Clean out any old list files
    // Clean out any old list files
-   if (!Failed && _config->FindB("APT::Get::List-Cleanup",true) == true)
+   if (!TransientNetworkFailure &&
+       _config->FindB("APT::Get::List-Cleanup",true) == true)
    {
    {
       if (Fetcher.Clean(_config->FindDir("Dir::State::lists")) == false ||
       if (Fetcher.Clean(_config->FindDir("Dir::State::lists")) == false ||
 	  Fetcher.Clean(_config->FindDir("Dir::State::lists") + "partial/") == false)
 	  Fetcher.Clean(_config->FindDir("Dir::State::lists") + "partial/") == false)
@@ -1397,9 +1406,11 @@ bool DoUpdate(CommandLine &CmdL)
    if (Cache.BuildCaches() == false)
    if (Cache.BuildCaches() == false)
       return false;
       return false;
    
    
-   if (Failed == true)
+   if (TransientNetworkFailure == true)
+      _error->Warning(_("Some index files failed to download, they have been ignored, or old ones used instead."));
+   else if (Failed == true)
       return _error->Error(_("Some index files failed to download, they have been ignored, or old ones used instead."));
       return _error->Error(_("Some index files failed to download, they have been ignored, or old ones used instead."));
-   
+
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -1709,8 +1720,10 @@ bool DoInstall(CommandLine &CmdL)
 	 return _error->Error(_("Broken packages"));
 	 return _error->Error(_("Broken packages"));
       }   
       }   
    }
    }
-   if (!DoAutomaticRemove(Cache)) 
+   if (_config->FindB("APT::Get::AutomaticRemove")) {
+      if (!DoAutomaticRemove(Cache)) 
 	 return false;
 	 return false;
+   }
 
 
    /* Print out a list of packages that are going to be installed extra
    /* Print out a list of packages that are going to be installed extra
       to what the user asked */
       to what the user asked */
@@ -2621,6 +2634,7 @@ void GetInitialize()
    _config->Set("APT::Get::Fix-Broken",false);
    _config->Set("APT::Get::Fix-Broken",false);
    _config->Set("APT::Get::Force-Yes",false);
    _config->Set("APT::Get::Force-Yes",false);
    _config->Set("APT::Get::List-Cleanup",true);
    _config->Set("APT::Get::List-Cleanup",true);
+   _config->Set("APT::Get::AutomaticRemove",false);
 }
 }
 									/*}}}*/
 									/*}}}*/
 // SigWinch - Window size change signal handler				/*{{{*/
 // SigWinch - Window size change signal handler				/*{{{*/

+ 16 - 0
debian/apt.cron.daily

@@ -14,6 +14,12 @@
 #  "APT::Periodic::AutocleanInterval"
 #  "APT::Periodic::AutocleanInterval"
 #  - Do "apt-get autoclean" every n-days (0=disable)
 #  - Do "apt-get autoclean" every n-days (0=disable)
 #
 #
+#  "APT::Periodic::Unattended-Upgrade"
+#  - Run the "unattended-upgrade" security upgrade script 
+#    every n-days (0=disabled)
+#    Requires the package "unattended-upgrades" and will write
+#    a log in /var/log/unattended-upgrades
+# 
 #  "APT::Archives::MaxAge",
 #  "APT::Archives::MaxAge",
 #  - Set maximum allowed age of a cache package file. If a cache 
 #  - Set maximum allowed age of a cache package file. If a cache 
 #    package file is older it is deleted (0=disable)
 #    package file is older it is deleted (0=disable)
@@ -148,6 +154,10 @@ eval $(apt-config shell UpdateInterval APT::Periodic::Update-Package-Lists Downl
 AutocleanInterval=$DownloadUpgradeableInterval
 AutocleanInterval=$DownloadUpgradeableInterval
 eval $(apt-config shell AutocleanInterval APT::Periodic::Autoclean)
 eval $(apt-config shell AutocleanInterval APT::Periodic::Autoclean)
 
 
+UnattendedUpgradeInterval=0
+eval $(apt-config shell UnattendedUpgradeInterval APT::Periodic::Unattended-Upgrade)
+
+
 # laptop check, on_ac_power returns:
 # laptop check, on_ac_power returns:
 #       0 (true)    System is on mains power
 #       0 (true)    System is on mains power
 #       1 (false)   System is not on mains power
 #       1 (false)   System is not on mains power
@@ -182,5 +192,11 @@ if check_stamp $AUTOCLEAN_STAMP $AutocleanInterval; then
     update_stamp $AUTOCLEAN_STAMP
     update_stamp $AUTOCLEAN_STAMP
 fi
 fi
 
 
+UPGRADE_STAMP=/var/lib/apt/periodic/upgrade-stamp
+if check_stamp $UPGRADE_STAMP $UnattendedUpgradeInterval; then
+    unattended-upgrade
+    update_stamp $UPGRADE_STAMP
+fi
+
 # check cache size 
 # check cache size 
 check_size_constraints
 check_size_constraints

+ 11 - 0
debian/changelog

@@ -2,6 +2,17 @@ apt (0.7.0) experimental; urgency=low
 
 
   * Branch that contains tall the new features
   * Branch that contains tall the new features
   * Removed all #pragma interface/implementation
   * Removed all #pragma interface/implementation
+  * Branch that contains tall the new features:
+  * translated package descriptions
+  * task install support
+  * automatic dependency removal
+  * Removed all #pragma interface/implementation
+  * merged support for the new dpkg "Breaks" field 
+    (thanks to Ian Jackson)
+  * handle network failures more gracefully on "update"
+  * support for unattended-upgrades (via unattended-upgrades
+    package)
+
 
 
  -- Michael Vogt <mvo@debian.org>  Thu, 14 Dec 2006 11:31:41 +0100
  -- Michael Vogt <mvo@debian.org>  Thu, 14 Dec 2006 11:31:41 +0100
 
 

+ 5 - 0
debian/rules

@@ -214,6 +214,11 @@ apt: build debian/shlibs.local
 	cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove
 	cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove
 #	head -n 500 ChangeLog > debian/ChangeLog
 #	head -n 500 ChangeLog > debian/ChangeLog
 
 
+	# make rosetta happy and remove pot files in po/ (but leave stuff
+	# in po/domains/* untouched) and cp *.po into each domain dir
+	rm -f build/po/*.pot
+	rm -f po/*.pot
+
 	dh_installexamples -p$@ $(BLD)/docs/examples/*
 	dh_installexamples -p$@ $(BLD)/docs/examples/*
 	dh_installman -p$@ 
 	dh_installman -p$@ 
 	dh_installcron -p$@
 	dh_installcron -p$@

+ 1 - 1
doc/apt-cache.8.xml

@@ -151,7 +151,7 @@ Reverse Provides:
        a dependency but were not provided by any package. Missing packages may 
        a dependency but were not provided by any package. Missing packages may 
        be in evidence if a full distribution is not accessed, or if a package
        be in evidence if a full distribution is not accessed, or if a package
        (real or virtual) has been dropped from the distribution. Usually they
        (real or virtual) has been dropped from the distribution. Usually they
-       are referenced from Conflicts statements.</para>
+       are referenced from Conflicts or Breaks statements.</para>
        </listitem>
        </listitem>
 
 
        <listitem><para><literal>Total distinct</literal> versions is the number of package versions 
        <listitem><para><literal>Total distinct</literal> versions is the number of package versions 

+ 2 - 1
doc/cache.sgml

@@ -492,7 +492,7 @@ This is the parsed priority value of the package.
 Dependency contains the information for a single dependency record. The records
 Dependency contains the information for a single dependency record. The records
 are split up like this to ease processing by the client. The base of list
 are split up like this to ease processing by the client. The base of list
 linked list is Version.DependsList. All forms of dependencies are recorded
 linked list is Version.DependsList. All forms of dependencies are recorded
-here including Conflicts, Suggests and Recommends.
+here including Conflicts, Breaks, Suggests and Recommends.
 
 
 <p>
 <p>
 Multiple depends on the same package must be grouped together in 
 Multiple depends on the same package must be grouped together in 
@@ -671,6 +671,7 @@ of them.
 #define pkgDEP_Recommends 4
 #define pkgDEP_Recommends 4
 #define pkgDEP_Conflicts 5
 #define pkgDEP_Conflicts 5
 #define pkgDEP_Replaces 6
 #define pkgDEP_Replaces 6
+#define pkgDEP_Breaks 8
 </example>
 </example>
 </sect1>
 </sect1>
 
 

+ 2 - 0
doc/dpkg-tech.sgml

@@ -46,6 +46,8 @@ The basic dpkg package control file supports the following major features:-
 	productivity of the package
 	productivity of the package
 	<item>Conflicts, to specify a package which must NOT be installed
 	<item>Conflicts, to specify a package which must NOT be installed
 	in order for the package to be configured
 	in order for the package to be configured
+	<item>Breaks, to specify a package which is broken by the
+	package and which should therefore not be configured while broken
 	</list>
 	</list>
 Each of these dependencies can specify a version and a depedency on that
 Each of these dependencies can specify a version and a depedency on that
 version, for example "<= 0.5-1", "== 2.7.2-1", etc. The comparators available
 version, for example "<= 0.5-1", "== 2.7.2-1", etc. The comparators available

Разница между файлами не показана из-за своего большого размера
+ 0 - 2574
po/ku.po


+ 3 - 0
po/makefile

@@ -40,6 +40,9 @@ $(POTFILES) : $(PO)/%.pot :
 	  --files-from=$(PO)/POTFILES_$*.in -o $(PO)/domains/$*/c.pot
 	  --files-from=$(PO)/POTFILES_$*.in -o $(PO)/domains/$*/c.pot
 	rm -f $(PO)/POTFILES_$*.in
 	rm -f $(PO)/POTFILES_$*.in
 	$(MSGCOMM) --more-than=0 $(PO)/domains/$*/c.pot $(PO)/domains/$*/sh.pot --output=$@
 	$(MSGCOMM) --more-than=0 $(PO)/domains/$*/c.pot $(PO)/domains/$*/sh.pot --output=$@
+	# copy into the domain dirs to make rosetta happy
+	rm -f $(PO)/domains/$*/*.pot
+	cp $@ $(PO)/domains/$*
 
 
 $(PACKAGE)-all.pot: $(POTFILES)
 $(PACKAGE)-all.pot: $(POTFILES)
 	$(MSGCOMM) --more-than=0 $(POTFILES) --output=$@
 	$(MSGCOMM) --more-than=0 $(POTFILES) --output=$@

Разница между файлами не показана из-за своего большого размера
+ 0 - 2803
po/uk.po