#
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
#
# Script to generate a package manifest for use with pkg(5) from a
# temporary proto area
#
# Usage: pkg-manifest-generate.pl [<attribute>=<value>...]
#
# If <manifest input> exists, it is merged into the output.
# If <manifest input> does not exist, <license file> is included in the output
# The result is written to <manifest output>, or stdout if not specified
use strict;
use warnings;
my %options;
}
sub required_option_list {
die ("Must specify $opt $message\n");
}
}
sub required_option {
my $opt_list_ref = required_option_list(@_);
if (scalar(@{$opt_list_ref}) != 1) {
die ("Must specify only one value for $opt $message\n");
}
return $opt_list_ref->[0];
}
my %actions_seen = ();
my @manifest_header;
sub next_action_seen {
my ($FH) = @_;
my $action = "";
while (my $l = <$FH>) {
chomp($l);
if ($l =~ m{^\#}) { # comment
$action .= $l;
return $action;
} elsif ($l =~ m{^(.*)\\$}) { # Line continues
} else {
$action .= $l;
$action =~ s{\s+}{ }g;
next if $action =~ m{^\s*$};
} else {
}
return $action;
}
}
return undef;
}
# Check if there is an existing manifest to merge with
if (exists $options{'input_manifest'}) {
next if (! -f $mf);
my $action = "";
push @manifest_header, $action;
}
close $INPUT_MF;
}
}
# Manifest listing entries not to include in manifest
if (exists $options{'exception_manifest'}) {
next if (! -f $mf);
die "Cannot open exception_manifest $mf: $!\n";
# Just adding it to action_seen, nothing more to do
}
close $EXCEPT_MF;
}
}
# Generate a manifest header if not merging into an existing file
if (!@manifest_header) {
('manifest_license', 'when not merging with existing manifest.');
# substitute the current year for @YEARS@ in the license template
chomp($ll);
if ($ll !~ m{^\#}) {
}
push @manifest_header, $ll;
}
close $LICENSE;
}
'when not merging with existing manifest.');
my $pkg_vers = '$(PKGVERS)';
if (exists $options{'version'}) {
}
push @manifest_header, 'set name=pkg.description ' .
'value="XXX: Please provide a descriptive paragraph for the package."';
my $pkg_summary = '';
if (exists $options{'summary'}) {
}
if ($pkg_summary =~ m{^\s*$}) {
foreach my $bdir (glob("build-*/$sdir")) {
# First try looking in a README file for a short summary
chomp($readme);
last if $readme =~ m{^[\-=\s]*$};
$readme =~ s{[\t\n]+}{ }g;
if ($pkg_summary =~ m{\S$}) {
$pkg_summary .= ' ';
}
$pkg_summary .= $readme;
}
close $README;
}
# Then try looking in man pages
push @manpage, glob("$bdir/*.man");
my $desc;
while (my $l = <$MANPAGE>) {
last;
}
}
close($MANPAGE);
chomp($desc);
# Remove backslashes, such as \- instead of -
$desc =~ s/\\//g;
}
if ($desc !~ m{^\s*$}) {
$pkg_summary = $desc;
last SDIR;
}
}
}
}
}
}
if ($pkg_summary eq '') {
$pkg_summary =
'XXX: Please provide a short name for the package';
} else {
$pkg_summary =~ s{^\s+}{};
$pkg_summary =~ s{\s+$}{};
}
if (exists $options{'classification'}) {
'value="org.opensolaris.category.2008:',
$pkg_class, '"');
}
}
## Contents
my @manifest_contents;
'with the name used for the subdirectory containing 64-bit objects');
'for files to include in manifest');
foreach my $proto_area (@{$proto_area_ref}) {
chomp($ps);
# Skip -uninstalled.pc files, since those are only used during build
# Convert 64-bit subdirectories to platform-independent form
# Don't add duplicates of actions we've already got
$action = $1;
} else {
$action =~ s{\s+}{ }g;
}
next if exists $actions_seen{$action};
# Drop file path from file actions, so we always use the path attribute
# Drop attributes that will be generated during package build
push @manifest_contents,
split /\s+/, $ps));
}
close $PKGSEND;
}
my $pkgfmt_cmd = 'pkgfmt';
if (exists $options{'pkgfmt'}) {
}
}
close $PKGFMT;