use Lintian::DepMap::Properties; use Lintian::Unpacker; my $done = 1; my $joblimit = 4; my $collmap = Lintian::DepMap::Properties->new; my %requested = ( 'debfiles' => 1 ); # Initialise $collmap with the collections and their relations # - Each node in $collmap should an instance of L::CollScript # as property. my $unpacker = Lintian::Unpacker->new ($collmap, \%requested, $joblimit); while (1) { my $errhandler = sub {}; # Insert hook my @lpkgs; # List of Lintian::Lab::Entry instances $unpacker->reset_worklist; next unless $unpacker->prepare_tasks ($errhandler, @lpkgs); my %hooks = ( 'coll-hook' => sub {}, # Insert hook 'finish-hook' => sub {}, # Insert hook ); $unpacker->process_tasks (); last if $done; }
COLLMAP is a Lintian::DepMap::Properties describing the dependencies between the collections. Each node in COLLMAP must have a Lintian::CollScript as property.
OPTIONS is an optional hashref containing optional configurations. If a key is not present, its value is assumed to be "undef" unless otherwise stated. The following key/values are available:
If ``profile'' is not present or its value is undefined, then all collections in COLLMAP will be unpacked.
Extra collections will be unpacked on top of other collections.
NB: This value is ignored if ``profile'' is not given.
The ERRHANDLER should be a code ref, which will be invoked in case that an entry is not in the laboratory and cannot be created (via the create method). It is invoked once per failed entry giving the entry as first (and only) argument.
If ERRHANDLER returns normally, the entry is skipped (and will not be unpacked later). If ERRHANDLER croaks/dies/etc., the method will attempt to update the status file for any entry it created before passing back the error to the caller (via die).
LAB-ENTRY is an array of lab entries to be processed. They must be instances of Lintian::Lab::Entry, but do not have to exists. They will be created as needed.
Returns a truth value if at least one entry needs to be processed and it did not cause an error. Otherwise, it returns "undef".
NB: The status file is not updated for created entries on successful return. It should either be done by running the process_tasks method or manually.
The return value is unspecified.
HOOKS (if given) is a hashref of hooks. The following hooks are available:
LPKG is the entry it is applied to. COLL is the collection being applied. EVENT is either ``start'' for a new job, ``start-failed'' for a job that failed to start (appears instead of a ``start'' event) or ``finish'' for a job terminating.
TASK_ID is the task id of the job (a string).
If the event is ``finish'', then STATUS_OR_ERROR_MSG is the exit code of the job (non-zero being an error). If the event is ``start-failed'', it is an error message explaining why the job failed to start. It is not defined for other events.
If the limit is 0, then there is no limit for the number of parallel jobs.