monotone

monotone Commit Details

Date:2009-02-08 18:57:31 (10 years 4 months ago)
Author:Tony Cooper
Branch:net.venge.monotone.contrib.mtn-browse
Commit:2eeb34f445a95a8a1b230b5991c4cc2ded0b0934
Parents: e471da4d6e123bc2c2263dd8b4c7b1dd462039d6
Message:- Added a Makefile.PL style install capability.

- Split out the dependency checker into a separate module.
- Updated INSTALL and README with the up to date details of installation.
- Moved the support modules for linux-installer into their own subdirectory.
Changes:
RInstaller.pm → installer-files/Installer.pm
Rlinux-install → linux-installer
Ainstaller-files
AMakefile.PL (full)
Ainstaller-files/DependencyChecker.pm (full)
MINSTALL (1 diff)
MREADME (3 diffs)
Mlinux-installer (6 diffs)

File differences

INSTALL
11
2
2
3
4
5
6
7
8
9
10
11
See the INSTALLATION section in the README file, or if you are feeling lucky
just run linux-installer :-).
just do:
tar xvpzf mtn-browse-<Version Number>.tgz
cd mtn-browse-<Version Number>
perl Makefile.PL
make
make test
make install
:-).
Makefile.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
use 5.008005;
use strict;
use IO::File;
my($dest_dir,
$makefile,
$prefix_dir);
my %valid_options = (DESTDIR => \$dest_dir,
PREFIX => \$prefix_dir);
$dest_dir = $prefix_dir = "";
# Parse command line options.
foreach my $arg (@ARGV)
{
my($name,
$value);
($name, $value) = ($arg =~ m/^([^=]+)=(.*)$/);
$name = uc($name);
if (exists($valid_options{$name}))
{
${$valid_options{$name}} = $value;
}
else
{
print(STDERR
"usage: perl Makefile.PL [PREFIX=<PATH>] [DESTDIR<PATH]\n");
exit(1);
}
}
# Check that the dependencies are satisfied.
system("perl linux-installer --dep-level=1");
# Generate Makefile.
print("Writing Makefile for mtn-browse\n");
die("IO::File failed with $!")
if (! defined($makefile = IO::File->new("Makefile", "w")));
$makefile->print(<<EOF
DESTDIR=$dest_dir
PREFIX=$prefix_dir
INSTALLER=linux-installer
all: \$(INSTALLER)
\@echo "Ok."
test: \$(INSTALLER)
\@echo "Ok."
install: \$(INSTALLER)
EOF
);
$makefile->print("\$(INSTALLER)");
$makefile->print(" --prefix=\$(PREFIX)") if ($prefix_dir ne "");
$makefile->print(" --destdir=\$(DESTDIR)") if ($dest_dir ne "");
$makefile->print("\n");
$makefile->close();
exit(0);
README
2323
2424
2525
26
27
26
27
2828
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
2960
3061
3162
3263
33
34
64
65
3566
3667
3768
3869
3970
4071
41
72
4273
43
74
4475
45
76
4677
4778
4879
......
98129
99130
100131
132
133
101134
135
136
137
138
139
140
141
142
143
144
102145
103146
104147
......
116159
117160
118161
119
162
120163
121164
122165
INSTALLATION
------------
Using linux-install
-------------------
Using Makefile.PL
-----------------
Simply unpack the tar file and use Makefile.PL by doing:
tar xvpzf mtn-browse-<Version Number>.tgz
cd mtn-browse-<Version Number>
perl Makefile.PL
make
make test
make install
To install to a custom location use:
perl Makefile.PL PREFIX=<PATH>
To configure the software to run in a custom location but have the installation
location prepended by an additional path (useful for package maintainers) use:
perl Makefile.PL PREFIX=<PATH> DESTDIR=<PATH>
Those of you familiar with CPAN will recognise the above as the standard
mechanism for installing Perl modules (or libraries). However, there does not
seem to be a standard way of installing a Perl application. Since Perl is
largely platform independent, the ./configure; make; make install approach of
automake does not seem right so I have decided to write a custom Makefile.PL
script that supports some basic installation capability. Please note that
Makefile.PL only supports those arguments documented above.
Alternatively one can run the installer directly. See the next subsection.
Using linux-installer
---------------------
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 -i
chmod +x linux-installer
./linux-installer -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
./linux-installer --man
In particular, package maintainers may find the following particularly useful:
In particular, package maintainers may find the following useful:
./linux-install --prefix=/opt/mtn-browse --destdir=/tmp/install-dir
./linux-installer --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
1) The Monotone directory is only needed if the Monotone::AutomateStdio package
from CPAN has not already been installed.
Monotone::AutomateStdio Library
-------------------------------
This library module is a Perl interface to Monotone's automate stdio interface
and is heavily used by mtn-browse. As such it is probably best to upgrade this
library each time you upgrade Monotone itself. For this reason you may decide
to just install this library as a part of mtn-browse. If you need to upgrade
the library then all you need do is just copy the new version into place.
The installation process will, by default, install a copy of this library in
mtn-browse's lib directory.
DEPENDENCIES
------------
- Gtk2-GladeXML (1.006) *
- Gtk2-SourceView (1.000) *
- libintl-perl (1.16)
- Monotone::AutomateStdio
- Monotone::AutomateStdio (0.02 or later)
Please note that the Gtk2 CPAN bundle will probably satisfy all of the
dependencies marked with * at the end of the line.
installer-files/DependencyChecker.pm
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
##############################################################################
#
# File Name - DependencyChecker.pm
#
# Description - Mmodule that provides a simple module dependency checker.
# The idea was taken from ExtUtils::MakeMaker. I would have
# used the ExtUtils::Installed module but this does not seem
# to search for site specific module directories specified in
# PERLLIB.
#
# Author - A.E.Cooper.
#
# Legal Stuff - Copyright (c) 2009 Anthony Edward Cooper
# <aecooper@coosoft.plus.com>.
#
# This library is free software; you can redistribute it
# and/or modify it under the terms of the GNU Lesser General
# Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your
# option) any later version.
#
# This library is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU Lesser General Public License for
# more details.
#
# You should have received a copy of the GNU Lesser General
# Public License along with this library; if not, write to
# the Free Software Foundation, Inc., 59 Temple Place - Suite
# 330, Boston, MA 02111-1307 USA.
#
##############################################################################
#
##############################################################################
#
# Package - DependencyChecker
#
# Description - See above.
#
##############################################################################
# ***** PACKAGE DECLARATION *****
package DependencyChecker;
# ***** DIRECTIVES *****
require 5.008005;
use strict;
use warnings;
# ***** FUNCTIONAL PROTOTYPES *****
# Public routines.
sub check($);
# ***** PACKAGE INFORMATION *****
use base qw(Exporter);
our @EXPORT = qw();
our @EXPORT_OK = qw();
our $VERSION = 0.1;
#
##############################################################################
#
# Routine - check
#
# Description - Checks that the specified Perl package dependencies are
# met.
#
# 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($)
{
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;
}
1;
linux-installer
11
22
33
4
4
55
66
77
......
4141
4242
4343
44
4445
4546
4647
......
5556
5657
5758
59
5860
59
60
61
62
63
64
6561
6662
6763
......
154150
155151
156152
157
153
158154
159155
160156
......
376372
377373
378374
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
458375
459376
460377
......
463380
464381
465382
466
383
467384
468
385
469386
470387
471388
472
389
473390
474391
475392
#!/usr/bin/perl
##############################################################################
#
# File Name - linux-install
# File Name - linux-installer
#
# Description - Perl Linux installer for mtn-browse
#
require 5.008005;
use lib "installer-files";
use strict;
use warnings;
# Modules specific to this application.
use DependencyChecker;
use Installer;
# ***** FUNCTIONAL PROTOTYPES *****
# Private routines.
sub check_dependencies($);
#
##############################################################################
#
# Do the check.
$met = check_dependencies(\%deps);
$met = DependencyChecker::check(\%deps);
# Deal with the result depending upon what the user wants.
#
##############################################################################
#
# 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
=head1 linux-installer
linux-install - Linux installer for the mtn-browse application
linux-installer - Linux installer for the mtn-browse application
=head1 SYNOPSIS
linux-install [options]
linux-installer [options]
Options:
--confirm -c Print out what will happen first

Archive Download the corresponding diff file

Branches

Tags

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