Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kentnl/gentoo-overlay

Tools for working with Gentoo Overlays
https://github.com/kentnl/gentoo-overlay

Last synced: 4 days ago
JSON representation

Tools for working with Gentoo Overlays

Awesome Lists containing this project

README

        

# NAME

Gentoo::Overlay - Tools for working with Gentoo Overlays

# VERSION

version 2.001003

# SYNOPSIS

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.

# METHODS

## default\_path

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.

## iterate

$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.
} );

# ATTRIBUTES

## path

Path to repository.

isa => File, ro, required, coerce

["File" in Types::Path::Tiny](https://metacpan.org/pod/Types::Path::Tiny#File)

## name

Repository name.

isa => Gentoo__Overlay_RepositoryName, ro, lazy_build

[`RepositoryName`](https://metacpan.org/pod/Gentoo::Overlay::Types#Gentoo__Overlay_RepositoryName)

["\_build\_name"](#_build_name)

# ATTRIBUTE ACCESSORS

## category\_names

Returns a list of the names of all the categories.

my @list = sort $overlay->category_names();

["\_categories"](#_categories)

## categories

Returns a hash of [`Category`](https://metacpan.org/pod/Gentoo::Overlay::Category) objects.

my %hash = $overlay->categories;
print $hash{dev-perl}->pretty_name; # dev-perl/::gentoo

["\_categories"](#_categories)

## get\_category

Returns a Category Object for a given category name

my $cat = $overlay->get_category('dev-perl');

["\_categories"](#_categories)

# PRIVATE ATTRIBUTES

## \_profile\_dir

Path to the profile sub-directory.

isa => Dir, ro, lazy_build

["Dir" in MooseX::Types::Path::Tiny](https://metacpan.org/pod/MooseX::Types::Path::Tiny#Dir)

["\_build\_\_profile\_dir"](#_build__profile_dir)

## \_categories

The auto-generating category hash backing

isa => HashRef[ Gentoo__Overlay_Category ], ro, lazy_build

["\_build\_\_categories"](#_build__categories)

["\_has\_category"](#_has_category)

["category\_names"](#category_names)

["categories"](#categories)

["get\_category"](#get_category)

["Gentoo\_\_Overlay\_Category" in Gentoo::Overlay::Types](https://metacpan.org/pod/Gentoo::Overlay::Types#Gentoo__Overlay_Category)

[`MooseX::Types::Moose`](https://metacpan.org/pod/MooseX::Types::Moose)

# PRIVATE ATTRIBUTE ACCESSORS

## \_has\_category

Returns if a named category exists

$overlay->_has_category("dev-perl");

["\_categories"](#_categories)

# PRIVATE CLASS ATTRIBUTES

## \_default\_paths

Class-wide list of path generators.

isa => HashRef[ CodeRef ], ro, lazy_build

["\_build\_\_default\_paths"](#_build__default_paths)

# PRIVATE METHODS

## \_build\_name

Extracts the repository name out of the file '`repo_name`'
in `$OVERLAY/profiles/repo_name`

$overlay->_build_name

["name"](#name)

## \_build\_\_profile\_dir

Verifies the existence of the profile directory, and returns the path to it.

$overlay->_build__profile_dir

["\_profile\_dir"](#_profile_dir)

## \_build\_\_categories

Generates the Category Hash-Table, either by reading the categories index ( new, preferred )
or by traversing the directory ( old, discouraged )

$category->_build_categories;

["\_categories"](#_categories)

["\_build\_\_\_categories\_scan"](#_build___categories_scan)

["\_build\_\_\_categories\_file"](#_build___categories_file)

## \_build\_\_\_categories\_file

Builds the category map using the 'categories' file found in the overlays profile directory.

$overlay->_build___categories_file

## \_build\_\_\_categories\_scan

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

## \_iterate\_ebuilds

$object->_iterate_ebuilds( ignored_value => sub { } );

Handles dispatch call for

$object->iterate( ebuilds => sub { } );

## \_iterate\_categories

$object->_iterate_categories( ignored_value => sub { } );

Handles dispatch call for

$object->iterate( categories => sub { } );

## \_iterate\_packages

$object->_iterate_packages( ignored_value => sub { } );

Handles dispatch call for

$object->iterate( packages => sub { } );

# AUTHOR

Kent Fredric

# COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Kent Fredric .

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.