~ubuntu-branches/ubuntu/maverick/apt/maverick-security

« back to all changes in this revision

Viewing changes to cmdline/apt-get.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt, David Kalnischkies, Jean-Baptiste Lallement
  • Date: 2010-03-31 21:59:42 UTC
  • Revision ID: james.westby@ubuntu.com-20100331215942-0041u6d8qes7tval
Tags: 0.7.25.3ubuntu5
[ David Kalnischkies ]
* cmdline/apt-get.cc:
  - try version match in FindSrc first exact than fuzzy (LP: #551178)

[ Jean-Baptiste Lallement ]
* apt-pkg/contrib/strutl.cc:
  - always escape '%' (LP: #130289) (Closes: #500560)
  - unescape '%' sequence only if followed by 2 hex digit
  - username/password are urlencoded in proxy string (RFC 3986)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1270
1270
   {
1271
1271
      if(VerTag.empty() == false || DefRel.empty() == false) 
1272
1272
      {
 
1273
         bool fuzzy = false;
1273
1274
         // we have a default release, try to locate the pkg. we do it like
1274
1275
         // this because GetCandidateVer() will not "downgrade", that means
1275
1276
         // "apt-get source -t stable apt" won't work on a unstable system
1276
 
         for (pkgCache::VerIterator Ver = Pkg.VersionList();
1277
 
              Ver.end() == false; Ver++) 
 
1277
         for (pkgCache::VerIterator Ver = Pkg.VersionList();; Ver++)
1278
1278
         {
 
1279
            // try first only exact matches, later fuzzy matches
 
1280
            if (Ver.end() == true)
 
1281
            {
 
1282
               if (fuzzy == true)
 
1283
                  break;
 
1284
               fuzzy = true;
 
1285
               Ver = Pkg.VersionList();
 
1286
            }
 
1287
            // We match against a concrete version (or a part of this version)
 
1288
            if (VerTag.empty() == false &&
 
1289
                (fuzzy == true || Cache.VS().CmpVersion(VerTag, Ver.VerStr()) != 0) && // exact match
 
1290
                (fuzzy == false || strncmp(VerTag.c_str(), Ver.VerStr(), VerTag.size()) != 0)) // fuzzy match
 
1291
               continue;
 
1292
 
1279
1293
            for (pkgCache::VerFileIterator VF = Ver.FileList();
1280
1294
                 VF.end() == false; VF++) 
1281
1295
            {
1288
1302
                   pkgCache::Flag::NotSource && Pkg.CurrentVer() != Ver)
1289
1303
                  continue;
1290
1304
 
1291
 
               // We match against a concrete version (or a part of this version)
1292
 
               if (VerTag.empty() == false && strncmp(VerTag.c_str(), Ver.VerStr(), VerTag.size()) != 0)
1293
 
                  continue;
1294
 
 
1295
1305
               // or we match against a release
1296
1306
               if(VerTag.empty() == false ||
1297
1307
                  (VF.File().Archive() != 0 && VF.File().Archive() == DefRel) ||
1302
1312
                  // no SourcePkg name, so it is the "binary" name
1303
1313
                  if (Src.empty() == true)
1304
1314
                     Src = TmpSrc;
1305
 
                  // no Version, so we try the Version of the SourcePkg -
1306
 
                  // and after that the version of the binary package
1307
 
                  if (VerTag.empty() == true)
1308
 
                     VerTag = Parse.SourceVer();
 
1315
                  // the Version we have is possibly fuzzy or includes binUploads,
 
1316
                  // so we use the Version of the SourcePkg (empty if same as package)
 
1317
                  VerTag = Parse.SourceVer();
1309
1318
                  if (VerTag.empty() == true)
1310
1319
                     VerTag = Ver.VerStr();
1311
1320
                  break;
1371
1380
         const string Ver = Parse->Version();
1372
1381
 
1373
1382
         // Ignore all versions which doesn't fit
1374
 
         if (VerTag.empty() == false && strncmp(VerTag.c_str(), Ver.c_str(), VerTag.size()) != 0)
 
1383
         if (VerTag.empty() == false &&
 
1384
             Cache.VS().CmpVersion(VerTag, Ver) != 0) // exact match
1375
1385
            continue;
1376
1386
 
1377
1387
         // Newer version or an exact match? Save the hit