App-MtAws
view release on metacpan or search on metacpan
* Alpha testing on Cygwin platform
### 2013-08-31 v1.050
* Optimized Journal memory usage by 12%
* Fixed: system error messages (i.e. ERRNO - like Permission denied etc) where clobbered on non-English locales (i.e.
when message is not ASCII-7bit). Error messages and check-local-hash output were affected.
* CPAN/Cosmetic: testsuite does not produce strings which looks like a warnings anymore.
### 2013-08-27 v1.000
* After one year since first public version released, beta testing now finished and version 1.000 released.
Current project status is non-beta, stable.
* New version scheme: 1.xyz (x - major change or major internal change, y - new version, z - tiny fixes)
* Internal changes. Nothing new.
* **JSON::XS** (or Debian package **libjson-xs-perl** or RPM package **perl-JSON-XS** or MacPort **p5-json-XS**)
##### Other notes
1. for old Perl < 5.9.3 (i.e. *CentOS 5.x*), install also **Digest::SHA** (or Debian package **libdigest-sha-perl** or RPM package **perl-Digest-SHA**)
2. Some distributions with old Perl stuff (examples: *Ubuntu 10.04*, *CentOS 5/6*) to use HTTPS you need to upgrade **LWP::Protocol::https** to version 6+ via CPAN.
3. *Fedora*, *CentOS 6* etc [decoupled](http://www.nntp.perl.org/group/perl.perl5.porters/2009/08/msg149747.html) Perl,
so package named `perl`, which is a part of default installation, is not actually real, full Perl, which is misleading.
`perl-core` is looks much more like a real Perl (I [hope](https://bugzilla.redhat.com/show_bug.cgi?id=985791) so)
4. On newer RHEL distributions (some *Fedora* versions) you need install **perl-LWP-Protocol-https** to use HTTPS.
5. To inistall `perl-JSON-XS` RPM package on RHEL5/6 you need to enable [EPEL](http://fedoraproject.org/wiki/EPEL) repository
6. If you've used manual installation before "CPAN" installation, it's probably better to remove previously installed `mtglacier` executable from your path.
7. CPAN distribution of *mt-aws-glacier* has a bit more dependencies than manual installation, as it requires additional modules for testsuite.
8. New releases of *mt-aws-glacier* usually appear on CPAN within a ~week after official release.
key=YOURKEY
secret=YOURSECRET
protocol=http
region=us-east-1
vault=Photos
journal=/home/me/.glacier/photos.journal
#### Why Journal does not contain region/vault information?
Keeping journal/vault in config does looks to me more like a Unix way. It can be a bit danger, but easier to maintain, because:
1. Let's imaging I decided to put region/vault into Journal. There are two options:
a. Put it into beginning of the file, before journal creation.
b. Store same region/vault in each record of the file. It looks like a waste of disk space.
Option (a) looks better. So this way journal will contain something like
region=us-east-1
vault=Photos
in the beginning. But same can be achieved by putting same lines to the config file (see previous question)
2. Also, putting vault/region to journal will make command line options `--vault` and `--region` useless
for general commands and will require to add another command (something like `create-journal-file`)
3. There is a possibility to use different *account id* in Amazon Glacier (i.e. different person's account). It's not supported yet in `mtglacier`,
lib/App/MtAws/Command/DownloadInventory.pm view on Meta::CPAN
{
my ($options, $j) = @_;
with_forks 1, $options, sub {
my $ft = App::MtAws::QueueJob::FetchAndDownloadInventory->new();
my ($R) = fork_engine->{parent_worker}->process_task($ft, undef);
my $attachmentref = $R->{inventory_raw_ref};
my $inventory_type = $R->{inventory_type};
# here we can have response from both JobList or Inventory output..
# JobList looks like 'response' => '{"JobList":[],"Marker":null}'
# Inventory retriebal has key 'ArchiveList'
# TODO: implement it more clear way on level of Job/Tasks object
croak if -s binaryfilename $options->{'new-journal'}; # TODO: fix race condition between this and opening file
if ($R && $attachmentref) { # $attachmentref can be SCALAR REF or can be undef
$j->open_for_write();
parse_and_write_journal($j, $inventory_type, $attachmentref);
$j->close_for_write();
}
}
}
t/integration/journal_readwrite.t view on Meta::CPAN
};
#
# kinda unit test
#
test_all_ok($data_sample);
#
# that's looks more like integration tests
#
# mtime formats
for my $mtime (qw/1355566755 -1969112106 +1355566755 -1 0 +0 -0 1 2 3 4 5 6 7 8 9 12 123/) {
test_all_ok($data_sample, mtime => $mtime);
test_all_ok($data_sample, mtime => $mtime, relfilename => $data_sample->{archive_id}, _mtime_should_be_undef => 1, _versions => [qw/A/]);
}
test_all_ok($data_sample, mtime => 'NONE', _mtime_should_be_undef => 1, _versions => [qw/B C/]);
t/integration/metadata.t view on Meta::CPAN
ok !defined App::MtAws::MetaData::meta_decode("$_"), 'should return undef, without warning, if input is marker plus empty string';
ok !defined App::MtAws::MetaData::meta_decode("$_ "), 'should return undef, without warning, if input is marker plus space';
ok !defined App::MtAws::MetaData::meta_decode("$_ "), 'should return undef, without warning, if input is marker plus multiple spaces';
}
ok defined App::MtAws::MetaData::meta_decode('mt2 '._encode_base64url('{ "filename": "a", "mtime": "20080102T222324Z"}')), 'should allow few spaces';
ok defined App::MtAws::MetaData::meta_decode("mt2\t\t"._encode_base64url('{ "filename": "a", "mtime": "20080102T222324Z"}')), 'should allow tabs';
ok defined App::MtAws::MetaData::meta_decode(" \tmt2\t\t "._encode_base64url('{ "filename": "a", "mtime": "20080102T222324Z"}')), 'should allow leading spaces';
eval { App::MtAws::MetaData::meta_decode('zzz') };
ok $@ eq '', 'should not override eval code'; # it looks now that those tests are broken
eval { App::MtAws::MetaData::meta_decode('mt2 zzz') };
ok $@ eq '', 'should not override eval code'; # it looks now that those tests are broken
}
# test error cacth while encoding
{
ok defined App::MtAws::MetaData::meta_encode('filename', -1), 'should not catch negative mtime';
t/unit/cmd_sync.t view on Meta::CPAN
use strict;
use warnings;
use utf8;
use FindBin;
use lib map { "$FindBin::RealBin/$_" } qw{../lib ../../lib};
use TestUtils 'w_fatal';
use Carp;
use List::Util qw/first/;
use Scalar::Util qw/looks_like_number/;
use Test::Spec;
use Test::More;
use Test::Deep;
use Data::Dumper;
use App::MtAws::Journal;
require App::MtAws::Command::Sync;
t/unit/cmd_sync.t view on Meta::CPAN
it "should define unique constants" => sub {
ok App::MtAws::Command::Sync::SHOULD_CREATE() != App::MtAws::Command::Sync::SHOULD_TREEHASH();
ok App::MtAws::Command::Sync::SHOULD_CREATE() != App::MtAws::Command::Sync::SHOULD_NOACTION();
ok App::MtAws::Command::Sync::SHOULD_CREATE();
ok App::MtAws::Command::Sync::SHOULD_TREEHASH();
ok !App::MtAws::Command::Sync::SHOULD_NOACTION(); # one should be FALSE
# numeric eq only
ok looks_like_number App::MtAws::Command::Sync::SHOULD_CREATE();
ok looks_like_number App::MtAws::Command::Sync::SHOULD_TREEHASH();
ok looks_like_number App::MtAws::Command::Sync::SHOULD_NOACTION();
};
it "should almost always return create if file size differs" => sub {
for (grep $_ ne 'always-positive', @all_detect) {
App::MtAws::Command::Sync->expects("is_mtime_differs")->never;
App::MtAws::Command::Sync->expects("file_size")->returns(42)->once;
is App::MtAws::Command::Sync::should_upload({detect => $_},{mtime => 123, size => 43}, 'file1'),
App::MtAws::Command::Sync::SHOULD_CREATE();
}
};
t/unit/filter.t view on Meta::CPAN
'pattern' => 'abc',
're' => qr/(^|\/)abc$/,
'action' => '-',
'match_subdirs' => '',
'notmatch' => '',
},
{
'pattern' => 'dir/',
# Test::Deep problem here https://rt.cpan.org/Ticket/Display.html?id=85785
# looks like perl 5.8.x issue with regexp stringification
're' => do { my $s = '(^|/)dir\/'; qr/$s/ },
'action' => '-',
'match_subdirs' => 1,
'notmatch' => '',
},
{
'pattern' => '*.gz',
're' => qr/(^|\/)[^\/]*\.gz$/,
'action' => '+',
( run in 0.330 second using v1.01-cache-2.11-cpan-64827b87656 )