Commit 5007209c authored by Jonas Smedegaard's avatar Jonas Smedegaard
Browse files

simplify and rename DistroRelase method get_packages() -> get_package()

parent b7c5a550
......@@ -155,24 +155,11 @@ sub update_sources ($self)
return 1;
}
sub get_packages ( $self, @pkg_names )
sub get_package ( $self, $pkg_name )
{
$self->update_sources;
return values %{ $self->{packages} }
if ( !@pkg_names );
return ( $self->{packages}{ $pkg_names[0] } // () )
if ( @pkg_names < 2 );
@_ = ();
my $filter = { map { $_ => undef } @pkg_names };
for ( values %{ $self->{packages} } ) {
if ( exists $filter->{ $_->name } ) {
push @_, $_;
}
}
return @_;
return $self->{packages}{$pkg_name};
}
sub get_package_release_versions ( $self, $pkg_name )
......@@ -223,7 +210,7 @@ sub add_package_release ( $self, %args )
# TODO: try inheritance recursively (or reintroduce global pool?)
for ( $self->origins ) {
$pkg = $_->get_packages($pkg_name);
$pkg = $_->get_package($pkg_name);
last;
}
$pkg //= App::DistroDelta::Package->new( name => $pkg_name );
......
......@@ -240,7 +240,11 @@ sub as_html ( $self )
my ( @pkgs, @pkgs_content );
for my $pkgname ( sort map { /$RE_pkg/ && $1 } @{ $reasons{$_} } )
{
my ($pkg) = map { $_->get_packages($pkgname) } @releases;
my $pkg;
for (@releases) {
$pkg = $_->get_package($pkgname)
and last;
}
push @pkgs, $pkg;
push @pkgs_content,
$self->template_processor->render(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment