| 1 | =head1 NAME | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | Software::Packager::Svr4 - The Software::Packager extension for System VR4 packages | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | use Software::Packager; | ||||||||||||||||||||||||||||
| 8 | my $packager = new Software::Packager('svr4'); | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | This module is used to create software packages in a format | ||||||||||||||||||||||||||||
| 13 | suitable for installation with pkgadd. | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | =head1 FUNCTIONS | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | =cut | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | package Software::Packager::Svr4; | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use File::Copy; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use File::Path; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | 1 | ▶ | use File::Basename; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | 1 | ▶ | use IO::File; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 26 | 1 | ▶ | use POSIX qw(uname); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 1 | ▶ | use base qw( Software::Packager ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 29 | 1 | ▶ | use Software::Packager::Object::Svr4; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 30 | 1 | our $VERSION; | |||||||||||||||||||||||||||
| 31 | 1 | $VERSION = substr(q$Revision: 1.2 $, 9); | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | =head2 B<new()> | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | This method creates and returns a new Software::Packager::SVR4 object. | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | =cut | ||||||||||||||||||||||||||||
| 38 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 39 | 1 | my $class = shift; | |||||||||||||||||||||||||||
| 40 | 1 | my $self = bless {}, $class; | |||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 1 | return $self; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | =head2 B<add_item()> | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | $packager->add_item(%object_data); | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | Adds a new object (file, link, etc) to the package. | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | =cut | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 16 | ▶ | sub add_item { | ||||||||||||||||||||||||||
|
Subroutine
add_item: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 54 | 16 | my $self = shift; | |||||||||||||||||||||||||||
| 55 | 16 | my %data = @_; | |||||||||||||||||||||||||||
| 56 | 16 | ▶ | my $object = Software::Packager::Object::Svr4->new(%data) || return; | ||||||||||||||||||||||||||
|
Condition50%1/2
'Software::Packager::Object::Svr4'->new(%data) || (return)
MC/DC0%0/1
'Software::Packager::Object::Svr4'->new(%data) || (return)
'Software::Packager::Object::Svr4'->new(%data)
Truth table50%1/2
A
A= 'Software::Packager::Object::Svr4'->new(%data)
| |||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | # check that the object has a unique destination | ||||||||||||||||||||||||||||
| 59 | return | ||||||||||||||||||||||||||||
| 60 | 16 | ▶ | if exists $self->{OBJECTS}->{$object->destination}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 1 | $self->{OBJECTS}->{$object->destination} = $object; | |||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 1 | ▶ | sub get_all_classes { | ||||||||||||||||||||||||||
|
Subroutine
get_all_classes: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 66 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 67 | 1 | my %class; | |||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 1 | foreach($self->get_directory_objects, $self->get_file_objects, | |||||||||||||||||||||||||||
| 70 | $self->get_link_objects) { | ||||||||||||||||||||||||||||
| 71 | 0 | $class{$_->class}++; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | 1 | return keys %class; | |||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | =head2 B<package()> | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | $packager->package(); | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | Create the package. | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | =cut | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 1 | ▶ | sub package { | ||||||||||||||||||||||||||
|
Subroutine
package: called CC=10 SCAR=35.1
Pod
documented
| |||||||||||||||||||||||||||||
| 85 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 86 | 1 | my $dir = $self->output_dir; | |||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 1 | ▶ | my $pkginfo = IO::File->new(">$dir/pkginfo") | ||||||||||||||||||||||||||
|
Condition50%1/2
'IO::File'->new(">$dir/pkginfo") || die("Couldn't open pkginfo for output: $!\n")
MC/DC0%0/1
'IO::File'->new(">$dir/pkginfo") || die("Couldn't open pkginfo for output: $!\n")
'IO::File'->new(">$dir/pkginfo")
Truth table50%1/2
A
A= 'IO::File'->new(">$dir/pkginfo")
| |||||||||||||||||||||||||||||
| 89 | || die "Couldn't open pkginfo for output: $!\n"; | ||||||||||||||||||||||||||||
| 90 | 1 | my %info = $self->info; | |||||||||||||||||||||||||||
| 91 | print $pkginfo "$_=$info{$_}\n" | ||||||||||||||||||||||||||||
| 92 | 1 | for keys %info; | |||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 1 | ▶ | my $pkgmap = IO::File->new(">$dir/pkgmap") | ||||||||||||||||||||||||||
|
Condition50%1/2
'IO::File'->new(">$dir/pkgmap") || die("Couldn't open pkgmap for output: $!\n")
MC/DC0%0/1
'IO::File'->new(">$dir/pkgmap") || die("Couldn't open pkgmap for output: $!\n")
'IO::File'->new(">$dir/pkgmap")
Truth table50%1/2
A
A= 'IO::File'->new(">$dir/pkgmap")
| |||||||||||||||||||||||||||||
| 95 | || die "Couldn't open pkgmap for output: $!\n"; | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 1 | mkdir "$dir/reloc", 0755; | |||||||||||||||||||||||||||
| 98 | 1 | chdir "$dir/reloc"; | |||||||||||||||||||||||||||
| 99 | 1 | my $maxlength = 0; | |||||||||||||||||||||||||||
| 100 | 1 | foreach($self->get_directory_objects, $self->get_file_objects, | |||||||||||||||||||||||||||
| 101 | $self->get_link_objects) { | ||||||||||||||||||||||||||||
| 102 | 0 | warn $_->destination, ", ", $_->prototype, "\n"; | |||||||||||||||||||||||||||
| 103 | 0 | ▶ | if($_->prototype eq 'f') { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 104 | 0 | ▶ | open(IN, $_->source) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 105 | || die "Couldn't open ", $_->source, " for input: $!\n"; | ||||||||||||||||||||||||||||
| 106 | 0 | ▶ | open(OUT, ">./".$_->destination) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 107 | || die "Couldn't open ", $_->destination, " for output: $!\n"; | ||||||||||||||||||||||||||||
| 108 | 0 | ($_->{length},$_->{crc}) = _sum_copy(\*IN, \*OUT); | |||||||||||||||||||||||||||
| 109 | 0 | ▶ | $maxlength = $_->{length} if $_->{length} > $maxlength; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 110 | 0 | $_->{mtime} = [lstat($_->source)]->[10]; | |||||||||||||||||||||||||||
| 111 | 0 | close IN; | |||||||||||||||||||||||||||
| 112 | 0 | close OUT; | |||||||||||||||||||||||||||
| 113 | 0 | chmod $_->mode, $_->destination; | |||||||||||||||||||||||||||
| 114 | } elsif($_->prototype eq 'd') { | ||||||||||||||||||||||||||||
| 115 | 0 | mkdir $_->destination, $_->mode; | |||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 0 | $pkgmap->print(_pkgmap_line($_)); | |||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | 1 | chdir "../.."; | |||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | 1 | print $pkgmap ":1 ". int($maxlength / 512). "\n"; | |||||||||||||||||||||||||||
| 123 | 1 | $pkgmap->close; | |||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | # an implementation of the 'cksum' utility in perl. written for the perl | ||||||||||||||||||||||||||||
| 127 | # power tools (ppt) project by theo van dinter (felicity@kluge.net). | ||||||||||||||||||||||||||||
| 128 | # | ||||||||||||||||||||||||||||
| 129 | # id: cksum,v 1.3 1999/03/04 17:14:08 felicity exp | ||||||||||||||||||||||||||||
| 130 | # modified to copy the file while it sums | ||||||||||||||||||||||||||||
| 131 | 0 | ▶ | sub _sum_copy { | ||||||||||||||||||||||||||
|
Subroutine
_sum_copy: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 132 | 0 | my($fh) = shift; | |||||||||||||||||||||||||||
| 133 | 0 | my($ofh) = shift; | |||||||||||||||||||||||||||
| 134 | 0 | my($crc) = my($len) = 0; | |||||||||||||||||||||||||||
| 135 | 0 | my($buf,$num,$i); | |||||||||||||||||||||||||||
| 136 | 0 | my($buflen) = 4096; # buffer is "4k", you can up it if you want... | |||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | 0 | ▶ | while($num = sysread $fh, $buf, $buflen) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 139 | 0 | $len += $num; | |||||||||||||||||||||||||||
| 140 | 0 | $crc += unpack("%32C*", $buf); | |||||||||||||||||||||||||||
| 141 | 0 | syswrite $ofh, $buf; | |||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | # crc = s (total of bytes) | ||||||||||||||||||||||||||||
| 145 | 0 | $crc = ($crc & 0xffff) + ($crc & 0xffffffff) / 0x10000; # r | |||||||||||||||||||||||||||
| 146 | 0 | $crc = ($crc & 0xffff) + ($crc / 0x10000); # cksum | |||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 0 | return $len,int($crc),($len+511)/512; # round # of blocks up ... | |||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 0 | ▶ | sub _pkgmap_line { | ||||||||||||||||||||||||||
|
Subroutine
_pkgmap_line: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 152 | 0 | my $finfo = shift; | |||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | (defined $finfo->part ? $finfo->part : "1") . " " . | ||||||||||||||||||||||||||||
| 155 | $finfo->prototype . " " . | ||||||||||||||||||||||||||||
| 156 | (defined $finfo->class ? $finfo->class : "none") . " " . | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | $finfo->destination . " " . sprintf("%04o",$finfo->mode) | ||||||||||||||||||||||||||||
| 159 | . " " . $finfo->user . " " . $finfo->group . " " . | ||||||||||||||||||||||||||||
| 160 | ($finfo->prototype eq 'f' ? $finfo->{length} . | ||||||||||||||||||||||||||||
| 161 | " " . $finfo->{crc} . " " | ||||||||||||||||||||||||||||
| 162 | 0 | ▶ | . $finfo->{mtime} . "\n" : "\n") | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | =head2 B<info> | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | This method returns a hash that is filled with the necessary | ||||||||||||||||||||||||||||
| 168 | information for a pkginfo file that conforms to the SYSV format. | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | =cut | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | 1 | ▶ | sub info { | ||||||||||||||||||||||||||
|
Subroutine
info: called CC=9 SCAR=24.1
Pod
documented
| |||||||||||||||||||||||||||||
| 173 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 174 | 1 | my %info; | |||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | 1 | ▶ | $info{PKG} = $self->package_name || warn "No package name.\n"; | ||||||||||||||||||||||||||
|
Condition50%1/2
$self->package_name || warn("No package name.\n")
MC/DC0%0/1
$self->package_name || warn("No package name.\n")
$self->package_name
Truth table50%1/2
A
A= $self->package_name
| |||||||||||||||||||||||||||||
| 177 | 1 | ▶ | $info{NAME} = $self->program_name || warn "No program name.\n"; | ||||||||||||||||||||||||||
|
Condition50%1/2
$self->program_name || warn("No program name.\n")
MC/DC0%0/1
$self->program_name || warn("No program name.\n")
$self->program_name
Truth table50%1/2
A
A= $self->program_name
| |||||||||||||||||||||||||||||
| 178 | 1 | ▶ | $info{VERSION} = $self->version || warn "No version number.\n"; | ||||||||||||||||||||||||||
|
Condition50%1/2
$self->version || warn("No version number.\n")
MC/DC0%0/1
$self->version || warn("No version number.\n")
$self->version
Truth table50%1/2
A
A= $self->version
| |||||||||||||||||||||||||||||
| 179 | 1 | ▶ | $info{ARCH} = $self->architecture | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 180 | if $self->architecture; | ||||||||||||||||||||||||||||
| 181 | 1 | ▶ | $info{PSTAMP} = $self->creator | ||||||||||||||||||||||||||
|
Condition33%1/3
$self->creator || POSIX::strftime([POSIX::uname()]->[1] . '%Y%m%d%H%M%S', localtime)
MC/DC0%0/2
$self->creator || POSIX::strftime([POSIX::uname()]->[1] . '%Y%m%d%H%M%S', localtime)
$self->creator
POSIX::strftime([POSIX::uname()]->[1] . '%Y%m%d%H%M%S', localtime)
Truth table33%1/3
A || B
A= $self->creatorB= POSIX::strftime([POSIX::uname()]->[1] . '%Y%m%d%H%M%S', localtime)
| |||||||||||||||||||||||||||||
| 182 | || POSIX::strftime([POSIX::uname]->[1].'%Y%m%d%H%M%S', localtime); | ||||||||||||||||||||||||||||
| 183 | 1 | $info{CLASSES} = join(", ",$self->get_all_classes); | |||||||||||||||||||||||||||
| 184 | 1 | ▶ | $info{CATEGORY} = $self->category | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 185 | if $self->category; | ||||||||||||||||||||||||||||
| 186 | 1 | ▶ | $info{VENDOR} = $self->vendor | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 187 | if $self->vendor; | ||||||||||||||||||||||||||||
| 188 | 1 | $info{BASEDIR} = $self->install_dir; | |||||||||||||||||||||||||||
| 189 | 1 | ▶ | $info{EMAIL} = $self->email_contact | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 190 | if $self->email_contact; | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | 1 | return %info; | |||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | =head2 B<package_name()> | ||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | Define the package name. | ||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | =cut | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 7 | ▶ | sub package_name { | ||||||||||||||||||||||||||
|
Subroutine
package_name: called CC=7 SCAR=22.0
Pod
documented
| |||||||||||||||||||||||||||||
| 203 | 7 | my $self = shift; | |||||||||||||||||||||||||||
| 204 | 7 | my $name = shift; | |||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | return $self->{PACKAGE_NAME} | ||||||||||||||||||||||||||||
| 207 | 7 | ▶ | unless $name; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | 1 | for ($name) { | |||||||||||||||||||||||||||
| 210 | 1 | ▶ | if (m{^(?![a-zA-Z])}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 211 | 1 | warn qq{Warning: Package name "$name" does not start with a letter. | |||||||||||||||||||||||||||
| 212 | Removing non letters from the start.\n}; | ||||||||||||||||||||||||||||
| 213 | 1 | s{^(.*?)(?=[a-zA-Z])(.*)}{$2}; | |||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||
| 215 | 1 | ▶ | if (/[^a-zA-Z0-9+-]!/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 216 | 0 | warn qq{Warning: Package name "$name" contains | |||||||||||||||||||||||||||
| 217 | charaters other that alphanumeric, + and -. Removing them.\n}; | ||||||||||||||||||||||||||||
| 218 | 0 | tr/a-zA-Z0-9+-//cd; | |||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||
| 220 | 1 | ▶ | if (length > 256) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 221 | 0 | warn qq{Warning: Package name "$name" is longer than 9 charaters. | |||||||||||||||||||||||||||
| 222 | Truncating to 9 charaters.\n}; | ||||||||||||||||||||||||||||
| 223 | 0 | $_ = substr($_, 0, 256); | |||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||
| 225 | 1 | ▶ | if (/^install$|^new$|^all$/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 226 | 0 | warn "Warning: The package name $name is reserved.\n"; | |||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | 1 | $self->{PACKAGE_NAME} = $_; | |||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | =head2 B<program_name()> | ||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | This is used to specify the full package name. | ||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | The program name must be less that 256 charaters. | ||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | For more details see the pkginfo(4) man page. | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | =cut | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | 3 | ▶ | sub program_name { | ||||||||||||||||||||||||||
|
Subroutine
program_name: called CC=5 SCAR=25.2
Pod
documented
| |||||||||||||||||||||||||||||
| 244 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 245 | 3 | my $name = shift; | |||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | return ($self->{PROGRAM_NAME} || $self->package_name) | ||||||||||||||||||||||||||||
| 248 | 3 | ▶ | unless $self->{PROGRAM_NAME}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{'PROGRAM_NAME'} || $self->package_name
MC/DC0%0/2
$self->{'PROGRAM_NAME'} || $self->package_name
$self->{'PROGRAM_NAME'}
$self->package_name
Truth table33%1/3
A || B
A= $self->{'PROGRAM_NAME'}B= $self->package_name
| |||||||||||||||||||||||||||||
| 249 | 0 | for($name) { | |||||||||||||||||||||||||||
| 250 | 0 | ▶ | if (length > 256) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 251 | 0 | warn qq{Warning: Package name "$_" is longer than 256 charaters. | |||||||||||||||||||||||||||
| 252 | Truncating to 256 charaters.\n}; | ||||||||||||||||||||||||||||
| 253 | 0 | $_ = substr($_, 0, 256); | |||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||
| 255 | 0 | $self->{PROGRAM_NAME} = $_; | |||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | =head2 B<architecture()> | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | The architecture must be a comma seperated list of alphanumeric tokens that | ||||||||||||||||||||||||||||
| 263 | indicate the architecture associated with the package. | ||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | The maximum length of a token is 16 charaters. | ||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | A token should be in the format "instruction set"."platform group" | ||||||||||||||||||||||||||||
| 268 | where: | ||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | =over | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | =item instruction set is in the format of `uname -p` | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | =item platform group is in the format of `uname -m` | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | =back | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | If the architecture is not set then the current instruction set is used. | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | For more details see the pkginfo(4) man page. | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | =cut | ||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | 5 | ▶ | sub architecture { | ||||||||||||||||||||||||||
|
Subroutine
architecture: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 285 | 5 | my $self = shift; | |||||||||||||||||||||||||||
| 286 | 5 | my $name = shift; | |||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | 5 | ▶ | $self->{ARCHITECTURE} = $name | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 289 | if $name; | ||||||||||||||||||||||||||||
| 290 | 5 | ▶ | $self->{ARCHITECTURE} ||= [uname]->[4]; | ||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"ARCHITECTURE"} ||= [uname()]->[4]
MC/DC0%0/2
$self->{"ARCHITECTURE"} ||= [uname()]->[4]
$self->{"ARCHITECTURE"}
[uname()]->[4]
Truth table66%2/3
A ||= B
A= $self->{"ARCHITECTURE"}B= [uname()]->[4]
| |||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | =head2 B<version()> | ||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||
| 295 | This method is used to check the format of the version and return it in the | ||||||||||||||||||||||||||||
| 296 | format required for SVR4. | ||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | =item * | ||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||
| 300 | The version must be 256 charaters or less. | ||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | =item * | ||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | The first charater cannot be a left parenthesis. | ||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | The recommended format is an arbitrary string of numbers in Dewey-decimal | ||||||||||||||||||||||||||||
| 307 | format. | ||||||||||||||||||||||||||||
| 308 | For more datails see the pkginfo(4) man page. | ||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||
| 310 | =cut | ||||||||||||||||||||||||||||
| 311 | 4 | ▶ | sub version { | ||||||||||||||||||||||||||
|
Subroutine
version: called CC=4 SCAR=15.5
Pod
documented
| |||||||||||||||||||||||||||||
| 312 | 4 | my $self = shift; | |||||||||||||||||||||||||||
| 313 | 4 | my $version = shift; | |||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | 4 | ▶ | if ($version) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 316 | 2 | ▶ | if (substr($version, 0, 1) eq '(') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 317 | 0 | warn "Warning: The version starts with a left parenthesis. | |||||||||||||||||||||||||||
| 318 | Removing it.\n"; | ||||||||||||||||||||||||||||
| 319 | 0 | $version = substr($version,1); | |||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||
| 321 | 2 | ▶ | if (length $version > 256) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 322 | 0 | warn "Warning: The version is longer than 256 charaters. | |||||||||||||||||||||||||||
| 323 | Truncating it.\n"; | ||||||||||||||||||||||||||||
| 324 | 0 | $version = substr($version,0,256); | |||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||
| 326 | 2 | $self->{PACKAGE_VERSION} = $version; | |||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | 4 | return $self->{PACKAGE_VERSION}; | |||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | =head2 B<install_dir()> | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | $packager->install_dir('/usr/local'); | ||||||||||||||||||||||||||||
| 335 | my $base_dir = $packager->install_dir; | ||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | This method sets the base directory for the software to be installed. | ||||||||||||||||||||||||||||
| 338 | The installation directory must start with a "/". | ||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||
| 340 | =cut | ||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||
| 342 | 3 | ▶ | sub install_dir { | ||||||||||||||||||||||||||
|
Subroutine
install_dir: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||
| 343 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 344 | 3 | my $value = shift; | |||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||
| 346 | 3 | ▶ | return ($self->{BASEDIR} || '/') | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$self->{'BASEDIR'} || '/'
MC/DC0%0/1
$self->{'BASEDIR'} || '/'
$self->{'BASEDIR'}
Truth table50%1/2
A
A= $self->{'BASEDIR'}
| |||||||||||||||||||||||||||||
| 347 | unless $value; | ||||||||||||||||||||||||||||
| 348 | 1 | for($value) { | |||||||||||||||||||||||||||
| 349 | 1 | ▶ | if (substr($_,0,1) ne '/') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 350 | 1 | warn qq{Warning: The installation directory does not start with a "/". | |||||||||||||||||||||||||||
| 351 | Prepending "/" to $value.}; | ||||||||||||||||||||||||||||
| 352 | 1 | $_ = "/$value"; | |||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||
| 354 | 1 | $self->{BASEDIR} = $_; | |||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | =head2 B<compatible_version()> | ||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | $packager->compatible_version('/some/path/file'); | ||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | or | ||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | $packager->compatible_version($compver_stored_in_string); | ||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||
| 366 | my $compatible_version = $packager->compatible_version(); | ||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | This method sets the compatible versions file for the software to | ||||||||||||||||||||||||||||
| 369 | be installed. | ||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||
| 371 | =cut | ||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | 0 | ▶ | sub compatible_version { | ||||||||||||||||||||||||||
|
Subroutine
compatible_version: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 374 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 375 | 0 | my $value = shift; | |||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||
| 377 | 0 | ▶ | $self->{COMPVER} = $value | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 378 | if $value; | ||||||||||||||||||||||||||||
| 379 | 0 | return $self->{COMPVER}; | |||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||
| 382 | =head2 B<space()> | ||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||
| 384 | $packager->space('/some/path/file'); | ||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||
| 386 | or | ||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||
| 388 | $packager->space($space_data_stored_in_string); | ||||||||||||||||||||||||||||
| 389 | my $space = $packager->space(); | ||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | This method sets the space file for the software to be installed. | ||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||
| 393 | =cut | ||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||
| 395 | 0 | ▶ | sub space { | ||||||||||||||||||||||||||
|
Subroutine
space: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 396 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 397 | 0 | my $value = shift; | |||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||
| 399 | 0 | ▶ | $self->{SPACE} = $value | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 400 | if $value; | ||||||||||||||||||||||||||||
| 401 | 0 | return $self->{SPACE}; | |||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||
| 404 | =head2 B<request_script()> | ||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||
| 406 | $packager->request_script('/some/path/file'); | ||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||
| 408 | or | ||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||
| 410 | $packager->request_script($request_script_stored_in_string); | ||||||||||||||||||||||||||||
| 411 | my $request_script = $packager->request_script(); | ||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | This method sets the space file for the software to be installed. | ||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||
| 415 | =cut | ||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||
| 417 | 0 | ▶ | sub request_script { | ||||||||||||||||||||||||||
|
Subroutine
request_script: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 418 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 419 | 0 | my $value = shift; | |||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||
| 421 | 0 | ▶ | $self->{REQUEST_SCRIPT} = $value | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 422 | if $value; | ||||||||||||||||||||||||||||
| 423 | 0 | return $self->{REQUEST_SCRIPT}; | |||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||
| 426 | 1 | 1; | |||||||||||||||||||||||||||
| 427 | __END__ | ||||||||||||||||||||||||||||