diff options
49 files changed, 1549 insertions, 2322 deletions
| diff --git a/Dh_Getopt.pm b/Dh_Getopt.pm new file mode 100644 index 00000000..0c28500d --- /dev/null +++ b/Dh_Getopt.pm @@ -0,0 +1,173 @@ +#!/usr/bin/perl -w +# +# Debhelper option processing library. +# +# Joey Hess GPL copyright 1998. + +package Dh_Getopt; +use strict; + +use Dh_Lib; +use Getopt::Long; +use Exporter; +#use vars qw{@ISA @EXPORT}; +#@ISA=qw(Exporter); +#@EXPORT=qw(&aparseopts); # FIXME: for some reason, this doesn't work. + +my (%options, %exclude_package); + +# Passed an option name and an option value, adds packages to the list +# of packages. We need this so the list will be built up in the right +# order. +sub AddPackage { my($option,$value)=@_; +	if ($option eq 'i' or $option eq 'indep') { +		push @{$options{DOPACKAGES}}, GetPackages('indep'); +		$options{DOINDEP}=1; +	} +	elsif ($option eq 'a' or $option eq 'arch') { +		push @{$options{DOPACKAGES}}, GetPackages('arch'); +		$options{DOARCH}=1; +	} +	elsif ($option eq 'p' or $option eq 'package') { +		push @{$options{DOPACKAGES}}, $value; +	} +	elsif ($option eq 's' or $option eq 'same-arch') { +		push @{$options{DOPACKAGES}}, GetPackages('same'); +		$options{DOSAME}=1; +	} +	else { +		error("bad option $option - should never happen!\n"); +	} +} + +# Add a package to a list of packages that should not be acted on. +sub ExcludePackage { my($option,$value)=@_; +	$exclude_package{$value}=1; +} + +# Add another item to the exclude list. +sub AddExclude { my($option,$value)=@_; +	push @{$options{EXCLUDE}},$value; +} + +# Parse options and return a hash of the values. +sub parseopts { +	undef %options; +	 +	my $ret=GetOptions( +		"v" => \$options{VERBOSE}, +		"verbose" => \$options{VERBOSE}, +	 +		"i" => \&AddPackage, +		"indep" => \&AddPackage, +	 +		"a" => \&AddPackage, +		"arch" => \&AddPackage, +	 +		"p=s" => \&AddPackage, +	        "package=s" => \&AddPackage, +	 +		"s" => \&AddPackage, +		"same-arch" => \&AddPackage, +	 +		"N=s" => \&ExcludePackage, +		"no-package=s" => \&ExcludePackage, +	 +		"n" => \$options{NOSCRIPTS}, +		"noscripts" => \$options{NOSCRIPTS}, + +		"x" => \$options{INCLUDE_CONFFILES}, # is -x for some unknown historical reason.. +		"include-conffiles" => \$options{INCLUDE_CONFFILES}, +	 +		"X=s" => \&AddExclude, +		"exclude=s" => \&AddExclude, +	 +		"d" => \$options{D_FLAG}, +		"remove-d" => \$options{D_FLAG}, +		"dirs-only" => \$options{D_FLAG}, +	 +		"r" => \$options{R_FLAG}, +		"no-restart-on-upgrade" => \$options{R_FLAG}, +	 +		"k" => \$options{K_FLAG}, +		"keep" => \$options{K_FLAG}, + +		"P=s" => \$options{TMPDIR}, +		"tmpdir=s" => \$options{TMPDIR}, + +		"u=s", => \$options{U_PARAMS}, +		"update-rcd-params=s", => \$options{U_PARAMS}, +	        "dpkg-shlibdeps-params=s", => \$options{U_PARAMS}, +		"dpkg-gencontrol-params=s", => \$options{U_PARAMS}, + +		"m=s", => \$options{M_PARAMS}, +		"major=s" => \$options{M_PARAMS}, + +		"V:s", => \$options{V_FLAG}, +		"version-info:s" => \$options{V_FLAG}, + +		"A" => \$options{PARAMS_ALL}, +		"all" => \$options{PARAMS_ALL}, + +		"no-act" => \$options{NO_ACT}, +	 +		"init-script=s" => \$options{INIT_SCRIPT}, +		 +		"sourcedir=s" => \$options{SOURCEDIR}, +		 +		"destdir=s" => \$options{DESTDIR}, +	); + +	if (!$ret) { +		error("unknown option; aborting"); +	} +	 +	# Check to see if -V was specified. If so, but no parameters were +	# passed, the variable will be defined but empty. +	if (defined($options{V_FLAG})) { +		$options{V_FLAG_SET}=1; +	} +	 +	# If we have not been given any packages to act on, assume they +	# want us to act on them all. Note we have to do this before excluding +	# packages out, below. +	if (! defined $options{DOPACKAGES} || ! @{$options{DOPACKAGES}}) { +		if ($options{DOINDEP} || $options{DOARCH} || $options{DOSAME}) { +				# User specified that all arch (in)dep package be +				# built, and there are none of that type. +				error("I have no package to build"); +		} +		push @{$options{DOPACKAGES}},GetPackages(); +	} +	 +	# Remove excluded packages from the list of packages to act on. +	my @package_list; +	my $package; +	foreach $package (@{$options{DOPACKAGES}}) { +		if (! $exclude_package{$package}) { +			push @package_list, $package;	 +		} +	} +	@{$options{DOPACKAGES}}=@package_list; + +	# Generate EXCLUDE_FIND. +	$options{EXCLUDE_FIND}=''; +	foreach (@{$options{EXCLUDE}}) { +		$options{EXCLUDE_FIND}.="-regex .*".quotemeta($_).".* -or "; +	} +	$options{EXCLUDE_FIND}=~s/ -or $//; + +	# If there are no packages to act on now, it's an error. +	if (! defined $options{DOPACKAGES} || ! @{$options{DOPACKAGES}}) { +		error("I have no package to build"); +	} + +	return %options; +}	 + +sub import { +	# Enable bundling of short command line options. +	Getopt::Long::config("bundling"); +}		 + +1 diff --git a/Dh_Lib.pm b/Dh_Lib.pm new file mode 100644 index 00000000..e74e8ccb --- /dev/null +++ b/Dh_Lib.pm @@ -0,0 +1,371 @@ +#!/usr/bin/perl -w +# +# Library functions for debhelper programs, perl version. +# +# Joey Hess, GPL copyright 1997, 1998. + +package Dh_Lib; +use strict; + +use Exporter; +use vars qw(@ISA @EXPORT %dh); +@ISA=qw(Exporter); +@EXPORT=qw(&init &doit &complex_doit &verbose_print &error &warning &tmpdir +	    &pkgfile &pkgext &isnative &autoscript &filearray &GetPackages +	    &xargs +	    %dh); + +my $max_compat=2; + +sub init { +	# If DH_OPTIONS is set, prepend it @ARGV. +	if (defined($ENV{DH_OPTIONS})) { +		unshift @ARGV,split(/\s+/,$ENV{DH_OPTIONS}); +	} + +	# Check to see if an argument on the command line starts with a dash. +	# if so, we need to pass this off to the resource intensive  +	# Getopt::Long, which I'd prefer to avoid loading at all if possible. +	my $parseopt=undef; +	my $arg; +	foreach $arg (@ARGV) { +		if ($arg=~m/^-/) { +			$parseopt=1; +			last; +		}        +	} +	if ($parseopt) { +		eval "use Dh_Getopt"; +		error($!) if $@; +		%dh=Dh_Getopt::parseopts(); +	} + +	# Check to see if DH_VERBOSE environment variable was set, if so, +	# make sure verbose is on. +	if (defined $ENV{DH_VERBOSE} && $ENV{DH_VERBOSE} ne "") { +		$dh{VERBOSE}=1; +	} + +	# Check to see if DH_NO_ACT environment variable was set, if so,  +	# make sure no act mode is on. +	if (defined $ENV{DH_NO_ACT} && $ENV{DH_NO_ACT} ne "") { +		$dh{NO_ACT}=1; +	} + +	# Get the name of the main binary package (first one listed in +	# debian/control). +	my @allpackages=GetPackages(); +	$dh{MAINPACKAGE}=$allpackages[0]; + +	# Check if packages to build have been specified, if not, fall back to +	# the default, doing them all. +	if (! defined $dh{DOPACKAGES} || ! @{$dh{DOPACKAGES}}) { +		if ($dh{DOINDEP} || $dh{DOARCH} || $dh{DOSAME}) { +			# User specified that all arch (in)dep package be  +			# built, and there are none of that type. +			error("I have no package to act on"); +		} +		push @{$dh{DOPACKAGES}},@allpackages; +	} + +	# Check to see if -P was specified. If so, we can only act on a single +	# package. +	if ($dh{TMPDIR} && $#{$dh{DOPACKAGES}} > 0) { +		error("-P was specified, but multiple packages would be acted on (".join(",",@{$dh{DOPACKAGES}}).")."); +	} + +	# Figure out which package is the first one we were instructed to build. +	# This package gets special treatement: files and directories specified on +	# the command line may affect it. +	$dh{FIRSTPACKAGE}=${$dh{DOPACKAGES}}[0]; + +	# Split the U_PARAMS up into an array. +	my $u=$dh{U_PARAMS}; +	undef $dh{U_PARAMS}; +	if (defined $u) { +		push @{$dh{U_PARAMS}}, split(/\s+/,$u); +	} +} + +# Escapes out shell metacharacters in a word of shell script. +sub escape_shell { my $word=shift; +	# This list is from _Unix in a Nutshell_. (except '#') +	$word=~s/([\s!"\$()*+#;<>?@\[\]\\`|~])/\\$1/g; +	return $word; +} + +# Run a command, and display the command to stdout if verbose mode is on. +# All commands that modifiy files in $TMP should be ran via this  +# function. +# +# Note that this cannot handle complex commands, especially anything +# involving redirection. Use complex_doit instead. +sub doit { +	verbose_print(join(" ",map { escape_shell($_) } @_)); +	 +	if (! $dh{NO_ACT}) { +		system(@_) == 0 +			|| error("command returned error code"); +		 +	} +} + +# Run a command and display the command to stdout if verbose mode is on. +# Use doit() if you can, instead of this function, because this function +# forks a shell. However, this function can handle more complicated stuff +# like redirection. +sub complex_doit { +	verbose_print(join(" ",@_)); +	 +	if (! $dh{NO_ACT}) { +		# The join makes system get a scalar so it forks off a shell. +		system(join(" ",@_)) == 0 +			|| error("command returned error code"); +	}			 +} + +# Run a command that may have a huge number of arguments, like xargs does. +# Pass in a reference to an array containing the arguments, and then other +# parameters that are the command and any parameters that should be passed to +# it each time. +sub xargs { +	my $args=shift; + +        # The kernel can accept command lines up to 20k worth of characters. +	my $command_max=20000; + +	# Figure out length of static portion of command. +	my $static_length=0; +	foreach (@_) { +		$static_length+=length($_)+1; +	} +	 +	my @collect=(); +	my $length=$static_length; +	foreach (@$args) { +		if (length($_) + 1 + $static_length > $command_max) { +			error("This command is greater than the maximum command size allowed by the kernel, and cannot be split up further. What on earth are you doing? \"@_ $_\""); +		} +		$length+=length($_) + 1; +		if ($length < $command_max) { +			push @collect, $_; +		} +		else { +			doit(@_,@collect) if $#collect > -1; +			@collect=(); +			$length=$static_length; +		} +	} +	doit(@_,@collect) if $#collect > -1; +} + +# Print something if the verbose flag is on. +sub verbose_print { my $message=shift; +	if ($dh{VERBOSE}) { +		print "\t$message\n"; +	} +} + +# Output an error message and exit. +sub error { my $message=shift; +	warning($message); +	exit 1; +} + +# Output a warning. +sub warning { my $message=shift; +	print STDERR basename($0).": $message\n"; +} + +# Returns the basename of the argument passed to it. +sub basename { my $fn=shift; +	$fn=~s:^.*/(.*?)$:$1:; +	return $fn; +} + +# Returns the directory name of the argument passed to it. +sub dirname { my $fn=shift; +	$fn=~s:^(.*)/.*?$:$1:; +	return $fn; +} + +# Pass in a number, will return true iff the current compatability level +# is equal to that number. +sub compat { +	my $num=shift; +	 +	my $c=1; +	if (defined $ENV{DH_COMPAT}) { +		$c=$ENV{DH_COMPAT}; +	} + +	if ($c > $max_compat) { +		error("Sorry, but $max_compat is the highest compatability level of debhelper currently supported."); +	} + +	return ($c == $num); +} + +# Pass it a name of a binary package, it returns the name of the tmp dir to +# use, for that package. +sub tmpdir { my $package=shift; +	if ($dh{TMPDIR}) { +		return $dh{TMPDIR}; +	} +	elsif (compat(1) && $package eq $dh{MAINPACKAGE}) { +		# This is for back-compatability with the debian/tmp tradition. +		return "debian/tmp"; +	} +	else { +		return "debian/$package"; +	} +} + +# Pass this the name of a binary package, and the name of the file wanted +# for the package, and it will return the actual filename to use. For +# example if the package is foo, and the file is somefile, it will look for +# debian/somefile, and if found return that, otherwise, if the package is +# the main package, it will look for debian/foo, and if found, return that. +# Failing that, it will return nothing. +sub pkgfile { my $package=shift; my $filename=shift; +	if (-f "debian/$package.$filename") { +		return "debian/$package.$filename"; +	} +	elsif ($package eq $dh{MAINPACKAGE} && -f "debian/$filename") { +		return "debian/$filename"; +	} +	return ""; +} + +# Pass it a name of a binary package, it returns the name to prefix to files +# in debian for this package. +sub pkgext { my $package=shift; +	if ($package ne $dh{MAINPACKAGE}) { +		return "$package."; +	} +	return ""; +} + +# Returns 1 if the package is a native debian package, null otherwise. +# As a side effect, sets $dh{VERSION} to the version of this package. +{ +	# Caches return code so it only needs to run dpkg-parsechangelog once. +	my %isnative_cache; +	 +	sub isnative { my $package=shift; +		if (! defined $isnative_cache{$package}) { +			# Make sure we look at the correct changelog. +			my $isnative_changelog=pkgfile($package,"changelog"); +			if (! $isnative_changelog) { +				$isnative_changelog="debian/changelog"; +			} + +			# Get the package version. +			my $version=`dpkg-parsechangelog -l$isnative_changelog`; +			($dh{VERSION})=$version=~m/Version: (.*)/m; + +			# Is this a native Debian package? +			if ($dh{VERSION}=~m/.*-/) { +				$isnative_cache{$package}=0; +			} +			else { +				$isnative_cache{$package}=1; +			} +		} +	 +		return $isnative_cache{$package}; +	} +} + +# Automatically add a shell script snippet to a debian script. +# Only works if the script has #DEBHELPER# in it. +# +# Parameters: +# 1: package +# 2: script to add to +# 3: filename of snippet +# 4: sed to run on the snippet. Ie, s/#PACKAGE#/$PACKAGE/ +sub autoscript { my $package=shift; my $script=shift; my $filename=shift; my $sed=shift || ""; +	# This is the file we will append to. +	my $outfile="debian/".pkgext($package)."$script.debhelper"; + +	# Figure out what shell script snippet to use. +	my $infile; +	if (defined($ENV{DH_AUTOSCRIPTDIR}) &&  +	    -e "$ENV{DH_AUTOSCRIPTDIR}/$filename") { +		$infile="$ENV{DH_AUTOSCRIPTDIR}/$filename"; +	} +	else { +		if (-e "/usr/share/debhelper/autoscripts/$filename") { +			$infile="/usr/share/debhelper/autoscripts/$filename"; +		} +		else { +			error("/usr/share/debhelper/autoscripts/$filename does not exist"); +		} +	} + +	# TODO: do this in perl, perhaps? +	complex_doit("echo \"# Automatically added by ".basename($0)."\">> $outfile"); +	complex_doit("sed \"$sed\" $infile >> $outfile"); +	complex_doit("echo '# End automatically added section' >> $outfile"); +} + +# Reads in the specified file, one word at a time, and returns an array of +# the result. +sub filearray { my $file=shift; +	my @ret; +	open (DH_FARRAY_IN,"<$file") || error("cannot read $file: $1"); +	while (<DH_FARRAY_IN>) { +		push @ret,split(' ',$_); +	} +	close DH_FARRAY_IN; +	 +	return @ret; +} + +# Returns a list of packages in the control file. +# Must pass "arch" or "indep" or "same" to specify arch-dependant or +# -independant or same arch packages. If nothing is specified, returns all +# packages. +sub GetPackages { my $type=shift; +	$type="" if ! defined $type; +	 +	# Look up the build arch if we need to. +	my$buildarch=''; +	if ($type eq 'same') { +		$buildarch=`dpkg --print-architecture` || error($!); +		chomp $buildarch; +	} + +	my $package=""; +	my $arch=""; +	my @list=(); +	open (CONTROL,"<debian/control") || +		error("cannot read debian/control: $!\n"); +	while (<CONTROL>) { +		chomp; +		s/\s+$//; +		if (/^Package:\s+(.*)/) { +			$package=$1; +		} +		if (/^Architecture:\s+(.*)/) { +			$arch=$1; +		} +		if (!$_ or eof) { # end of stanza. +			if ($package && +			    (($type eq 'indep' && $arch eq 'all') || +			     ($type eq 'arch' && $arch ne 'all') || +			     ($type eq 'same' && ($arch eq 'any' || $arch =~ /\b$buildarch\b/)) || +			     ! $type)) { +				push @list, $package; +				$package=""; +				$arch=""; +			} +		} +	} +	close CONTROL; + +	return @list; +} + +1 diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index 931864dd..00000000 --- a/debian/copyright +++ /dev/null @@ -1,24 +0,0 @@ -Debhelper is written by and copyright 1997-2003 Joey Hess <joeyh@debian.org>. - -Increasinly miniscule parts of the code (and certainly my inspiration from the -whole thing) came from debmake, by Christoph Lameter <clameter@debian.org>. - -Some of the dh_md5sums command is from a program by Charles -Briscoe-Smith <cpb4@ukc.ac.uk>. - -dh_perl is by Brendan O'Dea <bod@debian.org>. -dh_python is by Josselin Mouette <josselin.mouette@ens-lyon.org>. -dh_installcatalogs is by Adam Di Carlo <aph@debian.org>. -dh_scrollkeeper is by Ross Burton <ross@burtonini.com>. -dh_usrlocal is by Andrew Stribblehill <ads@debian.org>. -dh_installlogcheck is by Jon Middleton <jjm@debian.org>. - -The copyright of this package is GPL, version 2 or later. Files in the -examples/ directory are in the public domain[1]. On Debian systems the -complete text of the GPL is in /usr/share/common-licenses/GPL - -[1] Pendants who belive I cannot legally say that code I have written is in -    the public domain may consider them instead to be licensed as follows: - -    Redistribution and use in source and binary forms, with or without -    modification, are permitted under any circumstances. No warranty. diff --git a/debian/subtsvars b/debian/subtsvars new file mode 100644 index 00000000..458d7871 --- /dev/null +++ b/debian/subtsvars @@ -0,0 +1 @@ +perl:Depends=perl5 diff --git a/dh_builddeb b/dh_builddeb deleted file mode 100755 index 3d9f9d86..00000000 --- a/dh_builddeb +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_builddeb - build debian packages - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_builddeb> [S<I<debhelper options>>] [B<--destdir=>I<directory>] [B<--filename=>I<name>] [S<B<--> I<params>>] - -=head1 DESCRIPTION - -dh_builddeb simply calls L<dpkg-deb(8)> to build a debian package or -packages. - -=head1 OPTIONS - -=over 4 - -=item B<--destdir=>I<directory> - -Use this if you want the generated .deb files to be put in a directory -other than the default of ".." - -=item B<--filename=>I<name> - -Use this if you want to force the generated .deb file to have a particular -file name. Does not work well if more than one .deb is generated! - -=item B<-u>I<params> - -=item B<--> I<params> - -Pass I<params> to L<dpkg-deb(1)> when it is used to build the -package. - -=back - -=cut - -init(); - -# Set the default destination directory. -if (! defined $dh{DESTDIR}) { -	$dh{DESTDIR}='..'; -} - -if (! defined $dh{FILENAME}) { -	$dh{FILENAME}=''; -} -else { -	$dh{FILENAME}="/$dh{FILENAME}"; -} - -foreach my $package (@{$dh{DOPACKAGES}}) { -	my $tmp=tmpdir($package); -	if (exists $ENV{DH_ALWAYS_EXCLUDE} && length $ENV{DH_ALWAYS_EXCLUDE}) { -		complex_doit("find $tmp -name $_ | xargs rm -rf") -			foreach split(":", $ENV{DH_ALWAYS_EXCLUDE}); -	} -	doit("dpkg-deb", @{$dh{U_PARAMS}}, "--build", $tmp, $dh{DESTDIR}.$dh{FILENAME}); -} - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_builddeb.1 b/dh_builddeb.1 new file mode 100644 index 00000000..134cd883 --- /dev/null +++ b/dh_builddeb.1 @@ -0,0 +1,28 @@ +.TH DH_BUILDDEB 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_builddeb \- build debian packages +.SH SYNOPSIS +.B dh_builddeb +.I "[debhelper options] [--destdir=directory]" +.SH "DESCRIPTION" +dh_builddeb simply calls +.BR dpkg (8) +to build a .deb package or packages. +.SH OPTIONS +.TP +.B debhelper options +See +.BR debhelper (1) +for a list of options common to all debhelper commands. +.TP +.B --destdir=directory +Use this if you want the generated .deb files to be put in a directory other +than the default of ".." +.SH ENVIRONMENT +See +.BR debhelper (1) +for a list of environment variables that affect all debhelper commands. +.SH "SEE ALSO" +.BR debhelper (1) +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> @@ -1,77 +1,25 @@  #!/usr/bin/perl -w +# +# Clean up $TMP and other tepmorary files generated by the +# build process. -=head1 NAME - -dh_clean - clean up package build directories - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_clean> [S<I<debhelper options>>] [B<-k>] [B<-d>] [B<-X>I<item>] [S<I<file ...>>] - -=head1 DESCRIPTION - -dh_clean is a debhelper program that is responsible for cleaning up after a -package is built. It removes the package build directories, and removes some -other files including debian/files, and any detritus left behind by other -debhelper commands. It also removes common files that should not appear in a -debian diff: -  #*# *~ DEADJOE *.orig *.rej *.SUMS TAGS core .deps/* *.P - -=head1 OPTIONS - -=over 4 - -=item B<-k>, B<--keep> - -Do not delete debian/files. When do you want to use this? Anytime you have a -debian/rules that has 2 binary targets that build different .deb packages; -for example, one target is binary-arch, and the other is binary-indep, or -one target builds the shared library, and the other the -dev package. If you -didn't use -k in these cases, then debian/files would be deleted in the -middle, and your changes file will only contain the last binary package that -was built. - -=item B<-d>, B<--dirs-only> - -Only clean the package build directories, do not clean up any other files -at all. - -=item B<-X>I<item> B<--exclude=>I<item> - -Exclude files that contain "item" anywhere in their filename from being -deleted, even if they would normally be deleted. You may use this option -multiple times to build up a list of things to exclude. - -=item I<file ...> - -Delete these files too. - -=back - -=cut - +BEGIN { push @INC, "debian", "/usr/share/debhelper" } +use Dh_Lib;  init(); -foreach my $package (@{$dh{DOPACKAGES}}) { -	my $tmp=tmpdir($package); -	my $ext=pkgext($package); +foreach $PACKAGE (@{$dh{DOPACKAGES}}) { +	$TMP=tmpdir($PACKAGE); +	$EXT=pkgext($PACKAGE);  	if (! $dh{D_FLAG}) { -		doit("rm","-f","debian/${ext}substvars") -			unless excludefile("debian/${ext}substvars"); -		 -		# These are all debhelper temp files, and so it is safe to  -		# wildcard them. -		complex_doit("rm -f debian/$ext*.debhelper"); +		doit("rm","-f","debian/$EXT\substvars", +			"debian/$EXT\postinst.debhelper", +			"debian/$EXT\postrm.debhelper", +			"debian/$EXT\preinst.debhelper", +			"debian/$EXT\prerm.debhelper");  	} -	doit ("rm","-rf",$tmp) -		unless excludefile($tmp); +	doit ("rm","-rf",$TMP);  }  if (! $dh{D_FLAG}) { @@ -80,14 +28,7 @@ if (! $dh{D_FLAG}) {  	}  	if (! $dh{K_FLAG}) { -		doit("rm","-f","debian/files") -			unless excludefile("debian/files"); -	} - -	# See if some files that would normally be deleted are excluded. -	my $find_options=''; -	if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne '') { -		$find_options="-a ! ( $dh{EXCLUDE_FIND} )"; +		doit("rm","-f","debian/files");  	}  	# Remove other temp files. @@ -95,27 +36,11 @@ if (! $dh{D_FLAG}) {  	# parameters). Note that you _don't_ quote wildcards used by find  	# in here.  	doit(split(/\s+/,"find . -type f -a -	        ( -name #*# -o -name .*~ -o -name *~ -o -name DEADJOE +	        ( -name #*# -o -name *~ -o -name DEADJOE  		 -o -name *.orig -o -name *.rej -o -name *.bak  		 -o -name .*.orig -o -name .*.rej -o -name .SUMS  		 -o -name TAGS -o -name core -o ( -path */.deps/* -a -name *.P ) -		) $find_options -exec rm -f {} ;")); - -	# Stupid autoconf cache directory. -	doit("rm", "-rf", "autom4te.cache") -		unless excludefile("autom4te.cache"); +		) -exec rm -f {} ;"));  } -doit('rm', '-rf', 'debian/tmp') if -x 'debian/tmp' && ! compat(1); - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut +doit('rm', '-rf', 'debian/tmp') if -x 'debian/tmp' && ! Dh_Lib::compat(1); diff --git a/dh_clean.1 b/dh_clean.1 new file mode 100644 index 00000000..c2e71bf3 --- /dev/null +++ b/dh_clean.1 @@ -0,0 +1,41 @@ +.TH DH_CLEAN 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_clean \- clean up package build directories +.SH SYNOPSIS +.B dh_clean +.I "[debhelper options] [-k] [-d] [file ...]" +.SH "DESCRIPTION" +dh_clean is a debhelper program that is responsible for cleaning up after a +package is built. It removes the package build directories, and removes some +other files, such as debian/substvars, debian/files, DEADJOE, emacs backup  +files, any detritus left behind by other debhelper commands, etc. +.SH OPTIONS +.TP +.B debhelper options +See +.BR debhelper (1) +for a list of options common to all debhelper commands. +.TP +.B \-k, \--keep +Do not delete debian/files. When do you want to use this? Anytime you have a +debian/rules that has 2 binary targets that build different .deb packages; +for example, one target is binary-arch, and the other is binary-indep, or +one target builds the shared library, and the other the -dev package. If you +didn't use -k in these cases, then debian/files would be deleted in the +middle, and your changes file will only contain the last binary package that +was built. +.TP +.B \-d, \--dirs-only +Only clean the package build directories, do not clean up any other files at +all. +.TP +.B file ... +Delete these files too. +.SH ENVIRONMENT +See +.BR debhelper (1) +for a list of environment variables that affect all debhelper commands. +.SH "SEE ALSO" +.BR debhelper (1) +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_du.1 b/dh_du.1 new file mode 100644 index 00000000..aa3849e4 --- /dev/null +++ b/dh_du.1 @@ -0,0 +1,16 @@ +.TH DH_DU 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_du \- generate DEBIAN/du file (deprecated) +.SH SYNOPSIS +.B dh_du +.SH "DESCRIPTION" +dh_du is a debhelper program that was responsible for generating +a DEBIAN/du file, which listed the disk usage of directories in the package. +.P +This program is now deprecated, and does nothing, after a decision by the +debian developers that du control files should not exit. It will simply +output a warning message now. +.SH "SEE ALSO" +.BR debhelper (1) +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_gencontrol b/dh_gencontrol deleted file mode 100755 index 4e9ff3e8..00000000 --- a/dh_gencontrol +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_gencontrol - generate and install control file - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_gencontrol> [S<I<debhelper options>>] [S<B<--> I<params>>] - -=head1 DESCRIPTION - -dh_gencontrol is a debhelper program that is responsible for generating -control files, and installing them into the DEBIAN directory with the -proper permissions. - -This program is merely a wrapper around L<dpkg-gencontrol(1)>, which calls -it once for each package being acted on, and passes in some additional -useful flags including "-isp".  - -=head1 OPTIONS - -=over 4 - -=item B<-u>I<params>, B<--dpkg-gencontrol-params>I<params> - -=item B<--> I<params> - -Pass "params" to L<dpkg-gencontrol(1)>. - -=back - -=cut - -init(); - -foreach my $package (@{$dh{DOPACKAGES}}) { -	my $tmp=tmpdir($package); -	my $ext=pkgext($package); -	 -	my $changelog=pkgfile($package,'changelog'); -	if (! $changelog) { -		$changelog='debian/changelog'; -	} - -	if ( ! -d "$tmp/DEBIAN" ) { -		doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN"); -	} - -	# Generate and install control file. -	my @command="dpkg-gencontrol"; -	if (GetPackages() > 1) { -		push @command, "-p$package"; -	} -	doit(@command, "-l$changelog", "-isp", "-Tdebian/${ext}substvars",  -		"-P$tmp",@{$dh{U_PARAMS}}); - -	# This chmod is only necessary if the user sets the umask to -	# something odd. -	doit("chmod","644","$tmp/DEBIAN/control"); -	 -	doit("chown","0.0","$tmp/DEBIAN/control"); -} - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_installcron b/dh_installcron deleted file mode 100755 index d28277c5..00000000 --- a/dh_installcron +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_installcron - install cron scripts into etc/cron.* - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_installcron> [S<B<debhelper options>>] - -=head1 DESCRIPTION - -dh_installcron is a debhelper program that is responsible for installing -cron scripts into etc/cron.*/ in package build directories. The files -debian/package.cron.daily, debian/package.cron.weekly, -debian/package.cron.monthly, and debian/package.cron.d are installed. - -=cut - -init(); - -foreach my $package (@{$dh{DOPACKAGES}}) { -	my $tmp=tmpdir($package); -	foreach my $type (qw{daily weekly monthly}) { -		my $cron=pkgfile($package,"cron.$type"); -		if ($cron) { -			if (! -d "$tmp/etc/cron.$type") { -				doit("install","-o",0,"-g",0,"-d","$tmp/etc/cron.$type"); -			} -			doit("install",$cron,"$tmp/etc/cron.$type/$package"); -		} -	} -	# Seperate because this needs to be mode 644. -	my $cron=pkgfile($package,"cron.d"); -	if ($cron) { -		if (! -d "$tmp/etc/cron.d") { -			doit("install","-o",0,"-g",0,"-d","$tmp/etc/cron.d"); -		}	 -		doit("install","-m",644,$cron,"$tmp/etc/cron.d/$package"); -	} -} - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_installdeb b/dh_installdeb deleted file mode 100755 index 9527ff2e..00000000 --- a/dh_installdeb +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_installdeb - install files into the DEBIAN directory - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_installdeb> [S<I<debhelper options>>] - -=head1 DESCRIPTION - -dh_installdeb is a debhelper program that is responsible for installing -files into the DEBIAN directories in package build directories with the -correct permissions. - -dh_installdeb automatically installs the following files from debian/ into -the DEBIAN directory: -  package.postinst -  package.preinst -  package.postrm -  package.prerm -  package.shlibs -  package.conffiles - -The postinst, preinst, postrm, and prerm are handled specially: If a -corresponding file named debian/package.script.debhelper exists, the contents -of that file are merged into the script as follows: If the script exists, -then anywhere in it that "#DEBHELPER#" appears, the text of the .debhelper -file is inserted. If the script does not exist, then a script is generated -from the .debhelper file. The .debhelper files are created by other debhelper -programs, such as L<dh_installmenu(1)>, and are shell script fragments. - -In V3 compatibility mode and higher, all files in the etc/ directory in a -package will automatically be flagged as conffiles by this program, so -there is no need to list them manually in package.conffiles. - -=cut - -init(); - -foreach my $package (@{$dh{DOPACKAGES}}) { -	my $tmp=tmpdir($package); -	my $ext=pkgext($package); - -	if (! -d "$tmp/DEBIAN") { -		doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN"); -	} - -	# Install debian install scripts. -	# If any .debhelper files exist, add them into the scripts. -	foreach my $file (qw{postinst preinst prerm postrm}) { -		my $f=pkgfile($package,$file); -		if ($f) { -			if (-f "debian/$ext$file.debhelper") { -				# Add this into the script, where it has -				# #DEBHELPER# -				complex_doit("perl -pe 's~#DEBHELPER#~qx{cat debian/$ext$file.debhelper}~eg' < $f > $tmp/DEBIAN/$file"); -		        } -			else { -				# Just get rid of any #DEBHELPER# in the  -				# script. -				complex_doit("sed s/#DEBHELPER#// < $f > $tmp/DEBIAN/$file"); -			} -			doit("chown","0.0","$tmp/DEBIAN/$file"); -			doit("chmod",755,"$tmp/DEBIAN/$file"); -		} -		else { -			# Auto-generate script header and add .debhelper -			# content to it. -			if (-f "debian/$ext$file.debhelper") { -				complex_doit("printf '#!/bin/sh\nset -e\n' > $tmp/DEBIAN/$file"); -				complex_doit("cat debian/$ext$file.debhelper >> $tmp/DEBIAN/$file"); -				doit("chown","0.0","$tmp/DEBIAN/$file"); -				doit("chmod",755,"$tmp/DEBIAN/$file"); -			} -		} -	} - -	# Install non-executable files -	foreach my $file (qw{shlibs conffiles}) { -		my $f=pkgfile($package,$file); -		if ($f) { -			doit("install","-o",0,"-g",0,"-m",644,"-p",$f,"$tmp/DEBIAN/$file"); -		} -	} - -	# Automatic conffiles registration: If it is in /etc, it is a -	# conffile. -	if (! compat(2) && -d "$tmp/etc") { -		complex_doit("find $tmp/etc -type f -printf '/etc/%P\n' >> $tmp/DEBIAN/conffiles"); -		# Anything found? -		if (-z "$tmp/DEBIAN/conffiles") { -			doit("rm", "-f", "$tmp/DEBIAN/conffiles"); -		} -		else { -			doit("chmod", 644, "$tmp/DEBIAN/conffiles"); -		} -	} -} - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_installdebfiles.1 b/dh_installdebfiles.1 new file mode 100644 index 00000000..bb66ed5b --- /dev/null +++ b/dh_installdebfiles.1 @@ -0,0 +1,33 @@ +.TH DH_INSTALLDEBFILES 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_installdebfiles \- install files into the DEBIAN directory (deprecated) +.SH SYNOPSIS +.B dh_installdebfiles +.SH "DESCRIPTION" +dh_installdebfiles is a debhelper program that is responsible for installing +files into the DEBIAN directory in package build directories with the +correct permissions, canculating shared library dependancies, and creating a +control file. +.P +This program is deprecated. It is now merely a wrapper around three other +programs, and you may replace any calls to this program by: +.P +  dh_installdeb +  dh_shlibdeps +  dh_gencontrol +.SH WARNING +This program will be removed at some time in the future. +.SH OPTIONS +Any options passed to this program will be sent to each of the 3 programs +listed above. +.SH "SEE ALSO" +.TP +.BR debhelper (1) +.TP +.BR dh_installdeb (1) +.TP +.BR dh_shlibdeps (1) +.TP +.BR dh_gencontrol (1) +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_installdirs b/dh_installdirs deleted file mode 100755 index 3bd4ea80..00000000 --- a/dh_installdirs +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_installdirs - create subdirectories in package build directories - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_installdirs> [S<I<debhelper options>>] [B<-A>] [S<I<dir ...>>] - -=head1 DESCRIPTION - -dh_installdirs is a debhelper program that is responsible for creating -subdirectories in package build directories. - -Any directory names specified as parameters will be created in the package -build directory of the first package dh_installdirs is told to act on. By -default, this is the first binary package in debian/control, but if you use --p, -i, or -a flags, it will be the first package specified by those flags. - -A file named debian/package.dirs can list other directories to be created. -Separate the directory names with whitespace. - -Be sure to only use directory names relative to the package build -directory. Ie, "/usr/bin" should not be used, use "usr/bin" instead. - -=head1 OPTIONS - -=over 4 - -=item B<-A>, B<--all> - -Create any directories specified by command line parameters in ALL packages -acted on, not just the first. - -=item I<dir ...> - -Create these directories in the package build directory of the first -package acted on. (Or in all packages if -A is specified.) - -=back - -=cut - -init(); - -foreach my $package (@{$dh{DOPACKAGES}}) { -	my $tmp=tmpdir($package); -	my $file=pkgfile($package,"dirs"); - -	if (! -e $tmp) { -		doit("install","-d",$tmp); -	} - -	my @dirs; - -	if ($file) { -		@dirs=filearray($file) -	} - -	if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { -		push @dirs, @ARGV; -	}	 - -	if (@dirs) { -		# Stick the $tmp onto the front of all the dirs. -		# This is necessary, for 2 reasons, one to make them  -		# be in the right directory, but more importantly, it  -		# protects against the danger of absolute dirs being -		# specified. -		@dirs=map { -				$_="$tmp/$_"; -				tr:/:/:s; # just beautification. -				$_ -			  } @dirs; - -		# Create dirs. -		doit("install","-d",@dirs); -	} -} - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_installdirs.1 b/dh_installdirs.1 new file mode 100644 index 00000000..95be7151 --- /dev/null +++ b/dh_installdirs.1 @@ -0,0 +1,46 @@ +.TH DH_INSTALLDIRS 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_installdirs \- create subdirectories in package build directories +.SH SYNOPSIS +.B dh_installdirs +.I "[debhelper options] [-A] [dir ...]" +.SH "DESCRIPTION" +dh_installdirs is a debhelper program that is responsible for creating +subdirectories in package build directories. +.P +Any directory names specified as parameters will be created in the package +build directory of the first package dh_installdirs is told to act on. By +default, this is the first binary package in debian/control, but if you use  +-p, -i, or -a flags, it will be the first package specified by those flags. +.P +A file named debian/package.dirs (debian/dirs may be used for the first +binary package in debian/control) can list other directories to be created. +Separate the directory names with whitespace. +.P +Be sure to only use directory names relative to the package build +directory. Ie, "/usr/bin" should not be used, use "usr/bin" instead. +.SH OPTIONS +.TP +.B debhelper options +See +.BR debhelper (1) +for a list of options common to all debhelper commands. +.TP +.B \-A, \--all +Create any directories specified by command line parameters in ALL packages +acted on, not just the first. +.TP +.B dir ... +Create these directories in the package build directory of the first package +acted on. (Or in all packages if -A is specified.) +.SH ENVIRONMENT +See +.BR debhelper (1) +for a list of environment variables that affect all debhelper commands. +.SH "SEE ALSO" +.BR debhelper (1) +.SH BUGS +It's impossible to specify filenames with spaces or other whitespace in them +in debian/dirs file. This is more a historical design flaw than a bug. +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_installemacsen b/dh_installemacsen deleted file mode 100755 index 80b83e69..00000000 --- a/dh_installemacsen +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_installemacsen - register an emacs add on package - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_installemacsen> [S<I<debhelper options>>] [B<-n>] [B<--priority=>I<n>] [B<--flavor=>I<foo>] - -=head1 DESCRIPTION - -dh_installemacsen is a debhelper program that is responsible for installing -files used by the debian emacsen-common package into package build -directories. - -It also automatically generates the postinst and prerm commands needed to -register a package as an emacs add on package. See L<dh_installdeb(1)> -for an explanation of how this works. - -If a file named debian/package.emacsen-install exists, then it is installed -into -usr/lib/emacsen-common/packages/install/package in the package build -directory. Similarly, debian/package.emacsen-remove is installed into -usr/lib/emacsen-common/packages/remove/package . And similarly, -debian/package.emacsen-startup is installed into -etc/emacs/site-start.d/50<package>.el (by default). - -=head1 OPTIONS - -=over 4 - -=item B<-n>, B<--noscripts> - -Do not modify postinst/prerm scripts. - -=item B<--priority=>I<n> - -Sets the priority number of a site-start.d file. Default is 50. - -=item B<--flavor=>I<foo> - -Sets the flavor a site-start.d file will be installed in. Default is -"emacs", alternatives include "xemacs" and "emacs20". - -=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. - -=cut - -init(); - -if (! defined $dh{PRIORITY}) { -	$dh{PRIORITY}=50; -} -if (! defined $dh{FLAVOR}) { -	$dh{FLAVOR}='emacs'; -} - -foreach my $package (@{$dh{DOPACKAGES}}) { -	my $tmp=tmpdir($package); - -	my $emacsen_install=pkgfile($package,"emacsen-install"); -	my $emacsen_remove=pkgfile($package,"emacsen-remove"); -	my $emacsen_startup=pkgfile($package,"emacsen-startup"); - -	if ($emacsen_install ne '') { -		if (! -d "$tmp/usr/lib/emacsen-common/packages/install") { -			doit("install","-d","$tmp/usr/lib/emacsen-common/packages/install"); -		} -		doit("install","-m0755",$emacsen_install,"$tmp/usr/lib/emacsen-common/packages/install/$package"); -	} - -	if ($emacsen_remove ne '') { -		if (! -d "$tmp/usr/lib/emacsen-common/packages/remove") { -			doit("install","-d","$tmp/usr/lib/emacsen-common/packages/remove"); -		} -		doit("install","-m0755","$emacsen_remove","$tmp/usr/lib/emacsen-common/packages/remove/$package"); -	} -	 -	if ($emacsen_startup ne '') { -		if (! -d "$tmp/etc/$dh{FLAVOR}/site-start.d/") { -			doit("install","-d","$tmp/etc/$dh{FLAVOR}/site-start.d/"); -		} -		doit("install","-m0644",$emacsen_startup,"$tmp/etc/$dh{FLAVOR}/site-start.d/$dh{PRIORITY}$package.el"); -	} - -	if ($emacsen_install ne '' || $emacsen_remove ne '') { -		if (! $dh{NOSCRIPTS}) { -			autoscript($package,"postinst","postinst-emacsen", -				"s/#PACKAGE#/$package/"); -			autoscript($package,"prerm","prerm-emacsen", -				"s/#PACKAGE#/$package/"); -		} -	} -} - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_installemacsen.1 b/dh_installemacsen.1 new file mode 100644 index 00000000..df1512f5 --- /dev/null +++ b/dh_installemacsen.1 @@ -0,0 +1,51 @@ +.TH DH_INSTALLEMACSEN 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_installemacsen \- register an emacs add on package +.SH SYNOPSIS +.B dh_installemacsen +.I "[debhelper options] [-n] [--number=n] [--flavor=foo]" +.SH "DESCRIPTION" +dh_installemacsen is a debhelper program that is responsible for installing +files used by the debian emacsen-common package into package build directories.  +.P +It also automatically generates the postinst and prerm commands needed to  +register a package as an emacs add on package. See  +.BR dh_installdeb (1) +for an explanation of how this works. +.P +If a file named debian/package.emacsen-install exists, then it is installed into +usr/lib/emacsen-common/packages/install/package in the package build +directory. Similarly, debian/package.emacsen-remove is installed into +usr/lib/emacsen-common/packages/remove/package . And similarly, +debian/package.emacsen-startup is installed into +etc/emacs/site-start.d/50<package>.el (by default). +.P +For the first first binary package listed in the control file, you may use +debian/emacsen-install, debian/emacsen-remove, and debian/emacsen-startup instead. +.SH OPTIONS +.TP +.B debhelper options +See +.BR debhelper (1) +for a list of options common to all debhelper commands. +.TP +.B \-n, \--noscripts +Do not modify postinst/prerm scripts. +.TP +.B \--number=n +Sets the priority number of a site-start.d file. Default is 50. +.TP +.B \--flavor=foo +Sets the flavor a site-start.d file will be installed in. Default is +"emacs", alternatives include "xemacs" and "emacs20". +.SH ENVIRONMENT +See +.BR debhelper (1) +for a list of environment variables that affect all debhelper commands. +.SH "SEE ALSO" +.TP +.BR debhelper (1) +.TP +.BR /usr/doc/emacsen-common/debian-emacs-policy.gz +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_installinit b/dh_installinit deleted file mode 100755 index 5e4e1f35..00000000 --- a/dh_installinit +++ /dev/null @@ -1,181 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_installinit - install init scripts into package build directories - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_installinit> [S<I<debhelper options>>] [B<--init-script=>I<scriptname>] [B<-n>] [B<-r>] [B<-d>] [S<B<--> I<params>>] - -=head1 DESCRIPTION - -dh_installinit is a debhelper program that is responsible for installing -init scripts and associated defaults files into package build directories. - -It also automatically generates the postinst and postrm and prerm commands -needed to set up the symlinks in /etc/rc*.d/ and to start and stop the init -scripts. - -If a file named debian/package.init exists, then it is installed into -etc/init.d/package in the package build directory, with "package" replaced -by the package name. - -If a file named debian/package.default exists, then it is installed into -etc/default/package in the package build directory, with "package" replaced -by the package name. - -=head1 OPTIONS - -=over 4 - -=item B<-n>, B<--noscripts> - -Do not modify postinst/postrm/prerm scripts. - -=item B<-r>, B<--no-restart-on-upgrade> - -Do not restart init script on upgrade. - -=item B<--no-start> - -Do not start the init script on install or upgrade, or stop it on removal. -Only call update-rc.d. Useful for rcS scripts. - -=item B<-d>, B<--remove-d> - -Remove trailing "d" from the name of the package, and use the result for the -filename the init script is installed as in etc/init.d/ , and the default file -is installed as in etc/default/ . This may be useful for daemons with names -ending in "d". (Note: this takes precedence over the --init-script parameter -described below.) - -=item B<-u>I<params> B<--update-rcd-params=>I<params> - -=item B<--> I<params> - -Pass "params" to L<update-rc.d(8)>. If not specified, "defaults" will be -passed to L<update-rc.d(8)>. - -=item B<--init-script=>I<scriptname> - -Use "scriptname" as for the filename the init script is installed as in -etc/init.d/ (and also use it as the filename for the defaults file, if it -is installed). This is useful if you need to have an init script with a name -different from the package's name. Note that if you use this parameter, -dh_installinit will look to see if a file in the debian/ directory exists -that looks like "package.scriptname" and if so will install it as the init -script in preference to the files it normally installs. This feature is really -only useful if you need a single package to install more than one init script. - -=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. - -=cut - -init(); - -foreach my $package (@{$dh{DOPACKAGES}}) { -	my $tmp=tmpdir($package); - -	# Figure out what filename to install it as. -	my $script; -	if ($dh{D_FLAG}) { -		# -d on the command line sets D_FLAG. We will  -		# remove a trailing 'd' from the package name and  -		# use that as the name. -		$script=$package; -		if ($script=~m/(.*)d$/) { -			$script=$1; -		} -		else { -			warning("\"$package\" has no final d' in its name, but -d was specified."); -		} -	}        -	elsif ($dh{INIT_SCRIPT}) { -		$script=$dh{INIT_SCRIPT}; -	} -	else { -		$script=$package; -	}        - -	my $init=pkgfile($package,$script) || pkgfile($package,"init") || -	      pkgfile($package,"init.d"); -	my $default=pkgfile($package,'default'); - -	if ($default ne '') { -		if (! -d "$tmp/etc/default") { -			doit("install","-d","$tmp/etc/default"); -		} -		doit("install","-p","-m644",$default,"$tmp/etc/default/$script"); -	} - -	if ($init ne '') { -		if (! -d "$tmp/etc/init.d") { -			doit("install","-d","$tmp/etc/init.d"); -		} - -		doit("install","-p","-m755",$init,"$tmp/etc/init.d/$script"); - -		# This is set by the -u "foo" command line switch, it's -		# the parameters to pass to update-rc.d. If not set, -		# we have to say "defaults". -		my $params=''; -		if (defined($dh{U_PARAMS})) { -			$params=join(' ',@{$dh{U_PARAMS}}); -		}	 -		if ($params eq '') { -			$params="defaults"; -		} - -		if (! $dh{NOSCRIPTS}) { -			if (! $dh{NO_START}) { -				# update-rc.d, and start script -				autoscript($package,"postinst", "postinst-init", -					"s/#SCRIPT#/$script/;s/#INITPARMS#/$params/"); -			 -				if ($dh{R_FLAG}) { -					# stops script only on remove -					autoscript($package,"prerm","prerm-init-norestart", -						"s/#SCRIPT#/$script/;s/#INITPARMS#/$params/"); -				} -				else { -					# always stops script -					autoscript($package,"prerm","prerm-init", -						"s/#SCRIPT#/$script/;s/#INITPARMS#/$params/"); -				} -			} -			else { -				# just update-rc.d -				autoscript($package,"postinst", "postinst-init-nostart", -					"s/#SCRIPT#/$script/;s/#INITPARMS#/$params/"); -			} - -			# removes rc.d links -			autoscript($package,"postrm","postrm-init", -				"s/#SCRIPT#/$script/;s/#INITPARMS#/$params/"); -		} -	} -} - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_installinit.1 b/dh_installinit.1 new file mode 100644 index 00000000..cbb4b444 --- /dev/null +++ b/dh_installinit.1 @@ -0,0 +1,62 @@ +.TH DH_INSTALLINIT 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_installinit \- install init scripts into package build directories +.SH SYNOPSIS +.B dh_installinit +.I "[debhelper options] [--init-script=scriptname] [-n] [-r] [-d] [-uparams]" +.SH "DESCRIPTION" +dh_installinit is a debhelper program that is responsible for installing +init scripts into package build directories.  +.P +It also automatically generates the postinst and postrm and prerm commands  +needed to set up the symlinks in /etc/rc*.d/ and to start and stop the init +scripts. +.P +If a file named debian/package.init (or debian/package.init.d for backwards +compatibility with debstd) exists, then it is installed into +etc/init.d/package in the package build directory, with "package" replaced +by the packagename. (You may use debian/init for the first binary package +listed in the control file.) +.SH OPTIONS +.TP +.B debhelper options +See +.BR debhelper (1) +for a list of options common to all debhelper commands. +.TP +.B \-n, \--noscripts +Do not modify postinst/postrm/prerm scripts. +.TP +.B \-r, \--no-restart-on-upgrade +Do not restart daemon on upgrade. +.TP +.B \-d, \--remove-d +Remove trailing "d" from the name of the package, and use the result for the +filename the init script is installed as in etc/init.d/ . This may be useful +for daemons with names ending in "d". (Note: this takes precedence over +the --init-script parameter described below.) +.TP +.B \-uparams, \--update-rcd-params=params +Pass "params" to  +.BR update-rc.d (8) +If not specified, "defaults" will be passed to +.BR update-rc.d (8) +.TP +.B \--init-script=scriptname +Use "scriptname" as for the filename the init script is installed as in +etc/init.d/ . This is useful if you need to have an init script with a name +different from the package's name. Note that if you use this parameter, +dh_installinit will look to see if a file in the debian/ directory exists +that looks like "scriptname" or "package.scriptname" and if so will install +it as the inist script in preference to the files it normally installs. This +feature is really only useful if you need a single package to install more +than one init script. +.SH ENVIRONMENT +See +.BR debhelper (1) +for a list of environment variables that affect all debhelper commands. +.SH "SEE ALSO" +.BR debhelper (1), +.BR update_rc.d (8) +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_installmenu b/dh_installmenu deleted file mode 100755 index 420b2164..00000000 --- a/dh_installmenu +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_installmenu - install debian menu files into package build directories - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_installmenu> [S<B<debhelper options>>] [B<-n>] - -=head1 DESCRIPTION - -dh_installmenu is a debhelper program that is responsible for installing -files used by the debian menu package into package build directories. - -It also automatically generates the postinst and postrm commands needed to -interface with the debian menu package. See L<dh_installdeb(1)> for an -explanation of how this works. - -If a file named debian/package.menu exists, then it is installed into -usr/lib/menu/package in the package build directory. This is a debian menu -file. See L<menufile(5L)> for its format. - -If a file named debian/package.menu-method exits, then it is installed into -etc/menu-methods/package in the package build directory. This is a debian -menu method file. - -=head1 OPTIONS - -=over 4 - -=item B<-n>, B<--noscripts> - -Do not modify postinst/postrm scripts. - -=back - -=cut - -init(); - -foreach my $package (@{$dh{DOPACKAGES}}) { -	my $tmp=tmpdir($package); -	my $menu=pkgfile($package,"menu"); -	my $menu_method=pkgfile($package,"menu-method"); -	 -	if ($menu ne '') { -		if (! -d "$tmp/usr/lib/menu") { -			doit("install","-d","$tmp/usr/lib/menu"); -		} -		doit("install","-p","-m644",$menu,"$tmp/usr/lib/menu/$package"); -		 -		# Add the scripts if a menu-method file doesn't exist. -		# The scripts for menu-method handle everything these do, too. -		if ($menu_method eq "" && ! $dh{NOSCRIPTS}) { -			autoscript($package,"postinst","postinst-menu"); -			autoscript($package,"postrm","postrm-menu") -		} -	} - -	if ($menu_method ne '') { -		if (!-d "$tmp/etc/menu-methods") { -			doit("install","-d","$tmp/etc/menu-methods"); -		} -		doit("install","-p",$menu_method,"$tmp/etc/menu-methods/$package"); - -		if (! $dh{NOSCRIPTS}) { -			autoscript($package,"postinst","postinst-menu-method","s/#PACKAGE#/$package/"); -			autoscript($package,"postrm","postrm-menu-method","s/#PACKAGE#/$package/"); -		} -	} -} - -=head1 SEE ALSO - -L<debhelper(7)> -L<update-menus(1)> -L<menufile(5)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_installmenu.1 b/dh_installmenu.1 new file mode 100644 index 00000000..d9d8296a --- /dev/null +++ b/dh_installmenu.1 @@ -0,0 +1,45 @@ +.TH DH_INSTALLMENU 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_installmenu \- install debian menu files into package build directories +.SH SYNOPSIS +.B dh_installmenu +.I "[debhelper options] [-n]" +.SH "DESCRIPTION" +dh_installmenu is a debhelper program that is responsible for installing +files used by the debian menu package into package build directories.  +.P +It also automatically generates the postinst and postrm commands needed to  +interface with the debian menu package. See  +.BR dh_installdeb (1) +for an explanation of how this works. +.P +If a file named debian/package.menu exists, then it is installed into +usr/lib/menu/package in the package build directory. This is a debian menu +file. +.P +If a file named debian/package.menu-method exits, then it is installed into +etc/menu-methods/package in the package build directory. This is a debian +menu method file. +.P +For the first first binary package listed in the control file, you may use +debian/menu and debian/menu-method instead. +.SH OPTIONS +.TP +.B debhelper options +See +.BR debhelper (1) +for a list of options common to all debhelper commands. +.TP +.B \-n, \--noscripts +Do not modify postinst/postrm scripts. +.SH ENVIRONMENT +See +.BR debhelper (1) +for a list of environment variables that affect all debhelper commands. +.SH "SEE ALSO" +.TP +.BR debhelper (1) +.TP +.BR menufile (5) +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_installmime b/dh_installmime deleted file mode 100755 index 8ffd5236..00000000 --- a/dh_installmime +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_installmime - install mime files into package build directories - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_installmime> [S<I<debhelper options>>] [B<-n>] - -=head1 DESCRIPTION - -dh_installmime is a debhelper program that is responsible for installing -mime files into package build directories. - -It also automatically generates the postinst and postrm commands needed to -interface with the debian mime-support package. See L<dh_installdeb(1)> for -an explanation of how this works. - -If a file named debian/package.mime exists, then it is installed into -usr/lib/mime/packages/package in the package build directory. - -=head1 OPTIONS - -=over 4 - -=item B<-n>, B<--noscripts> - -Do not modify postinst/postrm scripts. - -=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. - -=cut - -init(); - -foreach my $package (@{$dh{DOPACKAGES}}) { -	my $tmp=tmpdir($package); -	my $mime=pkgfile($package,"mime"); -	 -	if ($mime ne '') { -		if (! -d "$tmp/usr/lib/mime/packages") { -			doit("install","-d","$tmp/usr/lib/mime/packages"); -		} -		doit("install","-p","-m644",$mime,"$tmp/usr/lib/mime/packages/$package"); - -		if (! $dh{NOSCRIPTS}) { -			autoscript($package,"postinst","postinst-mime"); -			autoscript($package,"postrm","postrm-mime") -		} -	} -} - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_installmime.1 b/dh_installmime.1 new file mode 100644 index 00000000..4ace9985 --- /dev/null +++ b/dh_installmime.1 @@ -0,0 +1,38 @@ +.TH DH_INSTALLMIME 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_installmime \- install mime files into package build directories +.SH SYNOPSIS +.B dh_installmime +.I "[debhelper options] [-n]" +.SH "DESCRIPTION" +dh_installmime is a debhelper program that is responsible for installing +mime files into package build directories.  +.P +It also automatically generates the postinst and postrm commands needed to  +interface with the debian mime-support package. See  +.BR dh_installdeb (1) +for an explanation of how this works. +.P +If a file named debian/package.mime exists, then it is installed into +usr/lib/mime/packages/package in the package build directory. +.P +For the first first binary package listed in the control file, you may use +debian/mime instead. +.SH OPTIONS +.TP +.B debhelper options +See +.BR debhelper (1) +for a list of options common to all debhelper commands. +.TP +.B \-n, \--noscripts +Do not modify postinst/postrm scripts. +.SH ENVIRONMENT +See +.BR debhelper (1) +for a list of environment variables that affect all debhelper commands. +.SH "SEE ALSO" +.TP +.BR debhelper (1) +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_installmodules b/dh_installmodules deleted file mode 100755 index 13fd8f5c..00000000 --- a/dh_installmodules +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_installmodules - register modules with modutils - - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; -use File::Find; - -=head1 SYNOPSIS - -B<dh_installmodules> [S<I<debhelper options>>] [B<-n>] - -=head1 DESCRIPTION - -dh_installmodules is a debhelper program that is responsible for -registering kernel modules with modutils. - -Files named debian/package.modules will be installed as -etc/modutils/package in the package build directory. - -Then postinst and postrm commands are automatically generated to register -the modules when the package is installed. See L<dh_installdeb(1)> for an -explanation of how this works. Note that this will be done for any -package this program acts on which has either the above-mentioned file, or -has .o files in /lib/modules. - -=head1 OPTIONS - -=over 4 - -=item B<-n>, B<--noscripts> - -Do not modify postinst/postrm scripts. - -=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. - -=cut - -init(); - -# Returns true if there are any .o files in the passed directory. -sub find_kernel_modules { -	my $searchdir=shift; -	my @results=(); - -	return unless -d $searchdir; -	find(sub { push @results, $_ if /\.o$/ }, $searchdir); -	return @results > 0; -} - -foreach my $package (@{$dh{DOPACKAGES}}) { -	my $tmp=tmpdir($package); -	my $file=pkgfile($package,"modules"); - -	if (! -e $tmp) { -		doit("install","-d",$tmp); -	} - -	if ($file) { -		if (! -e "$tmp/etc/modutils") { -			doit("install","-d","$tmp/etc/modutils"); -		} -		doit("install","-m","0644",$file,"$tmp/etc/modutils/$package"); -	} - -	if (! $dh{NOSCRIPTS} && -	    ($file || find_kernel_modules("$tmp/lib/modules"))) { -			autoscript($package,"postinst","postinst-modules","s/#PACKAGE#/$package/"); -			autoscript($package,"postrm","postrm-modules","s/#PACKAGE#/$package/"); -	} -} - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_installmodules.1 b/dh_installmodules.1 new file mode 100644 index 00000000..6d9016fe --- /dev/null +++ b/dh_installmodules.1 @@ -0,0 +1,35 @@ +.TH DH_INSTALLMODULES 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_installmodules \- register modules with modutils +.SH SYNOPSIS +.B dh_installmodules +.I "[debhelper options] [-n]" +.SH "DESCRIPTION" +dh_installmodules is a debhelper program that is responsible for registering +kernel modules with modutils. +.P +A file named debian/package.modules (debian/modules my be used for the first +binary package in debian/control) will be installed as etc/modutils/package +in the package build directory. +.P +Then postinst and postrm commands are automatically generated to register +the modules when the package is installed. See +.BR dh_installdeb (1) +for an explanation of how this works. +.SH OPTIONS +.TP +.B debhelper options +See +.BR debhelper (1) +for a list of options common to all debhelper commands. +.TP +.B \-n, \--noscripts +Do not modify postinst/postrm scripts. +.SH ENVIRONMENT +See +.BR debhelper (1) +for a list of environment variables that affect all debhelper commands. +.SH "SEE ALSO" +.BR debhelper (1) +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_installpam b/dh_installpam deleted file mode 100755 index 0f251798..00000000 --- a/dh_installpam +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_installpam - install pam support files - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_installpam> [S<I<debhelper options>>] [B<-n>] - -=head1 DESCRIPTION - -dh_installpam is a debhelper program that is responsible for installing -files used by PAM into package build directories. - -If a file named debian/package.pam exists, then it is installed into -etc/pam.d/package in the package build directory. - -=cut - -init(); - -foreach my $package (@{$dh{DOPACKAGES}}) { -	my $tmp=tmpdir($package); -	my $pam=pkgfile($package,"pam"); -	 -	if ($pam ne '') { -		if (! -d "$tmp/etc/pam.d") { -			doit("install","-d","$tmp/etc/pam.d"); -		} -		doit("install","-p","-m644",$pam,"$tmp/etc/pam.d/$package"); -	} -} - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_installpam.1 b/dh_installpam.1 new file mode 100644 index 00000000..bb34a45c --- /dev/null +++ b/dh_installpam.1 @@ -0,0 +1,30 @@ +.TH DH_INSTALLPAM 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_installpam \- install pam support files +.SH SYNOPSIS +.B dh_installpam +.I "[debhelper options] [-n]" +.SH "DESCRIPTION" +dh_installpam is a debhelper program that is responsible for installing +files used by PAM into package build directories.  +.P +If a file named debian/package.pam exists, then it is installed into +etc/pam.d/package in the package build directory. +.P +For the first first binary package listed in the control file, you may use +debian/pam instead. +.SH OPTIONS +.TP +.B debhelper options +See +.BR debhelper (1) +for a list of options common to all debhelper commands. +.SH ENVIRONMENT +See +.BR debhelper (1) +for a list of environment variables that affect all debhelper commands. +.SH "SEE ALSO" +.TP +.BR debhelper (1) +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_installwm b/dh_installwm deleted file mode 100755 index 31ce63c6..00000000 --- a/dh_installwm +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_installwm - register a window manager - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_installwm> [S<I<debhelper options>>] [B<-n>] [B<--priority=>I<n>] [S<I<wm ...>>] - -=head1 DESCRIPTION - -dh_installwm is a debhelper program that is responsible for -generating the postinst and postrm commands that register a window manager -with L<update-alternatives(8)> - -Any window manager programs specified as parameters will be registered in -the first package dh_installwm is told to act on. By default, this is the -first binary package in debian/control, but if you use -p, -i, or -a flags, -it will be the first package specified by those flags. - -Files named debian/package.wm can list other window manager programs to -register. - -=head1 OPTIONS - -=over 4 - -=item B<--priority=>I<n> - -Set the priority of the window manager. Default is 20, which is too low for -most window managers; see the Debian Policy document for instructions on -calculating the correct value. - -=item B<-n>, B<--noscripts> - -Do not modify postinst/postrm scripts. Turns this command into a no-op. - -=item I<wm ...> - -The commands used to run the window manager or window managers you want to -register. - -=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. - -=back - -=cut - -init(); - -if (! defined $dh{PRIORITY}) { -        $dh{PRIORITY}=20; -} - -if (@ARGV) { -	# This is here for backwards compatibility. If the filename doesn't -	# include a path, assume it's in /usr/X11R6/bin. -	if ($ARGV[0] !~ m:/:) { -		$ARGV[0]="/usr/X11R6/bin/$ARGV[0]"; -	} -} - -foreach my $package (@{$dh{DOPACKAGES}}) { -#	my $tmp=tmpdir($package); -	my $file=pkgfile($package,"wm"); - -	my @wm; -	if ($file) { -		@wm=filearray($file, '.'); -	} - -	if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { -		push @wm, @ARGV; -	} - -	if (! $dh{NOSCRIPTS}) { -		foreach (@wm) { -			autoscript($package,"postinst","postinst-wm","s:#WM#:$_:;s/#PRIORITY#/$dh{PRIORITY}/",); -			autoscript($package,"prerm","prerm-wm","s:#WM#:$_:"); -		} -	} -} - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_installwm.1 b/dh_installwm.1 new file mode 100644 index 00000000..d319d755 --- /dev/null +++ b/dh_installwm.1 @@ -0,0 +1,42 @@ +.TH DH_INSTALLWM 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_installwm \- register a window manager +.SH SYNOPSIS +.B dh_installwm +.I "[debhelper options] [-n] wmfilename" +.SH "DESCRIPTION" +dh_installwm is a debhelper program that is responsible for +generating the postinst and postrm commands needed to +interface with the the +.BR register-window-manager (8) +command. This results in a window manager being registered when it is +installed. +.SH OPTIONS +.TP +.B debhelper options +See +.BR debhelper (1) +for a list of options common to all debhelper commands. +.TP +.B \-n, \--noscripts +Do not modify postinst/postrm scripts. Turns this command into a no-op. +.TP +.B wmfilename +The filename of the window manager you wish to register. May be either a +simple filename if the window manager is in /usr/X11R6/bin/, or a complete +path otherwise. +.SH NOTES +Note that this command will set up postinst and postrm scripts for every +package it acts on. It's wise to limit its action to a single package with, +for example, the -p switch. +.SH ENVIRONMENT +See +.BR debhelper (1) +for a list of environment variables that affect all debhelper commands. +.SH "SEE ALSO" +.TP +.BR debhelper (1) +.TP +.BR register-window-manager (8) +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_installxaw b/dh_installxaw new file mode 100755 index 00000000..d71be544 --- /dev/null +++ b/dh_installxaw @@ -0,0 +1,65 @@ +#!/usr/bin/perl -w +# +# Integration with xaw-wrappers +# +# If debian/xaw-wrappers file exists, save it to  +# $TMP/usr/lib/xaw-wrappers/conf/$PACKAGE +# +# Also, add calls to postinst and postrm. + +BEGIN { push @INC, "debian", "/usr/share/debhelper" } +use Dh_Lib; +init(); + +foreach $PACKAGE (@{$dh{DOPACKAGES}}) { +	$TMP=tmpdir($PACKAGE); +	$xaw=pkgfile($PACKAGE,'xaw'); + +	if ($xaw ne '') { +		if (! -d "$TMP/usr/lib/xaw-wrappers/config") { +			doit("install","-d","$TMP/usr/lib/xaw-wrappers/config"); +		} +		doit("install","-p","-m644",$xaw, +			"$TMP/usr/lib/xaw-wrappers/config/$PACKAGE"); + +		if (! $dh{NOSCRIPTS}) { +			# Parse the xaw conf file to figure out what programs +			# and link names are present in it. Have to pass +			# those into the scripts. +			my %data; +			my $install_opts=''; +			my $remove_opts=''; +			my $stanza=''; +			 +			open (IN,$xaw); +			while (<IN>) { +				chomp; +				s/\s+/ /g; +				if (/^#/ eq '') { +					if (/(.*?):\s?(.*)/) { +						$data{lc($1)}=$2; +						$stanza=1; +					} +					elsif ($stanza) { +						$install_opts.="'$data{program} $data{'link-name'} $data{wrapped}' "; +						$remove_opts.="'$data{'link-name'} $data{wrapped}' "; +						undef %data; +						$stanza=''; +					} +				} +			} +			close IN; + +			if ($stanza) { +				$install_opts.="'$data{program} $data{'link-name'} $data{wrapped}'"; +				$remove_opts.="'$data{'link-name'} $data{wrapped}'"; +			} +			 +			autoscript($PACKAGE,"postinst","postinst-xaw", +				"s:#OPTS#:$install_opts:"); +			autoscript($PACKAGE,"prerm","prerm-xaw", +				"s:#OPTS#:$remove_opts:"); +			autoscript($PACKAGE,"postrm","postrm-xaw"); +		} +	} +} diff --git a/dh_installxaw.1 b/dh_installxaw.1 new file mode 100644 index 00000000..4fb9ebf6 --- /dev/null +++ b/dh_installxaw.1 @@ -0,0 +1,40 @@ +.TH DH_INSTALLXAW 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_installxaw \- install xaw wrappers config files into package build directories +.SH SYNOPSIS +.B dh_installxaw +.I "[debhelper options] [-n]" +.SH "DESCRIPTION" +dh_installxaw is a debhelper program that is responsible for installing +xaw wrappers config files into package build directories.  +.P +It also automatically generates the postinst, prerm, and postrm commands needed to  +interface with the debian xaw-wrappers package. See  +.BR dh_installdeb (1) +for an explanation of how this works. +.P +If a file named debian/package.xaw exists, then it is installed into +usr/lib/xaw-wrappers/config/package in the package build directory. +.P +For the first first binary package listed in the control file, you may use +debian/xaw instead. +.SH OPTIONS +.TP +.B debhelper options +See +.BR debhelper (1) +for a list of options common to all debhelper commands. +.TP +.B \-n, \--noscripts +Do not modify postinst/prerm/postrm scripts. +.SH ENVIRONMENT +See +.BR debhelper (1) +for a list of environment variables that affect all debhelper commands. +.SH "SEE ALSO" +.TP +.BR debhelper (1) +.TP +.BR update-xaw-wrappers (8) +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_link b/dh_link deleted file mode 100755 index 6cb889cd..00000000 --- a/dh_link +++ /dev/null @@ -1,181 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_link - create symlinks in package build directories - -=cut - -use strict; -use File::Find; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_link> [S<I<debhelper options>>] [B<-A>] [S<I<source destination ...>>] - -=head1 DESCRIPTION - -dh_link is a debhelper program that creates symlinks in package build -directories. - -dh_link accepts a list of pairs of source and destination files. The source -files are the already existing files that will be symlinked from. The -destination files are the symlinks that will be created. There B<must> be -an equal number of source and destination files specified. - -The list can be specified in two ways. A file named debian/package.links -can list pairs of files. If you use this file, you should put each pair -of files on its own line, and separate the files within the pair with -whitespace. Also, pairs of files can be specified as parameters - these -pairs will only be created in the package build directory of the first -package dh_link is told to act on. By default, this is the first binary -package in debian/control, but if you use -p, -i, or -a flags, it will be -the first package specified by those flags. - -Be sure you B<do> specify the full filename to both the source and -destination files (unlike you would do if you were using something like -L<ln(1)>). - -dh_link will generate symlinks that comply with debian policy - absolute -when policy says they should be absolute, and relative links with as short -a path as possible. It will also create any subdirectories it needs to to put -the symlinks in. - -dh_link also scans the package build tree for existing symlinks which do not -conform to debian policy, and corrects them (v4 only). - -=head1 OPTIONS - -=over 4 - -=item B<-A>, B<--all> - -Create any links specified by command line parameters in ALL packages -acted on, not just the first. - -=item I<source destination ...> - -Create a file named "destination" as a link to a file named "source". Do -this in the package build directory of the first package acted on. -(Or in all packages if -A is specified.) - -=back - -=head1 EXAMPLES - - dh_link usr/share/man/man1/foo.1 usr/share/man/man1/bar.1 - -Make bar.1 be a symlink to foo.1 - - dh_link var/lib/foo usr/lib/foo \ -   usr/X11R6/man/man1/foo.1x usr/share/man/man1/bar.1 - -Make /usr/lib/foo/ be a link to /var/lib/foo/, and bar.1 be a symlink to -the X man page foo.1x - -=cut - -init(); - -foreach my $package (@{$dh{DOPACKAGES}}) { -	my $tmp=tmpdir($package); -	my $file=pkgfile($package,"links"); - -	my @links; -	if ($file) { -		@links=filearray($file); -	} - -	# Make sure it has pairs of symlinks and destinations. If it -	# doesn't, $#links will be _odd_ (not even, -- it's zero-based). -	if (int($#links/2) eq $#links/2) { -		error("$file lists a link without a destination."); -	} - -	if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { -		push @links, @ARGV; -	} - -	# Same test as above, including arguments this time. -	if (int($#links/2) eq $#links/2) { -		error("parameters list a link without a destination."); -	} - -	# v4 only and only if there is a temp dir already -	if (! compat(3) && -e $tmp) { -		# Scan for existing links and add them to @links, so they -		# are recreated policy conformant. -		find( -			sub { -				return unless -l; -				my $dir=$File::Find::dir; -				$dir=~s/^\Q$tmp\E//; -				my $target = readlink($_); -				if ($target=~/^\//) { -					push @links, $target; -				} -				else { -					push @links, "$dir/$target"; -				} -				push @links, "$dir/$_"; -				doit("rm","-f",$_); -				 -			}, -			$tmp); -	} -	 -	while (@links) { -		my $dest=pop @links; -		my $src=pop @links; - -		# Relavatize src and dest. -		$src=~s:^/::; -		$dest=~s:^/::; - -		# Make sure the directory the link will be in exists. -		my $basedir=dirname("$tmp/$dest"); -		if (! -e $basedir) { -			doit("install","-d",$basedir); -		} -		 -		# Policy says that if the link is all within one toplevel -		# directory, it should be relative. If it's between -		# top level directories, leave it absolute. -		my @src_dirs=split(m:/+:,$src); -		my @dest_dirs=split(m:/+:,$dest); -		if ($src_dirs[0] eq $dest_dirs[0]) { -		    	# Figure out how much of a path $src and $dest -			# share in common. -			my $x; -			for ($x=0; $x<$#src_dirs && $src_dirs[$x] eq $dest_dirs[$x]; $x++) {} -			# Build up the new src. -			$src=""; -			for (1..$#dest_dirs - $x) { -				$src.="../"; -			} -			for ($x .. $#src_dirs) { -				$src.=$src_dirs[$_]."/"; -			} -			$src=~s:/$::; -		} -		else { -			# Make sure it's properly absolute. -			$src="/$src"; -		} -		 -		doit("ln","-sf",$src,"$tmp/$dest"); -	} -} - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_listpackages b/dh_listpackages deleted file mode 100755 index f919ef62..00000000 --- a/dh_listpackages +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_listpackages - list binary packages debhelper will act on - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_listpackages> [S<I<debhelper options>>] - -=head1 DESCRIPTION - -dh_listpackages is a debhelper program that outputs a list of all binary -packages debhelper commands will act on. If you pass it some options, it -will change the list to match the packages other debhelper commands would -act on if passed the same options. - -=cut - -init(); -print join("\n",@{$dh{DOPACKAGES}})."\n"; - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_listpackages.1 b/dh_listpackages.1 new file mode 100644 index 00000000..aa4e7419 --- /dev/null +++ b/dh_listpackages.1 @@ -0,0 +1,25 @@ +.TH DH_LISTPACKAGES 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_listpackages \- list binary packages debhelper will act on +.SH SYNOPSIS +.B dh_listpackages +.I "[debhelper options]" +.SH "DESCRIPTION" +dh_listpackages is a debhelper program that outputs a list of all binary +packages debhelper commands will act on. If you pass it some options, it +will change the list to match the packages other debhelper commands would +act on if passed the same options. +.SH OPTIONS +.TP +.B debhelper options +See +.BR debhelper (1) +for a list of options common to all debhelper commands. +.SH ENVIRONMENT +See +.BR debhelper (1) +for a list of environment variables that affect all debhelper commands. +.SH "SEE ALSO" +.BR debhelper (1) +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_md5sums b/dh_md5sums deleted file mode 100755 index 6f794e7f..00000000 --- a/dh_md5sums +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_md5sums - generate DEBIAN/md5sums file - -=cut - -use strict; -use Cwd; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_md5sums> [S<I<debhelper options>>] [B<-x>] [B<-X>I<item>] [B<--include-conffiles>] - -=head1 DESCRIPTION - -dh_md5sums is a debhelper program that is responsible for generating -a DEBIAN/md5sums file, which lists the md5sums of each file in the package. -These files are used by the debsums package. - -All files in DEBIAN/ are omitted from the md5sums file, as are all -conffiles (unless you use the --include-conffiles switch). - -The md5sums file is installed with proper permissions and ownerships. - -=head1 OPTIONS - -=over 4 - -=item B<-x>, B<--include-conffiles> - -Include conffiles in the md5sums list. Note that this information is -redundant since it is included elsewhere in debian packages. - -=item B<-X>I<item>, B<--exclude=>I<item> - -Exclude files that contain "item" anywhere in their filename from -being listed in the md5sums file. - -=back - -=cut - -init(); - -foreach my $package (@{$dh{DOPACKAGES}}) { -	my $tmp=tmpdir($package); - -	if (! -d "$tmp/DEBIAN") { -		doit("install","-d","$tmp/DEBIAN"); -	} - -	# Check if we should exclude conffiles. -	my $exclude=""; -	if (! $dh{INCLUDE_CONFFILES} && -r "$tmp/DEBIAN/conffiles") { -		# Generate exclude regexp. -		open (CONFF,"$tmp/DEBIAN/conffiles"); -		while (<CONFF>) { -			chomp; -			s/^\///; -			$exclude.="! -path \"$_\" "; -		} -		close CONFF; -	} -	 -	# See if we should exclude other files. -	if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne '') { -		$exclude.="! \\( $dh{EXCLUDE_FIND} \\) "; -	} -	 -	my $olddir=getcwd(); -	complex_doit("cd $tmp >/dev/null ; find . -type f $exclude ! -regex '.*/DEBIAN/.*' -printf '%P\\0' | xargs -r0 md5sum > DEBIAN/md5sums ; cd '$olddir' >/dev/null"); -	# If the file's empty, no reason to waste inodes on it. -	if (-z "$tmp/DEBIAN/md5sums") { -		doit("rm","-f","$tmp/DEBIAN/md5sums"); -	} -	else { -		doit("chmod",644,"$tmp/DEBIAN/md5sums"); -		doit("chown","0.0","$tmp/DEBIAN/md5sums"); -	} -} - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_md5sums.1 b/dh_md5sums.1 new file mode 100644 index 00000000..b044077c --- /dev/null +++ b/dh_md5sums.1 @@ -0,0 +1,36 @@ +.TH DH_MD5SUMS 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_md5sums \- generate DEBIAN/md5sums file +.SH SYNOPSIS +.B dh_md5sums +.I "[debhelper options] [-x] [-Xitem]" +.SH "DESCRIPTION" +dh_md5sums is a debhelper program that is responsible for generating +a DEBIAN/md5sums file, which lists the md5sums of each file in the package. +.P +All files in DEBIAN/ are omitted from the md5sums file, as are all conffiles +(unless you use the -x switch). +.P +The md5sums file is installed with proper permissions and ownerships. +.SH OPTIONS +.TP +.B debhelper options +See +.BR debhelper (1) +for a list of options common to all debhelper commands. +.TP +.B \-x, \--include-conffiles +Include conffiles in the md5sums list. Note that this information is +redundant since it is included elsewhere in debian packages. +.TP +.B \-Xitem, --exclude=item +Exclude files that contain "item" anywhere in their filename from +being listed in the md5sums file. +.SH ENVIRONMENT +See +.BR debhelper (1) +for a list of environment variables that affect all debhelper commands. +.SH "SEE ALSO" +.BR debhelper (1) +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_movefiles b/dh_movefiles deleted file mode 100755 index 2c8a63fd..00000000 --- a/dh_movefiles +++ /dev/null @@ -1,170 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_movefiles - move files out of debian/tmp into subpackages - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_movefiles> [S<I<debhelper options>>] [B<--sourcedir=>I<dir>] [B<-X>I<item>] S<I<file ...>>] - -=head1 DESCRIPTION - -dh_movefiles is a debhelper program that is responsible for moving files -out of debian/tmp or some other directory and into other package build -directories. This may be useful if your package has a Makefile that installs -everything into debian/tmp, and you need to break that up into subpackages. - -Files named debian/package.files list the files to be moved, separated by -whitespace. The filenames listed should be relative to debian/tmp/. You can -also list directory names, and the whole directory will be moved. If you -prefer, you can list the files to move on the command line and this will -apply to the first package dh_movefiles is told to act on. - -Note: dh_install is a much better program that can do everything this one can, -and more. - -=head1 OPTIONS - -=over 4 - -=item B<--sourcedir=>I<dir> - -Instead of moving files out of debian/tmp (the default), this option makes -it move files out of some other directory. Since the entire contents of -the sourcedir is moved, specifiying something like --sourcedir=/ is very -unsafe, so to prevent mistakes, the sourcedir must be a relative filename; -it cannot begin with a `/'. - -=item B<-Xitem>, B<--exclude=item> - -Exclude files that contain "item" anywhere in their filename from -being installed. - -=item I<file ...> - -Lists files to move. The filenames listed should be relative to -debian/tmp/. You can also list directory names, and the whole directory will -be moved. It is an error to list files here unless you use -p, -i, or -a to -tell dh_movefiles which subpackage to put them in. - -=back - -=head1 NOTES - -Note that files are always moved out of debian/tmp by default (even if you -have instructed debhelper to use a compatibility level higher than one, -which does not otherwise use debian/tmp for anything at all). The idea -behind this is that the package that is being built can be told to install -into debian/tmp, and then files can be moved by dh_movefiles from that -directory. Any files or directories that remain are ignored, and get -deleted by dh_clean later. - -=cut - -init(); - -my $ret=0; - -foreach my $package (@{$dh{DOPACKAGES}}) { -	my $tmp=tmpdir($package); -	my $files=pkgfile($package,"files"); - -	my $sourcedir="debian/tmp"; -	if ($dh{SOURCEDIR}) { -		if ($dh{SOURCEDIR}=~m:^/:) { -			error("The sourcedir must be a relative filename, not starting with `/'."); -		} -		$sourcedir=$dh{SOURCEDIR}; -	} - -	if (! -d $sourcedir) { -		error("$sourcedir does not exist."); -	} - -	my @tomove; - -        # debian/files has a different purpose, so ignore it. -	if ($files && $files ne "debian/files" ) { -		@tomove=filearray($files, $sourcedir); -	} -	 -	if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { -		push @tomove, @ARGV; -	} - -	if (@tomove && $tmp eq $sourcedir) { -		error("I was asked to move files from $sourcedir to $sourcedir. Perhaps you should set DH_COMPAT=2?"); -	} - -	# Now we need to expand wildcards in @tomove. -	# This is only necessary in pre-v3 land -- as of v3, the -	# expension is automatically done by filearray(). -	if (@tomove && compat(2)) { -		my @filelist=(); -		foreach (@tomove) { -			push @filelist, glob("$sourcedir/$_"); -		} -		@tomove=@filelist; -	} -	else { -		# However, filearray() does not add the sourcedir, -		# which we need. -		@tomove = map { "$sourcedir/$_" } @tomove; -	} - -	if (@tomove) { -		if (! -d $tmp) { -			doit("install","-d",$tmp); -		} - -		doit("rm","-f","debian/movelist"); -		foreach (@tomove) { -			my $file=$_; -			if (! -e $file && ! -l $file && ! $dh{NO_ACT}) { -				$ret=1; -				warning("$file not found (supposed to put it in $package)"); -			} -			$file=~s:^\Q$sourcedir\E/+::; -			my $cmd="(cd $sourcedir >/dev/null ; find $file ! -type d "; -			if ($dh{EXCLUDE_FIND}) { -				$cmd.="-a ! \\( $dh{EXCLUDE_FIND} \\) "; -			} -			$cmd.="-print || true) >> debian/movelist"; -			complex_doit($cmd); -		} -		my $pwd=`pwd`; -		chomp $pwd; -		complex_doit("(cd $sourcedir >/dev/null ; tar --create --files-from=$pwd/debian/movelist --file -) | (cd $tmp >/dev/null ;tar xpf -)"); -		# --remove-files is not used above because tar then doesn't -		# preserve hard links -		complex_doit("(cd $sourcedir >/dev/null ; cat $pwd/debian/movelist | xargs rm -f)"); -		doit("rm","-f","debian/movelist"); -	} -} - -# If $ret is set, we wern't actually able to find some  -# files that were specified to be moved, and we should -# exit with the code in $ret. This program puts off  -# exiting with an error until all files have been tried -# to be moved, because this makes it easier for some  -# packages that arn't always sure exactly which files need -# to be moved. -exit $ret; - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_movefiles.1 b/dh_movefiles.1 new file mode 100644 index 00000000..45b84a64 --- /dev/null +++ b/dh_movefiles.1 @@ -0,0 +1,49 @@ +.TH DH_MOVEFILES 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_movefiles \- move files out of debian/tmp into subpackages +.SH SYNOPSIS +.B dh_movefiles +.I "[debhelper options] [--sourcedir=dir] [file ..]" +.SH "DESCRIPTION" +dh_movefiles is a debhelper program that is responsible for moving files out +of debian/tmp or some other directory and into other package build  +directories. This may be useful if your package has a Makefile that installs +everything into debian/tmp, and you need to break that up into subpackages. +.P +Files named debian/package.files list the files to be moved, separated by +whitespace. The filenames listed should be relative to debian/tmp/. You can +also list directory names, and the whole directory will be moved. You can +even use wildcards if you like. If you prefer, you can list the files to +move on the command line and this will apply to the first package +dh_movefiles is told to act on. +.P +The files will be moved in a special order: first all normal files, then all +symlinks. This is done because it tends to be a good thing to have symlinks +last in debian packages, particularly in shared library packages. +.SH OPTIONS +.TP +.B debhelper options +See +.BR debhelper (1) +for a list of options common to all debhelper commands. +.TP +.B --sourcedir=dir +Instead of moveing files out of debian/tmp (the default), this option makes +it move files out of some other directory. Since the entire contents of +the sourcedir is moved, specifiying something like --sourcedir=/ is very +unsafe, so to prevent mistakes, the sourcedir must be a relative filename; it +cannot begin with a `/'. +.TP +.B file .. +Lists files to move. The filenames listed should be relative to debian/tmp/. +You can also list directory names, and the whole directory will be moved. You +can even use wildcards if you like. It is an error to list files here unless +you use -p, -i, or -a to tell dh_movefiles which subpackage to put them in. +.SH ENVIRONMENT +See +.BR debhelper (1) +for a list of environment variables that affect all debhelper commands. +.SH "SEE ALSO" +.BR debhelper (1) +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> @@ -1,72 +1,21 @@  #!/usr/bin/perl -w +# +# Find dependencies on perl stuff +# Remove .packlist files -=head1 NAME - -dh_perl - calculates perl dependencies - -=cut - -use strict; -use Config; -use File::Find; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_perl> [S<I<debhelper options>>] [B<-d>] [S<I<library dirs ...>>] - -=head1 DESCRIPTION - -dh_perl is a debhelper program that is responsible for generating -the ${perl:Depends} substitutions and adding them to substvars files. - -The program will look at perl scripts and modules in your package, -and will use this information to generate a dependency on perl or -perlapi. The dependency will be substituted into your package's control -file wherever you place the token "${perl:Depends}". - -=head1 OPTIONS - -=over 4 - -=item B<-d> - -In some specific cases you may want to depend on perl-base rather than the -full perl package. If so, you can pass the -d option to make dh_perl generate -a dependency on the correct base package. This is only necessary for some -packages that are included in the base system. - -=item B<-V> - -By default, scripts and architecture independent modules don't depend -on any specific version of perl.  The -V option causes the current -version of the perl (or perl-base with -d) package to be specified. - -=item I<library dirs> - -If your package installs perl modules in non-standard -directories, you can make dh_perl check those directories by passing their -names on the command line. It will only check the vendorlib and vendorarch -directories by default. - -=back - -=head1 CONFORMS TO - -Debian policy, version 3.0.1 - -Perl policy, version 1.18 - -=cut - +BEGIN { push @INC, "debian", "/usr/share/debhelper" } +use Dh_Lib;  init(); -my $vendorlib = substr $Config{vendorlib}, 1; -my $vendorarch = substr $Config{vendorarch}, 1; +my $ext = ''; +my $lib_dir = 'usr/lib/perl5'; -# the installation dir for arch-indep modules changed to -# /usr/share/perl5 in this version: -my $min_version = '5.6.0-16'; +# Figure out the version of perl. If $ENV{PERL} is set, query the perl binary +# it points to, otherwise query perl directly. +my $version=sprintf("%.3f", $]); +if (defined $ENV{PERL}) { +	$version=`$ENV{PERL} -e 'printf "%.3f", \$]'`; +}  # Cleaning the paths given on the command line  foreach (@ARGV) { @@ -74,74 +23,136 @@ foreach (@ARGV) {  	s#^/##;  } -my $perl = 'perl'; -# If -d is given, then the dependency is on perl-base rather than perl. -$perl .= '-base' if $dh{D_FLAG}; -my $version; +# If -d is given, then we'll try to depend on one of the perl-5.00X-base  +# package instead of perl-5.00X +$ext='-base' if ($dh{'D_FLAG'}); -# dependency types -use constant PROGRAM   => 1; -use constant PM_MODULE => 2; -use constant XS_MODULE => 4; +foreach $PACKAGE (@{$dh{DOPACKAGES}}) { +	$TMP=tmpdir($PACKAGE); +	$EXT=pkgext($PACKAGE); -foreach my $package (@{$dh{DOPACKAGES}}) { -	my $tmp = tmpdir($package); -	my $ext = pkgext($package); +	my ($file, $v, $arch); +	my $dep_arch = ''; +	my $dep = ''; +	my $found = 0; -	delsubstvar($package, "perl:Depends"); # for idempotency -	  	# Check also for alternate locations given on the command line -	my @dirs = grep -d, map "$tmp/$_", $vendorlib, $vendorarch, @ARGV; +	my $dirs = ''; +	foreach ($lib_dir, @ARGV) { +		$dirs .= "$TMP/$_ " if (-d "$TMP/$_"); +	} +	my $re = '(?:' . join('|', ($lib_dir, @ARGV)) . ')';  	# Look for perl modules and check where they are installed -	my $deps = 0; -	find sub { -		return unless -f; -		$deps |= PM_MODULE if /\.pm$/; -		$deps |= XS_MODULE if /\.so$/; -	}, @dirs if @dirs; - -	# find scripts -	find sub { -		return unless -f and (-x or /\.pl$/); -		local *F; -		return unless open F, $_; -		if (read F, local $_, 32 and m%^#!\s*(/usr/bin/perl|/usr/bin/env\s+perl)\s%) { -			$deps |= PROGRAM; +	if ($dirs) { +	    foreach $file (split(/\n/,`find $dirs -type f \\( -name "*.pm" -or -name "*.so" \\)`)) { +	        $found++; +		if ($file =~ m<^$TMP/$re/(\d\.\d{3})/([^/]+)/>) { +			$v = $1; +			$arch = $2; +			check_module_version ($v, $version); +			$v .= '-thread' if ($arch =~ /-thread/);  +			$dep_arch = add_deps ($dep_arch, "perl-$v"); +		} elsif ($file =~ m<^$TMP/$re/(\d.\d{3})/>) { +			$v = $1; +			check_module_version ($v, $version); +			$dep_arch = add_deps ($dep_arch, "perl-$v");  		} -		close F; -	}, $tmp; - -	if ($deps) { -		my $version=""; -		if ($deps & XS_MODULE or $dh{V_FLAG_SET}) { -			($version) = `dpkg -s $perl` =~ /^Version:\s*(\S+)/m -				unless $version; -			$version = ">= $version"; +	    } +	} + +	if ($found and not $dep_arch) { +		$dep = "perl5$ext"; +	} elsif ($dep_arch) { +		$dep = $dep_arch; +	} + +	# Look for perl scripts +	my ($ff, $newdep); +	foreach $file (split(/\n/,`find $TMP -type f \\( -name "*.pl" -or -perm +111 \\)`)) { +		$ff=`file -b $file`; +		if ($ff =~ /perl/) { +			$newdep = dep_from_script ($file); +			$dep = add_deps ($dep, $newdep) if $newdep;  		} -		elsif ($deps & PM_MODULE) { -			$version = ">= $min_version"; +	} + +	# Remove .packlist files and eventually some empty directories +	if (not $dh{'K_FLAG'}) { +		foreach $file (split(/\n/,`find $TMP -type f -name .packlist`)) +		{ +			unlink($file); +			# Get the directory name +			while ($file =~ s#/[^/]+$##){ +				last if (not -d $file); +				last if (not rmdir $file); +			}  		} -		 -		# no need to depend on an un-versioned perl-base -- it's -		# essential -		addsubstvar($package, "perl:Depends", $perl, $version) -			unless $perl eq 'perl-base' && ! length($version); - -		# add perlapi-<ver> for XS modules -		addsubstvar($package, "perl:Depends", "perlapi-$Config{version}") -			if $deps & XS_MODULE;  	} -} -=head1 SEE ALSO +	next unless $dep; -L<debhelper(7)> +	if (-e "debian/$EXT\substvars") { +		open (IN, "<debian/$EXT\substvars"); +		my @lines=grep { ! /^perl:Depends=/ } <IN>; +		close IN; +		open (OUT, ">debian/$EXT\substvars"); +		print OUT @lines; +	} else { +		open (OUT, ">debian/$EXT\substvars"); +	} +	print OUT "perl:Depends=$dep\n"; +	close OUT; +} -This program is a part of debhelper. +sub add_deps { +	my ($dep, $new) = @_; +	 +        # If the $new-base package can exist then add $ext to $new +	$new = "$new$ext" if ($new =~ m/^(?:perl5|perl-\d\.\d{3})$/); +	 +	# If $new = perl5 or perl5-thread check if perl-X.XXX(-thread)? +	# is not already in the dependencies +	if ($new eq "perl5") { +		return $dep if ($dep =~ m/(^|\s)perl-5\.\d{3}(\s|,|$)/); +	} elsif ($new eq "perl5-thread") { +		return $dep if ($dep =~ m/(^|\s)perl-5\.\d{3}-thread(\s|,|$)/); +	} +	 +	if (not $dep) { +		$dep = $new; +	} else { +		$dep .= ", $new" unless ($dep =~ m/(^|\s)$new(\s|,|$)/); +	} -=head1 AUTHOR +	return $dep; +} -Brendan O'Dea <bod@debian.org> +sub check_module_version { +	my ($v1, $v2) = @_; +	unless ($v1 eq $v2) { +		warning("A module has been found in perl-$v1 arch directory. But perl-$v2 is the perl currently used ...\n"); +	} +} -=cut +sub dep_from_script { +	my $file = shift; +	my ($line, $perl, $dep); +	open (SCRIPT, "<$file") || die "Can't open $file: $!\n"; +	$line = <SCRIPT>; +	close (SCRIPT); +	if ($line =~ m<^#!\s*/usr/bin/(perl\S*)(?:\s+|$)>) { +		$perl = $1; +		if ($perl eq "perl") { +			$dep = "perl5"; +		} elsif ($perl eq "perl-thread") { +			$dep = "perl5-thread"; +		} elsif ($perl =~ m/^perl-\d\.\d{3}(?:-thread)?$/) { +			$dep = $perl; +		} elsif ($perl =~ m/^perl(\d\.\d{3})(\d\d)$/) { +			# Should never happen but ... +			$dep = "perl-$1 (=$1.$2)"; +		} +	} +	return $dep; +} diff --git a/dh_strip b/dh_strip deleted file mode 100755 index 9e107f46..00000000 --- a/dh_strip +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_strip - strip executables, shared libraries, and some static libraries - -=cut - -use strict; -use File::Find; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_strip> [S<I<debhelper options>>] [B<-X>I<item>] - -=head1 DESCRIPTION - -dh_strip is a debhelper program that is responsible for stripping -executables, shared libraries, and static libraries that are not used for -debugging. - -This program examines your package build directories and works out what -to strip on its own. It uses L<file(1)> and file permisions and filenames -to figure out what files are shared libraries (*.so), executable binaries, -and static (lib*.a) and debugging libraries (lib*_g.a, debug/*.so), and -strips each as much as is possible. (Which is not at all for debugging -libraries.) In general it seems to make very good guesses, and will do the -right thing in almost all cases. - -Since it is very hard to automatically guess if a file is a -module, and hard to determine how to strip a module, dh_strip does not -currently deal with stripping binary modules such as .o files. - -=head1 OPTIONS - -=over 4 - -=item B<-X>I<item>, B<--exclude=>I<item> - -Exclude files that contain "item" anywhere in their filename from being -stripped. You may use this option multiple times to build up a list of -things to exclude. - -=back - -=head1 NOTES - -If the DEB_BUILD_OPTIONS environment variable contains "nostrip", nothing -will be stripped, in accordance with Debian policy. - -=head1 CONFORMS TO - -Debian policy, version 3.0.1 - -=cut - -init(); - -# This variable can be used to turn off stripping (see Policy). -if (defined $ENV{DEB_BUILD_OPTIONS} && $ENV{DEB_BUILD_OPTIONS} =~ /nostrip/) { -	exit; -} - -# I could just use `file $_[0]`, but this is safer -sub get_file_type { -	my $file=shift; -	open (FILE, '-|') # handle all filenames safely -		|| exec('file', $file) -		|| die "can't exec file: $!"; -	my $type=<FILE>; -	close FILE; -	return $type; -} - -# Check if a file is an elf binary, shared library, or static library, -# for use by File::Find. It'll fill the following 3 arrays with anything -# it finds: -my (@shared_libs, @executables, @static_libs); -sub testfile { -	return if -l $_ or -d $_; # Skip directories and symlinks always. - -	# See if we were asked to exclude this file. -	# Note that we have to test on the full filename, including directory. -	my $fn="$File::Find::dir/$_"; -	foreach my $f (@{$dh{EXCLUDE}}) { -		return if ($fn=~m/\Q$f\E/); -	} - -	# Is it a debug library in a debug subdir? -	return if $fn=~m/debug\/.*\.so/; - -	# Does its filename look like a shared library? -	if (m/.*\.so.*?/) { -		# Ok, do the expensive test. -		my $type=get_file_type($_); -		if ($type=~m/.*ELF.*shared.*/) { -			push @shared_libs, $fn; -			return; -		} -	} -	 -	# Is it executable? -x isn't good enough, so we need to use stat. -	my (undef,undef,$mode,undef)=stat(_); -	if ($mode & 0111) { -		# Ok, expensive test. -		my $type=get_file_type($_); -		if ($type=~m/.*ELF.*(executable|shared).*/) { -			push @executables, $fn; -			return; -		} -	} -	 -	# Is it a static library, and not a debug library? -	if (m/lib.*\.a$/ && ! m/.*_g\.a$/) { -		push @static_libs, $fn; -		return; -	} -} - -foreach my $package (@{$dh{DOPACKAGES}}) { -	my $tmp=tmpdir($package); - -	@shared_libs=@executables=@static_libs=(); -	find(\&testfile,$tmp); - -	foreach (@shared_libs) { -		# Note that all calls to strip on shared libs -		# *must* inclde the --strip-unneeded. -		doit("strip","--remove-section=.comment", -			"--remove-section=.note","--strip-unneeded",$_); -	} -	 -	foreach (@executables) { -		doit("strip","--remove-section=.comment", -			"--remove-section=.note",$_); -	} - -	foreach (@static_libs) { -		doit("strip","--strip-debug",$_); -	} -} - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_suidregister b/dh_suidregister deleted file mode 100755 index 3bc9bd98..00000000 --- a/dh_suidregister +++ /dev/null @@ -1,127 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_suidregister - obsolete suid registration program - -=head1 SYNOPSIS - -Do not run! - -=head1 DESCRIPTION - -This program used to register suid and sgid files with L<suidregister(1)>, -but with the introduction of L<dpkg-statoverride(8)>, registration of files -in this way is unnecessary, and even harmful, so this program should not be -used. - -=head1 CONVERTING TO STATOVERRIDE - -Converting a package that uses this program to use the new statoverride -mechanism is easy. Just remove the call to dh_suidregister from -debian/rules, and add a versioned conflicts into your control file, as -follows: - -  Conflicts: suidmanager (<< 0.50) - -The conflicts is only necessary if your package used to register things -with suidmanager; if it did not, you can just remove the call to this -program from your rules file. - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; -init(); - -my $notused=1; - -foreach my $package (@{$dh{DOPACKAGES}}) { -	my $tmp=tmpdir($package); -	my $suid=pkgfile($package,"suid"); -	my $tostrip=''; - -	my @files; -	if ($suid) { -		@files=filearray($suid, $tmp); -	} - -	if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { -		push @files, @ARGV; -	} - -	if (! @files && ! $suid) { -		# No files specified (and no empty debian/suid file), so -		# guess what files to process. -		@files=split(/\n/,`find $tmp -type f -perm +6000`); - -		# Strip the debian working directory off of the filenames. -		$tostrip="$tmp/"; -	} -	else { -		# We will strip leading /'s, so the user can feed this -		# program either absolute filenames, or relative filenames, -		# and it will do the right thing either way. -		$tostrip="/"; -	} - -	# Register files with suidregister. -	foreach my $file (@files) { -		# Strip leading $tostrip from $file. -		$file=~s/^$tostrip//; - -		# Create the sed string that will be used to -		# fill in the blanks in the autoscript files. -		# Fill with the owner, group, and perms of the file. -		my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat("$tmp/$file"); -		# Now come up with the user and group names for the uid and -		# gid. -		my $user=getpwuid($uid); -		if (! defined $user) { -			warning("$file has odd uid $uid, not in /etc/passwd"); -			$user=$uid; -		} -		my $group=getgrgid($gid); -		if (! defined $group) { -			warning("$file has odd gid $gid not in /etc/group"); -			$group=$gid; -		} -		# Note that I have to print mode in ocal, stripping file -		# type. -		my $sedstr=sprintf("s:#FILE#:$file:;s/#PACKAGE#/$package/;s/#OWNER#/$user/;s/#GROUP#/$group/;s/#PERMS#/%#o/", -                                   $mode & 07777); -		autoscript($package,"postinst","postinst-suid",$sedstr); -		autoscript($package,"postrm","postrm-suid","$sedstr"); -	} - -	# Remove suid bits from files. This is delayed to this point, because -	# of a situation with hard linked files if it is done earlier. -	# See changelog for 2.0.77. -	foreach my $file (@files) { -		if ( -e "$tmp/$file") { -			doit("chmod","a-s","$tmp/$file"); -		} -	} - -	if (@files) { -		warning("This program should no longer be used. Please read the dh_suidregister(1) man page."); -		$notused=0; -	} -} - -# Although they called it, it's not going to do anything. -if ($notused) { -	warning("This program is obsolete, does nothing, and may be safely removed from your rules file."); -} - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_suidregister.1 b/dh_suidregister.1 new file mode 100644 index 00000000..4e0984b4 --- /dev/null +++ b/dh_suidregister.1 @@ -0,0 +1,62 @@ +.TH DH_SUIDREGISTER 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_suidregister \- set up package to register files with suidregister +.SH SYNOPSIS +.B dh_suidregister +.I "[debhelper options] [-A] [file ...]" +.SH "DESCRIPTION" +dh_suidregister is a debhelper program that is responsible for modifying the +postinst and postrm scripts of a package so the package will register files +with  +.BR suidregister (1) +when it is installed. +.P +Any filenames specified as parameters will be registered in the first  +package dh_suidregister is told to act on. By default, this is the first  +binary package in debian/control, but if you use -p, -i, or -a flags,  +it will be the first package specified by those flags. +.P +Files named debian/package.suid (or debian/suid for the first binary package +in debian/control) can list other files to be registered. +.P +If neither of these methods is used to specify files, dh_suidregister will +scan the package build directory for files that have suid permissions, and +will automatically register all files it finds. +.P +Note that this program modifies your postinst and postrm files. See +.BR dh_installdeb (1) +for an explanation of how this works. +.P +Also note that all files registered by this program will *not* be suid in the +resulting .deb file. The postinst of the package will set their permissions +(even if the user doesn't have suidmanager installed). +.SH OPTIONS +.TP +.B debhelper options +See +.BR debhelper (1) +for a list of options common to all debhelper commands. +.TP +.B \-A, \--all +Register any files specified by command line parameters in ALL packages +acted on. I doubt anyone will find this useful, it's here for consitency +with other debhelper programs. +.TP +.B file ... +Register these files in the first package acted on. (Or in all packages if +-A is specified.) +.SH NOTES +dh_suidregister does not make anything suid. It merely records the +permissions binaries already have. If you need to make something suid, you +must do so manually before calling dh_suidregister. +.SH ENVIRONMENT +See +.BR debhelper (1) +for a list of environment variables that affect all debhelper commands. +.SH "SEE ALSO" +.TP +.BR debhelper (1) +.TP +.BR suidregister (8) +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_testdir b/dh_testdir deleted file mode 100755 index 451b9aeb..00000000 --- a/dh_testdir +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_testdir - test directory before building debian package - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_testdir> [S<I<debhelper options>>] [S<I<file ...>>] - -=head1 DESCRIPTION - -dh_testdir tries to make sure that you are in the correct directory when -building a debian package. It makes sure that the file debian/control -exists, as well as any other files you specify. If not, -it exits with an error. - -=head1 OPTIONS - -=over 4 - -=item I<file ...> - -Test for the existence of these files too. - -=back - -=cut - -init(); - -foreach my $file ('debian/control', @ARGV) { -	if (! -e $file) { -		error("\"$file\" not found. Are you sure you are in the correct directory?"); -	} -} - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_testdir.1 b/dh_testdir.1 new file mode 100644 index 00000000..43c7439a --- /dev/null +++ b/dh_testdir.1 @@ -0,0 +1,28 @@ +.TH DH_TESTDIR 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_testdir \- test directory before building debian package +.SH SYNOPSIS +.B dh_testdir +.I "[debhelper options] [file ...]" +.SH "DESCRIPTION" +dh_testdir tries to make sure that you are in the correct directory when +building a debian package. It makes sure that the file debian/control +exists, as well as any other files you specify. If not, +it exits with an error. +.SH OPTIONS +.TP +.B [debhelper options] +See +.BR debhelper (1) +for a list of options common to all debhelper commands. +.TP +.B file ... +Test for the existence of these files. +.SH ENVIRONMENT +See +.BR debhelper (1) +for a list of environment variables that affect all debhelper commands. +.SH "SEE ALSO" +.BR debhelper (1) +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_testroot b/dh_testroot deleted file mode 100755 index 34684768..00000000 --- a/dh_testroot +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_testroot - ensure that a package is built as root - -=head1 SYNOPSIS - -B<dh_testroot> [S<I<debhelper options>>] - -=head1 DESCRIPTION - -dh_testroot simply checks to see if you are root. If not, it exits with an -error. Debian packages must be built as root, though you can use  -L<fakeroot(1)> - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -if ($< != 0) { -	error("You must run this as root (or use fakeroot)."); -} - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_testroot.1 b/dh_testroot.1 new file mode 100644 index 00000000..6fcdf4f2 --- /dev/null +++ b/dh_testroot.1 @@ -0,0 +1,25 @@ +.TH DH_TESTROOT 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_testroot \- ensure that a package is built as root +.SH SYNOPSIS +.B dh_testroot +.I "[debhelper options]" +.SH "DESCRIPTION" +dh_testroot simply checks to see if you are root. If not, it exits with an +error. Debian packages must be built as root, though you can use +.BR fakeroot (1) +to work around this. +.SH OPTIONS +.TP +.B debhelper options +See +.BR debhelper (1) +for a list of options common to all debhelper commands. +.SH ENVIRONMENT +See +.BR debhelper (1) +for a list of environment variables that affect all debhelper commands. +.SH "SEE ALSO" +.BR debhelper (1) +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_testversion b/dh_testversion deleted file mode 100755 index a17f22e9..00000000 --- a/dh_testversion +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_testversion - ensure that the correct version of debhelper is installed - -=cut - -use Debian::Debhelper::Dh_Lib; -use Debian::Debhelper::Dh_Version; # contains the version number of debhelper. - -=head1 SYNOPSIS - -B<dh_testversion> [S<I<debhelper options>>] [I<operator>] [I<version>] - -=head1 DESCRIPTION - -Note: This program is deprecated. You should use build dependencies -instead. - -dh_testversion compares the version of debhelper against the version you -specify, and if the condition is not met, exits with an error message. - -You can use this in your debian/rules files if a new debhelper feature is -introduced, and your package requires that feature to build correctly. Use -debhelper's changelog to figure out the version you need. - -Be sure not to overuse dh_testversion. If debhelper version 9.5 -introduces a new dh_autofixbugs command, and your package uses it, then if -someone tries to build it with debhelper 1.0, the build will fail anyway when -dh_autofixbugs cannot be found, so there is no need for you to use -dh_testversion. - -=head1 OPTIONS - -=over 4 - -=item I<operator> - -Optional comparison operator used in comparing the versions. If not  -specified, ">=" is used. For descriptions of the comparison operators, see  -dpkg --help. - -=item I<version> - -Version number to compare against the current version of debhelper. If not -specified, dh_testversion does nothing. - -=back - -=cut - -init(); - -my($compare, $ver); - -if ($#ARGV > 0) { -	$compare=shift; -	$ver=shift; -} -elsif ($#ARGV eq 0) { -	$compare=">="; -	$ver=shift; -} - -warning("This program is deprecated, you should use build dependencies instead."); - -if (defined $compare and defined $ver) { -	warning("Something like: \"Build-Depends: debhelper ($compare $ver)\""); -	system('dpkg','--compare-versions',$Debian::Debhelper::Dh_Version::version,$compare,$ver) == 0 || -		error("debhelper version $Debian::Debhelper::Dh_Version::version is installed, but a version $compare $ver is needed to build this package."); -} - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_testversion.1 b/dh_testversion.1 new file mode 100644 index 00000000..19ded263 --- /dev/null +++ b/dh_testversion.1 @@ -0,0 +1,51 @@ +.TH DH_TESTVERSION 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_testversion \- ensure that the correct version of debhelper is installed +.SH SYNOPSIS +.B dh_testversion [debhelper options] [operator] [version] +.SH "DESCRIPTION" +dh_testversion compares the version of debhelper against the version you +specify, and if the condition is not met, exits with an error message. +.P +You should use this in your debian/rules files if a new debhelper feature is +introduced, and your package requires that feature to build correctly. Use +debhelper's changelog to figure out the version you need. +.P +Be sure not to overuse dh_testversion. If debhelper version 9.5 +introduces a new dh_autofixbugs command, and your package uses it, then if +someone tries to build it with debhelper 1.0, the build will fail anyway when +dh_autofixbugs cannot be found, so there is no need for you to use +dh_testversion. +.SH OPTIONS +.TP +.B debhelper options +See +.BR debhelper (1) +for a list of options common to all debhelper commands. +.TP +.B operator +Optional comparison operator used in comparing the versions. If not  +specified, ">=" is used. For descriptions of the comparison operators, see  +dpkg --help. +.TP +.B version +Version number to compare against the current version of debhelper. If not +specified, dh_testversion does nothing. +.SH EXAMPLES +.TP +.I dh_testversion 1.0 +Make sure debhelper version 1.0 or higher is installed. +.TP +.I dh_testversion ge 1.0 +Another way to make sure debhelper version 1.0 or higher is installed. +.TP +.I dh_testversion lt 1.0 +Make sure a version of debhelper less than version 1.0 is installed. +.SH ENVIRONMENT +See +.BR debhelper (1) +for a list of environment variables that affect all debhelper commands. +.SH "SEE ALSO" +.BR debhelper (1) +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> @@ -1,16 +1,20 @@  #!/usr/bin/perl  use Test; -plan(tests => 3); +plan(tests => 4);  # It used to not make absolute links in this situation, and it should.  # #37774  system("./dh_link","etc/foo","usr/lib/bar"); -ok("/etc/foo",readlink("debian/tmp/usr/lib/bar")); +ok("/etc/foo",readlink("debian/debhelper/usr/lib/bar"));  # let's make sure it makes simple relative links ok.  system("./dh_link","usr/bin/foo","usr/bin/bar"); -ok("foo",readlink("debian/tmp/usr/bin/bar")); +ok("foo",readlink("debian/debhelper/usr/bin/bar"));  # ok, more complex relative links.  system("./dh_link","usr/lib/1","usr/bin/2"); -ok("../lib/1",readlink("debian/tmp/usr/bin/2")); +ok("../lib/1",readlink("debian/debhelper/usr/bin/2")); + +# this was bug #40159. Absolute links passes to dh_link. +system("./dh_link","/etc/X11/dfm/system.dfmext","usr/share/dfm/dfmext"); +ok("/etc/X11/dfm/system.dfmext",readlink("debian/debhelper/usr/share/dfm/dfmext")); | 
