~ubuntu-branches/ubuntu/trusty/apt/trusty

« back to all changes in this revision

Viewing changes to apt-pkg/policy.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt, Michael Vogt, David Kalnischkies
  • Date: 2010-06-10 14:02:22 UTC
  • mto: (1.4.5 sid)
  • mto: This revision was merged to the branch mainline in revision 108.
  • Revision ID: james.westby@ubuntu.com-20100610140222-hb01wb7kfe3eocrv
Tags: 0.7.26~exp6
[ Michael Vogt ]
* merge the remaining Ubuntu change:
  - on gpg verification failure warn and restore the last known
    good state
  - on failure display the IP of the server (useful for servers
    that use round robin DNS)
  - support Original-Maintainer in RewritePackageOrder
  - enable cdrom autodetection via libudev by default
  - show message about Vcs in use when apt-get source is run for
    packages maintained in a Vcs
  - better support transitional packages with mark auto-installed. 
    when the transitional package is in "oldlibs" the new package
    is not marked auto installed (same is true for section
    metapackages)
  - provide new "deb mirror://archive.foo/mirrors.list sid main"
    method expects a list of mirrors (generated on the server e.g.
    via geoip) and will use that, including cycle on failure
  - write apport crash file on package failure (disabled by default
    on debian until apport is available)
  - support mirror failure reporting (disabled by default on debian)

[ David Kalnischkies ]
* apt-pkg/deb/dpkgpm.cc:
  - write Disappeared also to the history.log
  - forward manual-installed bit on package disappearance
* apt-pkg/deb/debsystem.cc:
  - add better config item for extended_states file
* apt-pkg/pkgcache.h:
  - switch {,Install-}Size to unsigned long long
* apt-pkg/depcache.cc:
  - do the autoremove mark process also for required packages to handle
    these illegally depending on lower priority packages (Closes: #583517)
  - try harder to find the other pseudo versions for autoremove multiarch
  - correct "Dangerous iterator usage" pointed out by cppcheck
  - deal with long long, not with int to remove 2GB Limit (LP: #250909)
  - deprecate AddSize with Multiplier as it is unused and switch to
    boolean instead to handle the sizes more gracefully.
  - switch i{Download,Usr}Size from double to (un)signed long long
* apt-pkg/aptconfiguration.cc:
  - remove duplicate architectures in getArchitectures()
* apt-pkg/indexrecords.{cc,h}:
  - backport forgotten Valid-Until patch from the obsolete experimental
    branch to prevent replay attacks better, thanks to Thomas Viehmann
    for the initial patch! (Closes: #499897)
  - add a constant Exists check for MetaKeys
* apt-pkg/acquire-item.cc:
  - do not try PDiff if it is not listed in the Meta file
  - sent Last-Modified header also for Translation files
* apt-pkg/cacheiterator.h:
  - let pkgCache::Iterator inherent std::iterator
* ftparchive/writer.h:
  - add a virtual destructor to FTWScanner class (for cppcheck)
* apt-pkg/cacheset.{cc,h}:
  - add simple wrapper around std::set for cache structures
  - move regex magic from apt-get to new FromRegEx method
  - move cmdline parsing from apt-cache to new FromCommandLine method
  - support special release-modifier 'installed' and 'candidate'
* apt-pkg/contrib/cmdline.cc:
  - fix segfault in SaveInConfig caused by writing over char[] sizes
* apt-pkg/pkgcache.cc:
  - get the best matching arch package from a group with FindPreferredPkg
* cmdline/apt-cache.cc:
  - make the search multiarch compatible by using GrpIterator instead
  - use pkgCacheFile and the new CacheSets all over the place
  - add --target-release option (Closes: #115520)
  - accept pkg/release and pkg=version in show and co. (Closes: #236270)
  - accept package versions in the unmet command
* cmdline/apt-get.cc:
  - use unsigned long long instead of double to store values it gets
* apt-pkg/cachefile.{cc,h}:
  - split Open() into submethods to be able to build only parts
  - make the OpProgress optional in the Cache buildprocess
  - store also the SourceList we use internally for export
* doc/apt.conf.5.xml:
  - document the new Valid-Until related options
* apt-pkg/contrib/strutl.cc:
  - split StrToTime() into HTTP1.1 and FTP date parser methods and
    use strptime() instead of some self-made scanf mangling
  - use the portable timegm shown in his manpage instead of a strange
    looking code copycat from wget
* ftparchive/writer.cc:
  - add ValidTime option to generate a Valid-Until header in Release file
* apt-pkg/policy.cc:
  - get the candidate right for a not-installed pseudo package if
    his non-pseudo friend is installed
* apt-pkg/indexcopy.cc:
  - move the gpg codecopy to a new method and use it also in methods/gpgv.cc

Show diffs side-by-side

added added

removed removed

Lines of Context:
115
115
// ---------------------------------------------------------------------
116
116
/* Evaluate the package pins and the default list to deteremine what the
117
117
   best package is. */
118
 
pkgCache::VerIterator pkgPolicy::GetCandidateVer(pkgCache::PkgIterator Pkg)
 
118
pkgCache::VerIterator pkgPolicy::GetCandidateVer(pkgCache::PkgIterator const &Pkg)
119
119
{
120
120
   // Look for a package pin and evaluate it.
121
121
   signed Max = GetPriority(Pkg);
147
147
    */
148
148
   for (pkgCache::VerIterator Ver = Pkg.VersionList(); Ver.end() == false; Ver++)
149
149
   {
 
150
      /* Lets see if this version is the installed version */
 
151
      bool instVer = (Pkg.CurrentVer() == Ver);
 
152
      if (Ver.Pseudo() == true && instVer == false)
 
153
      {
 
154
         pkgCache::PkgIterator const allPkg = Ver.ParentPkg().Group().FindPkg("all");
 
155
         if (allPkg->CurrentVer != 0 && allPkg.CurrentVer()->Hash == Ver->Hash &&
 
156
             strcmp(allPkg.CurVersion(), Ver.VerStr()) == 0)
 
157
            instVer = true;
 
158
      }
 
159
 
150
160
      for (pkgCache::VerFileIterator VF = Ver.FileList(); VF.end() == false; VF++)
151
161
      {
152
162
         /* If this is the status file, and the current version is not the
155
165
            out bogus entries that may be due to config-file states, or
156
166
            other. */
157
167
         if ((VF.File()->Flags & pkgCache::Flag::NotSource) == pkgCache::Flag::NotSource &&
158
 
             Pkg.CurrentVer() != Ver)
 
168
             instVer == false)
159
169
            continue;
160
 
                         
 
170
 
161
171
         signed Prio = PFPriority[VF.File()->ID];
162
172
         if (Prio > Max)
163
173
         {
171
181
         }       
172
182
      }      
173
183
      
174
 
      if (Pkg.CurrentVer() == Ver && Max < 1000)
 
184
      if (instVer == true && Max < 1000)
175
185
      {
176
186
         /* Elevate our current selection (or the status file itself)
177
187
            to the Pseudo-status priority. */
189
199
   // will always be a candidate (Closes: #512318)
190
200
   if (!Pref.IsGood() && MaxAlt > 0)
191
201
       Pref = PrefAlt;
 
202
 
192
203
   return Pref;
193
204
}
194
205
                                                                        /*}}}*/
238
249
// Policy::GetMatch - Get the matching version for a package pin        /*{{{*/
239
250
// ---------------------------------------------------------------------
240
251
/* */
241
 
pkgCache::VerIterator pkgPolicy::GetMatch(pkgCache::PkgIterator Pkg)
 
252
pkgCache::VerIterator pkgPolicy::GetMatch(pkgCache::PkgIterator const &Pkg)
242
253
{
243
254
   const Pin &PPkg = Pins[Pkg->ID];
244
 
   if (PPkg.Type != pkgVersionMatch::None)
245
 
   {
246
 
      pkgVersionMatch Match(PPkg.Data,PPkg.Type);
247
 
      return Match.Find(Pkg);
248
 
   }
249
 
   return pkgCache::VerIterator(*Pkg.Cache());
 
255
   if (PPkg.Type == pkgVersionMatch::None)
 
256
      return pkgCache::VerIterator(*Pkg.Cache());
 
257
 
 
258
   pkgVersionMatch Match(PPkg.Data,PPkg.Type);
 
259
   return Match.Find(Pkg);
250
260
}
251
261
                                                                        /*}}}*/
252
262
// Policy::GetPriority - Get the priority of the package pin            /*{{{*/