The following commit has been merged in the master branch: commit 8d93afe960920015bbcd51349682cb508ea19fc5 Author: Stefano Zacchiroli <z...@upsilon.cc> Date: Fri Jun 10 22:30:24 2011 +0200
new binary package: apt-cudf - provide glue among CUDF solvers and EDSP (i.e. APT's native) external solvers - new helper update-cudf-solvers, to be invoked at each new installation of CUDF solvers, to bind them to APT diff --git a/debian/apt-cudf.install b/debian/apt-cudf.install index 0d62735..5e81ca4 100644 --- a/debian/apt-cudf.install +++ b/debian/apt-cudf.install @@ -1 +1,2 @@ usr/bin/apt-cudf +debian/update-cudf-solvers usr/sbin diff --git a/debian/changelog b/debian/changelog index 7025957..a654c7e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,11 @@ dose3 (2.9.4+r2696-1) UNRELEASED; urgency=low * Imported Upstream version 2.9.4+r2696 - upstream SVN snapshot, release 2696 - contains apt-cudf + * new binary package: apt-cudf + - provides glue among CUDF solvers and EDSP (i.e. APT's native) + external solvers + - new helper update-cudf-solvers, to be invoked at each new + installation of CUDF solvers, to bind them to APT -- Stefano Zacchiroli <z...@debian.org> Fri, 10 Jun 2011 15:45:43 +0200 diff --git a/debian/update-cudf-solvers b/debian/update-cudf-solvers new file mode 100755 index 0000000..4f88067 --- /dev/null +++ b/debian/update-cudf-solvers @@ -0,0 +1,62 @@ +#!/usr/bin/perl -w +# +# update-cudf-solvers: register available CUDF solvers and bind them to APT +# +# Copyright (C) Stefano Zacchiroli 2011 <z...@debian.org> +# License: GNU Lesser General Public License, version 3 or above + +use strict; +use File::Basename; + +my $cudf_dir = "/usr/share/cudf/solvers"; +my $edsp_dir = "/usr/lib/apt/solvers"; +my $apt_cudf = "/usr/bin/apt-cudf"; + +my $debug = 0; + +sub shallow_find($$) { + my ($dir, $pred) = @_; + my @found = (); + foreach my $f (`find $dir -maxdepth 1 $pred`) { + chomp $f; + push @found, basename $f; + } + return @found; +} + +sub warning($) { my ($msg) = @_; print STDERR "update-cudf-solvers: W: $msg\n"; } +sub debug($) { my ($msg) = @_; print STDERR "update-cudf-solvers: I: $msg\n" if $debug; } + +my @cudf_solvers = shallow_find($cudf_dir, "-type f"); # current CUDF solvers +my @edsp_solvers = shallow_find($edsp_dir, "-type l"); # current EDSP solvers + +foreach my $s (@cudf_solvers) { debug "found cudf solver: $s"; } +foreach my $s (@edsp_solvers) { debug "found edsp solver: $s"; } + +# install: act on new CUDF solvers; make them available as EDSP solvers +foreach my $cudf_name (@cudf_solvers) { + my $edsp_solver = "$edsp_dir/$cudf_name"; + unless (-l $edsp_solver && readlink($edsp_solver) eq $apt_cudf) { + if (-e $edsp_solver || -l $edsp_solver) { + # either existing non CUDF solver or dangling symlink + warning "refuse to overwrite $edsp_solver with a symlink to $apt_cudf, skipping"; + } else { # file exists, but doesn't point to apt-cudf + debug "symlink $edsp_solver to $apt_cudf"; + symlink $apt_cudf, $edsp_solver + or warning "cannot symlink $edsp_solver to $apt_cudf, skipping"; + } + } +} + +# garbage collection: act on old EDSP solvers; get rid of them +foreach my $edsp_name (@edsp_solvers) { + my $edsp_solver = "$edsp_dir/$edsp_name"; + if (-l $edsp_solver && readlink($edsp_solver) eq $apt_cudf) { + if (! grep {"$_" eq "$edsp_name"} @cudf_solvers) { + # EDSP && CUDF solver, no longer existing + debug "unlink (gone) $edsp_solver"; + unlink $edsp_solver + or warning "cannot unlink $edsp_solver, skipping"; + } + } +} -- dose3 packaging _______________________________________________ Pkg-ocaml-maint-commits mailing list Pkg-ocaml-maint-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-ocaml-maint-commits