monotone

monotone Commit Details

Date:2009-02-08 11:31:11 (10 years 4 months ago)
Author:Tony Cooper
Branch:net.venge.monotone.contrib.mtn-browse
Commit:e471da4d6e123bc2c2263dd8b4c7b1dd462039d6
Parents: f0d902f893c8aee6ff0a229584a873b5f6bf9e70
Message:- Beefed up linux-install. It now:

- Can take all its information from the command line.
- Supports the concept of DESTDIR.
- Checks that Perl dependencies have been met.
- Has built in help.
- Switched all Perl scripts over to demanding Perl 5.8.5.
- README file has been updated as a result of the changes in linux-install.
Changes:
MInstaller.pm (1 diff)
MREADME (1 diff)
Mlib/perl/AdvancedFind.pm (1 diff)
Mlib/perl/Annotate.pm (1 diff)
Mlib/perl/ChangeLog.pm (1 diff)
Mlib/perl/ComboAutoCompletion.pm (1 diff)
Mlib/perl/Common.pm (1 diff)
Mlib/perl/Completion.pm (1 diff)
Mlib/perl/FindFiles.pm (1 diff)
Mlib/perl/FindText.pm (1 diff)
Mlib/perl/Globals.pm (1 diff)
Mlib/perl/History.pm (1 diff)
Mlib/perl/Preferences.pm (1 diff)
Mlib/perl/WindowManager.pm (1 diff)
Mlinux-install (10 diffs)
Mmtn-browse (1 diff)

File differences

Installer.pm
4444
4545
4646
47
47
4848
4949
5050
# ***** DIRECTIVES *****
require 5.008;
require 5.008005;
use integer;
use strict;
README
2323
2424
2525
26
27
28
2629
2730
2831
2932
3033
31
34
3235
3336
3437
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
3554
3655
3756
INSTALLATION
------------
Using linux-install
-------------------
As root simply unpack the tar file and run the installer by doing:
tar xvpzf mtn-browse-<Version Number>.tgz
cd mtn-browse-<Version Number>
chmod +x linux-install
./linux-install
./linux-install -i
and then follow the prompts.
If you wish to do an automated install then all of the options can be specified
on the command line. To get more information on what options are available do:
./linux-install --man
In particular, package maintainers may find the following particularly useful:
./linux-install --prefix=/opt/mtn-browse --destdir=/tmp/install-dir
This tells the installer to configure the installation as if it were going
under /opt/mtn-browse but actually installs it under /tmp/install-dir (i.e. the
application can be found at /tmp/install-dir/opt/mtn-browse/bin/mtn-browse).
Manual Installation
-------------------
If you prefer to install this application manually then copy the files into
place using the following directory structure:
lib/perl/AdvancedFind.pm
4040
4141
4242
43
43
4444
4545
4646
# ***** DIRECTIVES *****
require 5.008;
require 5.008005;
use strict;
use warnings;
lib/perl/Annotate.pm
4040
4141
4242
43
43
4444
4545
4646
# ***** DIRECTIVES *****
require 5.008;
require 5.008005;
use strict;
use warnings;
lib/perl/ChangeLog.pm
4040
4141
4242
43
43
4444
4545
4646
# ***** DIRECTIVES *****
require 5.008;
require 5.008005;
use strict;
use warnings;
lib/perl/ComboAutoCompletion.pm
4141
4242
4343
44
44
4545
4646
4747
# ***** DIRECTIVES *****
require 5.008;
require 5.008005;
use strict;
use warnings;
lib/perl/Common.pm
4040
4141
4242
43
43
4444
4545
4646
# ***** DIRECTIVES *****
require 5.008;
require 5.008005;
use strict;
use warnings;
lib/perl/Completion.pm
4545
4646
4747
48
48
4949
5050
5151
# ***** DIRECTIVES *****
require 5.008;
require 5.008005;
use integer;
use strict;
lib/perl/FindFiles.pm
4040
4141
4242
43
43
4444
4545
4646
# ***** DIRECTIVES *****
require 5.008;
require 5.008005;
use strict;
use warnings;
lib/perl/FindText.pm
4040
4141
4242
43
43
4444
4545
4646
# ***** DIRECTIVES *****
require 5.008;
require 5.008005;
use strict;
use warnings;
lib/perl/Globals.pm
4646
4747
4848
49
49
5050
5151
5252
# ***** DIRECTIVES *****
require 5.008;
require 5.008005;
use strict;
use warnings;
lib/perl/History.pm
4040
4141
4242
43
43
4444
4545
4646
# ***** DIRECTIVES *****
require 5.008;
require 5.008005;
use strict;
use warnings;
lib/perl/Preferences.pm
4040
4141
4242
43
43
4444
4545
4646
# ***** DIRECTIVES *****
require 5.008;
require 5.008005;
use strict;
use warnings;
lib/perl/WindowManager.pm
4545
4646
4747
48
48
4949
5050
5151
# ***** DIRECTIVES *****
require 5.008;
require 5.008005;
use integer;
use strict;
linux-install
3939
4040
4141
42
42
4343
4444
4545
......
4848
4949
5050
51
5152
5253
54
5355
5456
5557
5658
59
60
61
62
63
64
5765
5866
5967
......
7078
7179
7280
73
81
82
83
84
7485
7586
87
7688
7789
7890
91
92
7993
94
95
8096
8197
98
8299
83
100
101
102
84103
85
104
86105
106
107
87108
88109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
89168
90169
91
92
93
94
170
95171
96
97
98
99
100
101
172
173
174
175
102176
177
178
179
180
181
182
103183
104
105
106
107
184
108185
109
110
111
112
113
114
115
186
187
188
189
190
116191
192
193
194
195
196
197
198
117199
118
119
120
121
122
200
123201
124
125
126
127
128
129
130
202
203
204
205
206
131207
208
209
210
211
212
213
214
215
216
132217
133
134
135
136
218
137219
138
220
221
222
223
224
139225
140
226
227
228
141229
142
230
231
232
233
143234
144235
145
146
236
147237
148
238
239
240
241
149242
150
151
152
243
153244
154
245
246
247
248
155249
156250
157
158
159
160
161
162
163
164
251
165252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
166274
167275
276
277
278
279
168280
169281
282
170283
171284
172285
......
177290
178291
179292
180
293
181294
182295
183296
......
186299
187300
188301
189
302
190303
191304
192305
......
196309
197310
198311
199
312
200313
201314
202315
203
316
204317
205318
206319
......
220333
221334
222335
223
336
224337
225338
226339
......
229342
230343
231344
232
345
233346
234347
235348
236349
237
350
238351
239352
240353
......
251364
252365
253366
254
367
255368
256369
257370
......
260373
261374
262375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
# ***** DIRECTIVES *****
require 5.008;
require 5.008005;
use strict;
use warnings;
# Standard Perl and CPAN modules.
use Getopt::Long;
use IO::Dir;
use IO::File;
use Pod::Usage;
# Modules specific to this application.
use Installer;
# ***** FUNCTIONAL PROTOTYPES *****
# Private routines.
sub check_dependencies($);
#
##############################################################################
#
{
my($dir,
my($confirm,
$dep_level,
$dest_dir,
$dir,
$file,
$globs_file,
$help,
$infile,
$input,
$installer,
$interactive,
$lib_dest_dir,
$lib_dir,
$lib_prefix_dir,
$man,
$mas_path,
$outfile,
$parser,
$prefix_dir,
$use_dist_mas_lib);
$prefix_dest_dir,
$quiet,
$use_dists_mas_lib);
print("Linux installer for mtn-browse\n\n");
# Assign defaults.
$dep_level = 2;
$dest_dir = "";
$globs_file = "/usr/share/mime/globs";
$prefix_dir = "/usr";
$lib_dir = "/lib/mtn-browse";
$use_dists_mas_lib = 1;
# Process any command line options.
$parser = Getopt::Long::Parser->new();
$parser->configure("bundling");
if (! $parser->getoptions("confirm|c" => \$confirm,
"dep-level=i" => \$dep_level,
"destdir|d=s" => \$dest_dir,
"globs-file|g=s" => \$globs_file,
"interactive|i" => \$interactive,
"libdir|l=s" => \$lib_dir,
"prefix|p=s" => \$prefix_dir,
"quiet|q" => \$quiet,
"use-dists-mas!" => \$use_dists_mas_lib,
"help|?" => \$help,
"man|m" => \$man))
{
pod2usage(1);
}
pod2usage(0) if ($help);
pod2usage(-exitstatus => 0, -verbose => 2) if ($man);
# Do dependency checks if required.
if ($dep_level > 0)
{
my(%deps,
$met);
# Build up the dependency list.
%deps = ("Glib" => 1.144,
"Gnome2" => 1.042,
"Gnome2::Canvas" => 1.002,
"Gnome2::Print" => 1.000,
"Gnome2::VFS" => 1.080,
"Gtk2" => 1.146,
"Gtk2::GladeXML" => 1.006,
"Gtk2::SourceView" => 1.000,
"Locale::TextDomain" => 1.16);
$deps{"Monotone::AutomateStdio"} = 0.02 if (! $use_dists_mas_lib);
# Do the check.
$met = check_dependencies(\%deps);
# Deal with the result depending upon what the user wants.
exit($met ? 0 : 1) if ($dep_level == 1 || ($dep_level == 2 && ! $met));
}
# Do interactive stuff and validate options.
print("Linux installer for mtn-browse\n\n") if ($interactive);
while (1)
{
print("Where is your MIME globs file? [" . $globs_file . "]: ");
chomp($input = <STDIN>);
($input) = ($input =~ m/^\s*(.*)\s*$/);
if ($input ne "")
if ($interactive)
{
if (! -f $input)
{
print("Error: File `" . $input . "' is unreadable.\n");
next;
}
$globs_file = $input;
print("Where is your MIME globs file? [" . $globs_file . "]: ");
chomp($input = <STDIN>);
($input) = ($input =~ m/^\s*(.*)\s*$/);
$globs_file = $input if ($input ne "");
}
if (! -f $globs_file)
{
print("Error: File `" . $globs_file . "' is unreadable.\n");
exit(1) if (! $interactive);
next;
}
print("Where do you want to install it? [" . $prefix_dir . "]: ");
chomp($input = <STDIN>);
($input) = ($input =~ m/^\s*(.*)\s*$/);
if ($input ne "")
if ($interactive)
{
if (-e $input && (! -d $input || ! -w $input))
{
print("Error: Directory `" . $input . "' is unwritable or not "
. "a directory.\n");
next;
}
$prefix_dir = $input;
print("Where will it be run from (PREFIX_DIR)? [" . $prefix_dir
. "]: ");
chomp($input = <STDIN>);
($input) = ($input =~ m/^\s*(.*)\s*$/);
$prefix_dir = $input if ($input ne "");
}
if (-e $prefix_dir && ! -d $prefix_dir)
{
print("Error: Directory `" . $prefix_dir . "' is not a "
. "directory.\n");
exit(1) if (! $interactive);
next;
}
$lib_dir = $prefix_dir . "/lib/mtn-browse";
print("Where should the libraries go? [" . $lib_dir . "]: ");
chomp($input = <STDIN>);
($input) = ($input =~ m/^\s*(.*)\s*$/);
if ($input ne "")
if ($interactive)
{
if (-e $input && (! -d $input || ! -w $input))
{
print("Error: Directory `" . $input . "' is unwritable or not "
. "a directory.\n");
next;
}
$lib_dir = $input;
print("Where do you want to copy it to (DEST_DIR)? [" . $dest_dir
. "]: ");
chomp($input = <STDIN>);
($input) = ($input =~ m/^\s*(.*)\s*$/);
$dest_dir = $input if ($input ne "");
}
$prefix_dest_dir = $dest_dir . $prefix_dir;
if (-e $prefix_dest_dir
&& (! -d $prefix_dest_dir || ! -w $prefix_dest_dir))
{
print("Error: Directory `" . $prefix_dest_dir . "' is unwritable "
. "or not a directory.\n");
exit(1) if (! $interactive);
next;
}
print("Use the Monotone::AutomateStdio (MAS) library that came with "
. "this package? [Y]: ");
chomp($input = <STDIN>);
if ($input =~ m/^\s*[nN]\s*$/)
if ($interactive)
{
$use_dist_mas_lib = 0;
print("Where should the libraries go (LIB_DIR)? [<PREFIX_DIR>"
. $lib_dir . "]: ");
chomp($input = <STDIN>);
($input) = ($input =~ m/^\s*(.*)\s*$/);
$lib_dir = $input if ($input ne "");
}
else
$lib_prefix_dir = $prefix_dir . $lib_dir;
$lib_dest_dir = $dest_dir . $prefix_dir. $lib_dir;
if (-e $lib_dest_dir && (! -d $lib_dest_dir || ! -w $lib_dest_dir))
{
$use_dist_mas_lib = 1;
print("Error: Directory `" . $lib_dest_dir . "' is unwritable or "
. "not a directory.\n");
exit(1) if (! $interactive);
next;
}
($input) = ($input =~ m/^\s*(.*)\s*$/);
if ($input ne "")
if ($interactive)
{
if (-e $input && (! -d $input || ! -w $input))
print("Use the Monotone::AutomateStdio (MAS) library that came "
. "with this package? [Y]: ");
chomp($input = <STDIN>);
if ($input =~ m/^\s*[nN]\s*$/)
{
print("Error: Directory `" . $input . "' is unwritable or not "
. "a directory.\n");
next;
$use_dists_mas_lib = 0;
}
$lib_dir = $input;
else
{
$use_dists_mas_lib = 1;
}
}
print("\nInstallation options are:\n");
print("GLOBS_FILE = " . $globs_file . "\n");
print("PREFIX_DIR = " . $prefix_dir . "\n");
print("LIB_DIR = " . $lib_dir . "\n");
print("Use my MAS = " . ($use_dist_mas_lib ? "Yes" : "No") . "\n");
print("\nAccept these? [N]: ");
chomp($input = <STDIN>);
if ($input =~ m/^\s*[yY]\s*$/)
if ($confirm || $interactive || ! $quiet)
{
print("\nInstallation options are:\n");
print("GLOBS_FILE = " . $globs_file . "\n");
print("PREFIX_DIR = " . $prefix_dir . "\n");
print("DEST_DIR = " . $dest_dir . "\n");
print("LIB_DIR = <PREFIX_DIR>" . $lib_dir . "\n");
print("Use my MAS = " . ($use_dists_mas_lib ? "Yes" : "No")
. "\n");
}
if ($interactive)
{
print("\nAccept these? [N]: ");
chomp($input = <STDIN>);
if ($input =~ m/^\s*[yY]\s*$/)
{
last;
}
}
elsif ($confirm)
{
print("\nPress <Return> to continue: ");
<STDIN>;
last;
}
else
{
last;
}
}
print("Installing...\n") if (! $quiet);
$installer = Installer->new(0, 0, 0755, 0755, 0644);
# Install `executable'.
if (! defined($outfile = IO::File->new("mtn-browse.out", "w")));
while (defined($input = $infile->getline()))
{
$input =~ s/\@INST:LIB_DIR\@/$lib_dir/g;
$input =~ s/\@INST:LIB_DIR\@/$lib_prefix_dir/g;
$input =~ s/\@INST:GLOBS_FILE\@/$globs_file/g;
$input =~ s/\@INST:PREFIX_DIR\@/$prefix_dir/g;
$outfile->print($input);
$outfile->close();
$infile = $outfile = undef;
$installer->install("mtn-browse.out",
"${prefix_dir}/bin/mtn-browse",
"${prefix_dest_dir}/bin/mtn-browse",
0755);
unlink("mtn-browse.out");
if (! defined($dir = IO::Dir->new("lib/perl")));
while (defined($file = $dir->read()))
{
$installer->install("lib/perl/$file", "${lib_dir}/perl/$file")
$installer->install("lib/perl/$file", "${lib_dest_dir}/perl/$file")
if ($file =~ m/.*\.pm$/);
}
$dir->close();
if ($use_dist_mas_lib)
if ($use_dists_mas_lib)
{
my $mas_dir;
if (-r "lib/perl/Monotone/AutomateStdio.pm")
while (defined($file = $dir->read()))
{
$installer->install("${mas_dir}/$file",
"${lib_dir}/perl/Monotone/$file")
"${lib_dest_dir}/perl/Monotone/$file")
if ($file =~ m/.*\.pm$/ || $file =~ m/.*\.pod$/);
}
$dir->close();
# Install GUI components.
$installer->install("lib/ui/mtn-browse.glade",
"${lib_dir}/ui/mtn-browse.glade");
"${lib_dest_dir}/ui/mtn-browse.glade");
die("IO::Dir failed with $!")
if (! defined($dir = IO::Dir->new("lib/ui/pixmaps")));
while (defined($file = $dir->read()))
{
$installer->install("lib/ui/pixmaps/$file", "${lib_dir}/ui/$file")
$installer->install("lib/ui/pixmaps/$file", "${lib_dest_dir}/ui/$file")
if ($file =~ m/.*\.png$/);
}
$dir->close();
system("msgfmt --output-file=translations/${locale}.mo "
. "translations/$file");
$installer->install("translations/${locale}.mo",
"${prefix_dir}/share/locale/${locale}/"
"${prefix_dest_dir}/share/locale/${locale}/"
. "LC_MESSAGES/mtn-browse.mo");
}
}
exit(0);
}
#
##############################################################################
#
# Routine - check_dependencies
#
# Description - Checks that the specified Perl package dependencies are
# met. The code was taken/stolen from ExtUtils::MakeMaker.
#
# Data - $dependencies : A reference to a hash containing the
# dependencies, where the key is the package
# name and the value is the required version
# number. If the version number is zero then
# only the presence of the package is tested.
# Return Value : True if the dependencies are met, otherwise
# false if they are not.
#
##############################################################################
sub check_dependencies($)
{
my $dependencies = $_[0];
my $met = 1;
foreach my $dep (sort(keys(%$dependencies)))
{
# Attempt to eval the package in. Perl 5.8.0 has a bug with require
# Foo::Bar alone in an eval, so an extra statement is a workaround.
eval "require $dep; 0";
# What was the outcome?
if ($@ ne "")
{
# Not installed.
printf(STDERR "Warning: prerequisite %s %s not found.\n",
$dep,
$dependencies->{$dep});
$met = undef;
}
elsif ($dependencies->{$dep} > 0)
{
my $version;
# Installed, and we need to check the version number.
# Get the version number, converting X.Y_Z alpha version #s to X.YZ
# for easier comparisons.
$version = defined($dep->VERSION) ? $dep->VERSION : 0;
$version =~ s/(\d+)\.(\d+)_(\d+)/$1.$2$3/;
# Now check the version numbers.
if ($version < $dependencies->{$dep})
{
printf(STDERR
"Warning: prerequisite %s %s not found. We have %s.\n",
$dep,
$dependencies->{$dep},
$version);
$met = undef;
}
}
}
return $met;
}
##############################################################################
#
# Embedded Documentation For This Module
#
##############################################################################
__END__
=head1 linux-install
linux-install - Linux installer for the mtn-browse application
=head1 SYNOPSIS
linux-install [options]
Options:
--confirm -c Print out what will happen first
--dep-level LEVEL Specify type of dependency checking
--destdir= -d DIR Specify temp installation location
--globs-file= -g FILE Location of mime globs file
--interactive -i Ask questions interactively
--libdir= -l DIR Library dir relative to PREFIX_DIR
--prefix= -p DIR Installation location
--quiet -q Keep quiet
--(no)-use-dists-mas Use/don't use MAS within distro
--help -? Print this help text
--man -m Print full help text
=head1 OPTIONS
=over 8
=item B<--confirm or -c>
Print out what will be done before actually doing it.
=item B<--dep-level LEVEL>
Specify type of dependency checking. Valid values are:
0 - No dependency checking at all.
1 - Do dependency checking only.
2 - Do dependency checking and exit with an error code if
they are not met. This is the default.
3 - Do dependency checking and continue with the installation
regardless.
=item B<--destdir=DIR or -d DIR>
Specify the destination directory for the installation process. In effect this
path is prepended onto the PREFIX_DIR path. Normally this is blank. Any
directory paths in the application will still assume that it is installed in
the PREFIX_DIR directory. This option is particularly useful for package
maintainers.
=item B<--globs-file=FILE or -g FILE>
Specify the location of the system's MIME globs file. The default is
/usr/share/mime/globs.
=item B<--interactive or -i>
Ask for all of the installation options interactively rather than getting
settings from the command line.
=item B<--libdir=DIR or -l DIR>
Specify the library directory, relative to <PREFIX_DIR>, for the the mtn-browse
application. The default is (<PREFIX_DIR>)/lib/mtn-browse.
=item B<--prefix=DIR or -p DIR>
Specify the final base installation directory. mtn-browse will assume it is
running from the <PREFIX_DIR>/bin directory and its libraries are located in
<PREFIX_DIR>/<LIB_DIR>.
=item B<--quiet or -q>
Do not output anything to the screen.
=item B<--(no)-use-dists-mas>
Select whether to use the Monotone::AutomateStdio library that shipped with
mtn-browse or use one already installed on your system. The default is to use
the one that comes with mtn-browse.
=item B<-help>
Print a brief help message and exit.
=item B<-man or -m>
Prints the manual page and exit.
=back
=head1 DESCRIPTION
This program is the installer for the mtn-browse application. It is assumed
that this script will be run in the top level directory of the hierarchy made
by unpacking the tar file that mtn-browse was shipped in.
=cut
mtn-browse
4040
4141
4242
43
43
4444
4545
4646
# ***** DIRECTIVES *****
require 5.008;
require 5.008005;
BEGIN
{

Archive Download the corresponding diff file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status