]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-cache.cc
merged from debian
[apt.git] / cmdline / apt-cache.cc
index f10ea48be3bd8f15a7129ff4cfda75066ec15cff..f3bbb9cf35bea0851bd833cf93e550d8664042e2 100644 (file)
@@ -102,15 +102,13 @@ bool UnMet(CommandLine &CmdL)
            if (End->Type != pkgCache::Dep::PreDepends &&
                End->Type != pkgCache::Dep::Depends && 
                End->Type != pkgCache::Dep::Suggests &&
            if (End->Type != pkgCache::Dep::PreDepends &&
                End->Type != pkgCache::Dep::Depends && 
                End->Type != pkgCache::Dep::Suggests &&
-               End->Type != pkgCache::Dep::Recommends &&
-               End->Type != pkgCache::Dep::DpkgBreaks)
+               End->Type != pkgCache::Dep::Recommends)
               continue;
 
            // Important deps only
            if (Important == true)
               if (End->Type != pkgCache::Dep::PreDepends &&
               continue;
 
            // Important deps only
            if (Important == true)
               if (End->Type != pkgCache::Dep::PreDepends &&
-                  End->Type != pkgCache::Dep::Depends &&
-                  End->Type != pkgCache::Dep::DpkgBreaks)
+                  End->Type != pkgCache::Dep::Depends)
                  continue;
            
            // Verify the or group
                  continue;
            
            // Verify the or group
@@ -401,7 +399,7 @@ bool DumpAvail(CommandLine &Cmd)
    pkgCache &Cache = *GCache;
 
    pkgPolicy Plcy(&Cache);
    pkgCache &Cache = *GCache;
 
    pkgPolicy Plcy(&Cache);
-   if (ReadPinFile(Plcy) == false)
+   if (ReadPinFile(Plcy) == false || ReadPinDir(Plcy) == false)
       return false;
    
    unsigned long Count = Cache.HeaderP->PackageCount+1;
       return false;
    
    unsigned long Count = Cache.HeaderP->PackageCount+1;
@@ -557,6 +555,7 @@ bool Depends(CommandLine &CmdL)
    
    bool Recurse = _config->FindB("APT::Cache::RecurseDepends",false);
    bool Installed = _config->FindB("APT::Cache::Installed",false);
    
    bool Recurse = _config->FindB("APT::Cache::RecurseDepends",false);
    bool Installed = _config->FindB("APT::Cache::Installed",false);
+   bool Important = _config->FindB("APT::Cache::Important",false);
    bool DidSomething;
    do
    {
    bool DidSomething;
    do
    {
@@ -579,7 +578,12 @@ bool Depends(CommandLine &CmdL)
         
         for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++)
         {
         
         for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++)
         {
-
+           // Important deps only
+           if (Important == true)
+              if (D->Type != pkgCache::Dep::PreDepends &&
+                  D->Type != pkgCache::Dep::Depends)
+                 continue;
+                 
            pkgCache::PkgIterator Trg = D.TargetPkg();
 
            if((Installed && Trg->CurrentVer != 0) || !Installed)
            pkgCache::PkgIterator Trg = D.TargetPkg();
 
            if((Installed && Trg->CurrentVer != 0) || !Installed)
@@ -622,7 +626,7 @@ bool Depends(CommandLine &CmdL)
    
    return true;
 }
    
    return true;
 }
-
+                                                                       /*}}}*/
 // RDepends - Print out a reverse dependency tree - mbc                        /*{{{*/
 // ---------------------------------------------------------------------
 /* */
 // RDepends - Print out a reverse dependency tree - mbc                        /*{{{*/
 // ---------------------------------------------------------------------
 /* */
@@ -710,10 +714,7 @@ bool RDepends(CommandLine &CmdL)
    
    return true;
 }
    
    return true;
 }
-
                                                                        /*}}}*/
                                                                        /*}}}*/
-
-
 // xvcg - Generate a graph for xvcg                                    /*{{{*/
 // ---------------------------------------------------------------------
 // Code contributed from Junichi Uekawa <dancer@debian.org> on 20 June 2002.
 // xvcg - Generate a graph for xvcg                                    /*{{{*/
 // ---------------------------------------------------------------------
 // Code contributed from Junichi Uekawa <dancer@debian.org> on 20 June 2002.
@@ -928,13 +929,15 @@ bool XVcg(CommandLine &CmdL)
                Shapes[ShapeMap[Pkg->ID]]);
       
    }
                Shapes[ShapeMap[Pkg->ID]]);
       
    }
-   
+
+   delete[] Show;
+   delete[] Flags;
+   delete[] ShapeMap;
+
    printf("}\n");
    return true;
 }
                                                                        /*}}}*/
    printf("}\n");
    return true;
 }
                                                                        /*}}}*/
-
-
 // Dotty - Generate a graph for Dotty                                  /*{{{*/
 // ---------------------------------------------------------------------
 /* Dotty is the graphvis program for generating graphs. It is a fairly
 // Dotty - Generate a graph for Dotty                                  /*{{{*/
 // ---------------------------------------------------------------------
 /* Dotty is the graphvis program for generating graphs. It is a fairly
@@ -1272,13 +1275,16 @@ bool DisplayRecord(pkgCache::VerIterator V)
                                                                        /*}}}*/
 // Search - Perform a search                                           /*{{{*/
 // ---------------------------------------------------------------------
                                                                        /*}}}*/
 // Search - Perform a search                                           /*{{{*/
 // ---------------------------------------------------------------------
-/* This searches the package names and pacakge descriptions for a pattern */
+/* This searches the package names and package descriptions for a pattern */
 struct ExDescFile
 {
    pkgCache::DescFile *Df;
    bool NameMatch;
 };
 
 struct ExDescFile
 {
    pkgCache::DescFile *Df;
    bool NameMatch;
 };
 
+// Search - Perform a search                                           /*{{{*/
+// ---------------------------------------------------------------------
+/* This searches the package names and package descriptions for a pattern */
 bool Search(CommandLine &CmdL)
 {
    pkgCache &Cache = *GCache;
 bool Search(CommandLine &CmdL)
 {
    pkgCache &Cache = *GCache;
@@ -1515,7 +1521,7 @@ bool Policy(CommandLine &CmdL)
    
    pkgCache &Cache = *GCache;
    pkgPolicy Plcy(&Cache);
    
    pkgCache &Cache = *GCache;
    pkgPolicy Plcy(&Cache);
-   if (ReadPinFile(Plcy) == false)
+   if (ReadPinFile(Plcy) == false || ReadPinDir(Plcy) == false)
       return false;
    
    // Print out all of the package files
       return false;
    
    // Print out all of the package files
@@ -1529,7 +1535,8 @@ bool Policy(CommandLine &CmdL)
         if (SrcList->FindIndex(F,Indx) == false &&
             _system->FindIndex(F,Indx) == false)
            return _error->Error(_("Cache is out of sync, can't x-ref a package file"));
         if (SrcList->FindIndex(F,Indx) == false &&
             _system->FindIndex(F,Indx) == false)
            return _error->Error(_("Cache is out of sync, can't x-ref a package file"));
-        printf(_("%4i %s\n"),
+        
+        printf("%4i %s\n",
                Plcy.GetPriority(F),Indx->Describe(true).c_str());
         
         // Print the reference information for the package
                Plcy.GetPriority(F),Indx->Describe(true).c_str());
         
         // Print the reference information for the package
@@ -1691,7 +1698,6 @@ bool Madison(CommandLine &CmdL)
 
    return true;
 }
 
    return true;
 }
-
                                                                        /*}}}*/
 // GenCaches - Call the main cache generator                           /*{{{*/
 // ---------------------------------------------------------------------
                                                                        /*}}}*/
 // GenCaches - Call the main cache generator                           /*{{{*/
 // ---------------------------------------------------------------------
@@ -1739,8 +1745,8 @@ bool ShowHelp(CommandLine &Cmd)
       "   show - Show a readable record for the package\n"
       "   depends - Show raw dependency information for a package\n"
       "   rdepends - Show reverse dependency information for a package\n"
       "   show - Show a readable record for the package\n"
       "   depends - Show raw dependency information for a package\n"
       "   rdepends - Show reverse dependency information for a package\n"
-      "   pkgnames - List the names of all packages\n"
-      "   dotty - Generate package graphs for GraphVis\n"
+      "   pkgnames - List the names of all packages in the system\n"
+      "   dotty - Generate package graphs for GraphViz\n"
       "   xvcg - Generate package graphs for xvcg\n"
       "   policy - Show policy settings\n"
       "\n"
       "   xvcg - Generate package graphs for xvcg\n"
       "   policy - Show policy settings\n"
       "\n"
@@ -1765,8 +1771,7 @@ void CacheInitialize()
    _config->Set("help",false);
 }
                                                                        /*}}}*/
    _config->Set("help",false);
 }
                                                                        /*}}}*/
-
-int main(int argc,const char *argv[])
+int main(int argc,const char *argv[])                                  /*{{{*/
 {
    CommandLine::Args Args[] = {
       {'h',"help","help",0},
 {
    CommandLine::Args Args[] = {
       {'h',"help","help",0},
@@ -1873,3 +1878,4 @@ int main(int argc,const char *argv[])
           
    return 0;
 }
           
    return 0;
 }
+                                                                       /*}}}*/