NAME
Parrot::Manifest - Re-create MANIFEST and MANIFEST.SKIP
SYNOPSIS
use Parrot::Manifest;
$mani = Parrot::Manifest->new($0);
$manifest_lines_ref = $mani->prepare_manifest();
$need_for_files = $mani->determine_need_for_manifest($manifest_lines_ref);
$mani->print_manifest($manifest_lines_ref) if $need_for_files;
$print_str = $mani->prepare_manifest_skip();
$need_for_skip = $mani->determine_need_for_manifest_skip($print_str);
$mani->print_manifest_skip($print_str) if $need_for_skip;
DESCRIPTION
This package exports no functions. A Parrot::Manifest object is used in tools/dev/mk_manifest_and_skip.pl, which in turn is the basis of make manifest_tests
.
METHODS
new
$mani = Parrot::Manifest->new({
script => $0,
file => $filename,
skip => $skipfilename,
})
Creates a Parrot::Manifest object by asking git status
for verbose output, and parsing the results.
file
is the name of the file that the manifest will eventually be written to, and defaults to MANIFEST. skip
is the name of the file that will hold the list of files to be skipped, and defaults to MANIFEST.SKIP.
prepare_manifest
$manifest_lines_ref = $mani->prepare_manifest();
Prepares the manifest from the data read in by the new()
method, and returns a hash of the files. The keys of the hash are the filenames, and the values are strings representing the package and a list of the meta flags.
determine_need_for_manifest
$need_for_files =
$mani->determine_need_for_manifest($manifest_lines_ref);
Determines the need for the manifest. The checks are:
If there's no manifest yet, we need one.
If there's a difference between what's already there and what's in the list, we need a new one.
If a new manifest is needed, the return value is 1
; otherwise it is undefined. The value passed in is the hash as returned from e.g., prepare_manifest()
.
print_manifest
$mani->print_manifest($manifest_lines_ref) if $need_for_files;
Writes the manifest to a file. The example above does so only if an update is needed.
prepare_manifest_skip
$print_str = $mani->prepare_manifest_skip();
Gets a list of the files that Git ignores, and returns a string that can be put into MANIFEST.SKIP.
determine_need_for_manifest_skip
$need_for_skip =
$mani->determine_need_for_manifest_skip($print_str);
Determines whether MANIFEST.SKIP is needed. The tests used are:
If the file doesn't exist, we need one.
If the proposed and existing contents differ, we need one.
print_manifest_skip
$mani->print_manifest_skip($print_str) if $need_for_skip;
Writes MANIFEST.SKIP to a file. The example above does so only if needed.
MANIFEST FORMAT
The format of the MANIFEST (currently MANIFEST and MANIFEST.generated are used) is:
source_path <whitespace> [package]meta1,meta2,...
or you may optionally specify a different destination path:
source_path <whitespace> [package]meta1,meta2,... <whitespace> destination
Additionally, there may be a *
in front of the whole line to designate a generated file:
source_path <whitespace> *[package]meta1,meta2,... <whitespace> destination
The square brackets around package
are literal. package
gives the name of the RPM that the given file will be installed for, and is only used by this script to skip files that are not members of any package.
The various meta flags recognized are:
doc
-
Tag this file with
%doc
in the RPM, and omit the leading path (because rpm will put it into a directory of its choosing). include
-
Write this file to the location given by the
--includedir
option. lib
-
Write this file to the location given by the
--libdir
option. bin
-
Write this file to the location given by the
--bindir
option.
The optional destination
field provides a general way to change where a file will be written to. It will be applied before any metadata tags.
Example: if this line is in the MANIFEST.generated file
languages/snorkfest/snork-compile [main]bin
and the --bindir=/usr/parroty/bin
, then the generated parrot-<VERSION>-1.<arch>.rpm file will contain the file /usr/parroty/bin/snork-compile
.
SEE ALSO
tools/dev/mk_manifest_and_skip.pl.
AUTHOR
James E. Keenan (jkeenan@cpan.org) refactored code from earlier versions of tools/dev/mk_manifest_and_skip.pl.
LICENSE
This is free software which you may distribute under the same terms as Perl itself.