* apt-pkg/contrib/fileutl.cc:
authorDavid Kalnischkies <kalnischkies@gmail.com>
Sat, 26 Jun 2010 16:40:15 +0000 (18:40 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Sat, 26 Jun 2010 16:40:15 +0000 (18:40 +0200)
  - show notice about ignored file instead of being always silent
  - add a Dir::Ignore-Files-Silently list option to control the notice
*

apt-pkg/contrib/fileutl.cc
apt-pkg/init.cc
debian/changelog
doc/apt.conf.5.xml

index 16f7ce9..e95ddf5 100644 (file)
@@ -281,6 +281,7 @@ std::vector<string> GetListOfFilesInDir(string const &Dir, std::vector<string> c
    }
 
    std::vector<string> List;
+   Configuration::MatchAgainstConfig SilentIgnore("Dir::Ignore-Files-Silently");
    DIR *D = opendir(Dir.c_str());
    if (D == 0) 
    {
@@ -306,6 +307,7 @@ std::vector<string> GetListOfFilesInDir(string const &Dir, std::vector<string> c
            {
               if (Debug == true)
                  std::clog << "Bad file: " << Ent->d_name << " → no extension" << std::endl;
+              _error->Notice("Ignoring file '%s' in directory '%s' as it has no filename extension", Ent->d_name, Dir.c_str());
               continue;
            }
         }
@@ -313,6 +315,8 @@ std::vector<string> GetListOfFilesInDir(string const &Dir, std::vector<string> c
         {
            if (Debug == true)
               std::clog << "Bad file: " << Ent->d_name << " → bad extension »" << flExtension(Ent->d_name) << "«" << std::endl;
+           if (SilentIgnore.Match(Ent->d_name) == false)
+              _error->Notice("Ignoring file '%s' in directory '%s' as it has an invalid filename extension", Ent->d_name, Dir.c_str());
            continue;
         }
       }
index 21472eb..7a332c8 100644 (file)
@@ -78,6 +78,11 @@ bool pkgInitConfig(Configuration &Cnf)
    Cnf.Set("Dir::Log::Terminal","term.log");
    Cnf.Set("Dir::Log::History","history.log");
 
+   Cnf.Set("Dir::Ignore-Files-Silently::", "~$");
+   Cnf.Set("Dir::Ignore-Files-Silently::", "\\.disabled$");
+   Cnf.Set("Dir::Ignore-Files-Silently::", "\\.bak$");
+   Cnf.Set("Dir::Ignore-Files-Silently::", "\\.dpkg-[a-z]+$");
+
    // Translation
    Cnf.Set("APT::Acquire::Translation", "environment");
 
index 4500614..722e7ff 100644 (file)
@@ -25,8 +25,12 @@ apt (0.7.26~exp8) UNRELEASED; urgency=low
     - show a deprecation notice for APT::Acquire::Translation
   * apt-pkg/contrib/configuration.{cc,h}:
     - add a wrapper to match strings against configurable regex patterns
+  * apt-pkg/contrib/fileutl.cc:
+    - show notice about ignored file instead of being always silent
+    - add a Dir::Ignore-Files-Silently list option to control the notice
+  * 
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Sat, 26 Jun 2010 13:28:48 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Sat, 26 Jun 2010 18:40:01 +0200
 
 apt (0.7.26~exp7) experimental; urgency=low
 
index 0cf4bb6..39e2c8e 100644 (file)
@@ -507,6 +507,15 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";};
      will be looked up in
      <filename>/tmp/staging/var/lib/dpkg/status</filename>.
    </para>
+
+   <para>
+      The <literal>Ignore-Files-Silently</literal> list can be used to specify
+      which files APT should silently ignore while parsing the files in the
+      fragment directories. Per default a file which end with <literal>.disabled</literal>,
+      <literal>~</literal>, <literal>.bak</literal> or <literal>.dpkg-[a-z]+</literal>
+      is silently ignored. As seen in the last default value these patterns can use regular
+      expression syntax.
+   </para>
  </refsect1>
  
  <refsect1><title>APT in DSelect</title>