aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mageia.org>2012-03-12 18:13:57 +0000
committerPascal Terjan <pterjan@mageia.org>2012-03-12 18:13:57 +0000
commite5fefd376242c7024cce11b6b2e62749aed53bd9 (patch)
tree1e6dbca5288acca174a672b4cb217679abe6980b
parent795d8a847ba15ee5d5d8fd1eda8742e41b4d90e5 (diff)
downloadiurt-e5fefd376242c7024cce11b6b2e62749aed53bd9.tar
iurt-e5fefd376242c7024cce11b6b2e62749aed53bd9.tar.gz
iurt-e5fefd376242c7024cce11b6b2e62749aed53bd9.tar.bz2
iurt-e5fefd376242c7024cce11b6b2e62749aed53bd9.tar.xz
iurt-e5fefd376242c7024cce11b6b2e62749aed53bd9.zip
Never manually write to log file
-rwxr-xr-xemi1
-rwxr-xr-xiurt22
-rwxr-xr-xiurt_root_command1
-rw-r--r--lib/Iurt/Config.pm6
-rw-r--r--lib/Iurt/DKMS.pm8
-rwxr-xr-xulri1
6 files changed, 7 insertions, 12 deletions
diff --git a/emi b/emi
index 68e9a3e..87ad8a1 100755
--- a/emi
+++ b/emi
@@ -44,7 +44,6 @@ $run{program_name} = $program_name;
open(my $LOG, ">&STDERR");
plog_init($program_name, $LOG, 7, 1);
-$run{LOG} = sub { print $LOG @_ };
my $HOME = $ENV{HOME};
diff --git a/iurt2 b/iurt2
index 225ab42..ec3ba89 100755
--- a/iurt2
+++ b/iurt2
@@ -201,7 +201,6 @@ $run{todo} = [];
sub {
$run{log} = pop @_;
open my $log, ">$run{log}" or die "unable to open $run{log}\n";
- $run{LOG} = sub { print $log @_ };
$run{logfd} = $log;
print *$log, "command line: @ARGV\n";
1;
@@ -360,7 +359,6 @@ $run{todo} = [];
);
open(my $LOG, ">&STDERR");
-$run{LOG} = sub { print $LOG @_ };
plog_init($program_name, $run{logfd}||$LOG, 7, 1); # For parsing command line
diff --git a/iurt_root_command b/iurt_root_command
index 89edeeb..544ddbc 100755
--- a/iurt_root_command
+++ b/iurt_root_command
@@ -170,7 +170,6 @@ my %commands_with_more_args = (
);
open(my $LOG, ">&STDERR");
-$run{LOG} = sub { print $LOG @_ };
plog_init($program_name, $LOG, $run{verbose});
#plog_init($program_name, $LOG, 7, 1);
diff --git a/lib/Iurt/Config.pm b/lib/Iurt/Config.pm
index c2fbe6d..33d822f 100644
--- a/lib/Iurt/Config.pm
+++ b/lib/Iurt/Config.pm
@@ -137,7 +137,7 @@ sub init_cache {
my $cachefile = "$config->{cache_home}/$program_name.cache";
my $cache;
if (-f $cachefile) {
- $run->{LOG}->("$program_name: loading cache file $cachefile\n");
+ plog('DEBUG', "loading cache file $cachefile");
$cache = eval(cat_($cachefile)) or print "FATAL $program_name: could not load cache $cachefile ($!)\n";
} else {
$cache = $empty;
@@ -166,9 +166,9 @@ sub dump_cache {
$Data::Dumper::Terse = 1;
print $file Data::Dumper->Dump([ $cache ], [ "cache" ]);
# flock does not work on network files and lockf seems to fail too
- $run->{LOG}->("$program_name: locking to dump the cache in $filename\n");
+ plog('DEBUG', "locking to dump the cache in $filename");
if (-f "$filename.lock") {
- $run->{LOG}->("ERROR iurt: manual file lock exist, do not save the cache\n");
+ plog('ERROR', 'ERROR: manual file lock exist, do not save the cache');
} else {
open my $lock, ">$filename.lock";
print $lock $$;
diff --git a/lib/Iurt/DKMS.pm b/lib/Iurt/DKMS.pm
index 535e822..d5613e8 100644
--- a/lib/Iurt/DKMS.pm
+++ b/lib/Iurt/DKMS.pm
@@ -238,7 +238,7 @@ sub dkms_compile {
plog('DEBUG', "symlink from $modules_build_dir to /usr/src/$sourcedir");
if (system("sudo ln -sf /usr/src/$sourcedir $modules_build_dir")) {
- plog('ERROR', "linking failed ($!)");
+ plog('ERROR', "ERROR: linking failed ($!)");
next;
}
}
@@ -282,13 +282,13 @@ sub dkms_compile {
if (system("cp $rpms $dkms_spool/$media/ &>/dev/null") == 0) {
$copied = 1;
sudo($run, $config, '--rm', $rpms)
- or $run->{LOG}->("ERROR: could not delete dkms packages from $rpms ($!)\n");
+ or plog('ERROR', "ERROR: could not delete dkms packages from $rpms ($!)");
last;
}
}
- $run->{LOG}->("ERROR: could not copy dkms packages from " .
+ plog('ERROR', "ERROR: could not copy dkms packages from " .
join(" or ", map { "$chroot_tmp$_/*.rpm" } @dkms_rpm_dirs) .
- " to $dkms_spool/$media ($!)\n") if !$copied;
+ " to $dkms_spool/$media ($!)") if !$copied;
process_dkms_queue($self, 0, 0, $media, "$dkms_spool/$media");
# compile dkms modules
diff --git a/ulri b/ulri
index d9eaee9..aa661d7 100755
--- a/ulri
+++ b/ulri
@@ -50,7 +50,6 @@ my $program_name = 'ulri';
$run{program_name} = $program_name;
open(my $LOG, ">&STDERR");
-$run{LOG} = sub { print $LOG @_ };
plog_init($program_name, $LOG, 7, 1);