~mvo/apt/no-apport-without-logs

« back to all changes in this revision

Viewing changes to apt-pkg/policy.cc

  • Committer: Michael Vogt
  • Date: 2012-11-01 09:44:13 UTC
  • mfrom: (1327.97.156 debian-sid)
  • Revision ID: michael.vogt@ubuntu.com-20121101094413-jna4b5xtrffsj5ja
merged from the debian-sid branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
#include <apt-pkg/policy.h>
29
29
#include <apt-pkg/configuration.h>
 
30
#include <apt-pkg/cachefilter.h>
30
31
#include <apt-pkg/tagfile.h>
31
32
#include <apt-pkg/strutl.h>
32
33
#include <apt-pkg/fileutl.h>
259
260
   }
260
261
 
261
262
   // find the package (group) this pin applies to
262
 
   pkgCache::GrpIterator Grp;
263
 
   pkgCache::PkgIterator Pkg;
264
 
   if (Arch.empty() == false)
265
 
      Pkg = Cache->FindPkg(Name, Arch);
266
 
   else {
267
 
      Grp = Cache->FindGrp(Name);
268
 
      if (Grp.end() == false)
269
 
         Pkg = Grp.PackageList();
 
263
   pkgCache::GrpIterator Grp = Cache->FindGrp(Name);
 
264
   bool matched = false;
 
265
   if (Grp.end() == false)
 
266
   {
 
267
      std::string MatchingArch;
 
268
      if (Arch.empty() == true)
 
269
         MatchingArch = Cache->NativeArch();
 
270
      else
 
271
         MatchingArch = Arch;
 
272
      APT::CacheFilter::PackageArchitectureMatchesSpecification pams(MatchingArch);
 
273
      for (pkgCache::PkgIterator Pkg = Grp.PackageList(); Pkg.end() != true; Pkg = Grp.NextPkg(Pkg))
 
274
      {
 
275
         if (pams(Pkg.Arch()) == false)
 
276
            continue;
 
277
         Pin *P = Pins + Pkg->ID;
 
278
         // the first specific stanza for a package is the ruler,
 
279
         // all others need to be ignored
 
280
         if (P->Type != pkgVersionMatch::None)
 
281
            P = &*Unmatched.insert(Unmatched.end(),PkgPin(Pkg.FullName()));
 
282
         P->Type = Type;
 
283
         P->Priority = Priority;
 
284
         P->Data = Data;
 
285
         matched = true;
 
286
      }
270
287
   }
271
288
 
272
 
   if (Pkg.end() == true)
 
289
   if (matched == false)
273
290
   {
274
291
      PkgPin *P = &*Unmatched.insert(Unmatched.end(),PkgPin(Name));
275
292
      if (Arch.empty() == false)
279
296
      P->Data = Data;
280
297
      return;
281
298
   }
282
 
 
283
 
   for (; Pkg.end() != true; Pkg = Grp.NextPkg(Pkg))
284
 
   {
285
 
      Pin *P = Pins + Pkg->ID;
286
 
      // the first specific stanza for a package is the ruler,
287
 
      // all others need to be ignored
288
 
      if (P->Type != pkgVersionMatch::None)
289
 
         P = &*Unmatched.insert(Unmatched.end(),PkgPin(Pkg.FullName()));
290
 
      P->Type = Type;
291
 
      P->Priority = Priority;
292
 
      P->Data = Data;
293
 
      if (Grp.end() == true)
294
 
         break;
295
 
   }
296
299
}
297
300
                                                                        /*}}}*/
298
301
// Policy::GetMatch - Get the matching version for a package pin        /*{{{*/