~brian-murray/ubuntu/oneiric/apt/block-fsys-tarfile

« back to all changes in this revision

Viewing changes to apt-pkg/depcache.cc

  • Committer: Michael Vogt
  • Date: 2011-06-28 21:41:29 UTC
  • mfrom: (1327.97.34 debian-sid)
  • Revision ID: michael.vogt@ubuntu.com-20110628214129-tait7qp81nvm7wjv
mergedĀ fromĀ debian-sid

Show diffs side-by-side

added added

removed removed

Lines of Context:
339
339
   /* Check simple depends. A depends -should- never self match but 
340
340
      we allow it anyhow because dpkg does. Technically it is a packaging
341
341
      bug. Conflicts may never self match */
342
 
   if (Dep.TargetPkg() != Dep.ParentPkg() ||
343
 
       (Dep->Type != Dep::Conflicts && Dep->Type != Dep::DpkgBreaks && Dep->Type != Dep::Obsoletes))
 
342
   if (Dep.TargetPkg() != Dep.ParentPkg() || Dep.IsNegative() == false)
344
343
   {
345
344
      PkgIterator Pkg = Dep.TargetPkg();
346
345
      // Check the base package
370
369
   {
371
370
      /* Provides may never be applied against the same package (or group)
372
371
         if it is a conflicts. See the comment above. */
373
 
      if (P.OwnerPkg()->Group == Pkg->Group &&
374
 
          (Dep->Type == Dep::Conflicts || Dep->Type == Dep::DpkgBreaks))
 
372
      if (P.OwnerPkg()->Group == Pkg->Group && Dep.IsNegative() == true)
375
373
         continue;
376
374
      
377
375
      // Check if the provides is a hit
549
547
   // Not installed
550
548
   if (Pkg->CurrentVer == 0)
551
549
   {
552
 
      if (State.Mode == ModeDelete && 
 
550
      if (State.Mode == ModeDelete &&
553
551
          (State.iFlags & Purge) == Purge && Pkg.Purge() == false)
554
552
         iDelCount += Add;
555
553
      
594
592
 
595
593
      /* Invert for Conflicts. We have to do this twice to get the
596
594
         right sense for a conflicts group */
597
 
      if (D->Type == Dep::Conflicts ||
598
 
          D->Type == Dep::DpkgBreaks ||
599
 
          D->Type == Dep::Obsoletes)
 
595
      if (D.IsNegative() == true)
600
596
         State = ~State;
601
597
      
602
598
      // Add to the group if we are within an or..
607
603
         Group = 0;
608
604
      
609
605
      // Invert for Conflicts
610
 
      if (D->Type == Dep::Conflicts ||
611
 
          D->Type == Dep::DpkgBreaks ||
612
 
          D->Type == Dep::Obsoletes)
 
606
      if (D.IsNegative() == true)
613
607
         State = ~State;
614
608
   }     
615
609
}
742
736
               Group = 0;
743
737
 
744
738
            // Invert for Conflicts
745
 
            if (D->Type == Dep::Conflicts ||
746
 
                D->Type == Dep::DpkgBreaks ||
747
 
                D->Type == Dep::Obsoletes)
 
739
            if (D.IsNegative() == true)
748
740
               State = ~State;
749
741
         }
750
742
      }
774
766
      State = DependencyState(D);
775
767
    
776
768
      // Invert for Conflicts
777
 
      if (D->Type == Dep::Conflicts ||
778
 
          D->Type == Dep::DpkgBreaks ||
779
 
          D->Type == Dep::Obsoletes)
 
769
      if (D.IsNegative() == true)
780
770
         State = ~State;
781
771
 
782
772
      RemoveStates(D.ParentPkg());
1089
1079
      */
1090
1080
      if (IsImportantDep(Start) == false)
1091
1081
         continue;
1092
 
      
 
1082
 
 
1083
      /* If we are in an or group locate the first or that can 
 
1084
         succeed. We have already cached this.. */
 
1085
      for (; Ors > 1 && (DepState[Start->ID] & DepCVer) != DepCVer; --Ors)
 
1086
         ++Start;
 
1087
      if (Ors == 1 && (DepState[Start->ID] &DepCVer) != DepCVer && Start.IsNegative() == false)
 
1088
      {
 
1089
         if(DebugAutoInstall == true)
 
1090
            std::clog << OutputInDepth(Depth) << Start << " can't be satisfied!" << std::endl;
 
1091
         if (Start.IsCritical() == false)
 
1092
            continue;
 
1093
         // if the dependency was critical, we can't install it, so remove it again
 
1094
         MarkDelete(Pkg,false,Depth + 1, false);
 
1095
         return;
 
1096
      }
 
1097
 
1093
1098
      /* Check if any ImportantDep() (but not Critical) were added
1094
1099
       * since we installed the package.  Also check for deps that
1095
1100
       * were satisfied in the past: for instance, if a version
1097
1102
       * package should follow that Recommends rather than causing the
1098
1103
       * dependency to be removed. (bug #470115)
1099
1104
       */
1100
 
      bool isNewImportantDep = false;
1101
 
      bool isPreviouslySatisfiedImportantDep = false;
1102
 
      if(!ForceImportantDeps && !Start.IsCritical())
 
1105
      if (Pkg->CurrentVer != 0 && ForceImportantDeps == false && Start.IsCritical() == false)
1103
1106
      {
1104
 
         bool found=false;
1105
 
         VerIterator instVer = Pkg.CurrentVer();
1106
 
         if(!instVer.end())
1107
 
         {
1108
 
           for (DepIterator D = instVer.DependsList(); D.end() != true; D++)
1109
 
             {
1110
 
               //FIXME: deal better with or-groups(?)
1111
 
               if(IsImportantDep(D) && !D.IsCritical() &&
1112
 
                  Start.TargetPkg() == D.TargetPkg())
1113
 
                 {
1114
 
                   if(!isPreviouslySatisfiedImportantDep)
1115
 
                     {
1116
 
                       DepIterator D2 = D;
1117
 
                       while((D2->CompareOp & Dep::Or) != 0)
1118
 
                         ++D2;
1119
 
 
1120
 
                       isPreviouslySatisfiedImportantDep =
1121
 
                         (((*this)[D2] & DepGNow) != 0);
1122
 
                     }
1123
 
 
1124
 
                   found=true;
1125
 
                 }
1126
 
             }
1127
 
            // this is a new dep if it was not found to be already
1128
 
            // a important dep of the installed pacakge
1129
 
            isNewImportantDep = !found;
 
1107
         bool isNewImportantDep = true;
 
1108
         bool isPreviouslySatisfiedImportantDep = false;
 
1109
         for (DepIterator D = Pkg.CurrentVer().DependsList(); D.end() != true; ++D)
 
1110
         {
 
1111
            //FIXME: Should we handle or-group better here?
 
1112
            // We do not check if the package we look for is part of the same or-group
 
1113
            // we might find while searching, but could that really be a problem?
 
1114
            if (D.IsCritical() == true || IsImportantDep(D) == false ||
 
1115
                Start.TargetPkg() != D.TargetPkg())
 
1116
               continue;
 
1117
 
 
1118
            isNewImportantDep = false;
 
1119
 
 
1120
            while ((D->CompareOp & Dep::Or) != 0)
 
1121
               ++D;
 
1122
 
 
1123
            isPreviouslySatisfiedImportantDep = (((*this)[D] & DepGNow) != 0);
 
1124
            if (isPreviouslySatisfiedImportantDep == true)
 
1125
               break;
 
1126
         }
 
1127
 
 
1128
         if(isNewImportantDep == true)
 
1129
         {
 
1130
            if (DebugAutoInstall == true)
 
1131
               std::clog << OutputInDepth(Depth) << "new important dependency: "
 
1132
                         << Start.TargetPkg().FullName() << std::endl;
 
1133
         }
 
1134
         else if(isPreviouslySatisfiedImportantDep == true)
 
1135
         {
 
1136
            if (DebugAutoInstall == true)
 
1137
               std::clog << OutputInDepth(Depth) << "previously satisfied important dependency on "
 
1138
                         << Start.TargetPkg().FullName() << std::endl;
 
1139
         }
 
1140
         else
 
1141
         {
 
1142
            if (DebugAutoInstall == true)
 
1143
               std::clog << OutputInDepth(Depth) << "ignore old unsatisfied important dependency on "
 
1144
                         << Start.TargetPkg().FullName() << std::endl;
 
1145
            continue;
1130
1146
         }
1131
1147
      }
1132
 
      if(isNewImportantDep)
1133
 
         if(DebugAutoInstall == true)
1134
 
            std::clog << OutputInDepth(Depth) << "new important dependency: "
1135
 
                      << Start.TargetPkg().Name() << std::endl;
1136
 
      if(isPreviouslySatisfiedImportantDep)
1137
 
        if(DebugAutoInstall == true)
1138
 
          std::clog << OutputInDepth(Depth) << "previously satisfied important dependency on "
1139
 
                    << Start.TargetPkg().Name() << std::endl;
1140
 
 
1141
 
      // skip important deps if the package is already installed
1142
 
      if (Pkg->CurrentVer != 0 && Start.IsCritical() == false 
1143
 
          && !isNewImportantDep && !isPreviouslySatisfiedImportantDep
1144
 
          && !ForceImportantDeps)
1145
 
         continue;
1146
 
      
1147
 
      /* If we are in an or group locate the first or that can 
1148
 
         succeed. We have already cached this.. */
1149
 
      for (; Ors > 1 && (DepState[Start->ID] & DepCVer) != DepCVer; Ors--)
1150
 
         Start++;
1151
1148
 
1152
1149
      /* This bit is for processing the possibilty of an install/upgrade
1153
1150
         fixing the problem */
1213
1210
      /* For conflicts we just de-install the package and mark as auto,
1214
1211
         Conflicts may not have or groups.  For dpkg's Breaks we try to
1215
1212
         upgrade the package. */
1216
 
      if (Start->Type == Dep::Conflicts || Start->Type == Dep::Obsoletes ||
1217
 
          Start->Type == Dep::DpkgBreaks)
 
1213
      if (Start.IsNegative() == true)
1218
1214
      {
1219
1215
         for (Version **I = List; *I != 0; I++)
1220
1216
         {