-
Notifications
You must be signed in to change notification settings - Fork 138
/
mk_rpm_manifests.pl
executable file
·130 lines (95 loc) · 2.69 KB
/
mk_rpm_manifests.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#! perl
################################################################################
# Copyright (C) 2001-2007, Parrot Foundation.
################################################################################
=head1 TITLE
tools/dev/mk_rpm_manifests.pl - Generate MANIFEST.* files for building RPMs
=head1 SYNOPSIS
% perl tools/dev/mk_rpm_manifests.pl [options]
=head1 DESCRIPTION
This file generates a set of F<MANIFEST.*> files that give the final
locations in the file system for all the installable files listed in
F<MANIFEST> and F<MANIFEST.generated>.
It does NOT generate the F<MANIFEST> file that F<Configure.pl> checks
and the manifest checks use.
=head2 Options
=over 4
=item C<buildprefix>
The build prefix. Defaults to ''.
=item C<prefix>
The install prefix. Defaults to '/usr'.
=item C<exec_prefix>
The exec prefix. Defaults to '/usr'.
=item C<bindir>
The executables directory. Defaults to '/usr/bin'.
=item C<libdir>
The library directory. Defaults to '/usr/lib'.
=item C<includedir>
The header directory. Defaults to '/usr/include'.
=back
=head1 SEE ALSO
F<install_files.pl>
=cut
################################################################################
use strict;
use warnings;
my %options = (
prefix => '/usr',
exec_prefix => '/usr',
bindir => '/usr/bin',
libdir => '/usr/lib',
includedir => '/usr/include',
);
my $manifest;
foreach (@ARGV) {
if (/^--([^=]+)=(.*)/) {
$options{$1} = $2;
}
else {
$manifest = $_;
}
}
my %FILES; # { package => file }
@ARGV = ($manifest);
while (<>) {
chomp;
my ( $file, $meta, $dest ) = split( /\s+/, $_ );
$dest ||= $file;
my $generated = $meta =~ s/^\*//;
my ($package) = $meta =~ /^\[(.*?)\]/;
$meta =~ s/^\[(.*?)\]//;
next if $package eq "";
my %meta;
@meta{ split( /,/, $meta ) } = ();
$meta{$_} = 1 for ( keys %meta ); # Laziness
my $entry;
if ( $meta{doc} ) {
$entry = "%doc $dest";
}
elsif ( $meta{lib} ) {
$entry = "$options{libdir}/$dest";
}
elsif ( $meta{bin} ) {
$entry = "$options{bindir}/$dest";
}
elsif ( $meta{include} ) {
$entry = "$options{includedir}/$dest";
}
else {
$entry = "$options{prefix}/$dest";
}
push @{ $FILES{$package} }, $entry;
}
while ( my ( $package, $files ) = each %FILES ) {
my $manifest = "MANIFEST.$package";
open( my $MANIFEST, ">", "$manifest" ) or die "create $manifest: $!";
print $MANIFEST "$_\n" foreach (@$files);
close $MANIFEST;
print "Wrote $manifest\n";
}
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4: