[PATCH] Config: Check timestamps on directories when rebuilding transfer iso
We don't currently detect if a file with an old timestamp has been moved into a directory. This fixes that. --- lib/Sys/VirtV2V/Config.pm | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/lib/Sys/VirtV2V/Config.pm b/lib/Sys/VirtV2V/Config.pm index 3fff455..bb30dae 100644 --- a/lib/Sys/VirtV2V/Config.pm +++ b/lib/Sys/VirtV2V/Config.pm @@ -154,6 +154,7 @@ sub get_transfer_iso if ($iso_st->mtime > $config_st->mtime) { my $rebuild = 0; + my %dirs; foreach my $path (keys(%paths)) { my $path_st = stat($path); @@ -161,6 +162,19 @@ sub get_transfer_iso $rebuild = 1; last; } + + # Also check if the containing directory has been updated. This + # will pick up the case where a file with an old timestamp has + # been moved into a directory. + my (undef, $dir, undef) = File::Spec->splitpath($path); + if (!exists($dirs{$dir})) { + my $dir_st = stat($dir); + if ($dir_st->mtime > $iso_st->mtime) { + $rebuild = 1; + last; + } + $dirs{$dir} = 1; + } } return $iso_path if (!$rebuild); -- 1.6.6.1
On Fri, May 07, 2010 at 03:03:33PM +0100, Matthew Booth wrote:
We don't currently detect if a file with an old timestamp has been moved into a directory. This fixes that.
Why don't we just always rebuild the ISO? Surely mkisofs can't take that long? Anyway, change looks fine, ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
On 07/05/10 15:20, Richard W.M. Jones wrote:
On Fri, May 07, 2010 at 03:03:33PM +0100, Matthew Booth wrote:
We don't currently detect if a file with an old timestamp has been moved into a directory. This fixes that.
Why don't we just always rebuild the ISO? Surely mkisofs can't take that long?
It doesn't, and I've been wondering lately why I bothered. However, it is now up to 130M. It might start taking a long time :) Matt -- Matthew Booth, RHCA, RHCSS Red Hat Engineering, Virtualisation Team M: +44 (0)7977 267231 GPG ID: D33C3490 GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490
participants (2)
-
Matthew Booth -
Richard W.M. Jones