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

ocaml 3.09.0, dh_ocaml, and transition script



1) OCaml 3.09.0 is out, the original announcement is attached: time to
   prepare a transition!

   Volunteers for porting the ocaml package to the new release? :-)
   
   I can work on it, but there is a non-zero probability that I will be
   busy with dh_ocaml (see below), thus it would be great if someone
   else step forward.

2) Regarding dh_ocaml, I'm discussing these days which Joey Hess
   regarding its inclusion in debhelper. He raised some concerns which
   may inhibit the inclusion (mainly it does too much compared to other
   debhelpers and may be difficult for him to maintain in the future).
   If we manage to reach an agreement it would be included in the next
   days, otherwise I plan to ship it in the ocaml package and use it
   from there.  In both cases it should be ready before we start the
   migration of libraries to ocaml 3.09 so that we can rebuild them
   using it.

   If you want to follow the discussion have a look at #328422.

3) During the last ocaml transition I wrote, together with Enrico Tassi,
   a perl script which starts from a debian source package and bumps the
   ocaml version from a given version to another one. As a side effect
   of the change it also generates a .diff (to examine what has been
   done) and a list of unhandled files that may need to be looked at. It
   saved me a lot of work in the last transition, maybe it will be
   helpful to others as well. You can find the script attached.

Stay tuned,
Cheers.

-- 
Stefano Zacchiroli -*- Computer Science PhD student @ Uny Bologna, Italy
zack@{cs.unibo.it,debian.org,bononia.it} -%- http://www.bononia.it/zack/
If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. -!-
#!/usr/bin/perl -w
use strict;
# Copyright (C) 2005,
#   Stefano Zacchiroli	<zack@debian.org>
#   Enrico Tassi	<tassi@cs.unibo.it>
#
# This is free software, you can redistribute it and/or modify it under the
# terms of the GNU General Public License version 2 as published by the Free
# Software Foundation.

my @control_contexts = ("ocaml-", "ocaml-base-", "ocaml-base-nox-",
  "ocaml-compiler-libs-", "ocaml-interp-", "ocaml-nox-", "ocaml-source-");
my @control_fields = ("Build-Depends", "Build-Depends-Indep", "Depends");
my @dir_files = ("dirs", "*.dirs", "files", "*.files", "*.install", "rules");

my $usage =
  "Usage: bump_ocaml_version <old_version> <new_version> file.dsc\n"
 ."       bump_ocaml_version <old_version> <new_version> dir/\n";

my $old_version = shift || die $usage;
my $new_version = shift || die $usage;

my $patch_file = "bump_ocaml_version.diff";
my $unhandled_file = "bump_ocaml_version.unhandled";

sub message($) {
  my ($msg) = @_;
  print "$msg\n";
}

sub tempfile() {
  my $out = `tempfile -p "obump"`;
  chomp $out;
  return $out;
}

sub extract($) {
  my ($dsc) = @_;
  my $dpkg_source_out = `dpkg-source -x $dsc`;
  print $dpkg_source_out;
  my @lines = split /\n/, $dpkg_source_out;
  $lines[$#lines] =~ /^dpkg-source:\s+extracting.*in\s+(\S+)/;
  return $1;
}

sub sed($$$) {
  my ($fname, $regexp, $templ) = @_;
  my $tmp = `tempfile`;
  chomp $tmp;
  open FNAME, "< $fname" || die "Can't open $fname for reading\n";
  open TMP, "> $tmp" || die "Can't open $tmp for writing\n";
  while (my $l = <FNAME>) {
    $l =~ s/\Q$regexp\E/$templ/g;
    print TMP $l;
  }
  close FNAME;
  close TMP;
  system "mv $tmp $fname";
}

sub patch_control($) {
  message "Processing debian/control ...";
  my ($control) = @_;
  my $tmp = tempfile();
  open CONTROL, "< $control";
  open TMP, "> $tmp";
  while (my $line = <CONTROL>) {
    if ($line =~ /^([-a-zA-Z]+):\s+(.*)/) {
      my $lhs = $1;
      my $rhs = $2;
      foreach my $ctxt (@control_contexts) {
	$rhs =~ s/\Q$ctxt$old_version\E/$ctxt$new_version/g;
      }
      $line = "$lhs: $rhs\n";
    }
    print TMP $line;
  }
  close CONTROL;
  close TMP;
  system "mv $tmp $control";
}

sub bump_changelog($$) {
  message "Bumping debian/changelog ...";
  my ($dir, $new_version) = @_;
  system "cd $dir && dch -i Rebuilt against ocaml $new_version";
}

sub patch_files($@) {
  my ($dir, @patterns) = @_;
  my @files;
  foreach my $pat (@patterns) {
    push @files, glob "$dir/debian/$pat";
  }
  foreach my $f (@files) {
    if (-f $f) {
      message "Patching $f ...";
      sed($f, $old_version, $new_version);
    }
  }
}

sub unhandled($) {
  my ($dir) = @_;
  my @lines;
  open FIND, "find $dir/debian/ -type f |";
  while (my $f = <FIND>) {
    chomp $f;
    $f =~ s/^\Q$dir\E\///;
    next if ($f =~ /^debian\/(control|rules|changelog|(README|NEWS).Debian|([^\/]+\.)install|([^\/]+\.)?files|([^\/]+\.)?dirs)$/);
    open F, "< $dir/$f";
    my $lineno = 0;
    while (my $l = <F>) {
      $lineno++;
      chomp $l;
      if (($l =~ /\Q$old_version\E/) and not ($l =~ /\Q$new_version\E/)) {
	push @lines, "$f:$lineno:$l\n";
      }
    }
    close F;
  }
  close FIND;
  return @lines;
}

sub bump_ocaml_version($$) {
  my ($dir, $old_dir) = @_;
  patch_control("$dir/debian/control");
  bump_changelog($dir, $new_version);
  patch_files($dir, @dir_files);
  system "diff -ur $old_dir $dir > $patch_file";
  my @todo_lines = unhandled($dir);
  message "Done:";
  message "- patch saved in $patch_file";
  if ($#todo_lines >= 0) {
    open UNHANDLED, "> $unhandled_file";
    message "Lines that still match old version $old_version found and left unhandled:";
    print "  $_" foreach (@todo_lines);
    print UNHANDLED $_ foreach (@todo_lines);
    close UNHANDLED;
    message "- list of unhandled lines saved in $unhandled_file";
  }
  message "- new package ready to be built in $dir/";
}

my $subject = shift || die $usage;
my $dir;
my $keep_backup;
if (($subject =~ /\.dsc$/) && (-f $subject)) {
  # subject is a .dsc, extract debianized dir
  $dir = extract $subject;
  $keep_backup = 0;
} elsif (-d $subject) {
  $subject =~ /(.*)\/+$/;
  $dir = $1 || $subject;
  $keep_backup = 1;
} else {
  die "Don't know what to do with $subject: it is neither a .dsc nor a directory.\n";
}
my $old_dir = "$dir.old";
system "rm -rf $old_dir";
system "cp -r $dir $old_dir";
message "Original directory backed-up as $old_dir" if $keep_backup;
bump_ocaml_version($dir, $old_dir);
system "rm -rf $old_dir" unless $keep_backup;

Date: Thu, 27 Oct 2005 16:24:47 +0200
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: caml-list@inria.fr, caml-announce@inria.fr
Subject: [Caml-list] Objective Caml 3.09 released

It is my pleasure to announce the release of Objective Caml version 3.09.0,
the "Halloween" release.  Be very afraid :-)

Novelties in this release include:

- Introduction of private row types, for abstracting the row in object
  and variant types.  (See Jacques Garrigue's paper, " Private rows:
  abstracting the unnamed", available from
  http://www.math.nagoya-u.ac.jp/~garrigue/papers/).

- New warnings for variables locally bound and never used.

- A revised implementation of "ocamlopt -pack" that does not depend
  on GNU binutils and should work on all platforms supported by ocamlopt.
  The downside is that object files intended for later packing should
  be compiled with an appropriate "-for-pack" option.

Plus the usual assortment of corrections and small improvements listed
below.

The release can be found at http://caml.inria.fr/ocaml/release
and is currently available as source code and Windows binaries.
More binaries will be added in the coming weeks.

Enjoy,

- Xavier Leroy, for the OCaml development team

----------------------------------------------------------------------

Objective Caml 3.09.0:
----------------------

(Changes that can break existing programs are marked with a "*"  )

Language features:
- Introduction of private row types, for abstracting the row in object
  and variant types.

Type checking:
- Polymorphic variants with at most one constructor [< `A of t] are no
  longer systematically promoted to the exact type [`A of t]. This was
  more confusing than useful, and created problems with private row
  types.

Both compilers:
- Added warnings 'Y' and 'Z' for local variables that are bound but
  never used.
- Added warning for some uses non-returning functions (e.g. raise), when
they are
  passed extra arguments, or followed by extra statements.
- Pattern matching: more prudent compilation in case of guards; fixed PR#3780.
- Compilation of classes: reduction in size of generated code.
- Compilation of "module rec" definitions: fixed a bad interaction with
  structure coercion (to a more restrictive signature).

Native-code compiler (ocamlopt):
* Revised implementation of the -pack option (packing of several compilation
  units into one).  The .cmx files that are to be packed with
  "ocamlopt -pack -o P.cmx" must be compiled with "ocamlopt -for-pack P".
  In exchange for this additional constraint, ocamlopt -pack is now
  available on all platforms (no need for binutils).
* Fixed wrong evaluation order for arguments to certain inlined functions.
- Modified code generation for "let rec ... and ..." to reduce compilation
  time (which was quadratic in the number of mutually-recursive functions).
- x86 port: support tail-calls for functions with up to 21 arguments.
- AMD64 port, Linux: recover from system stack overflow.
- Sparc port: more portable handling of out-of-bound conditions
  on systems other than Solaris.

Standard library:
- Pervasives: faster implementation of close_in, close_out.
  set_binary_mode_{out,in} now working correctly under Cygwin.
- Printf: better handling of partial applications of the printf functions.
- Scanf: new function sscanf_format to read a format from a
  string. The type of the resulting format is dynamically checked and
  should be the type of the template format which is the second argument.
- Scanf: no more spurious lookahead attempt when the end of file condition
  is set and a correct token has already been read and could be returned.

Other libraries:
- System threads library: added Thread.sigmask; fixed race condition
  in signal handling.
- Bigarray library: fixed bug in Array3.of_array.
- Unix library: use canonical signal numbers in results of Unix.wait*;
  hardened Unix.establish_server against EINTR errors.

Run-time system:
- Support platforms where sizeof(void *) = 8 and sizeof(long) = 4.
- Improved and cleaned up implementation of signal handling.

Replay debugger:
- Improved handling of locations in source code.

OCamldoc:
- extensible {foo } syntax
- user can give .txt files on the command line, containing ocamldoc formatted
  text, to be able to include bigger texts out of source files
- -o option is now used by the html generator to indicate the prefix
  of generated index files (to avoid conflict when a Index module exists
  on case-insensitive file systems).

Miscellaneous:
- Configuration information is installed in `ocamlc -where`/Makefile.config
  and can be used by client Makefiles or shell scripts.

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Attachment: signature.asc
Description: Digital signature


Reply to: