Index: tools/dev/install_dev_files.pl =================================================================== --- tools/dev/install_dev_files.pl (revision 38087) +++ tools/dev/install_dev_files.pl (working copy) @@ -46,9 +46,9 @@ =back -=head2 See Also +=head1 SEE ALSO -See F for a detailed description of the MANIFEST +See F for a detailed description of the MANIFEST format. =cut Index: tools/dev/install_files.pl =================================================================== --- tools/dev/install_files.pl (revision 38087) +++ tools/dev/install_files.pl (working copy) @@ -46,64 +46,11 @@ =back -=head2 MANIFEST Format - -The format of the MANIFEST (currently MANIFEST and MANIFEST.generated -are used) is: - - source_path [package]meta1,meta2,... - -or you may optionally specify a different destination path: - - source_path [package]meta1,meta2,... destination - -Additionally, there may be a * in front of the whole line to designate -a generated file: - - source_path *[package]meta1,meta2,... destination - -The square brackets around C are literal. C 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: - -=over 4 - -=item C - -Tag this file with %doc in the RPM, and omit the leading path (because -rpm will put it into a directory of its choosing) - -=item C - -Write this file to the location given by the C<--includedir> option - -=item C - -Write this file to the location given by the C<--libdir> option - -=item C - -Write this file to the location given by the C<--bindir> option - -=back - -The optional C 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--1..rpm file will contain the file -/usr/parroty/bin/snork-compile. - =head1 SEE ALSO +See F for a detailed description of the MANIFEST +format. + F =cut Index: lib/Parrot/Manifest.pm =================================================================== --- lib/Parrot/Manifest.pm (revision 38087) +++ lib/Parrot/Manifest.pm (working copy) @@ -1,11 +1,56 @@ # $Id$ # Copyright (C) 2007, Parrot Foundation. +=head1 NAME + +Parrot::Manifest - Re-create MANIFEST and MANIFEST.SKIP + +=head1 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; + + $print_str = $mani->prepare_gitignore(); + $mani->print_gitignore($print_str) if $need_for_skip; + +=cut + package Parrot::Manifest; use strict; use warnings; use Carp; +=head1 METHODS + +=head2 new + + $mani = Parrot::Manifest->new({ + script => $0, + file => $filename, + skip => $skipfilename, + gitignore => $gitignoresfilename, + }) + +Creates a Parrot::Manifest object by asking "svn status" for verbose output, and parsing +the results. + +$filename is the name of the file that the manifest will eventually be written to, and +defaults to MANIFEST. $skipfilename is the name of the file that will hold the list of +files to be skipped, and defaults to MANIFEST.SKIP. gitignore contains the same +information as MANIFEST.SKIP in a different format. It defaults to '.gitignore'. The +script parameter is the name of the current script, for use in messages. + +=cut +# ...the results go into $self->{dirs} and $self->{versioned_files} sub new { my $class = shift; my $argsref = shift; @@ -55,6 +100,15 @@ return $self; } +=head2 prepare_manifest + + $manifest_lines_ref = $mani->prepare_manifest(); + +Prepares the manifest from the 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. + +=cut sub prepare_manifest { my $self = shift; @@ -66,6 +120,20 @@ return \%manifest_lines; } +=head2 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 + +The return value is 1 of needed, and undef otherwise. The value passed in is the hash +as returned from eg. prepare_manifest. + +=cut sub determine_need_for_manifest { my $self = shift; my $proposed_files_ref = shift; @@ -84,6 +152,14 @@ $different_patterns_count ? return 1 : return; } +=head2 print_manifest + + $mani->print_manifest($manifest_lines_ref) if $need_for_files; + +Writes the manifest to a file. The example above does it only if an update is needed. + +=cut + my $text_file_coda = <<'CODA'; # Local variables: # mode: text @@ -101,8 +177,8 @@ # # generated by $self->{script} $self->{time} UT # -# See tools/dev/install_files.pl for documentation on the -# format of this file. +# See below for documentation on the format of this file. +# # See docs/submissions.pod on how to recreate this file after SVN # has been told about new or deleted files. END_HEADER @@ -119,6 +195,9 @@ return 1; } +# Gets the package and the meta flags for the given file. This function does it based on +# the directory the file is in. If a particular file is needed, then _get_special (below) +# provides that functionality. sub _get_manifest_entry { my $file = shift; @@ -156,6 +235,7 @@ return $loc; } +# See comments for _get_manifest_entry, above sub _get_special { my %special = qw( LICENSE [main]doc @@ -190,6 +270,7 @@ return \%special; } +# Gets files currently listed in manifest, and returns a hash sub _get_current_files { my $self = shift; @@ -211,6 +292,14 @@ return \%current_files; } +=head2 prepare_manifest_skip + + $print_str = $mani->prepare_manifest_skip(); + +Gets a list of the files that SVN ignores, and returns a string that can be put into +MANIFEST.SKIP. + +=cut sub prepare_manifest_skip { my $self = shift; @@ -219,6 +308,14 @@ return $self->_compose_manifest_skip($ignores_ref); } +=head2 prepare_gitignore + + $print_str = $mani->prepare_gitignore(); + +Gets a list of the files that SVN ignores, and then writes it to the .gitignore file. + +=cut + sub prepare_gitignore { my $self = shift; @@ -227,6 +324,17 @@ return $self->_compose_gitignore($ignores_ref); } +=head2 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 + +=cut + sub determine_need_for_manifest_skip { my $self = shift; my $print_str = shift; @@ -249,6 +357,13 @@ } } +=head2 print_manifest_skip + + $mani->print_manifest_skip($print_str) if $need_for_skip; + +Writes MANIFEST.SKIP to a file. The example above does it only if needed. + +=cut sub print_manifest_skip { my $self = shift; my $print_str = shift; @@ -263,6 +378,13 @@ return 1; } +=head2 print_gitignore + + $mani->print_gitignore($print_str) if $need_for_skip; + +Writes the .gitignore file. The example above does so only if needed. + +=cut sub print_gitignore { my $self = shift; my $print_str = shift; @@ -277,6 +399,7 @@ return 1; } +# Gets a list of files that SVN ignores sub _get_ignores { my $self = shift; @@ -304,6 +427,7 @@ return \%ignores; } +# Turns the list of ignored files into .gitignore format sub _compose_gitignore { my $self = shift; my $ignores_ref = shift; @@ -336,6 +460,7 @@ return $print_str; } +# Turns list of ignored files into MANIFEST.SKIP format sub _compose_manifest_skip { my $self = shift; my $ignore_ref = shift; @@ -377,6 +502,7 @@ return $print_str; } +# Gets a list of the currently skipped files from MANIFEST.SKIP sub _get_current_skips { my $self = shift; @@ -394,6 +520,7 @@ return \%current_skips; } +# Gets list of files we're proposing to skip sub _get_proposed_skips { my $print_str = shift; @@ -410,29 +537,62 @@ 1; -#################### DOCUMENTATION #################### +=head1 MANIFEST FORMAT -=head1 NAME +The format of the MANIFEST (currently MANIFEST and MANIFEST.generated +are used) is: -Parrot::Manifest - Re-create MANIFEST and MANIFEST.SKIP + source_path [package]meta1,meta2,... -=head1 SYNOPSIS +or you may optionally specify a different destination path: - use Parrot::Manifest; + source_path [package]meta1,meta2,... destination - $mani = Parrot::Manifest->new($0); +Additionally, there may be a * in front of the whole line to designate +a generated file: - $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; + source_path *[package]meta1,meta2,... destination - $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; +The square brackets around C are literal. C 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. - $print_str = $mani->prepare_gitignore(); - $mani->print_gitignore($print_str) if $need_for_skip; +The various meta flags recognized are: +=over 4 + +=item C + +Tag this file with %doc in the RPM, and omit the leading path (because +rpm will put it into a directory of its choosing) + +=item C + +Write this file to the location given by the C<--includedir> option + +=item C + +Write this file to the location given by the C<--libdir> option + +=item C + +Write this file to the location given by the C<--bindir> option + +=back + +The optional C 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--1..rpm file will contain the file +/usr/parroty/bin/snork-compile. + =head1 SEE ALSO F. @@ -449,9 +609,3 @@ =cut -# Local Variables: -# mode: cperl -# cperl-indent-level: 4 -# fill-column: 100 -# End: -# vim: expandtab shiftwidth=4: Property changes on: lib/Parrot/Install.pm ___________________________________________________________________ Added: svn:mergeinfo Merged /branches/assert_args/lib/Parrot/Install.pm:r34776-34857 Merged /branches/jit_h_files/lib/Parrot/Install.pm:r34166-35215 Merged /branches/RELEASE_0_8_2/lib/Parrot/Install.pm:r34004-34020 Merged /branches/removing_stm/lib/Parrot/Install.pm:r35464-35502