]> git.saurik.com Git - apt.git/commitdiff
Merge remote-tracking branch 'mvo/debian/sid' into debian/sid
authorMichael Vogt <mvo@ubuntu.com>
Tue, 1 Apr 2014 10:21:10 +0000 (12:21 +0200)
committerMichael Vogt <mvo@ubuntu.com>
Tue, 1 Apr 2014 10:21:10 +0000 (12:21 +0200)
apt-pkg/contrib/fileutl.cc
apt-pkg/deb/dpkgpm.cc
doc/apt.conf.5.xml
doc/examples/configure-index

index 69406a9bf11f30c348cce891e7ec494f9c971f56..188bb87eebbcec1410299e07ab251d88a3af49ff 100644 (file)
@@ -104,7 +104,11 @@ bool RunScripts(const char *Cnf)
       {
         if (Opts->Value.empty() == true)
            continue;
-        
+
+         if(_config->FindB("Debug::RunScripts", false) == true)
+            std::clog << "Running external script: '"
+                      << Opts->Value << "'" << std::endl;
+
         if (system(Opts->Value.c_str()) != 0)
            _exit(100+Count);
       }
index 5a5fff13bc73170dff13d80abe4211acec9ac459..c3e7e1d1d41a9a02d47d0f97ce14748964fc6937 100644 (file)
@@ -399,10 +399,14 @@ bool pkgDPkgPM::SendPkgsInfo(FILE * const F, unsigned int const &Version)
    that are due to be installed. */
 bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf)
 {
+   bool result = true;
+
    Configuration::Item const *Opts = _config->Tree(Cnf);
    if (Opts == 0 || Opts->Child == 0)
       return true;
    Opts = Opts->Child;
+
+   sighandler_t old_sigpipe = signal(SIGPIPE, SIG_IGN);
    
    unsigned int Count = 1;
    for (; Opts != 0; Opts = Opts->Next, Count++)
@@ -410,6 +414,10 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf)
       if (Opts->Value.empty() == true)
          continue;
 
+      if(_config->FindB("Debug::RunScripts", false) == true)
+         std::clog << "Running external script with list of all .deb file: '"
+                   << Opts->Value << "'" << std::endl;
+
       // Determine the protocol version
       string OptSec = Opts->Value;
       string::size_type Pos;
@@ -424,8 +432,10 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf)
       std::set<int> KeepFDs;
       MergeKeepFdsFromConfiguration(KeepFDs);
       int Pipes[2];
-      if (pipe(Pipes) != 0)
-        return _error->Errno("pipe","Failed to create IPC pipe to subprocess");
+      if (pipe(Pipes) != 0) {
+         result = _error->Errno("pipe","Failed to create IPC pipe to subprocess");
+         break;
+      }
       if (InfoFD != (unsigned)Pipes[0])
         SetCloseExec(Pipes[0],true);
       else
@@ -459,8 +469,10 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf)
       }
       close(Pipes[0]);
       FILE *F = fdopen(Pipes[1],"w");
-      if (F == 0)
-        return _error->Errno("fdopen","Faild to open new FD");
+      if (F == 0) {
+         result = _error->Errno("fdopen","Faild to open new FD");
+         break;
+      }
       
       // Feed it the filenames.
       if (Version <= 1)
@@ -488,11 +500,14 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf)
       fclose(F);
       
       // Clean up the sub process
-      if (ExecWait(Process,Opts->Value.c_str()) == false)
-        return _error->Error("Failure running script %s",Opts->Value.c_str());
+      if (ExecWait(Process,Opts->Value.c_str()) == false) {
+        result = _error->Error("Failure running script %s",Opts->Value.c_str());
+         break;
+      }
    }
+   signal(SIGPIPE, old_sigpipe);
 
-   return true;
+   return result;
 }
                                                                        /*}}}*/
 // DPkgPM::DoStdin - Read stdin and pass to slave pty                  /*{{{*/
index 78f6a27a26823efe5d2f0447e126cb5b3b8fa509..fcbf20dac0d17ac8bcd75a4878bc107e28484cdd 100644 (file)
@@ -1184,6 +1184,18 @@ DPkg::TriggersPending "true";</literallayout></para>
        </listitem>
      </varlistentry>
 
+     <varlistentry>
+       <term><option>Debug::RunScripts</option></term>
+       <listitem>
+        <para>
+          Display the external commands that are called by apt hooks.
+          This includes e.g. the config options
+          <literal>DPkg::{Pre,Post}-Invoke</literal> or
+          <literal>APT::Update::{Pre,Post}-Invoke</literal>.
+        </para>
+       </listitem>
+     </varlistentry>
+
 <!-- 2009/07/11 Currently used nowhere. The corresponding code
 is commented.
      <varlistentry>
index 020f0d2ceb1efd1e10505721d15cf248293e1100..2d9f829ba89392aaa95c0dac98817d3a0f70515d 100644 (file)
@@ -450,7 +450,7 @@ Debug
   aptcdrom "false";        // Show found package files
   IdentCdrom "false";
   acquire::netrc "false";  // netrc parser
-  
+  RunScripts "false";      // debug invocation of external scripts  
 }
 
 pkgCacheGen::Essential "native"; // other modes: all, none, installed