# # # rename "Installer.pm" # to "installer-files/Installer.pm" # # rename "linux-install" # to "linux-installer" # # add_dir "installer-files" # # add_file "Makefile.PL" # content [83b18295296a23c35dd2406e6c3a5f4a6dc01975] # # add_file "installer-files/DependencyChecker.pm" # content [84176500545fee6843587ada1d3cf7865502792d] # # patch "INSTALL" # from [ddc0155f1301d07489c499b213afce15dfbb6347] # to [9882e7fc68399b69face7d957db7b2f2996889a7] # # patch "README" # from [9243454cecbc9ef3eb17aa4667fd3a7f91170e47] # to [a0c93bafbdc917861e5a97101be4a9dfc87be130] # # patch "linux-installer" # from [071db6af96c09d800f1de45296238921f33b9108] # to [7fa07c5c648d46fb88852ed9cd6407b54c307a14] # ============================================================ --- Makefile.PL 83b18295296a23c35dd2406e6c3a5f4a6dc01975 +++ Makefile.PL 83b18295296a23c35dd2406e6c3a5f4a6dc01975 @@ -0,0 +1,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=] [DESTDIRnew("Makefile", "w"))); +$makefile->print(<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); ============================================================ --- installer-files/DependencyChecker.pm 84176500545fee6843587ada1d3cf7865502792d +++ installer-files/DependencyChecker.pm 84176500545fee6843587ada1d3cf7865502792d @@ -0,0 +1,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 +# . +# +# 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; ============================================================ --- INSTALL ddc0155f1301d07489c499b213afce15dfbb6347 +++ INSTALL 9882e7fc68399b69face7d957db7b2f2996889a7 @@ -1,2 +1,11 @@ See the INSTALLATION section in the READ See the INSTALLATION section in the README file, or if you are feeling lucky -just run linux-installer :-). +just do: + + tar xvpzf mtn-browse-.tgz + cd mtn-browse- + perl Makefile.PL + make + make test + make install + +:-). ============================================================ --- README 9243454cecbc9ef3eb17aa4667fd3a7f91170e47 +++ README a0c93bafbdc917861e5a97101be4a9dfc87be130 @@ -23,26 +23,57 @@ INSTALLATION ------------ -Using linux-install -------------------- +Using Makefile.PL +----------------- +Simply unpack the tar file and use Makefile.PL by doing: + + tar xvpzf mtn-browse-.tgz + cd mtn-browse- + perl Makefile.PL + make + make test + make install + +To install to a custom location use: + + perl Makefile.PL PREFIX= + +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= DESTDIR= + +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-.tgz cd mtn-browse- - 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 @@ -98,7 +129,19 @@ 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 ------------ @@ -116,7 +159,7 @@ - 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. ============================================================ --- linux-install 071db6af96c09d800f1de45296238921f33b9108 +++ linux-installer 7fa07c5c648d46fb88852ed9cd6407b54c307a14 @@ -1,7 +1,7 @@ #!/usr/bin/perl ############################################################################## # -# File Name - linux-install +# File Name - linux-installer # # Description - Perl Linux installer for mtn-browse # @@ -41,6 +41,7 @@ require 5.008005; require 5.008005; +use lib "installer-files"; use strict; use warnings; @@ -55,13 +56,8 @@ use Pod::Usage; # Modules specific to this application. +use DependencyChecker; use Installer; - -# ***** FUNCTIONAL PROTOTYPES ***** - -# Private routines. - -sub check_dependencies($); # ############################################################################## # @@ -154,7 +150,7 @@ sub check_dependencies($); # Do the check. - $met = check_dependencies(\%deps); + $met = DependencyChecker::check(\%deps); # Deal with the result depending upon what the user wants. @@ -376,85 +372,6 @@ sub check_dependencies($); # ############################################################################## # -# 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 # ############################################################################## @@ -463,13 +380,13 @@ __END__ __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