]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-cdrom.cc
Fix permissions again
[apt.git] / cmdline / apt-cdrom.cc
index 0c948098b2f36734f612068c5e4df9e8512e71bd..7367a55a316f23187e15e541806a0eae1bb0a097 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: apt-cdrom.cc,v 1.37 2001/03/13 05:23:42 jgg Exp $
+// $Id: apt-cdrom.cc,v 1.45 2003/11/19 23:50:51 mdz Exp $
 /* ######################################################################
    
    APT CDROM - Tool for handling APT's CDROM database.
@@ -23,6 +23,7 @@
     
 #include "indexcopy.h"
 
+#include <locale.h>
 #include <iostream>
 #include <fstream>
 #include <vector>
@@ -34,6 +35,8 @@
 #include <stdio.h>
                                                                        /*}}}*/
 
+using namespace std;
+
 // FindPackages - Find the package files on the CDROM                  /*{{{*/
 // ---------------------------------------------------------------------
 /* We look over the cdrom for package files. This is a recursive
@@ -61,6 +64,10 @@ bool FindPackages(string CD,vector<string> &List,vector<string> &SList,
         InfoDir = CD + ".disk/";
    }
 
+   // Don't look into directories that have been marked to ingore.
+   if (stat(".aptignr",&Buf) == 0)
+      return true;
+   
    /* Aha! We found some package files. We assume that everything under 
       this dir is controlled by those package files so we don't look down
       anymore */
@@ -94,7 +101,8 @@ bool FindPackages(string CD,vector<string> &List,vector<string> &SList,
          //strcmp(Dir->d_name,"source") == 0 ||
          strcmp(Dir->d_name,".disk") == 0 ||
          strcmp(Dir->d_name,"experimental") == 0 ||
-         strcmp(Dir->d_name,"binary-all") == 0)
+         strcmp(Dir->d_name,"binary-all") == 0 ||
+          strcmp(Dir->d_name,"debian-installer") == 0)
         continue;
 
       // See if the name is a sub directory
@@ -168,7 +176,7 @@ bool DropBinaryArch(vector<string> &List)
 // Score - We compute a 'score' for a path                             /*{{{*/
 // ---------------------------------------------------------------------
 /* Paths are scored based on how close they come to what I consider
-   normal. That is ones that have 'dist' 'stable' 'frozen' will score
+   normal. That is ones that have 'dist' 'stable' 'testing' will score
    higher than ones without. */
 int Score(string Path)
 {
@@ -177,7 +185,7 @@ int Score(string Path)
       Res += 29;
    if (Path.find("/binary-") != string::npos)
       Res += 20;
-   if (Path.find("frozen/") != string::npos)
+   if (Path.find("testing/") != string::npos)
       Res += 28;
    if (Path.find("unstable/") != string::npos)
       Res += 27;
@@ -364,7 +372,7 @@ bool WriteSourceList(string Name,vector<string> &List,bool Source)
 
    // Open the stream for reading
    ifstream F((FileExists(File)?File.c_str():"/dev/null"),
-             ios::in | ios::nocreate);
+             ios::in );
    if (!F != 0)
       return _error->Errno("ifstream::ifstream","Opening %s",File.c_str());
 
@@ -770,7 +778,11 @@ int main(int argc,const char *argv[])
       {"add",&DoAdd},
       {"ident",&DoIdent},
       {0,0}};
-        
+
+   // Set up gettext support
+   setlocale(LC_ALL,"");
+   textdomain(PACKAGE);
+
    // Parse the command line and initialize the package library
    CommandLine CmdL(Args,_config);
    if (pkgInitConfig(*_config) == false ||
@@ -787,7 +799,7 @@ int main(int argc,const char *argv[])
       return ShowHelp();
 
    // Deal with stdout not being a tty
-   if (ttyname(STDOUT_FILENO) == 0 && _config->FindI("quiet",0) < 1)
+   if (isatty(STDOUT_FILENO) && _config->FindI("quiet",0) < 1)
       _config->Set("quiet","1");
    
    // Match the operation