/usr/bin/dh_lisp is in dh-lisp 0.7.1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | #!/usr/bin/perl -w
#
# Debhelper to automatically register Common Lisp components
#
# Copyright (C) 2005, 2006 by René van Bevern
#
=head1 NAME
dh_lisp - register Common Lisp source and implementations
=head1 SYNOPSIS
B<dh_lisp> [S<I<debhelper options>>] [S<I<implementation>>]
=head1 DESCRIPTION
dh_lisp is a debhelper program that is responsible for registering
Common Lisp source and implementations with the Common Lisp Controller.
For Common Lisp library packages dh_lisp will automatically generate the
postinst and prerm commands needed to interface with the Common Lisp
Controller. It also links the given ASDF system definitions
appropriately. It takes into account all ASDs that you installed below
usr/share/common-lisp/source (for example with L<dh_install>(1)).
If dh_lisp finds precompiled files from CLISP, SBCL or CMUCL, it will
add a dependency on the implementation that can read the FASL version
used by the implementation currently installed. (this is most likely
the one which built the binaries in the package)
If you supply I<implementation>, dh_lisp automatically installs the
implementation-specific script, which is expected to reside in
debian/I<implementation>.sh. dh_lisp automatically generates the
necessary maintainer scripts to register the implementation with
the Common Lisp Controller.
=head1 OPTIONS
=over 4
=item B<-n>, B<--noscripts>
do not add to maintainer scripts
=item B<-d>
do not generate dependencies on implementations for binary files in
the package
=item I<implementation>
Install the debian/I<implementation>.sh script and generate maintainer
scripts to (un)register I<implementation> at the Common Lisp Controller.
=back
=head1 NOTES
Note that this command is not idempotent. "dh_clean -k" should be called
between invocations of this command. Otherwise, it may cause multiple
instances of the same text to be added to maintainer scripts.
=head1 SEE ALSO
L<debhelper(7)>,
The Common Lisp in Debian Manual: S<I<http://cl-debian.alioth.debian.org/clid/>>
=head1 AUTHOR
RenE<eacute> van Bevern <rvb@debian.org>
=cut
use strict;
use File::Find;
use Debian::Debhelper::Dh_Lib;
init();
my $common_lisp_systems = "/usr/share/common-lisp/systems/";
my $common_lisp_sources = "/usr/share/common-lisp/source/";
my $common_lisp_bin = "/usr/lib/common-lisp/bin/";
my @interesting_files = ("fasl", "x86f", "asd", "fas");
my %formats = (
"# FASL" => "sbcl",
"FASL FILE output from" => "cmucl",
'\(SYSTEM::VERSION ' => "clisp",
"\177ELF" => "ecl");
my %version_info = (
"sbcl" => '--noinform --noprint --eval "(progn (format t \"~A~&\"
sb-fasl:+fasl-file-version+) (quit))"',
"cmucl" => '-quiet -noinit -batch -eval "(progn (format t \"~A~&\"
(c:backend-fasl-file-version c:*backend*)) (quit))"',
"clisp" => '-x --quiet "(car (system::version))"',
"ecl" => '-eval "(progn (format t \"~A~&\" (lisp-implementation-version))
(quit))"'
);
sub make_substvars {
addsubstvar(shift, "misc:Depends", "common-lisp-controller", ">= 5.11");
}
sub get_type {
my $filename = shift;
if ($filename =~ m/.+\.asd$/) {
return("asd");
} else {
open(FILE, $filename) || error("Could not open " . $filename
. " for reading");
my $line = <FILE>;
foreach my $magic (keys %formats) {
if($line =~ m/^$magic/) {
close(FILE);
return($formats{$magic});
}
}
close(FILE);
return("unknown");
}
}
foreach my $package (@{$dh{DOPACKAGES}})
{
my $tmp = tmpdir ($package);
my %matches;
# traverse common-lisp/source directory and record interesing
# files)
if ( -d $tmp) {
find(sub {
foreach my $format (@interesting_files) {
if ($File::Find::name !~ /^$tmp$common_lisp_systems.*/
&& $File::Find::name =~ m/.+\.$format$/) {
push(@{$matches{get_type($_)}}, $File::Find::name);
}
}
}, $tmp);
}
my $implementation = shift;
# find out fasl versions for implementations and add dependencies
# to them
if(! $dh{D_FLAG}) {
foreach my $impl (keys %matches) {
# only add dependencies on implementation if the
# implementation is not the one to be installed
if($impl ne "unknown" && $impl ne "asd" &&
!($implementation && $impl eq $implementation)) {
if ( -x "/usr/bin/" . $impl ) {
my $fasl_version = `$impl $version_info{$impl}`;
if ($impl eq "sbcl" || $impl eq "clisp") {
addsubstvar($package, "misc:Depends",
$impl . "-fasl-loader-" . $fasl_version, "");
} elsif ($impl eq "cmucl") {
addsubstvar($package, "misc:Depends", "$impl",
">= " . sprintf("%X", $fasl_version));
addsubstvar($package, "misc:Depends", "$impl",
"< ". sprintf("%X", $fasl_version + 1));
} elsif ($impl eq "ecl") {
addsubstvar($package, "misc:Depends", "$impl",
">= " . $fasl_version);
}
} else {
warning("Implementation " . $impl . " seems not to be "
. "installed on this system to build the "
. "binary files included in this package. If "
. "this package is part of the implementation"
. "itself, ignore this warning.");
}
}
}
}
}
|