2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00

98_update.pm: report skipped files only if they were changed

git-svn-id: https://svn.fhem.de/fhem/trunk@8566 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2015-05-11 11:56:09 +00:00
parent b552f13908
commit a11edf0b6c

View File

@ -164,7 +164,7 @@ doUpdate($$)
my @rl = upd_getChanges($root, $basePath); my @rl = upd_getChanges($root, $basePath);
########################### ###########################
# process the remote controlfile # process the remote controlfile
my $nChanged = 0; my ($nChanged,$nSkipped) = (0,0);
my $isSingle = ($arg ne "all" && $arg ne "force" && $arg ne "check"); my $isSingle = ($arg ne "all" && $arg ne "force" && $arg ne "check");
foreach my $r (@remList) { foreach my $r (@remList) {
my @r = split(" ", $r, 4); my @r = split(" ", $r, 4);
@ -190,23 +190,29 @@ doUpdate($$)
foreach my $ex (@excl) { foreach my $ex (@excl) {
$isExcl = 1 if($fName =~ m/$ex/); $isExcl = 1 if($fName =~ m/$ex/);
} }
if($isExcl) {
uLog 1, "update: skipping $fName, matches exclude_from_update";
next;
}
if($isSingle) { if($isSingle) {
next if($fName !~ m/$arg/); next if($fName !~ m/$arg/);
if($isExcl) {
uLog 1, "update: skipping $fName, matches exclude_from_update";
$nSkipped++;
next;
}
} else { } else {
my $fPath = "$root/$fName"; my $fPath = "$root/$fName";
$fPath = $0 if($fPath =~ m/$mainPgm/); $fPath = $0 if($fPath =~ m/$mainPgm/);
my $sz = -s $fPath; my $fileOk = ($lh{$fName} &&
next if($lh{$fName} && $lh{$fName}{TS} eq $r[1] &&
$lh{$fName}{TS} eq $r[1] && $lh{$fName}{LEN} eq $r[2]);
$sz && $sz eq $r[2] && if($isExcl && !$fileOk) {
$lh{$fName}{LEN} eq $r[2]); uLog 1, "update: skipping $fName, matches exclude_from_update";
$nSkipped++;
next;
}
my $sz = -s $fPath;
next if($isExcl || ($fileOk && defined($sz) && $sz eq $r[2]));
} }
uLog 1, "List of new / modified files since last update:" uLog 1, "List of new / modified files since last update:"
@ -238,7 +244,7 @@ doUpdate($$)
return if(!upd_writeFile($root, $restoreDir, $fName, $remFile)); return if(!upd_writeFile($root, $restoreDir, $fName, $remFile));
} }
if($nChanged == 0) { if($nChanged == 0 && $nSkipped == 0) {
uLog 1, "nothing to do..."; uLog 1, "nothing to do...";
return; return;
} }
@ -255,6 +261,8 @@ doUpdate($$)
"FHEM/$ctrlFileName", $remCtrlFile)); "FHEM/$ctrlFileName", $remCtrlFile));
} }
return "" if(!$nChanged);
if($canJoin && $needJoin) { if($canJoin && $needJoin) {
chdir($root); chdir($root);
uLog(1, "Calling $^X $cj, this may take a while"); uLog(1, "Calling $^X $cj, this may take a while");