Re: Installing PEAR packages in an idempotent fashion
Hi Justin, Ansgar, Justin Pryzby wrote: The big problem is installing the package itself in, I presume, the postinst script. My early tests were simply: pear -q install log but I found that when the package was installed this process would quit with an error second time around, stopping the script from being idempotent. At some stage this problem seemed to evaporate (maybe with lenny). Has anybody any words of wisdom to offer on how to handle pear module installations in an idempotent fashion? In my new version I've removed a lot of PEAR dependencies, and the only one that remained was Pear Log, so as Ansgar pointed out, it's a much better solution to simply but a dependency on php-log and remove pear as a dependency altogether now that I can! Thanks Ansgar for pointing that out. Nevertheless Justin, t=`tempfile` trap 'rm -fv -- $t' EXIT pear -q install log 2$tempfile || { ret=$? grep -Fx $the_error_message /dev/null $t || { cat $t exit $ret } } rm -f -- $t trap - EXIT I think this would also have been a great solution, but happily I can avoid it. I looked at the packaging for php-log itself to see if its postinst did anything interesting, but (perhaps obviously) it just installs the raw files that would pear would install and has no need for postinst magic. Thanks again to both of you, it's working a treat now on Etch and Lenny. CT. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Installing PEAR packages in an idempotent fashion
Hi, My package needs a Pear package, specifically Pear Log, it has php-pear in its dependencies. The big problem is installing the package itself in, I presume, the postinst script. My early tests were simply: pear -q install log but I found that when the package was installed this process would quit with an error second time around, stopping the script from being idempotent. At some stage this problem seemed to evaporate (maybe with lenny). However, somebody installed the package (currently obtained directly from my repo) today on an etch system and the postinst barfed on this point - strangely one other person has done this with no problems. On Lenny, the behaviour is -=- imladris:/home/colin# pear -q install log Nothing to install imladris:/home/colin# echo $? 0 -=- On Etch -=- fs1:/usr/share/opus# pear install log Did not download optional dependencies: pear/MDB2, use --alldeps to download automatically Skipping package pear/Log, already installed as version 1.9.11 No valid packages found install failed fs1:/usr/share/opus# echo $? 1 fs1:/usr/share/opus# pear -q install log No valid packages found install failed fs1:/usr/share/opus# echo $? 1 -=- Has anybody any words of wisdom to offer on how to handle pear module installations in an idempotent fashion? Thanks, CT. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: Installing PEAR packages in an idempotent fashion
On Fri, Apr 18, 2008 at 05:13:29PM +0100, Colin Turner wrote: Hi, My package needs a Pear package, specifically Pear Log, it has php-pear in its dependencies. The big problem is installing the package itself in, I presume, the postinst script. My early tests were simply: pear -q install log but I found that when the package was installed this process would quit with an error second time around, stopping the script from being idempotent. At some stage this problem seemed to evaporate (maybe with lenny). Has anybody any words of wisdom to offer on how to handle pear module installations in an idempotent fashion? You could read the source for pear and figure out under what conditions it exits with an error, and avoid calling it in that case: grep 'something' /path/somefile || pear -q install log. You could also (perhaps) test in postinst the $2 value to see if the package has been configured before (the earlier solution is better IMO). You could also test that, if it fails, it fails for that reason, and allow that failure. t=`tempfile` trap 'rm -fv -- $t' EXIT pear -q install log 2$tempfile || { ret=$? grep -Fx $the_error_message /dev/null $t || { cat $t exit $ret } } rm -f -- $t trap - EXIT #Justin -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: Installing PEAR packages in an idempotent fashion
Hi, Colin Turner wrote: My package needs a Pear package, specifically Pear Log, it has php-pear in its dependencies. The big problem is installing the package itself in, I presume, the postinst script. My early tests were simply: pear -q install log I'm not very familiar with neither Pear nor PHP, but doesn't the php-log package provide this? If so, is there a reason to not just depend on it? Regards, Ansgar -- PGP: 1024D/595FAD19 739E 2D09 0969 BEA9 9797 B055 DDB0 2FF7 595F AD19 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]