Matthew Booth
2011-Jan-17 17:00 UTC
[Libguestfs] [PATCH] Unconditionally always rebuild the transfer iso
Conditionally rebuilding the transfer iso saved relatively little execution time, and was a trickling source of bugs. This change simply removes the shortcut code, which means that the transfer iso will always be rebuild. Resolves RHBZ#618965 --- lib/Sys/VirtV2V/Config.pm | 45 +-------------------------------------------- 1 files changed, 1 insertions(+), 44 deletions(-) diff --git a/lib/Sys/VirtV2V/Config.pm b/lib/Sys/VirtV2V/Config.pm index ffb9424..8062280 100644 --- a/lib/Sys/VirtV2V/Config.pm +++ b/lib/Sys/VirtV2V/Config.pm @@ -150,50 +150,7 @@ sub get_transfer_iso unless defined($iso_path); $iso_path = $iso_path->getData(); - # Check if the transfer iso exists, and is newer than the config file - if (-e $iso_path) { - my $iso_st = stat($iso_path) - or die __x("Unable to stat {path}: {error}", - path => $iso_path, error => $!); - - my $config_st = stat($self->{path}) - or die __x("Unable to stat {path}: {error}", - path => $self->{path}, error => $!); - - if ($iso_st->mtime > $config_st->mtime) { - my $rebuild = 0; - - my %dirs; - foreach my $path (keys(%paths)) { - my $path_st = stat($path); - - if ($path_st->mtime > $iso_st->mtime) { - $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; - } - } - - if (!$rebuild) { - $self->{iso} = $iso_path; - return $iso_path; - } - } - } - - # Re-create the transfer iso + # Create the transfer iso my $eh = Sys::VirtV2V::ExecHelper->run ('mkisofs', '-o', $iso_path, '-r', '-J', -- 1.7.3.4
Richard W.M. Jones
2011-Jan-17 18:16 UTC
[Libguestfs] [PATCH] Unconditionally always rebuild the transfer iso
On Mon, Jan 17, 2011 at 05:00:56PM +0000, Matthew Booth wrote:> Conditionally rebuilding the transfer iso saved relatively little execution > time, and was a trickling source of bugs. This change simply removes the > shortcut code, which means that the transfer iso will always be rebuild.Simple code removal, ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
Reasonably Related Threads
- [PATCH] Config: Check timestamps on directories when rebuilding transfer iso
- [PATCH] Config: Don't require all referenced software to be available
- [PATCH] Move all interaction with the config file into Sys::VirtV2V::Config
- [PATCH 1/6] Convert config file to XML, and translate networks/bridge for all connections
- [PATCH] Fix error in Converter::Windows when there is no transfer iso