PEAR installer - ideas....
| From: | Alan Knowles | Date: | Fri, 23 Nov 2001 03:13:22 +0000 |
| Subject: | PEAR installer - ideas.... | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-3055@lists.php.net to get a copy of this message | ||
Hi, I have been looking at the installer on pear for some more generic uses, here are the two situations
1. I would like my application to install into the PEAR directory (not supplied by PEAR, but installed in that directory..)
2. I wanted to use the CVSLib from chora, but I dont want to copy the code into my application (and keep updating it manually), I needed a way to create a downloader that would install it using http calls to chora..
Looking at the current situation with the pear installer (ignoring C extension issues at present..) I had the following issues
At present the Pear installer depends on extensions :zlib, expat
and Pear module Archive_tar (not sure what else....)
from the angle here = the base installer should not depend on anything other than php existing.
I built an installer for phpmole, and intend to use it to try and solve the CVSLib problem,
These are some of the ideas I used to build it - they may be worth considering for the PEAR installer.
1. The package.xml can contain a 4 line script to access the installer script. see note at end about #php package.xml
2. the core installer is a single small php file. - Its purpose is to download (if the not already installed, the key classes to run a installer)
3. the key files that the installer grabs are: a pure php based xml parser/tree builder, and the installer class.
4. the package definition file is extended to include meta data about dependancies, download location etc.
The working code is at
Installer :
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/phpmole-ide/phpmole/installer/installer.php?rev=HEAD&content-type=text/vnd.viewcvs-markup
Installer class:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/phpmole-ide/phpmole/installer/phpmole_installer.class?rev=HEAD&content-type=text/vnd.viewcvs-markup
HTML/XML parser base class:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/phpmole-ide/phpmole/languages/HTML/parser_HTML_base.class?rev=HEAD&content-type=text/vnd.viewcvs-markup
XML tree builder/manager:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/phpmole-ide/phpmole/languages/XML/parser_XML.class?rev=HEAD&content-type=text/vnd.viewcvs-markup
Details of Extra package meta data:
DEPENDENCIES
<depends>
<executable>ci</executable>
<executable>co</executable>
<executable>rcs</executable>
<module>php_gtk</module>
<class>Gtk</class>
<class>GtkScintilla</class>
</depends>
- support for checking if extensions are available/ and whether it can find executables.
RECOMMENDS
<recommends>
<module>curl</module>
<class>GtkHTML</class>
</recommends> - support for recommended modules - things that make the application/module work better.
POSTINSTALL <postinstall>
<message>
--------------INSTALL COMPLETED---------------
some message here
--------------FIRE IT UP!---------------------
</message>
</postinstall>
- post install could also do things like <winexecute> or <unixexecute> to do a set of shell commands.
SOURCE
<source>
<cvsweb>
<host>cvs.sourceforge.net</host>
<root>cgi-bin/viewcvs.cgi</root>
<dir>phpmole-ide/phpmole</dir>
<branch>1.79.2</branch> <!-- eg. php 4_0_7 branch -->
</cvsweb> </source> -- where to download the application from.. - the example above is cvsweb, but I have written the chora support, and it would not take much to add 'tgz' support. - but since I dont know if the user has zlib/or tar xvfz.. these transports are safer
INSTALLSCRIPT
<installer>
<script language="php">
$install_file = __FILE__;
@include("PEAR/Installer.php");
if (!$pear_installer_loaded) include("http://cvs.php.net/co.php/php4/pear/PEAR/Installer.php?p=1");
</script>
</installer>
---
The installer could then be started by
php package.xml
or
php http://cvs.php.net/co.php/php4/pear/PEAR/package.xml
Anyway - let me know what you think -- not too many flames pls:)
regards
alan