import from svn://proxdev/server/svn//libarchive-perl/pmg3

This commit is contained in:
Dietmar Maurer 2014-09-19 14:10:29 +02:00
commit 918a6904d6
15 changed files with 6260 additions and 0 deletions

15
LibArchive/Changes Normal file
View File

@ -0,0 +1,15 @@
Revision history for Perl extension LibArchive.
2.2.4 Wed Jul 18 10:50:00 CEST 2007
- code cleanup
- pumped version number
- only export read interface
- bug fixes
0.01 Fri Jul 13 12:41:39 2007
- original version; created by h2xs 1.23 with options

247
LibArchive/LibArchive.xs Normal file
View File

@ -0,0 +1,247 @@
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
#include <archive.h>
#include <archive_entry.h>
#include "const-c.inc"
MODULE = LibArchive PACKAGE = LibArchive
INCLUDE: const-xs.inc
int
archive_api_feature()
int
archive_api_version()
void
archive_clear_error(arg0)
struct archive * arg0
int
archive_compression(arg0)
struct archive * arg0
const char *
archive_compression_name(arg0)
struct archive * arg0
int
archive_errno(arg0)
struct archive * arg0
const char *
archive_error_string(arg0)
struct archive * arg0
int
archive_format(arg0)
struct archive * arg0
int
archive_read_close(arg0)
struct archive * arg0
ssize_t
archive_read_data(arg0, buffer, nbytes)
PREINIT:
SV *sv_buffer = SvROK(ST(1)) ? SvRV(ST(1)) : ST(1);
INPUT:
struct archive * arg0
size_t nbytes
char * buffer = sv_grow( sv_buffer, nbytes+1 );
CLEANUP:
if (RETVAL >= 0) {
SvCUR_set(sv_buffer, RETVAL);
SvPOK_only(sv_buffer);
*SvEND(sv_buffer) = '\0';
SvTAINTED_on(sv_buffer);
}
int
archive_read_data_skip(arg0)
struct archive * arg0
int
archive_read_extract(arg0, arg1, flags)
struct archive * arg0
struct archive_entry * arg1
int flags
int
archive_read_finish(arg0)
struct archive * arg0
struct archive *
archive_read_new()
int
archive_read_next_header(arg0, entry)
struct archive * arg0
struct archive_entry *entry = NO_INIT
CODE:
RETVAL = archive_read_next_header (arg0, &entry);
OUTPUT:
entry
RETVAL
int
archive_read_open_FILE(arg0, _file)
struct archive * arg0
FILE * _file
int
archive_read_open_fd(arg0, _fd, _block_size)
struct archive * arg0
int _fd
size_t _block_size
int
archive_read_open_file(arg0, _filename, _block_size)
struct archive * arg0
const char * _filename
size_t _block_size
int
archive_read_open_filename(arg0, _filename, _block_size)
struct archive * arg0
const char * _filename
size_t _block_size
int
archive_read_support_compression_all(arg0)
struct archive * arg0
int
archive_read_support_compression_bzip2(arg0)
struct archive * arg0
int
archive_read_support_compression_compress(arg0)
struct archive * arg0
int
archive_read_support_compression_gzip(arg0)
struct archive * arg0
int
archive_read_support_compression_none(arg0)
struct archive * arg0
int
archive_read_support_compression_program(arg0, command)
struct archive * arg0
const char * command
int
archive_read_support_format_all(arg0)
struct archive * arg0
int
archive_read_support_format_ar(arg0)
struct archive * arg0
int
archive_read_support_format_cpio(arg0)
struct archive * arg0
int
archive_read_support_format_empty(arg0)
struct archive * arg0
int
archive_read_support_format_gnutar(arg0)
struct archive * arg0
int
archive_read_support_format_iso9660(arg0)
struct archive * arg0
int
archive_read_support_format_tar(arg0)
struct archive * arg0
int
archive_read_support_format_zip(arg0)
struct archive * arg0
const char *
archive_version()
int
archive_version_stamp()
time_t
archive_entry_atime(arg0)
struct archive_entry * arg0
long
archive_entry_atime_nsec(arg0)
struct archive_entry * arg0
time_t
archive_entry_ctime(arg0)
struct archive_entry * arg0
long
archive_entry_ctime_nsec(arg0)
struct archive_entry * arg0
mode_t
archive_entry_mode(arg0)
struct archive_entry * arg0
const char *
archive_entry_gname(arg0)
struct archive_entry * arg0
const char *
archive_entry_hardlink(arg0)
struct archive_entry * arg0
time_t
archive_entry_mtime(arg0)
struct archive_entry * arg0
long
archive_entry_mtime_nsec(arg0)
struct archive_entry * arg0
unsigned int
archive_entry_nlink(arg0)
struct archive_entry * arg0
const char *
archive_entry_pathname(arg0)
struct archive_entry * arg0
long
archive_entry_size(arg0)
struct archive_entry * arg0
CODE:
int64_t lsize;
long res;
lsize = archive_entry_size (arg0);
if (lsize > LONG_MAX || lsize < LONG_MIN) {
Perl_croak(aTHX_ "archive entry too large");
}
RETVAL = res = lsize;
OUTPUT:
RETVAL
const char *
archive_entry_symlink(arg0)
struct archive_entry * arg0
const char *
archive_entry_uname(arg0)
struct archive_entry * arg0

9
LibArchive/MANIFEST Normal file
View File

@ -0,0 +1,9 @@
Changes
LibArchive.xs
Makefile.PL
MANIFEST
ppport.h
README
typemap
t/LibArchive.t
lib/LibArchive.pm

55
LibArchive/Makefile.PL Normal file
View File

@ -0,0 +1,55 @@
use 5.008008;
use ExtUtils::MakeMaker;
use ExtUtils::Constant;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
NAME => 'LibArchive',
PREFIX => '/usr',
VERSION_FROM => 'lib/LibArchive.pm', # finds $VERSION
PREREQ_PM => {}, # e.g., Module::Name => 1.1
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'lib/LibArchive.pm', # retrieve abstract from module
AUTHOR => 'Proxmox Support Team <support@proxmox.com>') : ()),
LIBS => ['-larchive'], # e.g., '-lm'
DEFINE => '', # e.g., '-DHAVE_SOMETHING'
INC => '-I.', # e.g., '-I. -I/usr/include/other'
# Un-comment this if you add C files to link with later:
# OBJECT => '$(O_FILES)', # link all the C files too
);
my @names = (qw(ARCHIVE_API_FEATURE ARCHIVE_API_VERSION
ARCHIVE_BYTES_PER_RECORD ARCHIVE_COMPRESSION_BZIP2
ARCHIVE_COMPRESSION_COMPRESS ARCHIVE_COMPRESSION_GZIP
ARCHIVE_COMPRESSION_NONE ARCHIVE_COMPRESSION_PROGRAM
ARCHIVE_DEFAULT_BYTES_PER_BLOCK ARCHIVE_EOF
ARCHIVE_EXTRACT_ACL ARCHIVE_EXTRACT_FFLAGS
ARCHIVE_EXTRACT_NO_AUTODIR ARCHIVE_EXTRACT_NO_OVERWRITE
ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER ARCHIVE_EXTRACT_OWNER
ARCHIVE_EXTRACT_PERM ARCHIVE_EXTRACT_SECURE_NODOTDOT
ARCHIVE_EXTRACT_SECURE_SYMLINKS ARCHIVE_EXTRACT_TIME
ARCHIVE_EXTRACT_UNLINK ARCHIVE_EXTRACT_XATTR ARCHIVE_FAILED
ARCHIVE_FATAL ARCHIVE_FORMAT_AR ARCHIVE_FORMAT_AR_BSD
ARCHIVE_FORMAT_AR_GNU ARCHIVE_FORMAT_BASE_MASK
ARCHIVE_FORMAT_CPIO ARCHIVE_FORMAT_CPIO_BIN_BE
ARCHIVE_FORMAT_CPIO_BIN_LE ARCHIVE_FORMAT_CPIO_POSIX
ARCHIVE_FORMAT_CPIO_SVR4_CRC ARCHIVE_FORMAT_CPIO_SVR4_NOCRC
ARCHIVE_FORMAT_EMPTY ARCHIVE_FORMAT_ISO9660
ARCHIVE_FORMAT_ISO9660_ROCKRIDGE ARCHIVE_FORMAT_SHAR
ARCHIVE_FORMAT_SHAR_BASE ARCHIVE_FORMAT_SHAR_DUMP
ARCHIVE_FORMAT_TAR ARCHIVE_FORMAT_TAR_GNUTAR
ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE
ARCHIVE_FORMAT_TAR_PAX_RESTRICTED ARCHIVE_FORMAT_TAR_USTAR
ARCHIVE_FORMAT_ZIP ARCHIVE_OK ARCHIVE_RETRY
ARCHIVE_VERSION_STAMP ARCHIVE_WARN));
ExtUtils::Constant::WriteConstants(
NAME => 'LibArchive',
NAMES => \@names,
DEFAULT_TYPE => 'IV',
C_FILE => 'const-c.inc',
XS_FILE => 'const-xs.inc',
);

54
LibArchive/README Normal file
View File

@ -0,0 +1,54 @@
LibArchive
==========
LibArchive provides perl binding for libarchive (read interface only)
INSTALLATION
To install this module type the following:
perl Makefile.PL
make
make test
make install
DEPENDENCIES
This module requires these other modules and libraries:
libarchive version 2.2.4
COPYRIGHT AND LICENCE
Copyright (C) 2007 by Dietmar Maurer <dietmar@proxmox.com>
This library (perl bindings) is free software; you can redistribute it
and/or modify it under the same terms as Perl itself, either Perl
version 5.8.8 or, at your option, any later version of Perl 5 you may
have available.
The librachive code has the following Copyright
Copyright (c) 2003-2006 Tim Kientzle
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer
in this position and unchanged.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,358 @@
package LibArchive;
use 5.008008;
use strict;
use warnings;
use Carp;
require Exporter;
use AutoLoader;
our @ISA = qw(Exporter);
# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
# This allows declaration use LibArchive ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.
our %EXPORT_TAGS = ( 'all' => [ qw(
AE_IFBLK
AE_IFCHR
AE_IFDIR
AE_IFIFO
AE_IFLNK
AE_IFMT
AE_IFREG
ARCHIVE_API_FEATURE
ARCHIVE_API_VERSION
ARCHIVE_BYTES_PER_RECORD
ARCHIVE_COMPRESSION_BZIP2
ARCHIVE_COMPRESSION_COMPRESS
ARCHIVE_COMPRESSION_GZIP
ARCHIVE_COMPRESSION_NONE
ARCHIVE_COMPRESSION_PROGRAM
ARCHIVE_DEFAULT_BYTES_PER_BLOCK
ARCHIVE_EOF
ARCHIVE_EXTRACT_ACL
ARCHIVE_EXTRACT_FFLAGS
ARCHIVE_EXTRACT_NO_AUTODIR
ARCHIVE_EXTRACT_NO_OVERWRITE
ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER
ARCHIVE_EXTRACT_OWNER
ARCHIVE_EXTRACT_PERM
ARCHIVE_EXTRACT_SECURE_NODOTDOT
ARCHIVE_EXTRACT_SECURE_SYMLINKS
ARCHIVE_EXTRACT_TIME
ARCHIVE_EXTRACT_UNLINK
ARCHIVE_EXTRACT_XATTR
ARCHIVE_FAILED
ARCHIVE_FATAL
ARCHIVE_FORMAT_AR
ARCHIVE_FORMAT_AR_BSD
ARCHIVE_FORMAT_AR_GNU
ARCHIVE_FORMAT_BASE_MASK
ARCHIVE_FORMAT_CPIO
ARCHIVE_FORMAT_CPIO_BIN_BE
ARCHIVE_FORMAT_CPIO_BIN_LE
ARCHIVE_FORMAT_CPIO_POSIX
ARCHIVE_FORMAT_CPIO_SVR4_CRC
ARCHIVE_FORMAT_CPIO_SVR4_NOCRC
ARCHIVE_FORMAT_EMPTY
ARCHIVE_FORMAT_ISO9660
ARCHIVE_FORMAT_ISO9660_ROCKRIDGE
ARCHIVE_FORMAT_SHAR
ARCHIVE_FORMAT_SHAR_BASE
ARCHIVE_FORMAT_SHAR_DUMP
ARCHIVE_FORMAT_TAR
ARCHIVE_FORMAT_TAR_GNUTAR
ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE
ARCHIVE_FORMAT_TAR_PAX_RESTRICTED
ARCHIVE_FORMAT_TAR_USTAR
ARCHIVE_FORMAT_ZIP
ARCHIVE_OK
ARCHIVE_RETRY
ARCHIVE_VERSION_STAMP
ARCHIVE_WARN
) ] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = qw(
AE_IFBLK
AE_IFCHR
AE_IFDIR
AE_IFIFO
AE_IFLNK
AE_IFMT
AE_IFREG
ARCHIVE_API_FEATURE
ARCHIVE_API_VERSION
ARCHIVE_BYTES_PER_RECORD
ARCHIVE_COMPRESSION_BZIP2
ARCHIVE_COMPRESSION_COMPRESS
ARCHIVE_COMPRESSION_GZIP
ARCHIVE_COMPRESSION_NONE
ARCHIVE_COMPRESSION_PROGRAM
ARCHIVE_DEFAULT_BYTES_PER_BLOCK
ARCHIVE_EOF
ARCHIVE_EXTRACT_ACL
ARCHIVE_EXTRACT_FFLAGS
ARCHIVE_EXTRACT_NO_AUTODIR
ARCHIVE_EXTRACT_NO_OVERWRITE
ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER
ARCHIVE_EXTRACT_OWNER
ARCHIVE_EXTRACT_PERM
ARCHIVE_EXTRACT_SECURE_NODOTDOT
ARCHIVE_EXTRACT_SECURE_SYMLINKS
ARCHIVE_EXTRACT_TIME
ARCHIVE_EXTRACT_UNLINK
ARCHIVE_EXTRACT_XATTR
ARCHIVE_FAILED
ARCHIVE_FATAL
ARCHIVE_FORMAT_AR
ARCHIVE_FORMAT_AR_BSD
ARCHIVE_FORMAT_AR_GNU
ARCHIVE_FORMAT_BASE_MASK
ARCHIVE_FORMAT_CPIO
ARCHIVE_FORMAT_CPIO_BIN_BE
ARCHIVE_FORMAT_CPIO_BIN_LE
ARCHIVE_FORMAT_CPIO_POSIX
ARCHIVE_FORMAT_CPIO_SVR4_CRC
ARCHIVE_FORMAT_CPIO_SVR4_NOCRC
ARCHIVE_FORMAT_EMPTY
ARCHIVE_FORMAT_ISO9660
ARCHIVE_FORMAT_ISO9660_ROCKRIDGE
ARCHIVE_FORMAT_SHAR
ARCHIVE_FORMAT_SHAR_BASE
ARCHIVE_FORMAT_SHAR_DUMP
ARCHIVE_FORMAT_TAR
ARCHIVE_FORMAT_TAR_GNUTAR
ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE
ARCHIVE_FORMAT_TAR_PAX_RESTRICTED
ARCHIVE_FORMAT_TAR_USTAR
ARCHIVE_FORMAT_ZIP
ARCHIVE_OK
ARCHIVE_RETRY
ARCHIVE_VERSION_STAMP
ARCHIVE_WARN
);
our $VERSION = '2.2.4';
sub AUTOLOAD {
# This AUTOLOAD is used to 'autoload' constants from the constant()
# XS function.
my $constname;
our $AUTOLOAD;
($constname = $AUTOLOAD) =~ s/.*:://;
croak "&LibArchive::constant not defined" if $constname eq 'constant';
my ($error, $val) = constant($constname);
if ($error) { croak $error; }
{
no strict 'refs';
*$AUTOLOAD = sub { $val };
}
goto &$AUTOLOAD;
}
require XSLoader;
XSLoader::load('LibArchive', $VERSION);
# Preloaded methods go here.
# Autoload methods go after =cut, and are processed by the autosplit program.
1;
__END__
# Below is stub documentation for your module. You'd better edit it!
=head1 NAME
LibArchive - Perl extension to access libarchive functions
=head1 SYNOPSIS
use LibArchive;
=head1 DESCRIPTION
We currently support only a limited interface for reading archives.
=head2 EXPORT
None by default.
=head2 Exportable constants
AE_IFBLK
AE_IFCHR
AE_IFDIR
AE_IFIFO
AE_IFLNK
AE_IFMT
AE_IFREG
ARCHIVE_API_FEATURE
ARCHIVE_API_VERSION
ARCHIVE_BYTES_PER_RECORD
ARCHIVE_COMPRESSION_BZIP2
ARCHIVE_COMPRESSION_COMPRESS
ARCHIVE_COMPRESSION_GZIP
ARCHIVE_COMPRESSION_NONE
ARCHIVE_COMPRESSION_PROGRAM
ARCHIVE_DEFAULT_BYTES_PER_BLOCK
ARCHIVE_EOF
ARCHIVE_EXTRACT_ACL
ARCHIVE_EXTRACT_FFLAGS
ARCHIVE_EXTRACT_NO_AUTODIR
ARCHIVE_EXTRACT_NO_OVERWRITE
ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER
ARCHIVE_EXTRACT_OWNER
ARCHIVE_EXTRACT_PERM
ARCHIVE_EXTRACT_SECURE_NODOTDOT
ARCHIVE_EXTRACT_SECURE_SYMLINKS
ARCHIVE_EXTRACT_TIME
ARCHIVE_EXTRACT_UNLINK
ARCHIVE_EXTRACT_XATTR
ARCHIVE_FAILED
ARCHIVE_FATAL
ARCHIVE_FORMAT_AR
ARCHIVE_FORMAT_AR_BSD
ARCHIVE_FORMAT_AR_GNU
ARCHIVE_FORMAT_BASE_MASK
ARCHIVE_FORMAT_CPIO
ARCHIVE_FORMAT_CPIO_BIN_BE
ARCHIVE_FORMAT_CPIO_BIN_LE
ARCHIVE_FORMAT_CPIO_POSIX
ARCHIVE_FORMAT_CPIO_SVR4_CRC
ARCHIVE_FORMAT_CPIO_SVR4_NOCRC
ARCHIVE_FORMAT_EMPTY
ARCHIVE_FORMAT_ISO9660
ARCHIVE_FORMAT_ISO9660_ROCKRIDGE
ARCHIVE_FORMAT_SHAR
ARCHIVE_FORMAT_SHAR_BASE
ARCHIVE_FORMAT_SHAR_DUMP
ARCHIVE_FORMAT_TAR
ARCHIVE_FORMAT_TAR_GNUTAR
ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE
ARCHIVE_FORMAT_TAR_PAX_RESTRICTED
ARCHIVE_FORMAT_TAR_USTAR
ARCHIVE_FORMAT_ZIP
ARCHIVE_OK
ARCHIVE_RETRY
ARCHIVE_VERSION_STAMP
ARCHIVE_WARN
=head2 Exportable functions
int archive_api_feature(void)
int archive_api_version(void)
void archive_clear_error(struct archive *)
int archive_compression(struct archive *)
const char *archive_compression_name(struct archive *)
void archive_copy_error(struct archive *dest, struct archive *src)
int archive_errno(struct archive *)
const char *archive_error_string(struct archive *)
int archive_format(struct archive *)
int archive_read_close(struct archive *)
ssize_t archive_read_data(struct archive *, void *, size_t)
int archive_read_data_skip(struct archive *)
int archive_read_finish(struct archive *)
struct archive *archive_read_new(void)
int archive_read_next_header(struct archive *,
struct archive_entry **)
int archive_read_open(struct archive *, void *_client_data,
archive_open_callback *, archive_read_callback *,
archive_close_callback *)
int archive_read_open_FILE(struct archive *, FILE *_file)
int archive_read_open_fd(struct archive *, int _fd,
size_t _block_size)
int archive_read_open_file(struct archive *,
const char *_filename, size_t _block_size)
int archive_read_open_filename(struct archive *,
const char *_filename, size_t _block_size)
int archive_read_support_compression_all(struct archive *)
int archive_read_support_compression_bzip2(struct archive *)
int archive_read_support_compression_compress(struct archive *)
int archive_read_support_compression_gzip(struct archive *)
int archive_read_support_compression_none(struct archive *)
int archive_read_support_compression_program(struct archive *,
const char *command)
int archive_read_support_format_all(struct archive *)
int archive_read_support_format_ar(struct archive *)
int archive_read_support_format_cpio(struct archive *)
int archive_read_support_format_empty(struct archive *)
int archive_read_support_format_gnutar(struct archive *)
int archive_read_support_format_iso9660(struct archive *)
int archive_read_support_format_tar(struct archive *)
int archive_read_support_format_zip(struct archive *)
const char * archive_version(void)
int archive_version_stamp(void)
time_t archive_entry_atime(struct archive_entry *)
long archive_entry_atime_nsec(struct archive_entry *)
time_t archive_entry_ctime(struct archive_entry *)
long archive_entry_ctime_nsec(struct archive_entry *)
mode_t archive_entry_mode(struct archive_entry *)
const char * archive_entry_gname(struct archive_entry *)
const char * archive_entry_hardlink(struct archive_entry *)
time_t archive_entry_mtime(struct archive_entry *)
long archive_entry_mtime_nsec(struct archive_entry *)
unsigned int archive_entry_nlink(struct archive_entry *)
const char * archive_entry_pathname(struct archive_entry *)
long archive_entry_size(struct archive_entry *)
const char * archive_entry_symlink(struct archive_entry *)
const char * archive_entry_uname(struct archive_entry *)
=head1 SEE ALSO
man libarchive
=head1 AUTHOR
perl bindings: Proxmox Support Team, E<lt>support@proxmox.comE<gt>
libarchive: Tim Kientzle
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2007 by Dietmar Maurer
This library (perl bindings) is free software; you can redistribute it
and/or modify it under the same terms as Perl itself, either Perl
version 5.8.8 or, at your option, any later version of Perl 5 you may
have available.
The librachive code has the following Copyright
Copyright (c) 2003-2006 Tim Kientzle
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer
in this position and unchanged.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=cut

4954
LibArchive/ppport.h Normal file

File diff suppressed because it is too large Load Diff

49
LibArchive/t/LibArchive.t Normal file
View File

@ -0,0 +1,49 @@
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl LibArchive.t'
#########################
# change 'tests => 2' to 'tests => last_test_to_print';
use Test::More tests => 2;
BEGIN { use_ok('LibArchive') };
my $fail = 0;
foreach my $constname (qw(
ARCHIVE_API_FEATURE ARCHIVE_API_VERSION ARCHIVE_BYTES_PER_RECORD
ARCHIVE_COMPRESSION_BZIP2 ARCHIVE_COMPRESSION_COMPRESS
ARCHIVE_COMPRESSION_GZIP ARCHIVE_COMPRESSION_NONE
ARCHIVE_COMPRESSION_PROGRAM ARCHIVE_DEFAULT_BYTES_PER_BLOCK ARCHIVE_EOF
ARCHIVE_EXTRACT_ACL ARCHIVE_EXTRACT_FFLAGS ARCHIVE_EXTRACT_NO_AUTODIR
ARCHIVE_EXTRACT_NO_OVERWRITE ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER
ARCHIVE_EXTRACT_OWNER ARCHIVE_EXTRACT_PERM
ARCHIVE_EXTRACT_SECURE_NODOTDOT ARCHIVE_EXTRACT_SECURE_SYMLINKS
ARCHIVE_EXTRACT_TIME ARCHIVE_EXTRACT_UNLINK ARCHIVE_EXTRACT_XATTR
ARCHIVE_FAILED ARCHIVE_FATAL ARCHIVE_FORMAT_AR ARCHIVE_FORMAT_AR_BSD
ARCHIVE_FORMAT_AR_GNU ARCHIVE_FORMAT_BASE_MASK ARCHIVE_FORMAT_CPIO
ARCHIVE_FORMAT_CPIO_BIN_BE ARCHIVE_FORMAT_CPIO_BIN_LE
ARCHIVE_FORMAT_CPIO_POSIX ARCHIVE_FORMAT_CPIO_SVR4_CRC
ARCHIVE_FORMAT_CPIO_SVR4_NOCRC ARCHIVE_FORMAT_EMPTY
ARCHIVE_FORMAT_ISO9660 ARCHIVE_FORMAT_ISO9660_ROCKRIDGE
ARCHIVE_FORMAT_SHAR ARCHIVE_FORMAT_SHAR_BASE ARCHIVE_FORMAT_SHAR_DUMP
ARCHIVE_FORMAT_TAR ARCHIVE_FORMAT_TAR_GNUTAR
ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE ARCHIVE_FORMAT_TAR_PAX_RESTRICTED
ARCHIVE_FORMAT_TAR_USTAR ARCHIVE_FORMAT_ZIP ARCHIVE_OK ARCHIVE_RETRY
ARCHIVE_VERSION_STAMP ARCHIVE_WARN)) {
next if (eval "my \$a = $constname; 1");
if ($@ =~ /^Your vendor has not defined LibArchive macro $constname/) {
print "# pass: $@";
} else {
print "# fail: $@";
$fail = 1;
}
}
ok( $fail == 0 , 'Constants' );
#########################
# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.

328
LibArchive/typemap Normal file
View File

@ -0,0 +1,328 @@
archive_close_callback * T_PTROBJ
archive_open_callback * T_PTROBJ
archive_read_callback * T_PTROBJ
archive_skip_callback * T_PTROBJ
archive_write_callback * T_PTROBJ
const void * T_PTROBJ
const void ** T_PTROBJ
off_t T_NV
off_t * T_PTROBJ
size_t * T_OPAQUEPTR
struct archive * T_PTROBJ
struct archive_entry * T_PTROBJ
mode_t T_NV
# basic C types
int T_IV
unsigned T_UV
unsigned int T_UV
long T_IV
unsigned long T_UV
short T_IV
unsigned short T_UV
char T_CHAR
unsigned char T_U_CHAR
char * T_PV
unsigned char * T_PV
const char * T_PV
caddr_t T_PV
wchar_t * T_PV
wchar_t T_IV
# bool_t is defined in <rpc/rpc.h>
bool_t T_IV
size_t T_UV
ssize_t T_IV
time_t T_NV
unsigned long * T_OPAQUEPTR
char ** T_PACKEDARRAY
void * T_PTR
Time_t * T_PV
SV * T_SV
SVREF T_SVREF
AV * T_AVREF
HV * T_HVREF
CV * T_CVREF
IV T_IV
UV T_UV
NV T_NV
I32 T_IV
I16 T_IV
I8 T_IV
STRLEN T_UV
U32 T_U_LONG
U16 T_U_SHORT
U8 T_UV
Result T_U_CHAR
Boolean T_BOOL
float T_FLOAT
double T_DOUBLE
SysRet T_SYSRET
SysRetLong T_SYSRET
FILE * T_STDIO
PerlIO * T_INOUT
FileHandle T_PTROBJ
InputStream T_IN
InOutStream T_INOUT
OutputStream T_OUT
bool T_BOOL
#############################################################################
INPUT
T_SV
$var = $arg
T_SVREF
if (SvROK($arg))
$var = (SV*)SvRV($arg);
else
Perl_croak(aTHX_ \"$var is not a reference\")
T_AVREF
if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV)
$var = (AV*)SvRV($arg);
else
Perl_croak(aTHX_ \"$var is not an array reference\")
T_HVREF
if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVHV)
$var = (HV*)SvRV($arg);
else
Perl_croak(aTHX_ \"$var is not a hash reference\")
T_CVREF
if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVCV)
$var = (CV*)SvRV($arg);
else
Perl_croak(aTHX_ \"$var is not a code reference\")
T_SYSRET
$var NOT IMPLEMENTED
T_UV
$var = ($type)SvUV($arg)
T_IV
$var = ($type)SvIV($arg)
T_INT
$var = (int)SvIV($arg)
T_ENUM
$var = ($type)SvIV($arg)
T_BOOL
$var = (bool)SvTRUE($arg)
T_U_INT
$var = (unsigned int)SvUV($arg)
T_SHORT
$var = (short)SvIV($arg)
T_U_SHORT
$var = (unsigned short)SvUV($arg)
T_LONG
$var = (long)SvIV($arg)
T_U_LONG
$var = (unsigned long)SvUV($arg)
T_CHAR
$var = (char)*SvPV_nolen($arg)
T_U_CHAR
$var = (unsigned char)SvUV($arg)
T_FLOAT
$var = (float)SvNV($arg)
T_NV
$var = ($type)SvNV($arg)
T_DOUBLE
$var = (double)SvNV($arg)
T_PV
$var = ($type)SvPV_nolen($arg)
T_PTR
$var = INT2PTR($type,SvIV($arg))
T_PTRREF
if (SvROK($arg)) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = INT2PTR($type,tmp);
}
else
Perl_croak(aTHX_ \"$var is not a reference\")
T_REF_IV_REF
if (sv_isa($arg, \"${ntype}\")) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = *INT2PTR($type *, tmp);
}
else
Perl_croak(aTHX_ \"$var is not of type ${ntype}\")
T_REF_IV_PTR
if (sv_isa($arg, \"${ntype}\")) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = INT2PTR($type, tmp);
}
else
Perl_croak(aTHX_ \"$var is not of type ${ntype}\")
T_PTROBJ
if (sv_derived_from($arg, \"${ntype}\")) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = INT2PTR($type,tmp);
}
else
Perl_croak(aTHX_ \"$var is not of type ${ntype}\")
T_PTRDESC
if (sv_isa($arg, \"${ntype}\")) {
IV tmp = SvIV((SV*)SvRV($arg));
${type}_desc = (\U${type}_DESC\E*) tmp;
$var = ${type}_desc->ptr;
}
else
Perl_croak(aTHX_ \"$var is not of type ${ntype}\")
T_REFREF
if (SvROK($arg)) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = *INT2PTR($type,tmp);
}
else
Perl_croak(aTHX_ \"$var is not a reference\")
T_REFOBJ
if (sv_isa($arg, \"${ntype}\")) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = *INT2PTR($type,tmp);
}
else
Perl_croak(aTHX_ \"$var is not of type ${ntype}\")
T_OPAQUE
$var = *($type *)SvPV_nolen($arg)
T_OPAQUEPTR
$var = ($type)SvPV_nolen($arg)
T_PACKED
$var = XS_unpack_$ntype($arg)
T_PACKEDARRAY
$var = XS_unpack_$ntype($arg)
T_CALLBACK
$var = make_perl_cb_$type($arg)
T_ARRAY
U32 ix_$var = $argoff;
$var = $ntype(items -= $argoff);
while (items--) {
DO_ARRAY_ELEM;
ix_$var++;
}
/* this is the number of elements in the array */
ix_$var -= $argoff
T_STDIO
$var = PerlIO_findFILE(IoIFP(sv_2io($arg)))
T_IN
$var = IoIFP(sv_2io($arg))
T_INOUT
$var = IoIFP(sv_2io($arg))
T_OUT
$var = IoOFP(sv_2io($arg))
#############################################################################
OUTPUT
T_SV
$arg = $var;
T_SVREF
$arg = newRV((SV*)$var);
T_AVREF
$arg = newRV((SV*)$var);
T_HVREF
$arg = newRV((SV*)$var);
T_CVREF
$arg = newRV((SV*)$var);
T_IV
sv_setiv($arg, (IV)$var);
T_UV
sv_setuv($arg, (UV)$var);
T_INT
sv_setiv($arg, (IV)$var);
T_SYSRET
if ($var != -1) {
if ($var == 0)
sv_setpvn($arg, "0 but true", 10);
else
sv_setiv($arg, (IV)$var);
}
T_ENUM
sv_setiv($arg, (IV)$var);
T_BOOL
$arg = boolSV($var);
T_U_INT
sv_setuv($arg, (UV)$var);
T_SHORT
sv_setiv($arg, (IV)$var);
T_U_SHORT
sv_setuv($arg, (UV)$var);
T_LONG
sv_setiv($arg, (IV)$var);
T_U_LONG
sv_setuv($arg, (UV)$var);
T_CHAR
sv_setpvn($arg, (char *)&$var, 1);
T_U_CHAR
sv_setuv($arg, (UV)$var);
T_FLOAT
sv_setnv($arg, (double)$var);
T_NV
sv_setnv($arg, (NV)$var);
T_DOUBLE
sv_setnv($arg, (double)$var);
T_PV
sv_setpv((SV*)$arg, $var);
T_PTR
sv_setiv($arg, PTR2IV($var));
T_PTRREF
sv_setref_pv($arg, Nullch, (void*)$var);
T_REF_IV_REF
sv_setref_pv($arg, \"${ntype}\", (void*)new $ntype($var));
T_REF_IV_PTR
sv_setref_pv($arg, \"${ntype}\", (void*)$var);
T_PTROBJ
sv_setref_pv($arg, \"${ntype}\", (void*)$var);
T_PTRDESC
sv_setref_pv($arg, \"${ntype}\", (void*)new\U${type}_DESC\E($var));
T_REFREF
NOT_IMPLEMENTED
T_REFOBJ
NOT IMPLEMENTED
T_OPAQUE
sv_setpvn($arg, (char *)&$var, sizeof($var));
T_OPAQUEPTR
sv_setpvn($arg, (char *)$var, sizeof(*$var));
T_PACKED
XS_pack_$ntype($arg, $var);
T_PACKEDARRAY
XS_pack_$ntype($arg, $var, count_$ntype);
T_DATAUNIT
sv_setpvn($arg, $var.chp(), $var.size());
T_CALLBACK
sv_setpvn($arg, $var.context.value().chp(),
$var.context.value().size());
T_ARRAY
{
U32 ix_$var;
EXTEND(SP,size_$var);
for (ix_$var = 0; ix_$var < size_$var; ix_$var++) {
ST(ix_$var) = sv_newmortal();
DO_ARRAY_ELEM
}
}
T_STDIO
{
GV *gv = newGVgen("$Package");
PerlIO *fp = PerlIO_importFILE($var,0);
if ( fp && do_open(gv, "+<&", 3, FALSE, 0, 0, fp) )
sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1)));
else
$arg = &PL_sv_undef;
}
T_IN
{
GV *gv = newGVgen("$Package");
if ( do_open(gv, "<&", 2, FALSE, 0, 0, $var) )
sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1)));
else
$arg = &PL_sv_undef;
}
T_INOUT
{
GV *gv = newGVgen("$Package");
if ( do_open(gv, "+<&", 3, FALSE, 0, 0, $var) )
sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1)));
else
$arg = &PL_sv_undef;
}
T_OUT
{
GV *gv = newGVgen("$Package");
if ( do_open(gv, "+>&", 3, FALSE, 0, 0, $var) )
sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1)));
else
$arg = &PL_sv_undef;
}

38
Makefile Normal file
View File

@ -0,0 +1,38 @@
RELEASE=3.0
# h2xs -Afn LibArchive
# h2xs -an LibArchive /usr/include/archive.h /usr/include/archive_entry.h
# perl Makefile.PL PREFIX=/usr
#OPKGNAME = libarchive-2.2.4
#DEB = libarchive1_2.2.4-1_i386.deb
#DEVDEB = libarchive-dev_2.2.4-1_i386.deb
PPSRC = LibArchive
PDEB = libarchive-perl_2.8.4-1_amd64.deb
all: ${PDEB}
${PDEB}: ${PPSRC}/LibArchive.xs
-rm -rf build
rsync -a --exclude .svn ${PPSRC}/ build/
cp -a debian build
cd build; dpkg-buildpackage -b -us -uc -rfakeroot
lintian ${PDEB}
.phony: upload
upload: ${PDEB}
umount /proxmox/${RELEASE}; mount /proxmox/${RELEASE} -o rw
mkdir -p /proxmox/${RELEASE}/extra
rm -rf /proxmox/${RELEASE}/extra/libarchive1_*.deb
rm -rf /proxmox/${RELEASE}/extra/libarchive-dev_*.deb
rm -rf /proxmox/${RELEASE}/extra/libarchive-perl_*.deb
cp ${PDEB} /proxmox/${RELEASE}/extra
cd /proxmox/${RELEASE}/extra; dpkg-scanpackages . /dev/null > Packages; gzip -9c Packages > Packages.gz
umount /proxmox/${RELEASE}; mount /proxmox/${RELEASE} -o ro
CLEANFILES = *~ build *.deb libarchive_* ${OPKGNAME} libarchive-perl_*
.phony: clean
clean:
rm -rf ${CLEANFILES}

12
debian/changelog vendored Normal file
View File

@ -0,0 +1,12 @@
libarchive-perl (2.8.4-1) unstable; urgency=low
* update for debian squeeze amd64
-- Proxmox Support Team <support@proxmox.com> Thu, 31 May 2012 11:02:51 +0200
libarchive-perl (2.2.4-1) stable; urgency=low
* Initial Release.
-- Proxmox Support Team <support@proxmox.com> Wed, 11 Jul 2007 12:52:19 +0200

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
5

13
debian/control vendored Normal file
View File

@ -0,0 +1,13 @@
Source: libarchive-perl
Section: perl
Priority: optional
Build-Depends: debhelper (>= 5.0.0), perl (>= 5.8.8-7), libarchive-dev
Description: Perl extension to access libarchive functions
Maintainer: Proxmox Support Team <support@proxmox.com>
Standards-Version: 3.7.2
Package: libarchive-perl
Architecture: any
Depends: ${perl:Depends}, ${shlibs:Depends}, ${misc:Depends}, libarchive1
Description: Perl extension to access libarchive functions
This module provides access to various archive formats using libarchive.

35
debian/copyright vendored Normal file
View File

@ -0,0 +1,35 @@
LICENSE AND WARRANTY
This library (perl bindings) is free software; you can redistribute it
and/or modify it under the same terms as Perl itself, either Perl
version 5.8.8 or, at your option, any later version of Perl 5 you may
have available.
A copy of the license can be found at /usr/share/common-licenses/Artistic
The libachive code has the following Copyright
Copyright (c) 2003-2006 Tim Kientzle
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer
in this position and unchanged.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

92
debian/rules vendored Executable file
View File

@ -0,0 +1,92 @@
#!/usr/bin/make -f
# This debian/rules file is provided as a template for normal perl
# packages. It was created by Marc Brockschmidt <marc@dch-faq.de> for
# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
# be used freely wherever it is useful.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# If set to a true value then MakeMaker's prompt function will
# always return the default without waiting for user input.
export PERL_MM_USE_DEFAULT=1
PACKAGE=$(shell dh_listpackages)
ifndef PERL
PERL = /usr/bin/perl
endif
TMP =$(CURDIR)/debian/$(PACKAGE)
# Allow disabling build optimation by setting noopt in
# $DEB_BUILD_OPTIONS
CFLAGS = -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
build: build-stamp
build-stamp:
dh_testdir
# Add commands to compile the package here
$(PERL) Makefile.PL INSTALLDIRS=vendor
$(MAKE) OPTIMIZE="$(CFLAGS)" LD_RUN_PATH=""
touch build-stamp
clean:
dh_testdir
dh_testroot
# Add commands to clean up after the build process here
[ ! -f Makefile ] || $(MAKE) realclean
dh_clean build-stamp install-stamp
install: build install-stamp
install-stamp:
dh_testdir
dh_testroot
dh_clean -k
# Add commands to install the package into debian/$PACKAGE_NAME here
$(MAKE) test
$(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
touch install-stamp
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
dh_installdocs README
dh_installexamples
# dh_installmenu
# dh_installcron
# dh_installman
dh_installchangelogs Changes
dh_link
dh_strip
dh_compress
dh_fixperms
dh_makeshlibs
dh_installdeb
dh_perl
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
source diff:
@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary