diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2018-12-19 14:35:49 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-12-19 14:55:09 +0200 |
commit | ea2c058ce96484937fcfe52dc7382a461a9d72e3 (patch) | |
tree | ae86e1115c3ef91bc03d2cfcb7df4f7ff8d19ce9 /lib/App/Glacier/Command/Get.pm | |
parent | 249512af92d3f592ae683279c2cd1f54a7c1a726 (diff) | |
download | glacier-ea2c058ce96484937fcfe52dc7382a461a9d72e3.tar.gz glacier-ea2c058ce96484937fcfe52dc7382a461a9d72e3.tar.bz2 |
Bugfixes.
* lib/App/Glacier/Command.pm (option,check_job): New methods.
* lib/App/Glacier/Command/Get.pm: Rewrite debug messages (fixes
temporary solution in 6c6dab5d).
* lib/App/Glacier/Command/Jobs.pm: Rewrite the db->foreach sub.
* lib/App/Glacier/Command/Periodic.pm: Likewise.
* lib/App/Glacier/DB/GDBM.pm (CLONE_SKIP): New method.
* lib/App/Glacier/Job.pm: Overload the "" operator.
* lib/App/Glacier/Roster.pm (foreach): Overload method.
Diffstat (limited to 'lib/App/Glacier/Command/Get.pm')
-rw-r--r-- | lib/App/Glacier/Command/Get.pm | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/App/Glacier/Command/Get.pm b/lib/App/Glacier/Command/Get.pm index 0d17659..82b32c8 100644 --- a/lib/App/Glacier/Command/Get.pm +++ b/lib/App/Glacier/Command/Get.pm @@ -160,6 +160,8 @@ sub run { if ($job->is_completed) { my $cache_file = $job->cache_file; if (-f $cache_file) { + $self->debug(1, "$job: copying from $cache_file"); + return if $self->dry_run; unless (copy($cache_file, $localname)) { $self->abend(EX_FAILURE, "can't copy $cache_file to $localname: $!"); @@ -193,6 +195,7 @@ use constant TWOMB => 2*MB; sub download { my ($self, $job, $localname) = @_; + my $archive_size = $job->get('ArchiveSizeInBytes'); if ($archive_size < $self->cf_transfer_param(qw(download single-part-size))) { # simple download @@ -214,9 +217,7 @@ sub _open_output { sub _download_simple { my ($self, $job, $localname) = @_; - eval { # FIXME: file_name might be absent - $self->debug(1, "downloading", $job->file_name(1), "in single part"); - }; + $self->debug(1, "$job: downloading in single part"); return if $self->dry_run; my $fd = $self->_open_output($localname); my ($res, $tree_hash) = $self->glacier->Get_job_output($job->vault, @@ -256,8 +257,8 @@ sub _download_multipart { # Compute the number of parts per job my $job_parts = int(($total_parts + $njobs - 1) / $njobs); - $self->debug(1, - "downloading", $job->file_name(1), "to $localname in chunks of $part_size bytes, in $njobs jobs, with $job_parts parts per job"); + $self->debug(1, "$job: downloading in chunks of $part_size bytes, in $njobs jobs, with $job_parts parts per job"); + return if $self->dry_run; use Fcntl qw(SEEK_SET); |