Skip to content
Snippets Groups Projects
Select Git revision
  • 2.7.0
  • main default
  • 2.6.y
  • 2.4.y
  • debian-dch-always-online
  • 1.6.y
  • 2.0.y
  • 2.2.y
  • 1.2.y
  • 1.8.2.z
  • 1.8.y
  • debian/jessie
  • 1.4.y
  • ubuntu/master
  • ubuntu/trusty
  • 1.7.y
  • test-runner
  • 1.5.y
  • 1.3.y
  • debian/wheezy
  • attic/cmake
  • 2.7.2
  • 2.6.1
  • 2.7.1
  • 2.6.0
  • 2.5.6
  • 2.5.5
  • 2.4.9
  • 2.5.3ubuntu0.1
  • 2.5.4
  • 2.4.8
  • 2.5.3
  • 1.6.17
  • 1.6.16
  • 2.4.7
  • 2.5.2
  • 2.3.9ubuntu0.2
  • 2.4.6
  • 2.5.1
  • 2.0.9
40 results

algorithms.cc

Blame
  • Forked from APT Developers / apt
    Source project has a limited visibility.
    algorithms.cc 51.52 KiB
    // -*- mode: cpp; mode: fold -*-
    // Description								/*{{{*/
    /* ######################################################################
    
       Algorithms - A set of misc algorithms
    
       The pkgProblemResolver class has become insanely complex and
       very sophisticated, it handles every test case I have thrown at it
       to my satisfaction. Understanding exactly why all the steps the class
       does are required is difficult and changing though not very risky
       may result in other cases not working.
       
       ##################################################################### */
    									/*}}}*/
    // Include Files							/*{{{*/
    #include <config.h>
    
    #include <apt-pkg/algorithms.h>
    #include <apt-pkg/cachefilter.h>
    #include <apt-pkg/configuration.h>
    #include <apt-pkg/depcache.h>
    #include <apt-pkg/dpkgpm.h>
    #include <apt-pkg/edsp.h>
    #include <apt-pkg/error.h>
    #include <apt-pkg/macros.h>
    #include <apt-pkg/packagemanager.h>
    #include <apt-pkg/pkgcache.h>
    #include <apt-pkg/string_view.h>
    #include <apt-pkg/strutl.h>
    #include <apt-pkg/version.h>
    
    #include <apt-pkg/prettyprinters.h>
    
    #include <cstdlib>
    #include <iostream>
    #include <map>
    #include <set>
    #include <sstream>
    #include <string>
    #include <utility>
    #include <vector>
    #include <string.h>
    #include <sys/utsname.h>
    
    #include <apti18n.h>
    									/*}}}*/
    using namespace std;
    
    class APT_HIDDEN pkgSimulatePrivate
    {
    public:
       std::vector<pkgDPkgPM::Item> List;
    };
    // Simulate::Simulate - Constructor					/*{{{*/
    // ---------------------------------------------------------------------
    /* The legacy translations here of input Pkg iterators is obsolete, 
       this is not necessary since the pkgCaches are fully shared now. */
    pkgSimulate::pkgSimulate(pkgDepCache *Cache) : pkgPackageManager(Cache),
    		            d(new pkgSimulatePrivate()), iPolicy(Cache),
    			    Sim(&Cache->GetCache(),&iPolicy),
    			    group(Sim)
    {
       Sim.Init(0);
       auto PackageCount = Cache->Head().PackageCount;
       Flags = new unsigned char[PackageCount];
       memset(Flags,0,sizeof(*Flags)*PackageCount);
    
       // Fake a filename so as not to activate the media swapping
       string Jnk = "SIMULATE";
       for (decltype(PackageCount) I = 0; I != PackageCount; ++I)