mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
Add ability to show reverse dependencies
This commit is contained in:
@@ -67,6 +67,14 @@ sub package_info
|
||||
}
|
||||
}
|
||||
|
||||
# virtual_package_info(package)
|
||||
# Returns an array of package information for a virtual package, usually called
|
||||
# if "package_info" returns nothing.
|
||||
sub virtual_package_info
|
||||
{
|
||||
return ( );
|
||||
}
|
||||
|
||||
# is_package(file)
|
||||
# Tests if some file is a valid package file
|
||||
sub is_package
|
||||
|
||||
@@ -80,6 +80,14 @@ close(RPM);
|
||||
return ($tmp[0], $tmp[1], $d, $tmp[2], $tmp[3], $tmp[4], &make_date($tmp[5]));
|
||||
}
|
||||
|
||||
# virtual_package_info(package)
|
||||
# Returns an array of package information for a virtual package, usually called
|
||||
# if "package_info" returns nothing.
|
||||
sub virtual_package_info
|
||||
{
|
||||
return ( );
|
||||
}
|
||||
|
||||
# is_package(file)
|
||||
# Check if some file is a package file
|
||||
sub is_package
|
||||
|
||||
@@ -87,6 +87,41 @@ push(@rv, $text{'debian_unknown'});
|
||||
return @rv;
|
||||
}
|
||||
|
||||
# virtual_package_info(package)
|
||||
# Returns an array of package information for a virtual package, usually called
|
||||
# if "package_info" returns nothing.
|
||||
sub virtual_package_info
|
||||
{
|
||||
my ($pkg) = @_;
|
||||
my $qpkg = quotemeta($pkg);
|
||||
my $apt_cache_cmd = &has_command("apt-cache");
|
||||
return ( ) if (!$apt_cache_cmd);
|
||||
my $out = &backquote_command("$apt_cache_cmd showpkg $qpkg 2>&1", 1);
|
||||
|
||||
# Get the package that provides this virtual package
|
||||
my ($vpkg);
|
||||
if ($out =~ /Reverse Provides:\s*(\S+\s+\S+)/) {
|
||||
my ($rpkg, $rver) = split(/\s+/, $1, 2);
|
||||
$vpkg = $rpkg;
|
||||
$qvpkg = quotemeta($vpkg)."=".quotemeta($rver);
|
||||
}
|
||||
return ( ) if (!$vpkg);
|
||||
|
||||
# Get full status
|
||||
$out = &backquote_command("$apt_cache_cmd show $qvpkg 2>&1", 1);
|
||||
$out =~ s/[\0-\177]*\r?\n\r?\n(Package:)/\\1/; # remove available ver
|
||||
return () if ($? || $out =~ /Package .* is not available/i);
|
||||
local @rv = ( $vpkg, &alphabet_name($vpkg) );
|
||||
push(@rv, $out =~ /Description(-en)?:\s+((.*\n)(\s+.*\n)*)/i ? $2
|
||||
: $text{'debian_unknown'});
|
||||
push(@rv, $out =~ /Architecture:\s+(\S+)/i ? $1 : $text{'debian_unknown'});
|
||||
push(@rv, $out =~ /Version:\s+(\S+)/i ? $1 : $text{'debian_unknown'});
|
||||
push(@rv, $out =~ /Maintainer:\s+(.*)/i ? &html_escape($1)
|
||||
: $text{'debian_unknown'});
|
||||
push(@rv, $text{'debian_unknown'});
|
||||
return @rv;
|
||||
}
|
||||
|
||||
# check_files(package)
|
||||
# Fills in the %files array with information about the files belonging
|
||||
# to some package. Values in %files are path type user group mode size error
|
||||
|
||||
@@ -98,6 +98,14 @@ return ( $packages{0,'name'}, $packages{0,'class'}, $packages{0,'desc'},
|
||||
$system_arch, $packages{0,'version'}, "Gentoo", &make_date($st[9]) );
|
||||
}
|
||||
|
||||
# virtual_package_info(package)
|
||||
# Returns an array of package information for a virtual package, usually called
|
||||
# if "package_info" returns nothing.
|
||||
sub virtual_package_info
|
||||
{
|
||||
return ( );
|
||||
}
|
||||
|
||||
# is_package(file)
|
||||
# Check if some file is a package file
|
||||
sub is_package
|
||||
|
||||
@@ -73,6 +73,14 @@ push(@rv, @st ? ctime($st[9]) : $text{'bsd_unknown'});
|
||||
return @rv;
|
||||
}
|
||||
|
||||
# virtual_package_info(package)
|
||||
# Returns an array of package information for a virtual package, usually called
|
||||
# if "package_info" returns nothing.
|
||||
sub virtual_package_info
|
||||
{
|
||||
return ( );
|
||||
}
|
||||
|
||||
# check_files(package, version)
|
||||
# Fills in the %files array with information about the files belonging
|
||||
# to some package. Values in %files are path type user group mode size error
|
||||
|
||||
@@ -92,6 +92,14 @@ close(SW);
|
||||
return ($name, $class, $desc, $arch, $version, $vendor, $date);
|
||||
}
|
||||
|
||||
# virtual_package_info(package)
|
||||
# Returns an array of package information for a virtual package, usually called
|
||||
# if "package_info" returns nothing.
|
||||
sub virtual_package_info
|
||||
{
|
||||
return ( );
|
||||
}
|
||||
|
||||
# is_package(file)
|
||||
# Check if some file is a package file
|
||||
sub is_package
|
||||
|
||||
@@ -113,6 +113,14 @@ push(@rv, $packages{$pos, 'install'} ? "" : false);
|
||||
return @rv;
|
||||
}
|
||||
|
||||
# virtual_package_info(package)
|
||||
# Returns an array of package information for a virtual package, usually called
|
||||
# if "package_info" returns nothing.
|
||||
sub virtual_package_info
|
||||
{
|
||||
return ( );
|
||||
}
|
||||
|
||||
# check_files(package)
|
||||
# Fills in the %files array with information about the files belonging
|
||||
# to some package. Values in %files are path type user group mode size error
|
||||
|
||||
@@ -175,6 +175,14 @@ else {
|
||||
}
|
||||
}
|
||||
|
||||
# virtual_package_info(package)
|
||||
# Returns an array of package information for a virtual package, usually called
|
||||
# if "package_info" returns nothing.
|
||||
sub virtual_package_info
|
||||
{
|
||||
return ( );
|
||||
}
|
||||
|
||||
# is_package(file)
|
||||
# Check if some file is a package file
|
||||
sub is_package
|
||||
|
||||
@@ -49,6 +49,14 @@ push(@rv, @st ? ctime($st[9]) : $text{'bsd_unknown'});
|
||||
return @rv;
|
||||
}
|
||||
|
||||
# virtual_package_info(package)
|
||||
# Returns an array of package information for a virtual package, usually called
|
||||
# if "package_info" returns nothing.
|
||||
sub virtual_package_info
|
||||
{
|
||||
return ( );
|
||||
}
|
||||
|
||||
# check_files(package)
|
||||
# Fills in the %files array with information about the files belonging
|
||||
# to some package. Values in %files are path type user group mode size error
|
||||
|
||||
@@ -71,6 +71,14 @@ push(@rv, $out =~ /INSTDATE:\s+(.*)\n/ ? $1 : $text{'pkgadd_unknown'});
|
||||
return @rv;
|
||||
}
|
||||
|
||||
# virtual_package_info(package)
|
||||
# Returns an array of package information for a virtual package, usually called
|
||||
# if "package_info" returns nothing.
|
||||
sub virtual_package_info
|
||||
{
|
||||
return ( );
|
||||
}
|
||||
|
||||
# is_package(file)
|
||||
# Tests if some file is a valid package file
|
||||
sub is_package
|
||||
|
||||
@@ -78,6 +78,14 @@ return ($packages{0,'name'}, $packages{0,'class'}, $packages{0,'desc'},
|
||||
$packages{0,'arch'}, $packages{0,'version'}, undef, undef);
|
||||
}
|
||||
|
||||
# virtual_package_info(package)
|
||||
# Returns an array of package information for a virtual package, usually called
|
||||
# if "package_info" returns nothing.
|
||||
sub virtual_package_info
|
||||
{
|
||||
return ( );
|
||||
}
|
||||
|
||||
# is_package(file)
|
||||
# Always returns 0, because pkgsrc doesn't support installing from files
|
||||
sub is_package
|
||||
|
||||
@@ -58,6 +58,29 @@ close(RPM);
|
||||
return ($tmp[0], $tmp[1], $d, $tmp[2], $tmp[3], $tmp[4], &make_date($tmp[5]));
|
||||
}
|
||||
|
||||
# virtual_package_info(package)
|
||||
# Returns an array of package information for a virtual package, usually called
|
||||
# if "package_info" returns nothing.
|
||||
sub virtual_package_info
|
||||
{
|
||||
my ($vpkg) = @_;
|
||||
my $query_format =
|
||||
'%{NAME}\n%{GROUP}\n%{ARCH}\n%{VERSION}-%{RELEASE}\n%{VENDOR}\n'.
|
||||
'%{INSTALLTIME}\n%{DESCRIPTION}';
|
||||
|
||||
&open_execute_command(*RPM, "rpm -q --whatprovides $vpkg --queryformat ".
|
||||
"\"$query_format\" 2>/dev/null", 1, 1);
|
||||
my @tmp = <RPM>;
|
||||
close(RPM);
|
||||
|
||||
return () if (!@tmp || $tmp[0] =~ /no\s+package\s+provides/);
|
||||
|
||||
# Extract fields properly
|
||||
my @fields = splice(@tmp, 0, 6);
|
||||
chomp(@fields);
|
||||
return (@fields[0, 1], join('', @tmp), @fields[2, 3, 4], &make_date($fields[5]));
|
||||
}
|
||||
|
||||
# is_package(file)
|
||||
# Check if some file is a package file
|
||||
sub is_package
|
||||
|
||||
@@ -94,6 +94,14 @@ close(PKG);
|
||||
return @rv;
|
||||
}
|
||||
|
||||
# virtual_package_info(package)
|
||||
# Returns an array of package information for a virtual package, usually called
|
||||
# if "package_info" returns nothing.
|
||||
sub virtual_package_info
|
||||
{
|
||||
return ( );
|
||||
}
|
||||
|
||||
# check_files(package)
|
||||
# Fills in the %files array with information about the files belonging
|
||||
# to some package. Values in %files are path type user group mode size error
|
||||
|
||||
Reference in New Issue
Block a user