[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ocaml 3.04-3 uploaded

On Fri, Jan 11, 2002 at 03:07:41PM +0100, Sven wrote:
> > OTOH, a dh_ocaml debhelper script would be helpful to automatically call
> > update-ocaml-ldconf in post{inst,rm} scripts.
> huh ???
> Do you mean to have a dh_ocaml script which would add the propper
> update-ocaml-ldconf calls in the post{inst,rm} files ?

Hi again,

here is an implementation.  This dh_ocamlld script add calls to Stefano's OCaml
program (called ocaml-ldconf in these files) in postinst and postrm scripts.
The post{inst,rm}-ocamlld snippets must first be put into
/usr/share/debhelper/autoscripts/ directory.

Its documentation says that multiple directories can be put on command line,
but it does not work.  We can either fix Stefano's tool to accept multiple
-a and -r flags on command line, or change dh_ocamlld to call it for each
directory, in which case the last block becomes

	if (@dirs && ! $dh{NOSCRIPTS}) {
		foreach $DIR (@dirs) {
			autoscript($package,"postinst","postinst-ocamlld", "s/#DIR#/$DIR/");
			autoscript($package,"postrm","postrm-ocamlld", "s/#DIR#/$DIR/");

#!/usr/bin/perl -w

=head1 NAME

dh_ocamlld - add calls to ocaml-ldconf in maintainer scripts


use strict;
use Debian::Debhelper::Dh_Lib;


B<dh_ocamlld> [S<I<debhelper options>>] [B<-A>] [B<-n>] S<I<dir ...>>


dh_ocamlld is a debhelper program that automatically adds calls to
C<ocaml-ldconf> in maintainer scripts.

=head1 OPTIONS

=over 4

=item B<-A>, B<--all>

Change maintainer scripts for ALL packages acted on, not just the first.

=item B<-n>, B<--noscripts>

Do nothing.

=item I<dir ...>

Specify directories to pass through C<ocaml-ldconf>.




foreach my $package (@{$dh{DOPACKAGES}}) {
	my (@dirs, $DIR);

	if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
		push @dirs, @ARGV;
	if (@dirs && ! $dh{NOSCRIPTS}) {
		$DIR = join(' -a ', @dirs);
		autoscript($package,"postinst","postinst-ocamlld", "s/#DIR#/$DIR/");
		my $DIR = join(' -r ', @dirs);
		autoscript($package,"postrm","postrm-ocamlld", "s/#DIR#/$DIR/");

=head1 AUTHOR

Denis Barbier E<lt>barbier@debian.orgE<gt>

if [ "$1" = "configure" ]; then
	ocaml-ldconf -a #DIR#
if [ "$1" = "remove" ]; then
	ocaml-ldconf -r #DIR#

Reply to: