[Pkg-ocaml-maint-commits] [SCM] dose3 packaging branch, master, updated. debian/2.9.4-2-13-gc77a550
The following commit has been merged in the master branch: commit 813803eb31f61417bf74a17a200ec7ce547b77db Author: Stefano Zacchiroli z...@upsilon.cc Date: Fri Jun 10 23:48:00 2011 +0200 add trigger to monitor /usr/share/cudf/solvers/ and run update-cudf-solvers at each change diff --git a/debian/apt-cudf.postinst b/debian/apt-cudf.postinst new file mode 100644 index 000..f15d5a2 --- /dev/null +++ b/debian/apt-cudf.postinst @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +# Will be invoked both at apt-cudf configuration time and each time the trigger +# monitoring CUDF solver dir (usually /usr/share/cudf/solvers/) is activated. +# +update-cudf-solvers + +#DEBHELPER# + +exit 0 diff --git a/debian/apt-cudf.prerm b/debian/apt-cudf.prerm new file mode 100644 index 000..316ea89 --- /dev/null +++ b/debian/apt-cudf.prerm @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +# Clean up EDSP (i.e. APT external) solvers which have been generated for CUDF +# solvers. They will be added back upon (re-)installation of apt-cudf. +# +update-cudf-solvers --remove + +#DEBHELPER# + +exit 0 diff --git a/debian/apt-cudf.triggers b/debian/apt-cudf.triggers new file mode 100644 index 000..d009580 --- /dev/null +++ b/debian/apt-cudf.triggers @@ -0,0 +1 @@ +interest /usr/share/cudf/solvers diff --git a/debian/changelog b/debian/changelog index a654c7e..8bbe7c8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,8 @@ dose3 (2.9.4+r2696-1) UNRELEASED; urgency=low external solvers - new helper update-cudf-solvers, to be invoked at each new installation of CUDF solvers, to bind them to APT +- set up trigger monitoring /usr/share/cudf/solvers/; it will invoke + update-cudf-solvers at each change -- Stefano Zacchiroli z...@debian.org Fri, 10 Jun 2011 15:45:43 +0200 -- 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
[Pkg-ocaml-maint-commits] [SCM] dose3 packaging branch, master, updated. debian/2.9.4-2-13-gc77a550
The following commit has been merged in the master branch: commit 344d88c0e7a1db8e3a05d1d0c8fbb031cd2d9135 Author: Stefano Zacchiroli z...@upsilon.cc Date: Sat Jun 11 09:58:31 2011 +0200 update-cudf-solvers: manpage generation and cleanup diff --git a/debian/apt-cudf.manpages b/debian/apt-cudf.manpages new file mode 100644 index 000..38e59a3 --- /dev/null +++ b/debian/apt-cudf.manpages @@ -0,0 +1 @@ +debian/update-cudf-solvers.1 diff --git a/debian/rules b/debian/rules index 2bf10e6..8b06b34 100755 --- a/debian/rules +++ b/debian/rules @@ -21,4 +21,11 @@ override_dh_installman: cd debian/dose3-distcheck/usr/share/man/man1 \ mv distcheck.1 dose3-distcheck.1 +override_dh_auto_build: + dh_auto_build + pod2man debian/update-cudf-solvers debian/update-cudf-solvers.1 + +override_dh_auto_clean: + dh_auto_clean + rm -f debian/update-cudf-solvers.1 -- 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
[Pkg-ocaml-maint-commits] [SCM] dose3 packaging branch, master, updated. debian/2.9.4-2-13-gc77a550
The following commit has been merged in the master branch: commit 16a325a4152402fb33436aaf05ef1c9b0950b733 Author: Stefano Zacchiroli z...@upsilon.cc Date: Sat Jun 11 09:58:57 2011 +0200 clean-up build left-overs diff --git a/debian/rules b/debian/rules index 8b06b34..5307bb8 100755 --- a/debian/rules +++ b/debian/rules @@ -28,4 +28,5 @@ override_dh_auto_build: override_dh_auto_clean: dh_auto_clean rm -f debian/update-cudf-solvers.1 + rm -f _tags -- 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
[Pkg-ocaml-maint-commits] [SCM] dose3 packaging branch, master, updated. debian/2.9.4-2-13-gc77a550
The following commit has been merged in the master branch: commit c77a5501a8d417e1ca17cc0a4b538f19fb154641 Author: Stefano Zacchiroli z...@upsilon.cc Date: Sat Jun 11 10:58:34 2011 +0200 update-cudf-solvers: create EDSP dir if needed diff --git a/debian/update-cudf-solvers b/debian/update-cudf-solvers index 1d149f7..8495705 100755 --- a/debian/update-cudf-solvers +++ b/debian/update-cudf-solvers @@ -8,6 +8,7 @@ use strict; use File::Basename; +use File::Path qw(make_path); use Getopt::Long; use Pod::Usage; @@ -98,6 +99,8 @@ sub main() { ); die_usage if (! $getopt || $help_action); +-d $edsp_dir or make_path($edsp_dir, { mode = 0755 }); + my @cudf_solvers = shallow_find($cudf_dir, -type f); my @edsp_solvers = shallow_find($edsp_dir, -type l); foreach my $s (@cudf_solvers) { debug found cudf solver: $s; } -- 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
[Pkg-ocaml-maint-commits] [SCM] dose3 packaging branch, master, updated. debian/2.9.4-2-13-gc77a550
The following commit has been merged in the master branch: commit eb42b0ee24762b83e1655006f7504f8a02eacdf0 Author: Stefano Zacchiroli z...@upsilon.cc Date: Sat Jun 11 10:47:39 2011 +0200 update-cudf-solvers: support for --remove and documentation - major changes (getopt, pod, etc.) - substantial code refactoring for reuse and future extensions diff --git a/debian/update-cudf-solvers b/debian/update-cudf-solvers index 4f88067..1d149f7 100755 --- a/debian/update-cudf-solvers +++ b/debian/update-cudf-solvers @@ -2,17 +2,24 @@ # # update-cudf-solvers: register available CUDF solvers and bind them to APT # -# Copyright (C) Stefano Zacchiroli 2011 z...@debian.org +# Copyright: © Stefano Zacchiroli 2011 z...@debian.org # License: GNU Lesser General Public License, version 3 or above use strict; + use File::Basename; +use Getopt::Long; +use Pod::Usage; +# configuration my $cudf_dir = /usr/share/cudf/solvers; my $edsp_dir = /usr/lib/apt/solvers; my $apt_cudf = /usr/bin/apt-cudf; +# globals my $debug = 0; +my $help_action = 0; +my $remove_action = 0; sub shallow_find($$) { my ($dir, $pred) = @_; @@ -27,16 +34,24 @@ sub shallow_find($$) { 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 +sub die_usage() { +my %podflags = ( verbose = 1, +exitval = 2 ); +pod2usage(%podflags); +} -foreach my $s (@cudf_solvers) { debug found cudf solver: $s; } -foreach my $s (@edsp_solvers) { debug found edsp solver: $s; } +# check whether a given EDSP solver path originates from a CUDF solver +sub is_cudf_solver($) { +my ($path) = @_; +return (-l $path readlink($path) eq $apt_cudf); +} # 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) { +sub install_new($$) { +my ($cudf_solvers, $edsp_solvers) = @_; +foreach my $cudf_name (@$cudf_solvers) { + my $edsp_solver = $edsp_dir/$cudf_name; + next if is_cudf_solver($edsp_solver); 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; @@ -49,10 +64,12 @@ foreach my $cudf_name (@cudf_solvers) { } # 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) { +sub remove_old($$) { +my ($cudf_solvers, $edsp_solvers) = @_; +foreach my $edsp_name (@$edsp_solvers) { + my $edsp_solver = $edsp_dir/$edsp_name; + next unless is_cudf_solver($edsp_solver); + if (! grep {$_ eq $edsp_name} @$cudf_solvers) { # EDSP CUDF solver, no longer existing debug unlink (gone) $edsp_solver; unlink $edsp_solver @@ -60,3 +77,113 @@ foreach my $edsp_name (@edsp_solvers) { } } } + +# remove all EDSP solvers originating from CUDF solvers +sub remove_all($$) { +my ($cudf_solvers, $edsp_solvers) = @_; +foreach my $edsp_name (@$edsp_solvers) { + my $edsp_solver = $edsp_dir/$edsp_name; + if (is_cudf_solver($edsp_solver)) { + unlink $edsp_solver + or warning cannot unlink $edsp_solver, skipping; + } +} +} + +sub main() { +my $getopt = GetOptions( + debug = \$debug, + h|help = \$help_action, + remove = \$remove_action, + ); +die_usage if (! $getopt || $help_action); + +my @cudf_solvers = shallow_find($cudf_dir, -type f); +my @edsp_solvers = shallow_find($edsp_dir, -type l); +foreach my $s (@cudf_solvers) { debug found cudf solver: $s; } +foreach my $s (@edsp_solvers) { debug found edsp solver: $s; } + +if ($remove_action) { + remove_all(\@cudf_solvers, \@edsp_solvers); +} else { + install_new(\@cudf_solvers, \@edsp_solvers); + remove_old(\@cudf_solvers, \@edsp_solvers); +} +exit 0; +} + +main(); + +__END__ + +=head1 NAME + +update-cudf-solvers - register available CUDF solvers as APT external solvers + +=head1 SYNOPSIS + +=over + +=item Bupdate-cudf-solvers [IOPTION]... + +=item Bupdate-cudf-solvers [IOPTION]... --remove + +=back + +=head1 DESCRIPTION + +update-cudf-solvers maintain the list of installed CUDF solvers and register +them as external solvers for APT. + +The first form (without mandatory options) should be invoked each time a new +CUDF solver specification file is added to or removed from the