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

Bug#651131: dh-ocaml: debhelper sequence cannot be used with additional options



tags 651131 + patch
thanks

Here is the patch that:
 1. Add dh_ocamlclean with the same code as dh_ocamlinit -d
 2. Adds a deprecation warning for dh_ocamlinit -d, in case if someone
    uses it without dh or cdbs
 3. Uses dh_ocamlclean instead of dh_ocamlinit -d in all places

I tested it with coccinelle and it breaks nothing, and it is possible to
use that --parallel option. It would be good if someone could try it with
packages that use those *.in files.

Regards,
Eugeniy Meshcheryakov

6 грудня 2011 о 02:07 +0100 Євгеній Мещеряков написав(-ла):
> Package: dh-ocaml
> Version: 1.0.2
> Severity: important
> 
> The debhelper sequence cannot be used if additional options are passed
> to dh, like this:
> 
>    dh $@ --with ocaml --parallel
> 
> In this case package build fails with this:
> 
>       "dh_ocamlinit -d" -O--parallel
>    make: *** [clean] Error 255
> 
> Without additional options it works because dh uses system() to execute
> commands and it behaves differently with only one argument. I do not
> think that this is a failure of debhelper because ocaml seems to be the 
> only sequence with command that has parameters, and I think it is hard to
> use overrides for that "dh_ocamlinit -d".
> 
> I think the functionality of dh_ocamlinit -d should be split into a new
> program, called for example dh_ocamlclean.
> 
> -- System Information:
> Debian Release: wheezy/sid
>   APT prefers unstable
>   APT policy: (500, 'unstable')
> Architecture: amd64 (x86_64)
> 
> Kernel: Linux 3.1.0-1-amd64 (SMP w/2 CPU cores)
> Locale: LANG=uk_UA.UTF-8, LC_CTYPE=uk_UA.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/dash
> 
> dh-ocaml depends on no packages.
> 
> Versions of packages dh-ocaml recommends:
> ii  debhelper  8.9.11
> ii  ocaml-nox  3.12.1-2
> 
> Versions of packages dh-ocaml suggests:
> ii  git  1:1.7.7.3-1
> 
> -- no debconf information
From 1d0e0bd62f16939d6b058fa10c421b9431d4d78a Mon Sep 17 00:00:00 2001
From: Eugeniy Meshcheryakov
 <Євгеній Мещеряков eugen@debian.org>
Date: Wed, 7 Dec 2011 21:01:44 +0100
Subject: [PATCH] Add new program, dh_ocamlclean, for cleaning files generated
 by dh_ocamlinit, and use it instead of dh_ocamlinit -d
 (closes: #651131)

---
 cdbs/1/rules/ocaml.mk   |    2 +-
 debhelper/Makefile      |    2 +-
 debhelper/dh_ocamlclean |   58 +++++++++++++++++++++++++++++++++++++++++++++++
 debhelper/dh_ocamlinit  |    4 ++-
 debhelper/ocaml.pm      |    8 +++---
 debian/changelog        |    7 +++++
 debian/install          |    1 +
 share/ocamlinit.mk      |    2 +-
 8 files changed, 76 insertions(+), 8 deletions(-)
 create mode 100755 debhelper/dh_ocamlclean

diff --git a/cdbs/1/rules/ocaml.mk b/cdbs/1/rules/ocaml.mk
index 458b4cd..86fe11b 100644
--- a/cdbs/1/rules/ocaml.mk
+++ b/cdbs/1/rules/ocaml.mk
@@ -87,7 +87,7 @@ ocamlinit-stamp:
 
 .PHONY: ocamlinit-clean
 ocamlinit-clean:
-	dh_ocamlinit -d
+	dh_ocamlclean
 
 pre-build:: ocamlinit-stamp
 clean:: ocamlinit-clean
diff --git a/debhelper/Makefile b/debhelper/Makefile
index 8792a77..014ba6d 100644
--- a/debhelper/Makefile
+++ b/debhelper/Makefile
@@ -1,5 +1,5 @@
 
-PAGES=dh_ocaml.1 dh_ocamlinit.1 dh_ocamldoc.1 ocaml-md5sums.1 ocaml-lintian.1
+PAGES=dh_ocaml.1 dh_ocamlinit.1 dh_ocamlclean.1 dh_ocamldoc.1 ocaml-md5sums.1 ocaml-lintian.1
 
 all:
 	for i in $(PAGES); do \
diff --git a/debhelper/dh_ocamlclean b/debhelper/dh_ocamlclean
new file mode 100755
index 0000000..531900e
--- /dev/null
+++ b/debhelper/dh_ocamlclean
@@ -0,0 +1,58 @@
+#!/usr/bin/perl -w
+
+# Copyright © 2009 Mehdi Dogguy <mehdi@debian.org>
+# Copyright © 2010 Stéphane Glondu <glondu@debian.org>
+#
+# This is free software, you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 or above
+# as published by the Free Software Foundation.
+#
+# This program 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
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
+
+=head1 NAME
+
+dh_ocamlclean - Clean files generated by dh_ocamlinit.
+
+=cut
+
+use strict;
+use Debian::Debhelper::Dh_Lib;
+init();
+
+=head1 SYNOPSIS
+
+B<dh_ocamlclean> [S<I<debhelper options>>]
+
+=head1 DESCRIPTION
+
+dh_ocamlinit cleans files generated by dh_ocamlinit from present
+debian/*.in ones.
+
+=cut
+
+my @ocaml_in_files = split /\n/,
+    `find debian/ -type f -name "*.in" -not \\( -name control\.in \\) | sed 's/.in\$//'`;
+
+inhibit_log();
+complex_doit("rm -f ocamlinit-stamp @ocaml_in_files");
+exit;
+
+=head1 SEE ALSO
+
+L<debhelper(7)>, L<dh(1)>, L<dh_ocaml(1)>, L<dh_ocamlinit(1)>
+
+This program is meant to be used together with debhelper.
+
+=head1 AUTHOR
+
+Mehdi Dogguy <mehdi@debian.org>
+
+=cut
diff --git a/debhelper/dh_ocamlinit b/debhelper/dh_ocamlinit
index 0259522..3d99612 100755
--- a/debhelper/dh_ocamlinit
+++ b/debhelper/dh_ocamlinit
@@ -48,6 +48,7 @@ OCAMLINIT_SED environment variable.
 =item B<-d>
 
 Clean files generated from present debian/*.in ones and exit.
+This option is deprecated, use dh_ocamlclean instead.
 
 =back
 
@@ -67,6 +68,7 @@ my @ocaml_in_files = split /\n/,
     `find debian/ -type f -name "*.in" -not \\( -name control\.in \\) | sed 's/.in\$//'`;
 
 if (defined($dh{D_FLAG})) {
+    warning("dh_ocamlinit -d is deprecated; use dh_ocamlclean instead");
     inhibit_log();
     complex_doit("rm -f ocamlinit-stamp @ocaml_in_files");
     exit;
@@ -98,7 +100,7 @@ complex_doit("touch ocamlinit-stamp") unless defined($dh{D_FLAG});
 
 =head1 SEE ALSO
 
-L<debhelper(7)>, L<dh(1)>, L<dh_ocaml(1)>
+L<debhelper(7)>, L<dh(1)>, L<dh_ocaml(1)>, L<dh_ocamlclean(1)>
 
 This program is meant to be used together with debhelper.
 
diff --git a/debhelper/ocaml.pm b/debhelper/ocaml.pm
index 9bf8f0f..4d635c0 100644
--- a/debhelper/ocaml.pm
+++ b/debhelper/ocaml.pm
@@ -3,9 +3,9 @@ use warnings;
 use strict;
 use Debian::Debhelper::Dh_Lib;
 
-insert_before ("dh_gencontrol"    , "dh_ocaml"       );
-insert_before ("dh_auto_configure", "dh_ocamlinit"   );
-insert_before ("dh_clean"         , "dh_ocamlinit -d");
-insert_before ("dh_installdocs"   , "dh_ocamldoc"    );
+insert_before ("dh_gencontrol"    , "dh_ocaml"     );
+insert_before ("dh_auto_configure", "dh_ocamlinit" );
+insert_before ("dh_clean"         , "dh_ocamlclean");
+insert_before ("dh_installdocs"   , "dh_ocamldoc"  );
 
 1;
diff --git a/debian/changelog b/debian/changelog
index 49644ac..41546e4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+dh-ocaml (1.0.3) unstable; urgency=low
+
+  * Add new program, dh_ocamlclean, for cleaning files generated by
+    dh_ocamlinit, and use it instead of dh_ocamlinit -d (closes: #651131)
+
+ -- Євгеній Мещеряков <eugen@debian.org>  Wed, 07 Dec 2011 20:57:53 +0100
+
 dh-ocaml (1.0.2) unstable; urgency=low
 
   * dom-new-git-repo: use git.debian.org for ssh host (Closes: #632246)
diff --git a/debian/install b/debian/install
index 371497c..9142b61 100644
--- a/debian/install
+++ b/debian/install
@@ -2,6 +2,7 @@ cdbs/1                  usr/share/cdbs
 share/*                 usr/share/ocaml
 debhelper/dh_ocaml      usr/bin
 debhelper/dh_ocamlinit  usr/bin
+debhelper/dh_ocamlclean usr/bin
 debhelper/dh_ocamldoc   usr/bin
 debhelper/ocaml-md5sums usr/bin
 debhelper/ocaml-lintian usr/bin
diff --git a/share/ocamlinit.mk b/share/ocamlinit.mk
index 046af6a..daf956e 100644
--- a/share/ocamlinit.mk
+++ b/share/ocamlinit.mk
@@ -32,7 +32,7 @@ ocamlinit-stamp:
 	dh_ocamlinit
 
 ocamlinit-clean:
-	dh_ocamlinit -d
+	dh_ocamlclean
 
 .PHONY: ocamlinit ocamlinit-clean
 
-- 
1.7.7.3

Attachment: signature.asc
Description: Digital signature


Reply to: