Archive-Libarchive-Any

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

t/common_list_contents_of_archive.t
t/common_match2.t
t/common_match_owner.t
t/common_memory_write.t
t/common_read_data_into_fh.t
t/common_read_disk.t
t/common_read_open_error.t
t/common_signature.t
t/common_sparse.t
t/common_stat.t
t/common_uid_gid_lookup.t
t/common_unicode.t
t/common_universal_decompressor.t
t/common_user_group_lookup.t
t/foo.tar
t/foo.tar.Z
t/foo.tar.bz2
t/foo.tar.gz
t/foo.txt.Z.uu
t/foo.txt.gz.uu
t/foo.xar

inc/functions.txt  view on Meta::CPAN

archive_entry_ctime_is_set
archive_entry_ctime_nsec
archive_entry_dev
archive_entry_dev_is_set
archive_entry_devmajor
archive_entry_devminor
archive_entry_fflags
archive_entry_fflags_text
archive_entry_filetype
archive_entry_free
archive_entry_gid
archive_entry_gname
archive_entry_hardlink
archive_entry_ino
archive_entry_ino_is_set
archive_entry_linkify
archive_entry_linkresolver_free
archive_entry_linkresolver_new
archive_entry_linkresolver_set_strategy
archive_entry_mac_metadata
archive_entry_mode

inc/functions.txt  view on Meta::CPAN

archive_entry_rdevminor
archive_entry_set_atime
archive_entry_set_birthtime
archive_entry_set_ctime
archive_entry_set_dev
archive_entry_set_devmajor
archive_entry_set_devminor
archive_entry_set_fflags
archive_entry_set_fflags_text
archive_entry_set_filetype
archive_entry_set_gid
archive_entry_set_gname
archive_entry_set_hardlink
archive_entry_set_ino
archive_entry_set_link
archive_entry_set_mac_metadata
archive_entry_set_mode
archive_entry_set_mtime
archive_entry_set_nlink
archive_entry_set_pathname
archive_entry_set_perm

inc/functions.txt  view on Meta::CPAN

archive_filter_name
archive_format
archive_format_name
archive_match_exclude_entry
archive_match_exclude_pattern
archive_match_exclude_pattern_from_file
archive_match_excluded
archive_match_free
archive_match_include_date
archive_match_include_file_time
archive_match_include_gid
archive_match_include_gname
archive_match_include_pattern
archive_match_include_pattern_from_file
archive_match_include_time
archive_match_include_uid
archive_match_include_uname
archive_match_new
archive_match_owner_excluded
archive_match_path_excluded
archive_match_path_unmatched_inclusions

inc/functions.txt  view on Meta::CPAN

archive_write_add_filter_lzip
archive_write_add_filter_lzma
archive_write_add_filter_lzop
archive_write_add_filter_none
archive_write_add_filter_program
archive_write_add_filter_uuencode
archive_write_add_filter_xz
archive_write_close
archive_write_data
archive_write_data_block
archive_write_disk_gid
archive_write_disk_new
archive_write_disk_set_group_lookup
archive_write_disk_set_options
archive_write_disk_set_skip_file
archive_write_disk_set_standard_lookup
archive_write_disk_set_user_lookup
archive_write_disk_uid
archive_write_fail
archive_write_finish_entry
archive_write_free

t/common_entry.t  view on Meta::CPAN

diag $@ if $@;

is eval { archive_entry_strmode($e) }, '-rw-r--r-- ', 'archive_entry_strmode';
diag $@ if $@;

is archive_entry_uid($e), 0, 'archive_entry_uid = 0';
$r = archive_entry_set_uid($e, 101);
is $r, ARCHIVE_OK, 'archive_entry_set_uid';
is archive_entry_uid($e), 101, 'archive_entry_uid = 101';

is eval { archive_entry_gid($e) }, 0, 'archive_entry_gid = 0';
diag $@ if $@;
$r = eval { archive_entry_set_gid($e, 201) };
diag $@ if $@;
is $r, ARCHIVE_OK, 'archive_entry_set_gid';
is eval { archive_entry_gid($e) }, 201, 'archive_entry_gid = 201';
diag $@ if $@;

$r = archive_entry_set_nlink($e, 5);
is $r, ARCHIVE_OK, 'archive_entry_set_nlink';

is eval { archive_entry_nlink($e) }, 5, 'archive_entry_nlink';
diag $@ if $@;

SKIP: {
  skip 'requires archive_entry_dev_is_set', 1 unless Archive::Libarchive::Any->can('archive_entry_dev_is_set');

t/common_match_owner.t  view on Meta::CPAN

  ok archive_match_owner_excluded($m, $e), 'archive_match_owner_excluded (1003)';
  ok archive_match_excluded($m,$e),        'archive_match_excluded (1003)';

  $r = archive_match_free($m);
  is $r, ARCHIVE_OK, 'archive_match_free';

  $r = archive_entry_free($e);
  is $r, ARCHIVE_OK, 'archive_entry_free';
};

subtest gid => sub {
  plan tests => 21;
  my $m = archive_match_new();
  ok $m, 'archive_match_new';

  my $e = archive_entry_new();
  ok $e, 'archive_entry_new';

  $r = archive_match_include_gid($m, 1000);
  is $r, ARCHIVE_OK, 'archive_match_include_gid 1000';

  $r = archive_match_include_gid($m, 1002);
  is $r, ARCHIVE_OK, 'archive_match_include_gid 1002';

  $r = archive_entry_set_gid($e, 0);
  is $r, ARCHIVE_OK, 'archive_entry_set_gid 0';
  ok archive_match_owner_excluded($m, $e), 'archive_match_owner_excluded (0)';
  ok archive_match_excluded($m,$e),        'archive_match_excluded (0)';

  $r = archive_entry_set_gid($e, 1000);
  is $r, ARCHIVE_OK, 'archive_entry_set_gid 1000';
  ok !archive_match_owner_excluded($m, $e), 'archive_match_owner_excluded (1000)';
  ok !archive_match_excluded($m,$e),        'archive_match_excluded (1000)';

  $r = archive_entry_set_gid($e, 1001);
  is $r, ARCHIVE_OK, 'archive_entry_set_gid 1001';
  ok archive_match_owner_excluded($m, $e), 'archive_match_owner_excluded (1001)';
  ok archive_match_excluded($m,$e),        'archive_match_excluded (1001)';

  $r = archive_entry_set_gid($e, 1002);
  is $r, ARCHIVE_OK, 'archive_entry_set_gid 1002';
  ok !archive_match_owner_excluded($m, $e), 'archive_match_owner_excluded (1002)';
  ok !archive_match_excluded($m,$e),        'archive_match_excluded (1002)';

  $r = archive_entry_set_gid($e, 1003);
  is $r, ARCHIVE_OK, 'archive_entry_set_gid 1002';
  ok archive_match_owner_excluded($m, $e), 'archive_match_owner_excluded (1003)';
  ok archive_match_excluded($m,$e),        'archive_match_excluded (1003)';

  $r = archive_match_free($m);
  is $r, ARCHIVE_OK, 'archive_match_free';

  $r = archive_entry_free($e);
  is $r, ARCHIVE_OK, 'archive_entry_free';
};

t/common_stat.t  view on Meta::CPAN

subtest 'archive_entry_stat' => sub {
  plan tests => 10;

  my $entry = archive_entry_new();

  archive_entry_set_dev($entry, 0x1234);
  archive_entry_set_ino($entry, 0x5678);
  archive_entry_set_mode($entry, 0400);
  archive_entry_set_nlink($entry, 1);
  archive_entry_set_uid($entry, 500);
  archive_entry_set_gid($entry, 501);
  archive_entry_set_rdev($entry, 0x1357);
  archive_entry_set_atime($entry, 123456789, 123456789);
  archive_entry_set_mtime($entry, 123456779, 123456779);
  archive_entry_set_ctime($entry, 123456769, 123456769);

  my($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $atime, $mtime, $ctime) = eval { archive_entry_stat($entry) };
  diag $@ if $@;

  is $dev,   0x1234,    'dev';
  is $ino,   0x5678,    'ino';
  is $mode,  0400,      'mode';
  is $nlink, 1,         'nlink';
  is $uid,   500,       'uid';
  is $gid,   501,       'gid';
  is $rdev,  0x1357,    'rdev';
  is $atime, 123456789, 'atime';
  is $mtime, 123456779, 'mtime';
  is $ctime, 123456769, 'ctime';

  archive_entry_free($entry);

};

subtest 'archive_entry_set_stat' => sub {

t/common_stat.t  view on Meta::CPAN

  my $entry = archive_entry_new();

  eval { archive_entry_set_stat($entry,0x1234,0x5678,0400,1,500,501,0x1357,123456789,123456779,123456769) };
  diag $@ if $@;

  my $dev   = archive_entry_dev($entry);
  my $ino   = archive_entry_ino($entry);
  my $mode  = archive_entry_mode($entry);
  my $nlink = archive_entry_nlink($entry);
  my $uid   = archive_entry_uid($entry);
  my $gid   = archive_entry_gid($entry);
  my $rdev  = archive_entry_rdev($entry);
  my $atime = archive_entry_atime($entry);
  my $mtime = archive_entry_mtime($entry);
  my $ctime = archive_entry_ctime($entry);

  is $dev,   0x1234,    'dev';
  is $ino,   0x5678,    'ino';
  is $mode,  0400,      'mode';
  is $nlink, 1,         'nlink';
  is $uid,   500,       'uid';
  is $gid,   501,       'gid';
  is $rdev,  0x1357,    'rdev';
  is $atime, 123456789, 'atime';
  is $mtime, 123456779, 'mtime';
  is $ctime, 123456769, 'ctime';

  archive_entry_free($entry);

};

t/common_uid_gid_lookup.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More;
use Archive::Libarchive::Any qw( :all );

plan skip_all => 'requires archive_write_disk_gid' unless Archive::Libarchive::Any->can('archive_write_disk_gid');
plan tests => 7;

# based on test_write_disk_lookup.c

my $gmagic = 0x13579;
my $umagic = 0x1234;

my $a = archive_write_disk_new();
ok $a, 'archive_write_disk_new';

subtest 'Default uname/gname lookup always return ID.' => sub {
  plan tests => 5;
  is archive_write_disk_gid($a, '', 0), 0, 'gid "",0 = 0';
  is archive_write_disk_gid($a, 'root', 12), 12, 'gid root,12 = 12';
  is archive_write_disk_gid($a, 'wheel', 12), 12, 'gid wheel,12 = 12';
  is archive_write_disk_uid($a, '', 0), 0, 'uid "",0 = 0';
  is archive_write_disk_uid($a, 'root', 18), 18, 'uid root,18 = 18';
};

subtest 'Register some weird lookup functions' => sub {
  plan tests => 1;
  my $r = eval { archive_write_disk_set_group_lookup($a, \$gmagic, \&group_lookup, \&group_cleanup) };
  diag $@ if $@;
  is $r, ARCHIVE_OK, 'archive_write_disk_set_group_lookup';
};

subtest 'Verify that our new function got called.' => sub {
  plan tests => 2;
  is archive_write_disk_gid($a, "FOOGROUP",    8), 73, 'gid FOOGROUP    8 = 73';
  is archive_write_disk_gid($a, "NOTFOOGROUP", 8),  1, 'gid NOTFOOGROUP 8 = 1';
};

subtest 'De-register.' => sub {
  plan tests => 2;
  my $r = eval { archive_write_disk_set_group_lookup($a, undef, undef, undef) };
  diag $@ if $@;
  is $r, ARCHIVE_OK, 'archive_write_disk_set_group_lookup';
  is $gmagic, 0x2468, 'Ensure our cleanup function got called.';
};

t/common_uid_gid_lookup.t  view on Meta::CPAN


sub group_cleanup
{
  my($data) = @_;
  die unless $$data == 0x13579;
  $$data = 0x2468;
}

sub group_lookup
{
  my($data, $name, $gid) = @_;
  die unless $$data == 0x13579;
  return 1 if $name ne 'FOOGROUP';
  return 73;
}

sub user_cleanup
{
  my($data) = @_;
  die unless $$data == 0x1234;
  $$data = 0x2345;

t/common_user_group_lookup.t  view on Meta::CPAN


sub gname_cleanup
{
  my($data) = @_;
  die unless $$data == 0x13579;
  $$data = 0x2468;
}

sub gname_lookup
{
  my($data, $gid) = @_;
  return "FOOGROUP" if $gid == 1;
  return "NOTFOOGROUP";
}

sub uname_cleanup
{
  my($data) = @_;
  die unless $$data == 0x1234;
  $$data = 0x2345;
}



( run in 0.769 second using v1.01-cache-2.11-cpan-ceb78f64989 )