]> git.donarmstrong.com Git - wannabuild.git/commitdiff
Create valid dctrl-like output
authorJoachim Breitner <mail@joachim-breitner.de>
Fri, 24 Jul 2009 12:57:35 +0000 (14:57 +0200)
committerJoachim Breitner <mail@joachim-breitner.de>
Fri, 24 Jul 2009 12:57:35 +0000 (14:57 +0200)
Instead of adding the dots for empty lines when reading the input, and
adding the extra space when outputting, save the data as is and create
the correct format when outputting. This makes sure that multi-line-data
passed to -m is also represented correctly.

bin/wanna-build

index 4f3690cdd1977990ea15a127e4eba260c20a9add..c093a7f13b31faac485ca90f5a8328655d3208dc 100755 (executable)
@@ -274,7 +274,6 @@ if (!$fail_reason) {
                while(!eof(STDIN)) {
                        $line = <STDIN>;
                        last if $line eq ".\n";
-                       $line = ".\n" if $line eq "\n";
                        $fail_reason .= $line;
                }
                chomp( $fail_reason );
@@ -2187,8 +2186,8 @@ sub write_db {
                                if (!defined($ui->{'User'}));
                            foreach $key (keys %{$ui}) {
                                my $val = $ui->{$key};
-                               chomp($val);
-                               $val =~ s/\n/\n /g;
+                               $val =~ s/^/ /mg;
+                               $val =~ s/^ $/ ./mg;
                                print F "$key: $val\n";
                            }
                            print F "\n";
@@ -2198,7 +2197,8 @@ sub write_db {
                        foreach $key (keys %{$pkg}) {
                                my $val = $pkg->{$key};
                                chomp( $val );
-                               $val =~ s/\n/\n /g;
+                               $val =~ s/^/ /mg;
+                               $val =~ s/^ $/ ./mg;
                                print F "$key: $val\n";
                        }
                        print F "\n";