[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.5.1-25-ge286734



The following commit has been merged in the master branch:
commit e28673477be94fb646c896b735d48f5cf90866a0
Author: Niels Thykier <niels@thykier.net>
Date:   Wed Jun 29 12:22:42 2011 +0200

    Lintian::Command now supports appending to files
    
    The new out_append/err_append can be used instead of out/err to
    append the output to a file without of truncating the file first.

diff --git a/debian/changelog b/debian/changelog
index a29d857..0a58547 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -58,6 +58,10 @@ lintian (2.5.2) UNRELEASED; urgency=low
       loaded.  Previously Lintian would only load direct
       dependencies of a collection and assume that was enough.
 
+  * lib/Lintian/Command.pm:
+    + [NT] Added support for appending output to files without
+      truncating them first via the new out_append and
+      err_append options.
   * lib/Lintian/{Internal/FrontendUtil,Profile}.pm:
     + [NT] New files.
   * lib/Lintian/{Tag/Info,Tags}.pm:
diff --git a/lib/Lintian/Command.pm b/lib/Lintian/Command.pm
index 5317a9b..8f88b41 100644
--- a/lib/Lintian/Command.pm
+++ b/lib/Lintian/Command.pm
@@ -98,6 +98,12 @@ STDOUT of the last forked child.  Will be set to a newly created
 scalar reference by default which can be used to retrieve the output
 after the call.
 
+=item out_append
+
+STDOUT of all forked childs, cannot be used with out and should only be
+used with files.  Unlike out, this appends the output to the file
+instread of truncating the file.
+
 =item pipe_out
 
 Use a pipe for STDOUT and start the process in the background.
@@ -108,6 +114,12 @@ process to end properly.
 
 STDERR of all forked childs.  Defaults to STDERR of the parent.
 
+=item err_append
+
+STDERR of all forked childs, cannot be used with err and should only be
+used with files.  Unlike err, this appends the output to the file
+instread of truncating the file.
+
 =item pipe_err
 
 Use a pipe for STDERR and start the process in the background.
@@ -170,15 +182,23 @@ sub spawn {
 	@out = ('>pipe', $opts->{pipe_out});
 	$background = 1;
     } else {
-	$opts->{out} ||= \$out;
-	@out = ('>', $opts->{out});
+	if (!exists $opts->{out} && defined $opts->{out_append}){
+	    @out = ('>>', $opts->{out_append});
+	} else {
+	    $opts->{out} ||= \$out;
+	    @out = ('>', $opts->{out});
+	}
     }
     if ($opts->{pipe_err}) {
 	@err = ('2>pipe', $opts->{pipe_err});
 	$background = 1;
     } else {
-	$opts->{err} ||= \*STDERR;
-	@err = ('2>', $opts->{err});
+	if (!exists $opts->{err} && defined $opts->{err_append}){
+	    @err = ('2>>', $opts->{err_append});
+	} else {
+	    $opts->{err} ||= \*STDERR;
+	    @err = ('2>', $opts->{err});
+	}
     }
 
 #    use Data::Dumper;

-- 
Debian package checker


Reply to: