NAME

Pinto::Repository - Coordinates the database, files, and indexes

VERSION

version 0.14

ATTRIBUTES

root

config

db

store

locator

locker

METHODS

locate( target => );

lock( $LOCK_TYPE )

unlock

get_stack()

get_stack( $stack_name )

get_stack( $stack_object )

Returns the Pinto::Schema::Result::Stack object with the given $stack_name. If the argument is a Pinto::Schema::Result::Stack, then it just returns that. If there is no stack with such a name in the repository, throws an exception. If you do not specify a stack name (or it is undefined) then you'll get whatever stack is currently marked as the default stack.

The stack object will not be open for revision, so you will not be able to change any of the registrations for that stack. To get a stack that you can modify, use open_stack.

get_stack_maybe()

get_stack_maybe( $stack_name )

get_stack_maybe( $stack_object )

Same as get_stack but simply returns undef if the stack does not exist rather than throwing an exception.

get_default_stack()

Returns the Pinto::Schema::Result::Stack that is currently marked as the default stack in this repository. This is what you get when you call get_stack without any arguments.

The stack object will not be open for revision, so you will not be able to change any of the registrations for that stack. To get a stack that you can modify, use open_stack.

At any time, there must be exactly one default stack. This method will throw an exception if it discovers that condition is not true.

get_all_stacks()

Returns a list of all the Pinto::Schema::Result::Stack objects in the repository. You can sort them as strings (by name) or numerically (by last modification time).

get_revision($commit)

get_revision_maybe($commit)

get_package( target => $pkg_spec )

Returns a Pinto:Schema::Result::Package representing the latest version of the package in the repository with the same name as the package target and the same or higher version as the package spec. See Pinto::Target::Package for the definition of a package target.

get_package( name => $pkg_name )

Returns a Pinto:Schema::Result::Package representing the latest version of the package in the repository with the given $pkg_name. If there is no such package with that name in the repository, returns nothing.

get_package( name => $pkg_name, path => $dist_path )

Returns the Pinto:Schema::Result::Package with the given $pkg_name that belongs to the distribution identified by $dist_path. If there is no such package in the repository, returns nothing.

TODO: Consider making this a "maybe" function and the wrapping it with a version that throws exceptions if no match is found. See get_stack_maybe() for an example.

get_distribution( target => $target )

Given a Pinto::Target::Package, returns the Pinto::Schema::Result::Distribution that contains the latest version of the package in this repository with the same name as the target and the same or higher version as the target. Returns nothing if no such distribution is found.

Given a Pinto::Target::Distribution, returns the Pinto::Schema::Result::Distribution from this repository with the same author id and archive attributes as the target. Returns nothing if no such distribution is found.

get_distribution( path => $dist_path )

Given a distribution path, (for example AUTHOR/Dist-1.0.tar.gz or A/AU/AUTHOR/Dist-1.0.tar.gz returns the Pinto::Schema::Result::Distribution from this repository that is identified by the author ID and archive file name in the path. Returns nothing if no such distribution is found.

get_distribution( author => $author, archive => $archive )

Given an author id and a distribution archive file basename, returns the Pinto::Schema::Result::Distribution from this repository with those attributes. Returns nothing if no such distribution exists.

TODO: Consider making this a "maybe" function and the wrapping it with a version that throws exceptions if no match is found. See get_stack_maybe() for an example.

ups_distribution( target => target )

Given a Pinto::Target::Package, locates the distribution that contains the latest version of the package across all upstream repositories with the same name as the target, and the same or higher version as the target. If such distribution is found, it is fetched and added to this repository. If it is not found, then an exception is thrown.

Given a Pinto::Target::Distribution, locates the first distribution in any upstream repository with the same author and archive as the target. If such distribution is found, it is fetched and added to this repository. If it is not found, then an exception is thrown.

TODO: Consider making this a "maybe" function and the wrapping it with a version that throws exceptions if no match is found. See get_stack_maybe() for an example.

add( archive => $path, author => $id )

add( archive => $path, author => $id, source => $uri )

Adds the distribution archive located on the local filesystem at $path to the repository in the author directory for the author with $id. The packages provided by the distribution will be indexed, and the prerequisites will be recorded. If the source is specified, it must be the URI to the root of the repository where the distribution came from. Otherwise, the source defaults to LOCAL. Returns a Pinto::Schema::Result::Distribution object representing the newly added distribution.

fetch_distribution( uri => $uri )

Fetches a distribution archive from a remote URI and adds it to this repository. The packages provided by the distribution will be indexed, and the prerequisites will be recorded. Returns a Pinto::Schema::Result::Distribution object representing the fetched distribution.

clean_files()

Deletes all distribution archives that are on the filesystem but not in the database. This can happen when an Action fails or is aborted prematurely.

AUTHOR

Jeffrey Ryan Thalhammer <jeff@stratopan.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Jeffrey Ryan Thalhammer.

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