3
# This Source Code Form is subject to the terms of the Mozilla Public
4
# License, v. 2.0. If a copy of the MPL was not distributed with this
5
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
10
# Parse a package file and copy the specified files for a component
11
# from the given source directory into the given destination directory
12
# for packaging by the install builder.
16
# - change warn()s to die()s to enforce updating package files.
17
# - change var names to standard form
24
# initialize variables
25
%components = (); # list of components to copy
26
$srcdir = ""; # root directory being copied from
27
$destdir = ""; # root directory being copied to
28
$package = ""; # file listing files to copy
29
$os = ""; # os type (MacOS, MSDOS, Unix, OS/2)
30
$verbose = 0; # shorthand for --debug 1
31
$debug = 0; # controls amount of debug output
32
$help = 0; # flag: if set, print usage
35
# get command line options
37
"source|s=s", \$srcdir,
38
"destination|d=s", \$destdir,
39
"file|f=s", \$package,
41
"component|c=s", \@components,
44
"verbose|v", \$verbose,
46
"<>", \&do_badargument
50
if ($verbose && !($debug)) {
52
} elsif ($debug != 0) {
53
$debug = abs ($debug);
54
($debug >= 2) && print "debug level: $debug\n";
60
die "Error: couldn't parse command line options. See \'$0 --help' for options.\nExiting...\n";
63
# ensure that Packager.pm is in @INC, since we might not be called from
64
# mozilla/toolkit/mozapps/installer.
67
$top_path =~ s/\\/\//g;
69
push(@INC, dirname($top_path));
74
if ($srcdir !~ /^.:+/) {
75
$srcdir = $cwd."/".$srcdir;
79
Packager::Copy($srcdir, $destdir, $package, $os, $flat, $help, $debug, @components);
82
# This is called by GetOptions when there are extra command line arguments
83
# it doesn't understand.
87
warn "Warning: unknown command line option specified: @_.\n";