view release on metacpan or search on metacpan
lib/Alien/Packages/Base.pm view on Meta::CPAN
192021222324252627282930313233343536373839404142=head2 new
Instantiates new object, no attributes evaluated.
=cut
sub
_run_ipc_cmd
{
$_
[0]->isa(
'Alien::Packages::Base'
) and
shift
;
my
(
$success
,
$error_code
,
$full_buf
,
$stdout_buf
,
$stderr_buf
) = IPC::Cmd::run(
@_
);
$stdout_buf
= [
join
(
""
,
@$stdout_buf
) ];
$stderr_buf
= [
join
(
""
,
@$stderr_buf
) ];
return
(
$success
,
$error_code
,
$full_buf
,
$stdout_buf
,
$stderr_buf
);
}
sub
new
{
my
$class
=
$_
[0];
my
$self
=
bless
( {},
$class
);
return
$self
;
}
=head2 pkgtype
lib/Alien/Packages/Dpkg.pm view on Meta::CPAN
505152535455565758596061626364656667686970Returns the list of installed I<dpkg> packages.
=cut
sub list_packages
{
my $self = $_[0];
my @packages;
my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
$self->_run_ipc_cmd(
command => [ $dpkg_query, '-W', q(-f=${Package}:${Version}:${Description}\n) ],
verbose => 0, );
if ($success)
{
chomp $stdout_buf->[0];
my @pkglist = split( /\n/, $stdout_buf->[0] );
my %pkg_details;
foreach my $pkg (@pkglist)
lib/Alien/Packages/Dpkg.pm view on Meta::CPAN
9293949596979899100101102103104105106107108109110111112=cut
sub list_fileowners
{
my ( $self, @files ) = @_;
my %file_owners;
foreach my $file (@files)
{
my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
$self->_run_ipc_cmd( command => [ $dpkg_query, '-S', $file ],
verbose => 0, );
if ($success)
{
chomp $stdout_buf->[0];
my @pkglist = split( /\n/, $stdout_buf->[0] );
foreach my $pkg (@pkglist)
{
if ( my ( $pkg_names, $fn ) = $pkg =~ m/^([^:]+):\s+([^\s].*)$/ )
lib/Alien/Packages/LsLpp.pm view on Meta::CPAN
616263646566676869707172737475767778798081Get's the list of installed filesets.
=cut
sub list_packages
{
my $self = $_[0];
my @packages;
my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
$self->_run_ipc_cmd( command => [ $lslpp, '-lc' ],
verbose => 0, );
if ($success)
{
chomp $stdout_buf->[0];
my @pkglist = split( /\n/, $stdout_buf->[0] );
foreach my $pkg (@pkglist)
{
next if ( $pkg =~ m/^#/ );
lib/Alien/Packages/LsLpp.pm view on Meta::CPAN
979899100101102103104105106107108109110111112113114115116117=cut
sub list_fileowners
{
my ( $self, @files ) = @_;
my %file_owners;
foreach my $file (@files)
{
my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
$self->_run_ipc_cmd( command => [ $lslpp, '-wc', $file ],
verbose => 0, );
if ($success)
{
chomp $stdout_buf->[0];
my @output = split( /\n/, $stdout_buf->[0] );
foreach my $line (@output)
{
next if ( $line =~ m/^#/ );
lib/Alien/Packages/PkgInfo.pm view on Meta::CPAN
585960616263646566676869707172737475767778Returns the list of installed packages.
=cut
sub list_packages
{
my $self = $_[0];
my @packages;
my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
$self->_run_ipc_cmd( command => [ $pkginfo, '-x' ],
verbose => 0, );
if ($success)
{
while ( $stdout_buf->[0] =~ m/(\w+)\s+([^\s].*)\s+(\(\w+\))\s(\d[\d.]+,REV=[^\s]+)/gx )
{
push(
@packages,
{
lib/Alien/Packages/PkgInfo.pm view on Meta::CPAN
102103104105106107108109110111112113114115116117118119120121122
File::Spec->catfile( File::Spec->tmpdir(),
join
(
"_"
,
qw(alias pkg list fileowner)
, $$ ) );
foreach
my
$file
(
@files
)
{
my
$fh
;
open
(
$fh
,
">"
,
$tmpfile
) or
die
"Can't open $tmpfile: $!"
;
$fh
"$file\n"
;
close
(
$fh
) or
die
"Can't close $tmpfile: $!"
;
# that seems to fail on OpenSolaris - Solaris 10u8 on sparc64 succeeds
my
(
$success
,
$error_code
,
$full_buf
,
$stdout_buf
,
$stderr_buf
) =
$self
->_run_ipc_cmd(
command
=> [
$pkgchk
,
'-i'
,
$tmpfile
,
'-l'
],
verbose
=> 0, );
if
(
$success
)
{
while
(
$stdout_buf
->[0] =~
m/Pathname:\s*(.*?)\n.
*Referenced
\sby\sthe\sfollowing\spackages:\s+([A-Za-z0-9]+)/xsg
)
{
push
( @{
$file_owners
{$1} }, {
Package
=> $2 } );
lib/Alien/Packages/Pkg_Info/pkgsrc.pm view on Meta::CPAN
474849505152535455565758596061626364656667
@pkg_info
= File::Which::where(
'pkg_info'
);
};
if
($@)
{
@pkg_info
=
grep
{
$_
} ( IPC::Cmd::can_run(
'pkg_info'
) );
}
foreach
my
$piexe
(
@pkg_info
)
{
my
(
$success
,
$error_code
,
$full_buf
,
$stdout_buf
,
$stderr_buf
) =
IPC::Cmd::run(
command
=> [
$piexe
,
'-V'
],
verbose
=> 0, );
my
$pkgsrc
=
$success
&& @{
$stdout_buf
} &&
$stdout_buf
->[0] =~ m/^\d{4}\d{2}\d{2}$/;
$pkgsrc
and
$pkg_info
=
$piexe
and
last
;
}
defined
(
$pkg_info
) or
$pkg_info
=
''
;
}
return
$pkg_info
;
lib/Alien/Packages/Pkg_Info/pkgsrc.pm view on Meta::CPAN
717273747576777879808182838485868788899091Returns the list of installed I<pkgsrc> packages.
=cut
sub list_packages
{
my $self = $_[0];
my @packages;
my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
$self->_run_ipc_cmd( command => [$pkg_info],
verbose => 0, );
if ($success)
{
my @pkglist = split( /\n/, $stdout_buf->[0] );
foreach my $pkg (@pkglist)
{
my @pkg_details = split( ' ', $pkg, 2 );
if ( $pkg_details[0] =~ m/^(.*)-([^-]*)$/ )
lib/Alien/Packages/Pkg_Info/pkgsrc.pm view on Meta::CPAN
111112113114115116117118119120121122123124125126127128129130131=cut
sub list_fileowners
{
my ( $self, @files ) = @_;
my %file_owners;
foreach my $file (@files)
{
my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
$self->_run_ipc_cmd( command => [ $pkg_info, '-Fe', $file ],
verbose => 0, );
if ($success)
{
chomp $stdout_buf->[0];
if ( $stdout_buf->[0] =~ m/^(.*)-([^-]*)$/ )
{
push( @{ $file_owners{$file} }, { Package => $1 } );
}
lib/Alien/Packages/Pkg_Info/ports.pm view on Meta::CPAN
474849505152535455565758596061626364656667
@pkg_info
= File::Which::where(
'pkg_info'
);
};
if
($@)
{
@pkg_info
=
grep
{
$_
} ( IPC::Cmd::can_run(
'pkg_info'
) );
}
foreach
my
$piexe
(
@pkg_info
)
{
my
(
$success
,
$error_code
,
$full_buf
,
$stdout_buf
,
$stderr_buf
) =
IPC::Cmd::run(
command
=> [
$piexe
,
'-qP'
],
verbose
=> 0, );
my
$ports
=
$success
&& @{
$stdout_buf
} &&
$stdout_buf
->[0] =~ m/^\d{4}\d{2}\d{2}$/;
$ports
and
$pkg_info
=
$piexe
and
last
;
}
defined
(
$pkg_info
) or
$pkg_info
=
''
;
}
return
$pkg_info
;
lib/Alien/Packages/Pkg_Info/ports.pm view on Meta::CPAN
717273747576777879808182838485868788899091Returns the list of installed FreeBSD ports.
=cut
sub list_packages
{
my $self = $_[0];
my @packages;
my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
$self->_run_ipc_cmd( command => [$pkg_info],
verbose => 0, );
if ($success)
{
my @pkglist = split( /\n/, $stdout_buf->[0] );
foreach my $pkg (@pkglist)
{
my @pkg_details = split( ' ', $pkg, 2 );
if ( $pkg_details[0] =~ m/^(.*)-([^-]*)$/ )
lib/Alien/Packages/Pkg_Info/ports.pm view on Meta::CPAN
111112113114115116117118119120121122123124125126127128129130131=cut
sub list_fileowners
{
my ( $self, @files ) = @_;
my %file_owners;
foreach my $file (@files)
{
my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
$self->_run_ipc_cmd( command => [ $pkg_info, '-q', '-W', $file ],
verbose => 0, );
if ($success)
{
chomp $stdout_buf->[0];
if ( $stdout_buf->[0] =~ m/^(.*)-([^-]*)$/ )
{
push( @{ $file_owners{$file} }, { Package => $1 } );
}
lib/Alien/Packages/Rpm.pm view on Meta::CPAN
616263646566676869707172737475767778798081Returns the list of installed I<rpm> packages.
=cut
sub list_packages
{
my $self = $_[0];
my @packages;
my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
$self->_run_ipc_cmd(
command => [ $rpm, '-qa', '--queryformat', '"%{NAME}:%{VERSION}:%{RELEASE}:%{SUMMARY}\n"' ],
verbose => 0, );
if ($success)
{
my @pkglist = split( /\n/, $stdout_buf->[0] );
foreach my $pkg (@pkglist)
{
next if ( $pkg =~ m/^#/ );
lib/Alien/Packages/Rpm.pm view on Meta::CPAN
101102103104105106107108109110111112113114115116117118119120=cut
sub list_fileowners
{
my ( $self, @files ) = @_;
my %file_owners;
foreach my $file (@files)
{
my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = $self->_run_ipc_cmd(
command => [ $rpm, '-qf', $file ], # XXX received with or without versions
verbose => 0, );
if ($success)
{
chomp $stdout_buf->[0];
push( @{ $file_owners{$file} }, { Package => $stdout_buf->[0] } );
}
}