Re: custom install targets

Bram Moolenaar <[email protected]> Thu, 15 Jan 2004 20:05:29 +0100
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
Scott Henry Harrison wrote:

> >> Right, you also need to manually do something for uninstalling then.
> >> It's very similar:  
> >> 
> >> 	uninstall-local:
> >> 	   :del $CUSTOM1DIR/$*INSTALL_CUSTOM1  
> >> 
> > I agree.  The syntax as you have it is simple enough
> 
> But does not appear to work... 
> 
>  --begin main.aap--
> INSTALL_DIAGNOSTICSCRIPT += 
> $(SOURCEPREFIX)system_dependencies/tests/mysql_requirements.pl
> DIAGNOSTICSCRIPTDIR = /tmp/ 
> 
> uninstall-local :
>  :del $DIAGNOSTICSCRIPTDIR/$*INSTALL_DIAGNOSTICSCRIPT
>  :print Deinstallation completed 
> 
> install-local :
>  :copy $INSTALL_DIAGNOSTICSCRIPT $DIAGNOSTICSCRIPTDIR
>  :print Installation completed
>  --end main.aap-- 
> 
> [[email protected] build]$ aap uninstall
> Aap: Error in recipe "/home/sharrison/svn/repos/trunk/build/main.aap" line 
> 37: No such file or directory: 
> "/tmp//../system_dependencies/tests/mysql_requirements.pl" 
> 
> Thus, the error is that the leading filesystem paths need to be
> removed. 
> 
> Blindly removing the directory is not an option for me
> (only remove the directory if it is empty and non-essential). 
> 
> Now, should this involve some form of python custom-fix,
> or do you know of any built-in A-A-P solution? 

Sorry for giving you a non-working example.  I should have tried it...

It's probably best to use the same functions that are used for the
default uninstall actions (in the default.aap recipe):

	uninstall-local:
	   @uninstall_files(_no.DIAGNOSTICSCRIPTDIR, _no.INSTALL_DIAGNOSTICSCRIPT)

For installing a similar construct could be used:

	install-local:
	   @install_files(_no.DIAGNOSTICSCRIPTDIR, _no.INSTALL_DIAGNOSTICSCRIPT, '0644')

Where "0644" is the mode of the installed file.  This time I verified it
actually works! :-)

Now, this isn't obvious.  It would be possible to define actions to hide
the Python function, but it requires passing two arguments.  Something
like:

	:do install {dir = $DIAGNOSTICSCRIPTDIR} $INSTALL_DIAGNOSTICSCRIPT
	:do uninstall {dir = $DIAGNOSTICSCRIPTDIR} {mode = 0644} $INSTALL_DIAGNOSTICSCRIPT

I suppose the Python functions are actually simpler to use.  They should
be documented though.

-- 
GALAHAD: No. Look, I can tackle this lot single-handed!
GIRLS:   Yes, yes, let him Tackle us single-handed!
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\  Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html  ///


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn