Browse Source

CDROM debug option
Author: jgg
Date: 1999-07-02 22:20:50 GMT
CDROM debug option

Arch Librarian 22 years ago
parent
commit
fbdccabb17
2 changed files with 17 additions and 11 deletions
  1. 15 10
      apt-pkg/contrib/cdromutl.cc
  2. 2 1
      doc/apt.conf.5.yo

+ 15 - 10
apt-pkg/contrib/cdromutl.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: cdromutl.cc,v 1.6 1999/06/05 03:54:29 jgg Exp $
+// $Id: cdromutl.cc,v 1.7 1999/07/02 22:21:01 jgg Exp $
 /* ######################################################################
 /* ######################################################################
    
    
    CDROM Utilities - Some functions to manipulate CDROM mounts.
    CDROM Utilities - Some functions to manipulate CDROM mounts.
@@ -203,16 +203,21 @@ bool IdentCdrom(string CD,string &Res,unsigned int Version)
    closedir(D);
    closedir(D);
    
    
    // Some stats from the fsys
    // Some stats from the fsys
-   struct statfs Buf;
-   if (statfs(CD.c_str(),&Buf) != 0)
-      return _error->Errno("statfs","Failed to stat the cdrom");
-
-   // We use a kilobyte block size to advoid overflow
-   sprintf(S,"%lu %lu",(long)(Buf.f_blocks*(Buf.f_bsize/1024)),
-	   (long)(Buf.f_bfree*(Buf.f_bsize/1024)));
-   Hash.Add(S);
+   if (_config->FindB("Debug::identcdrom",false) == false)
+   {
+      struct statfs Buf;
+      if (statfs(CD.c_str(),&Buf) != 0)
+	 return _error->Errno("statfs","Failed to stat the cdrom");
+      
+      // We use a kilobyte block size to advoid overflow
+      sprintf(S,"%lu %lu",(long)(Buf.f_blocks*(Buf.f_bsize/1024)),
+	      (long)(Buf.f_bfree*(Buf.f_bsize/1024)));
+      Hash.Add(S);
+      sprintf(S,"-%u",Version);
+   }
+   else
+      sprintf(S,"-%u.debug",Version);
    
    
-   sprintf(S,"-%u",Version);
    Res = Hash.Result().Value() + S;
    Res = Hash.Result().Value() + S;
    return true;   
    return true;   
 }
 }

+ 2 - 1
doc/apt.conf.5.yo

@@ -216,7 +216,8 @@ normal user, however bf(Debug::pkgProblemResolver) shows interesting
 output about the decisions dist-upgrade makes. bf(Debug::NoLocking)
 output about the decisions dist-upgrade makes. bf(Debug::NoLocking)
 disables file locking so apt can do some operations as non-root and
 disables file locking so apt can do some operations as non-root and
 bf(Debug::pkgDPkgPM) will print out the command line for each dpkg 
 bf(Debug::pkgDPkgPM) will print out the command line for each dpkg 
-invokation.
+invokation. bf(Debug::IdentCdrom) will disable the inclusion of statfs 
+data in CDROM IDs.
 
 
 manpagesection(EXAMPLES)
 manpagesection(EXAMPLES)
 bf(/usr/doc/apt/examples/apt.conf) contains a sample configuration file
 bf(/usr/doc/apt/examples/apt.conf) contains a sample configuration file