~racb/ubuntu/quantal/apt/by_hash

« back to all changes in this revision

Viewing changes to apt-pkg/deb/deblistparser.cc

  • Committer: Package Import Robot
  • Author(s): Steve Langasek, Michael Vogt, Steve Langasek
  • Date: 2012-06-11 22:36:16 UTC
  • mfrom: (1.4.47 sid)
  • Revision ID: package-import@ubuntu.com-20120611223616-1cctfc7qrxrx4vcu
Tags: 0.9.6ubuntu1
[ Michael Vogt ]
* merged from Debian, remaining changes:
  - use ubuntu keyring and ubuntu archive keyring in apt-key
  - run update-apt-xapian-index in apt.cron
  - support apt-key net-update and verify keys against master-keyring
  - run apt-key net-update in cron.daily
  - different example sources.list
  - APT::pkgPackageManager::MaxLoopCount set to 5000
  - apport pkgfailure handling
  - ubuntu changelog download handling
  - patch for apt cross-building, see http://bugs.debian.org/666772

[ Steve Langasek ]
* Drop upgrade handling for obsolete conffile /etc/apt/apt.conf.d/01ubuntu,
  removed in previous LTS.
* prepare-release: declare the packages needed as source build deps.

Show diffs side-by-side

added added

removed removed

Lines of Context:
215
215
 */
216
216
MD5SumValue debListParser::Description_md5()
217
217
{
218
 
   string value = Section.FindS("Description-md5");
219
 
 
220
 
   if (value.empty()) 
 
218
   string const value = Section.FindS("Description-md5");
 
219
   if (value.empty() == true)
221
220
   {
222
221
      MD5Summation md5;
223
222
      md5.Add((Description() + "\n").c_str());
224
223
      return md5.Result();
225
 
   } else
226
 
      return MD5SumValue(value);
 
224
   }
 
225
   else if (likely(value.size() == 32))
 
226
   {
 
227
      if (likely(value.find_first_not_of("0123456789abcdefABCDEF") == string::npos))
 
228
         return MD5SumValue(value);
 
229
      _error->Error("Malformed Description-md5 line; includes invalid character '%s'", value.c_str());
 
230
      return MD5SumValue();
 
231
   }
 
232
   _error->Error("Malformed Description-md5 line; doesn't have the required length (32 != %d) '%s'", (int)value.size(), value.c_str());
 
233
   return MD5SumValue();
227
234
}
228
235
                                                                        /*}}}*/
229
236
// ListParser::UsePackage - Update a package structure                  /*{{{*/
236
243
   if (Pkg->Section == 0)
237
244
      Pkg->Section = UniqFindTagWrite("Section");
238
245
 
239
 
   // Packages which are not from the "native" arch doesn't get the essential flag
240
 
   // in the default "native" mode - it is also possible to mark "all" or "none".
 
246
   string const static myArch = _config->Find("APT::Architecture");
 
247
   // Possible values are: "all", "native", "installed" and "none"
241
248
   // The "installed" mode is handled by ParseStatus(), See #544481 and friends.
242
 
   string const static myArch = _config->Find("APT::Architecture");
243
 
   string const static essential = _config->Find("pkgCacheGen::Essential", "native");
244
 
   if ((essential == "native" && Pkg->Arch != 0 && myArch == Pkg.Arch()) ||
245
 
       essential == "all")
 
249
   string const static essential = _config->Find("pkgCacheGen::Essential", "all");
 
250
   if (essential == "all" ||
 
251
       (essential == "native" && Pkg->Arch != 0 && myArch == Pkg.Arch()))
246
252
      if (Section.FindFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false)
247
253
         return false;
248
254
   if (Section.FindFlag("Important",Pkg->Flags,pkgCache::Flag::Important) == false)
249
255
      return false;
250
256
 
251
257
   if (strcmp(Pkg.Name(),"apt") == 0)
252
 
      Pkg->Flags |= pkgCache::Flag::Important;
253
 
   
 
258
   {
 
259
      if ((essential == "native" && Pkg->Arch != 0 && myArch == Pkg.Arch()) ||
 
260
          essential == "all")
 
261
         Pkg->Flags |= pkgCache::Flag::Essential | pkgCache::Flag::Important;
 
262
      else
 
263
         Pkg->Flags |= pkgCache::Flag::Important;
 
264
   }
 
265
 
254
266
   if (ParseStatus(Pkg,Ver) == false)
255
267
      return false;
256
268
   return true;
625
637
   if (Section.Find(Tag,Start,Stop) == false)
626
638
      return true;
627
639
 
628
 
   string Package;
629
640
   string const pkgArch = Ver.Arch();
630
 
   string Version;
631
 
   unsigned int Op;
632
641
 
633
642
   while (1)
634
643
   {
 
644
      string Package;
 
645
      string Version;
 
646
      unsigned int Op;
 
647
 
635
648
      Start = ParseDepends(Start,Stop,Package,Version,Op,false,!MultiArchEnabled);
636
649
      if (Start == 0)
637
650
         return _error->Error("Problem parsing dependency %s",Tag);
 
651
      size_t const found = Package.rfind(':');
638
652
 
639
653
      if (MultiArchEnabled == true &&
640
654
          (Type == pkgCache::Dep::Conflicts ||
646
660
            if (NewDepends(Ver,Package,*a,Version,Op,Type) == false)
647
661
               return false;
648
662
      }
 
663
      else if (MultiArchEnabled == true && found != string::npos &&
 
664
               strcmp(Package.c_str() + found, ":any") != 0)
 
665
      {
 
666
         string Arch = Package.substr(found+1, string::npos);
 
667
         Package = Package.substr(0, found);
 
668
         // Such dependencies are not supposed to be accepted …
 
669
         // … but this is probably the best thing to do.
 
670
         if (Arch == "native")
 
671
            Arch = _config->Find("APT::Architecture");
 
672
         if (NewDepends(Ver,Package,Arch,Version,Op,Type) == false)
 
673
            return false;
 
674
      }
649
675
      else if (NewDepends(Ver,Package,pkgArch,Version,Op,Type) == false)
650
676
         return false;
651
677
      if (Start == Stop)