Gentoo::Overlay - Tools for working with Gentoo Overlays
version 2.001002
my $overlay = Gentoo::Overlay->new( path => '/usr/portage' ); my $name = $overlay->name(); my %categories = $overlay->categories(); print "Overlay $name 's categories:\n"; for( sort keys %categories ){ printf "%30s : %s", $_, $categories{$_}; } # Overlay gentoo 's categories: # ..... # dev-lang : /usr/portage/dev-lang # .....
There will be more features eventually, this is just a first release.
Useful function to easily wrap the class-wide method with a per-object sugar.
$overlay->default_path('profiles'); -> ::Overlay->_default_paths->{'profiles'}->($overlay); -> $overlay->path->subdir('profiles') $overlay->default_path('category','foo'); -> ::Overlay->_default_path('category')->( $overlay, 'foo' ); -> $overlay->path->subdir('foo') $overlay->default_path('repo_name'); -> ::Overlay->_default_path('repo_name')->( $overlay ); -> $overlay->_profile_dir->file('repo_name')
They're class wide functions, but they need individual instances to work.
$overlay->iterate( $what, sub { my ( $context_information ) = shift; } );
The iterate method provides a handy way to do walking across the whole tree stopping at each of a given type.
$what = 'categories'
$overlay->iterate( categories => sub { my ( $self, $c ) = shift; # $c->{category_name} # String # $c->{category} # Category Object # $c->{num_categories} # How many categories are there to iterate # $c->{last_category} # Index ID of the last category. # $c->{category_num} # Index ID of the current category. } );
$what = 'packages'
$overlay->iterate( packages => sub { my ( $self, $c ) = shift; # $c->{category_name} # String # $c->{category} # Category Object # $c->{num_categories} # How many categories are there to iterate # $c->{last_category} # Index ID of the last category. # $c->{category_num} # Index ID of the current category. # # $c->{package_name} # String # See ::Category for the rest of the fields provided by the package Iterator. # Very similar though. } );
$what = 'ebuilds'
$overlay->iterate( ebuilds => sub { my ( $self, $c ) = shift; # $c->{category_name} # String # $c->{category} # Category Object # $c->{num_categories} # How many categories are there to iterate # $c->{last_category} # Index ID of the last category. # $c->{category_num} # Index ID of the current category. # # $c->{package_name} # String # See ::Category for the rest of the fields provided by the package Iterator. # Very similar though. # # $c->{ebuild_name} # String # See ::Package for the rest of the fields provided by the ebuild Iterator. # Very similar though. } );
Path to repository.
isa => File, ro, required, coerce
"File" in Types::Path::Tiny
Repository name.
isa => Gentoo__Overlay_RepositoryName, ro, lazy_build
RepositoryName
"_build_name"
Returns a list of the names of all the categories.
my @list = sort $overlay->category_names();
"_categories"
Returns a hash of Category objects.
Category
my %hash = $overlay->categories; print $hash{dev-perl}->pretty_name; # dev-perl/::gentoo
Returns a Category Object for a given category name
my $cat = $overlay->get_category('dev-perl');
Path to the profile sub-directory.
isa => Dir, ro, lazy_build
"Dir" in MooseX::Types::Path::Tiny
"_build__profile_dir"
The auto-generating category hash backing
isa => HashRef[ Gentoo__Overlay_Category ], ro, lazy_build
"_build__categories"
"_has_category"
"category_names"
"categories"
"get_category"
"Gentoo__Overlay_Category" in Gentoo::Overlay::Types
MooseX::Types::Moose
Returns if a named category exists
$overlay->_has_category("dev-perl");
Class-wide list of path generators.
isa => HashRef[ CodeRef ], ro, lazy_build
"_build__default_paths"
Extracts the repository name out of the file 'repo_name' in $OVERLAY/profiles/repo_name
repo_name
$OVERLAY/profiles/repo_name
$overlay->_build_name
"name"
Verifies the existence of the profile directory, and returns the path to it.
$overlay->_build__profile_dir
"_profile_dir"
Generates the Category Hash-Table, either by reading the categories index ( new, preferred ) or by traversing the directory ( old, discouraged )
$category->_build_categories;
"_build___categories_scan"
"_build___categories_file"
Builds the category map using the 'categories' file found in the overlays profile directory.
$overlay->_build___categories_file
Builds the category map the hard way by scanning the directory and then skipping things that are files and/or blacklisted.
$overlay->_build___categories_scan
$object->_iterate_ebuilds( ignored_value => sub { } );
Handles dispatch call for
$object->iterate( ebuilds => sub { } );
$object->_iterate_categories( ignored_value => sub { } );
$object->iterate( categories => sub { } );
$object->_iterate_packages( ignored_value => sub { } );
$object->iterate( packages => sub { } );
Kent Fredric <kentnl@cpan.org>
This software is copyright (c) 2017 by Kent Fredric <kentnl@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Gentoo::Overlay, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gentoo::Overlay
CPAN shell
perl -MCPAN -e shell install Gentoo::Overlay
For more information on module installation, please visit the detailed CPAN module installation guide.