debhelper-9.20131227ubuntu1/0000775000000000000000000000000012301136554012272 5ustar debhelper-9.20131227ubuntu1/dh_undocumented0000775000000000000000000000120212164264535015370 0ustar #!/usr/bin/perl -w =head1 NAME dh_undocumented - undocumented.7 symlink program (deprecated no-op) =cut use strict; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS Do not run! =head1 DESCRIPTION This program used to make symlinks to the F man page for man pages not present in a package. Debian policy now frowns on use of the F man page, and so this program does nothing, and should not be used. =cut init(); warning("This program does nothing and should no longer be used."); =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_fixperms0000775000000000000000000001042212164264535014537 0ustar #!/usr/bin/perl -w =head1 NAME dh_fixperms - fix permissions of files in package build directories =cut use strict; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B [S>] [B<-X>I] =head1 DESCRIPTION B is a debhelper program that is responsible for setting the permissions of files and directories in package build directories to a sane state -- a state that complies with Debian policy. B makes all files in F in the package build directory (excluding files in the F directory) be mode 644. It also changes the permissions of all man pages to mode 644. It makes all files be owned by root, and it removes group and other write permission from all files. It removes execute permissions from any libraries, headers, Perl modules, or desktop files that have it set. It makes all files in the standard F and F directories, F and F executable (since v4). Finally, it removes the setuid and setgid bits from all files in the package. =head1 OPTIONS =over 4 =item B<-X>I, B<--exclude> I Exclude files that contain I anywhere in their filename from having their permissions changed. You may use this option multiple times to build up a list of things to exclude. =back =cut init(); foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); my $find_options=''; if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne '') { $find_options="! \\( $dh{EXCLUDE_FIND} \\)"; } # General permissions fixing. complex_doit("find $tmp $find_options -print0", "2>/dev/null | xargs -0r chown --no-dereference 0:0"); complex_doit("find $tmp ! -type l $find_options -print0", "2>/dev/null | xargs -0r chmod go=rX,u+rw,a-s"); # Fix up permissions in usr/share/doc, setting everything to not # executable by default, but leave examples directories alone. complex_doit("find $tmp/usr/share/doc -type f $find_options ! -regex '$tmp/usr/share/doc/[^/]*/examples/.*' -print0 2>/dev/null", "| xargs -0r chmod 644"); complex_doit("find $tmp/usr/share/doc -type d $find_options -print0 2>/dev/null", "| xargs -0r chmod 755"); # Executable man pages are a bad thing.. complex_doit("find $tmp/usr/share/man $tmp/usr/man/ $tmp/usr/X11*/man/ -type f", "$find_options -print0 2>/dev/null | xargs -0r chmod 644"); # ..and so are executable shared and static libraries # (and .la files from libtool) .. complex_doit("find $tmp -perm -5 -type f", "\\( -name '*.so.*' -or -name '*.so' -or -name '*.la' -or -name '*.a' \\) $find_options -print0", "2>/dev/null | xargs -0r chmod 644"); # ..and header files .. complex_doit("find $tmp/usr/include -type f $find_options -print0", "2>/dev/null | xargs -0r chmod 644"); # ..and desktop files .. complex_doit("find $tmp/usr/share/applications -type f $find_options -print0", "2>/dev/null | xargs -0r chmod 644"); # ..and OCaml native-code shared objects .. complex_doit("find $tmp -perm -5 -type f", "\\( -name '*.cmxs' \\) $find_options -print0", "2>/dev/null | xargs -0r chmod 644"); # .. and perl modules. complex_doit("find $tmp/usr/lib/perl5 $tmp/usr/share/perl5 -type f", "-perm -5 -name '*.pm' $find_options -print0", "2>/dev/null | xargs -0r chmod a-X"); # v4 and up if (! compat(3)) { # Programs in the bin and init.d dirs should be executable.. for my $dir (qw{usr/bin bin usr/sbin sbin usr/games etc/init.d}) { if (-d "$tmp/$dir") { complex_doit("find $tmp/$dir -type f $find_options -print0 2>/dev/null", "| xargs -0r chmod a+x"); } } } # ADA ali files should be mode 444 to avoid recompilation complex_doit("find $tmp/usr/lib -type f", "-name '*.ali' $find_options -print0", "2>/dev/null | xargs -0r chmod uga-w"); # Lintian overrides should never be executable, too. if (-d "$tmp/usr/share/lintian") { complex_doit("find $tmp/usr/share/lintian/overrides", "-type f $find_options -print0", "2>/dev/null | xargs -0r chmod 644"); } # Files in $tmp/etc/sudoers.d/ must be mode 440. if (-d "$tmp/etc/sudoers.d") { complex_doit("find $tmp/etc/sudoers.d", "-type f ! -perm 440 $find_options -print0", "2>/dev/null | xargs -0r chmod 440"); } } =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_installinit0000775000000000000000000002462012251374541015235 0ustar #!/usr/bin/perl -w =head1 NAME dh_installinit - install service init files into package build directories =cut use strict; use Debian::Debhelper::Dh_Lib; use File::Find; =head1 SYNOPSIS B [S>] [B<--name=>I] [B<-n>] [B<-R>] [B<-r>] [B<-d>] [S I>] =head1 DESCRIPTION B is a debhelper program that is responsible for installing init scripts with associated defaults files, as well as upstart job files, and systemd service files into package build directories. It also automatically generates the F and F and F commands needed to set up the symlinks in F to start and stop the init scripts. =head1 FILES =over 4 =item debian/I.init If this exists, it is installed into etc/init.d/I in the package build directory. =item debian/I.default If this exists, it is installed into etc/default/I in the package build directory. =item debian/I.upstart If this exists, it is installed into etc/init/I.conf in the package build directory. =item debian/I.service If this exists, it is installed into lib/systemd/system/I.service in the package build directory. =item debian/I.tmpfile If this exists, it is installed into usr/lib/tmpfiles.d/I.conf in the package build directory. (The tmpfiles.d mechanism is currently only used by systemd.) =back =head1 OPTIONS =over 4 =item B<-n>, B<--noscripts> Do not modify F/F/F scripts. =item B<-o>, B<--onlyscripts> Only modify F/F/F scripts, do not actually install any init script, default files, upstart job or systemd service file. May be useful if the file is shipped and/or installed by upstream in a way that doesn't make it easy to let B find it. =item B<-R>, B<--restart-after-upgrade> Do not stop the init script until after the package upgrade has been completed. This is different than the default behavior, which stops the script in the F, and starts it again in the F. This can be useful for daemons that should not have a possibly long downtime during upgrade. But you should make sure that the daemon will not get confused by the package being upgraded while it's running before using this option. =item B<-r>, B<--no-restart-on-upgrade> Do not stop 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 B. Useful for rcS scripts. =item B<-d>, B<--remove-d> Remove trailing B from the name of the package, and use the result for the filename the upstart job file is installed as in F , and for the filename the init script is installed as in etc/init.d and the default file is installed as in F . This may be useful for daemons with names ending in B. (Note: this takes precedence over the B<--init-script> parameter described below.) =item B<-u>I B<--update-rcd-params=>I =item B<--> I Pass I to L. If not specified, B will be passed to L. =item B<--name=>I Install the init script (and default file) as well as upstart job file using the filename I instead of the default filename, which is the package name. When this parameter is used, B looks for and installs files named F, F and F instead of the usual F, F and F. =item B<--init-script=>I Use I as the filename the init script is installed as in F (and also use it as the filename for the defaults file, if it is installed). If you use this parameter, B will look to see if a file in the F directory exists that looks like F and if so will install it as the init script in preference to the files it normally installs. This parameter is deprecated, use the B<--name> parameter instead. This parameter is incompatible with the use of upstart jobs. =item B<--upstart-only> Deprecated option, ignored for compatibility. =item B<--error-handler=>I Call the named shell I if running the init script fails. The function should be provided in the F and F scripts, before the B<#DEBHELPER#> token. =back =head1 NOTES Note that this command is not idempotent. L 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(options => { "r" => \$dh{R_FLAG}, "no-restart-on-upgrade" => \$dh{R_FLAG}, "no-start" => \$dh{NO_START}, "R|restart-after-upgrade" => \$dh{RESTART_AFTER_UPGRADE}, "init-script=s" => \$dh{INIT_SCRIPT}, "update-rcd-params=s", => \$dh{U_PARAMS}, "remove-d" => \$dh{D_FLAG}, "upstart-only" => \$dh{UPSTART_ONLY}, }); # PROMISE: DH NOOP WITHOUT service tmpfile default upstart init init.d foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); # Figure out what filename to install it as. my $script; my $scriptsrc; my $jobfile=$package; if (defined $dh{NAME}) { $jobfile=$script=$dh{NAME}; } elsif ($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$/) { $jobfile=$script=$1; } else { warning("\"$package\" has no final d' in its name, but -d was specified."); } $scriptsrc=$script; } elsif ($dh{INIT_SCRIPT}) { $script=$dh{INIT_SCRIPT}; $scriptsrc=$script; } else { $script=$package; if (compat(9)) { $scriptsrc=$script; } else { $scriptsrc="init"; } } my $service=pkgfile($package,"service"); if ($service ne '' && ! $dh{ONLYSCRIPTS}) { my $path="$tmp/lib/systemd/system"; if (! -d "$path") { doit("install","-d","$path"); } doit("install","-p","-m644",$service,"$path/$script.service"); } my $tmpfile=pkgfile($package,"tmpfile"); if ($tmpfile ne '' && ! $dh{ONLYSCRIPTS}) { my $path="$tmp/usr/lib/tmpfiles.d"; if (! -d "$path") { doit("install","-d","$path"); } doit("install","-p","-m644",$tmpfile,"$path/$script.conf"); } my $job=pkgfile($package,"upstart"); if ($job ne '' && ! $dh{ONLYSCRIPTS}) { if (! -d "$tmp/etc/init") { doit("install","-d","$tmp/etc/init"); } doit("install","-p","-m644",$job,"$tmp/etc/init/$jobfile.conf"); } my $default=pkgfile($package,'default'); if ($default ne '' && ! $dh{ONLYSCRIPTS}) { if (! -d "$tmp/etc/default") { doit("install","-d","$tmp/etc/default"); } doit("install","-p","-m644",$default,"$tmp/etc/default/$script"); } my $init=pkgfile($package,$scriptsrc) || pkgfile($package,"init") || pkgfile($package,"init.d"); if ($job ne '' || ($dh{ONLYSCRIPTS} && -e "$tmp/etc/init/$jobfile.conf")) { # minimal version of invoke-rc.d that supports upstart jobs # directly addsubstvar($package, "misc:Depends", "sysv-rc (>= 2.88dsf-24) | file-rc (>= 0.8.16)"); } if ($init ne '' && ! $dh{ONLYSCRIPTS}) { if (! -d "$tmp/etc/init.d") { doit("install","-d","$tmp/etc/init.d"); } doit("install","-p","-m755",$init,"$tmp/etc/init.d/$script"); } if ($dh{INIT_SCRIPT} && $job ne '' && $init ne '') { error("Can't use --init-script with an upstart job"); } # NB: The case that only $tmpfile is set makes no sense. The # tmpfiles.d(5) mechanism is only available when using systemd (at # least currently), so there has to be an init script which does the # same thing for sysvinit. if ($service ne '' || $job ne '' || $init ne '' || $dh{ONLYSCRIPTS}) { # 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}) { # Include postinst-init-tmpfiles if the package ships any files # in /usr/lib/tmpfiles.d or /etc/tmpfiles.d my $tmpdir = tmpdir($package); my @tmpfiles; find({ wanted => sub { my $name = $File::Find::name; return unless -f $name; $name =~ s/^$tmpdir//g; if ($name =~ m,^/usr/lib/tmpfiles\.d/, || $name =~ m,^/etc/tmpfiles\.d/,) { push @tmpfiles, $name; } }, no_chdir => 1, }, $tmpdir); if (@tmpfiles > 0) { autoscript($package,"postinst", "postinst-init-tmpfiles", "s,#TMPFILES#," . join(" ", @tmpfiles).","); } if (! $dh{NO_START}) { if ($dh{RESTART_AFTER_UPGRADE}) { # update-rc.d, and restart (or # start if new install) script autoscript($package,"postinst", "postinst-init-restart", "s/#SCRIPT#/$script/g;s/#INITPARMS#/$params/;s/#ERROR_HANDLER#/$dh{ERROR_HANDLER}/"); } else { # update-rc.d, and start script autoscript($package,"postinst", "postinst-init", "s/#SCRIPT#/$script/g;s/#INITPARMS#/$params/;s/#ERROR_HANDLER#/$dh{ERROR_HANDLER}/"); } if ($dh{R_FLAG} || $dh{RESTART_AFTER_UPGRADE}) { # stops script only on remove autoscript($package,"prerm","prerm-init-norestart", "s/#SCRIPT#/$script/g;s/#INITPARMS#/$params/;s/#ERROR_HANDLER#/$dh{ERROR_HANDLER}/"); } else { # always stops script autoscript($package,"prerm","prerm-init", "s/#SCRIPT#/$script/g;s/#INITPARMS#/$params/;s/#ERROR_HANDLER#/$dh{ERROR_HANDLER}/"); } } else { # just update-rc.d autoscript($package,"postinst", "postinst-init-nostart", "s/#SCRIPT#/$script/g;s/#INITPARMS#/$params/;s/#ERROR_HANDLER#/$dh{ERROR_HANDLER}/"); } if ($job ne '') { $script=$jobfile; autoscript($package,"preinst", "preinst-upstart-compatibility", "s!#OLD#!/etc/init.d/$script!g;s!#PACKAGE#!$package!g"); autoscript($package,"postinst", "postinst-upstart-replace", "s/#SCRIPT#/$script/g;s/#ERROR_HANDLER#/$dh{ERROR_HANDLER}/"); } else { # removes rc.d links autoscript($package,"postrm","postrm-init", "s/#SCRIPT#/$script/g;s/#INITPARMS#/$params/;s/#ERROR_HANDLER#/$dh{ERROR_HANDLER}/"); } } } } =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHORS Joey Hess Steve Langasek Michael Stapelberg Scott James Remnant =cut debhelper-9.20131227ubuntu1/dh_auto_test0000775000000000000000000000334112164264535014713 0ustar #!/usr/bin/perl -w =head1 NAME dh_auto_test - automatically runs a package's test suites =cut use strict; use Debian::Debhelper::Dh_Lib; use Debian::Debhelper::Dh_Buildsystems; =head1 SYNOPSIS B [S>] [S>] [S I>] =head1 DESCRIPTION B is a debhelper program that tries to automatically run a package's test suite. It does so by running the appropriate command for the build system it detects the package uses. For example, if there's a Makefile and it contains a B or B target, then this is done by running B (or B, if the environment variable is set). If the test suite fails, the command will exit nonzero. If there's no test suite, it will exit zero without doing anything. This is intended to work for about 90% of packages with a test suite. If it doesn't work, you're encouraged to skip using B at all, and just run the test suite manually. =head1 OPTIONS See L> for a list of common build system selection and control options. =over 4 =item B<--> I Pass I to the program that is run, after the parameters that B usually passes. =back =head1 NOTES If the B environment variable contains B, no tests will be performed. dh_auto_test does not run the test suite when a package is being cross compiled. =cut if (get_buildoption("nocheck") || (dpkg_architecture_value("DEB_HOST_GNU_TYPE") ne dpkg_architecture_value("DEB_BUILD_GNU_TYPE"))) { exit 0; } buildsystems_init(); buildsystems_do(); =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/autoscripts/0000775000000000000000000000000012301136554014652 5ustar debhelper-9.20131227ubuntu1/autoscripts/preinst-emacsen0000664000000000000000000000031312251330374017667 0ustar if ( [ "$1" = "install" ] || [ "$1" = "upgrade" ] ) \ && [ -e /var/lib/emacsen-common/state/package/installed/emacsen-common ] then /usr/lib/emacsen-common/emacs-package-install --preinst #PACKAGE# fi debhelper-9.20131227ubuntu1/autoscripts/preinst-sgmlcatalog0000664000000000000000000000067412164264535020573 0ustar if test -f #CENTRALCAT# -a "(" "$1" = "upgrade" -o "$1" = "install" -a -n "$2" ")" && ! dpkg-query -S #CENTRALCAT# >/dev/null 2>&1; then # If the dpkg-query command returns non-zero, the central catalog is # not owned by any package. This is due to an old behaviour of # debhelper. Now that file becomes a conffile. In order to avoid a # question during installation, we remove the old non-conffile. mv #CENTRALCAT# #CENTRALCAT#.old fi debhelper-9.20131227ubuntu1/autoscripts/postinst-modules0000664000000000000000000000021112164264535020130 0ustar if [ "$1" = "configure" ]; then if [ -e /boot/System.map-#KVERS# ]; then depmod -a -F /boot/System.map-#KVERS# #KVERS# || true fi fi debhelper-9.20131227ubuntu1/autoscripts/postrm-suid0000664000000000000000000000022012164264535017065 0ustar if [ "$1" = remove ] && [ -e /etc/suid.conf ] && \ which suidunregister >/dev/null 2>&1; then suidunregister -s #PACKAGE# /#FILE# fi debhelper-9.20131227ubuntu1/autoscripts/postinst-wm-noman0000664000000000000000000000020112164264535020210 0ustar if [ "$1" = "configure" ]; then update-alternatives --install /usr/bin/x-window-manager \ x-window-manager #WM# #PRIORITY# fi debhelper-9.20131227ubuntu1/autoscripts/postinst-init-tmpfiles0000664000000000000000000000034112164264535021250 0ustar # In case this system is running systemd, we need to ensure that all # necessary tmpfiles (if any) are created before starting. if [ -d /run/systemd/system ] ; then systemd-tmpfiles --create #TMPFILES# >/dev/null || true fi debhelper-9.20131227ubuntu1/autoscripts/postrm-debconf0000664000000000000000000000016012164264535017524 0ustar if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then . /usr/share/debconf/confmodule db_purge fi debhelper-9.20131227ubuntu1/autoscripts/postinst-init-nostart0000664000000000000000000000021112164264535021113 0ustar if [ -x "/etc/init.d/#SCRIPT#" ]; then if [ ! -e "/etc/init/#SCRIPT#.conf" ]; then update-rc.d #SCRIPT# #INITPARMS# >/dev/null fi fi debhelper-9.20131227ubuntu1/autoscripts/postrm-init0000664000000000000000000000041512164264535017072 0ustar if [ "$1" = "purge" ] ; then update-rc.d #SCRIPT# remove >/dev/null fi # In case this system is running systemd, we make systemd reload the unit files # to pick up changes. if [ -d /run/systemd/system ] ; then systemctl --system daemon-reload >/dev/null || true fi debhelper-9.20131227ubuntu1/autoscripts/postinst-wm0000664000000000000000000000033112164264535017106 0ustar if [ "$1" = "configure" ]; then update-alternatives --install /usr/bin/x-window-manager \ x-window-manager #WM# #PRIORITY# \ --slave /usr/share/man/man1/x-window-manager.1.gz \ x-window-manager.1.gz #WMMAN# fi debhelper-9.20131227ubuntu1/autoscripts/postinst-suid0000664000000000000000000000042112164264535017427 0ustar if [ "$1" = "configure" ]; then if which suidregister >/dev/null 2>&1 && [ -e /etc/suid.conf ]; then suidregister -s #PACKAGE# /#FILE# #OWNER# #GROUP# #PERMS# elif [ -e /#FILE# ]; then chown #OWNER#:#GROUP# /#FILE# chmod #PERMS# /#FILE# fi fi debhelper-9.20131227ubuntu1/autoscripts/prerm-usrlocal0000664000000000000000000000013112164264535017547 0ustar ( while read dir; do rmdir "$dir" 2>/dev/null || true done ) << DATA #JUSTDIRS# DATA debhelper-9.20131227ubuntu1/autoscripts/prerm-emacsen0000664000000000000000000000022312251330374017330 0ustar if [ -e /var/lib/emacsen-common/state/package/installed/emacsen-common ] ; then /usr/lib/emacsen-common/emacs-package-remove --prerm #PACKAGE# fi debhelper-9.20131227ubuntu1/autoscripts/postrm-ucf0000664000000000000000000000041412164264535016703 0ustar if [ "$1" = "purge" ]; then for ext in .ucf-new .ucf-old .ucf-dist ""; do rm -f "#UCFDEST#$ext" done if [ -x "`which ucf 2>/dev/null`" ]; then ucf --purge "#UCFDEST#" fi if [ -x "`which ucfr 2>/dev/null`" ]; then ucfr --purge #PACKAGE# "#UCFDEST#" fi fi debhelper-9.20131227ubuntu1/autoscripts/maintscript-helper0000664000000000000000000000005112164264535020413 0ustar dpkg-maintscript-helper #PARAMS# -- "$@" debhelper-9.20131227ubuntu1/autoscripts/postinst-init-restart0000664000000000000000000000045212164264535021114 0ustar if [ -x "/etc/init.d/#SCRIPT#" ] || [ -e "/etc/init/#SCRIPT#.conf" ]; then if [ ! -e "/etc/init/#SCRIPT#.conf" ]; then update-rc.d #SCRIPT# #INITPARMS# >/dev/null fi if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi invoke-rc.d #SCRIPT# $_dh_action || #ERROR_HANDLER# fi debhelper-9.20131227ubuntu1/autoscripts/preinst-upstart-compatibility0000664000000000000000000000026012164264535022636 0ustar if [ "$1" = install ] || [ "$1" = upgrade ]; then if [ -e "#OLD#" ] && [ -L "#OLD#" ] \ && [ $(readlink -f "#OLD#") = /lib/init/upstart-job ] then rm -f "#OLD#" fi fi debhelper-9.20131227ubuntu1/autoscripts/postinst-icons0000664000000000000000000000012412164264535017576 0ustar if which update-icon-caches >/dev/null 2>&1 ; then update-icon-caches #DIRLIST# fi debhelper-9.20131227ubuntu1/autoscripts/postinst-moveconffile0000664000000000000000000000030512164264535021140 0ustar if [ "$1" = configure ]; then if [ -e "#OLD#" ]; then echo "Preserving user changes to #NEW# ..." if [ -e "#NEW#" ]; then mv -f "#NEW#" "#NEW#.dpkg-new" fi mv -f "#OLD#" "#NEW#" fi fi debhelper-9.20131227ubuntu1/autoscripts/postinst-init0000664000000000000000000000033412164264535017431 0ustar if [ -x "/etc/init.d/#SCRIPT#" ] || [ -e "/etc/init/#SCRIPT#.conf" ]; then if [ ! -e "/etc/init/#SCRIPT#.conf" ]; then update-rc.d #SCRIPT# #INITPARMS# >/dev/null fi invoke-rc.d #SCRIPT# start || #ERROR_HANDLER# fi debhelper-9.20131227ubuntu1/autoscripts/prerm-wm0000664000000000000000000000012412164264535016350 0ustar if [ "$1" = "remove" ]; then update-alternatives --remove x-window-manager #WM# fi debhelper-9.20131227ubuntu1/autoscripts/postrm-menu-method0000664000000000000000000000025212164264535020350 0ustar inst=/etc/menu-methods/#PACKAGE# if [ "$1" = "remove" ] && [ -f "$inst" ]; then chmod a-x $inst ; fi if [ -x "`which update-menus 2>/dev/null`" ]; then update-menus ; fi debhelper-9.20131227ubuntu1/autoscripts/postinst-emacsen0000664000000000000000000000025712251330374020075 0ustar if [ "$1" = "configure" ] && [ -e /var/lib/emacsen-common/state/package/installed/emacsen-common ] then /usr/lib/emacsen-common/emacs-package-install --postinst #PACKAGE# fi debhelper-9.20131227ubuntu1/autoscripts/postinst-python0000664000000000000000000000030412164264535020004 0ustar PYTHON=#PYVER# if which $PYTHON >/dev/null 2>&1 && [ -e /usr/lib/$PYTHON/compileall.py ]; then DIRLIST="#DIRLIST#" for i in $DIRLIST ; do $PYTHON /usr/lib/$PYTHON/compileall.py -q $i done fi debhelper-9.20131227ubuntu1/autoscripts/postrm-menu0000664000000000000000000000010512164264535017067 0ustar if [ -x "`which update-menus 2>/dev/null`" ]; then update-menus ; fi debhelper-9.20131227ubuntu1/autoscripts/preinst-moveconffile0000664000000000000000000000042212164264535020741 0ustar if [ "$1" = install ] || [ "$1" = upgrade ]; then if [ -e "#OLD#" ]; then if [ "`md5sum \"#OLD#\" | sed -e \"s/ .*//\"`" = \ "`dpkg-query -W -f='${Conffiles}' #PACKAGE# | sed -n -e \"\\\\' #OLD# '{s/ obsolete$//;s/.* //p}\"`" ] then rm -f "#OLD#" fi fi fi debhelper-9.20131227ubuntu1/autoscripts/prerm-init0000664000000000000000000000017412164264535016675 0ustar if [ -x "/etc/init.d/#SCRIPT#" ] || [ -e "/etc/init/#SCRIPT#.conf" ]; then invoke-rc.d #SCRIPT# stop || #ERROR_HANDLER# fi debhelper-9.20131227ubuntu1/autoscripts/postinst-xfonts0000664000000000000000000000007312164264535020007 0ustar if which update-fonts-dir >/dev/null 2>&1; then #CMDS# fi debhelper-9.20131227ubuntu1/autoscripts/postrm-xfonts0000664000000000000000000000010212164264535017441 0ustar if [ -x "`which update-fonts-dir 2>/dev/null`" ]; then #CMDS# fi debhelper-9.20131227ubuntu1/autoscripts/postinst-upstart-replace0000664000000000000000000000007512164264535021603 0ustar update-rc.d -f #SCRIPT# remove >/dev/null || #ERROR_HANDLER# debhelper-9.20131227ubuntu1/autoscripts/postrm-sgmlcatalog0000664000000000000000000000006712164264535020427 0ustar if [ "$1" = "purge" ]; then rm -f #CENTRALCAT#.old fi debhelper-9.20131227ubuntu1/autoscripts/postinst-ucf0000664000000000000000000000013312164264535017240 0ustar if [ "$1" = "configure" ]; then ucf "#UCFSRC#" "#UCFDEST#" ucfr #PACKAGE# "#UCFDEST#" fi debhelper-9.20131227ubuntu1/autoscripts/postrm-icons0000664000000000000000000000012412164264535017237 0ustar if which update-icon-caches >/dev/null 2>&1 ; then update-icon-caches #DIRLIST# fi debhelper-9.20131227ubuntu1/autoscripts/prerm-python0000664000000000000000000000011712164264535017250 0ustar dpkg -L #PACKAGE# | awk '$0~/\.py$/ {print $0"c\n" $0"o"}' | xargs rm -f >&2 debhelper-9.20131227ubuntu1/autoscripts/postinst-menu-method0000664000000000000000000000022212164264535020704 0ustar inst=/etc/menu-methods/#PACKAGE# if [ -f $inst ]; then chmod a+x $inst if [ -x "`which update-menus 2>/dev/null`" ]; then update-menus fi fi debhelper-9.20131227ubuntu1/autoscripts/prerm-init-norestart0000664000000000000000000000023012164264535020705 0ustar if ([ -x "/etc/init.d/#SCRIPT#" ] || [ -e "/etc/init/#SCRIPT#.conf" ]) && \ [ "$1" = remove ]; then invoke-rc.d #SCRIPT# stop || #ERROR_HANDLER# fi debhelper-9.20131227ubuntu1/autoscripts/postinst-makeshlibs0000664000000000000000000000005512164264535020610 0ustar if [ "$1" = "configure" ]; then ldconfig fi debhelper-9.20131227ubuntu1/autoscripts/postinst-usrlocal0000664000000000000000000000042612164264535020314 0ustar if [ "$1" = configure ]; then ( while read line; do set -- $line dir="$1"; mode="$2"; user="$3"; group="$4" if [ ! -e "$dir" ]; then if mkdir "$dir" 2>/dev/null; then chown "$user":"$group" "$dir" chmod "$mode" "$dir" fi fi done ) << DATA #DIRS# DATA fi debhelper-9.20131227ubuntu1/autoscripts/postinst-menu0000664000000000000000000000013612164264535017432 0ustar if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ]; then update-menus fi debhelper-9.20131227ubuntu1/autoscripts/postrm-makeshlibs0000664000000000000000000000005212164264535020246 0ustar if [ "$1" = "remove" ]; then ldconfig fi debhelper-9.20131227ubuntu1/autoscripts/postrm-modules0000664000000000000000000000014312164264535017575 0ustar if [ -e /boot/System.map-#KVERS# ]; then depmod -a -F /boot/System.map-#KVERS# #KVERS# || true fi debhelper-9.20131227ubuntu1/dh_strip0000775000000000000000000001557512251330333014044 0ustar #!/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 [S>] [B<-X>I] [B<--dbg-package=>I] [B<--keep-debug>] =head1 DESCRIPTION B 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 and file permissions and filenames to figure out what files are shared libraries (F<*.so>), executable binaries, and static (F) and debugging libraries (F, F), 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, B does not currently deal with stripping binary modules such as F<.o> files. =head1 OPTIONS =over 4 =item B<-X>I, B<--exclude=>I Exclude files that contain I anywhere in their filename from being stripped. You may use this option multiple times to build up a list of things to exclude. =item B<--dbg-package=>I Causes B to save debug symbols stripped from the packages it acts on as independent files in the package build directory of the specified debugging package. For example, if your packages are libfoo and foo and you want to include a I package with debugging symbols, use BI. Note that this option behaves significantly different in debhelper compatibility levels 4 and below. Instead of specifying the name of a debug package to put symbols in, it specifies a package (or packages) which should have separated debug symbols, and the separated symbols are placed in packages with B<-dbg> added to their name. =item B<-k>, B<--keep-debug> Debug symbols will be retained, but split into an independent file in F in the package build directory. B<--dbg-package> is easier to use than this option, but this option is more flexible. =back =head1 NOTES If the B environment variable contains B, nothing will be stripped, in accordance with Debian policy (section 10.1 "Binaries"). =head1 CONFORMS TO Debian policy, version 3.0.1 =cut init(options => { "keep-debug" => \$dh{K_FLAG}, }); # This variable can be used to turn off stripping (see Policy). if (get_buildoption('nostrip')) { exit; } my $objcopy = cross_command("objcopy"); my $strip = cross_command("strip"); # 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=; 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? # (*.cmxs are OCaml native code shared libraries) if (m/.*\.(so.*?|cmxs$)/) { # 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$/) { # Is it a binary file, or something else (maybe a liner # script on Hurd, for example? I don't use file, because # file returns a variety of things on static libraries. if (-B $_) { push @static_libs, $fn; return; } } } sub make_debug { my $file=shift; my $tmp=shift; my $desttmp=shift; # Don't try to copy debug symbols out if the file is already # stripped. return unless get_file_type($file) =~ /not stripped/; my ($base_file)=$file=~/^\Q$tmp\E(.*)/; my $debug_path; if (! compat(8) && `LC_ALL=C readelf -n $file`=~ /^\s+Build ID: ([0-9a-f]{2})([0-9a-f]+)$/m) { $debug_path=$desttmp."/usr/lib/debug/.build-id/$1/$2.debug" } else { $debug_path=$desttmp."/usr/lib/debug/".$base_file; } my $debug_dir=dirname($debug_path); if (! -d $debug_dir) { doit("install", "-d", $debug_dir); } if (compat(8)) { doit($objcopy, "--only-keep-debug", $file, $debug_path); } else { doit($objcopy, "--only-keep-debug", "--compress-debug-sections", $file, $debug_path); } # No reason for this to be executable. doit("chmod", 644, $debug_path); return $debug_path; } sub attach_debug { my $file=shift; my $debug_path=shift; doit($objcopy, "--add-gnu-debuglink", $debug_path, $file); } foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); # Support for keeping the debugging symbols in a detached file. my $keep_debug=$dh{K_FLAG}; my $debugtmp=$tmp; if (! compat(4)) { if (ref $dh{DEBUGPACKAGES}) { $keep_debug=1; # Note that it's only an array for the v4 stuff; # for v5 only one value is used. my $debugpackage=@{$dh{DEBUGPACKAGES}}[0]; if (! grep { $_ eq $debugpackage } getpackages()) { error("debug package $debugpackage is not listed in the control file"); } $debugtmp=tmpdir($debugpackage); } } else { if (ref $dh{DEBUGPACKAGES} && grep { $_ eq $package } @{$dh{DEBUGPACKAGES}}) { $keep_debug=1; $debugtmp=tmpdir($package."-dbg"); } } @shared_libs=@executables=@static_libs=(); find(\&testfile,$tmp); foreach (@shared_libs) { my $debug_path = make_debug($_, $tmp, $debugtmp) if $keep_debug; # Note that all calls to strip on shared libs # *must* include the --strip-unneeded. doit($strip,"--remove-section=.comment", "--remove-section=.note","--strip-unneeded",$_); attach_debug($_, $debug_path) if defined $debug_path; } foreach (@executables) { my $debug_path = make_debug($_, $tmp, $debugtmp) if $keep_debug; doit($strip,"--remove-section=.comment", "--remove-section=.note",$_); attach_debug($_, $debug_path) if defined $debug_path; } foreach (@static_libs) { doit($strip,"--strip-debug",$_); } } =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_auto_clean0000775000000000000000000000262612164264535015023 0ustar #!/usr/bin/perl -w =head1 NAME dh_auto_clean - automatically cleans up after a build =cut use strict; use Debian::Debhelper::Dh_Lib; use Debian::Debhelper::Dh_Buildsystems; =head1 SYNOPSIS B [S>] [S>] [S I>] =head1 DESCRIPTION B is a debhelper program that tries to automatically clean up after a package build. It does so by running the appropriate command for the build system it detects the package uses. For example, if there's a F and it contains a B, B, or B target, then this is done by running B (or B, if the environment variable is set). If there is a F or F, it is run to clean the package. This is intended to work for about 90% of packages. If it doesn't work, or tries to use the wrong clean target, you're encouraged to skip using B at all, and just run B manually. =head1 OPTIONS See L> for a list of common build system selection and control options. =over 4 =item B<--> I Pass I to the program that is run, after the parameters that B usually passes. =back =cut inhibit_log(); buildsystems_init(); buildsystems_do(); =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_makeshlibs0000775000000000000000000001674312164264535015040 0ustar #!/usr/bin/perl -w =head1 NAME dh_makeshlibs - automatically create shlibs file and call dpkg-gensymbols =cut use strict; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B [S>] [B<-m>I] [B<-V>I<[dependencies]>] [B<-n>] [B<-X>I] [S I>] =head1 DESCRIPTION B is a debhelper program that automatically scans for shared libraries, and generates a shlibs file for the libraries it finds. It also adds a call to ldconfig in the F and F scripts (in v3 mode and above only) to any packages in which it finds shared libraries. Packages that support multiarch are detected, and a Pre-Dependency on multiarch-support is set in ${misc:Pre-Depends} ; you should make sure to put that token into an appropriate place in your debian/control file for packages supporting multiarch. =head1 FILES =over 4 =item debian/I.symbols =item debian/I.symbols.I These symbols files, if present, are passed to L to be processed and installed. Use the I specific names if you need to provide different symbols files for different architectures. =back =head1 OPTIONS =over 4 =item B<-m>I, B<--major=>I Instead of trying to guess the major number of the library with objdump, use the major number specified after the -m parameter. This is much less useful than it used to be, back in the bad old days when this program looked at library filenames rather than using objdump. =item B<-V>, B<-V>I =item B<--version-info>, B<--version-info=>I By default, the shlibs file generated by this program does not make packages depend on any particular version of the package containing the shared library. It may be necessary for you to add some version dependency information to the shlibs file. If B<-V> is specified with no dependency information, the current upstream version of the package is plugged into a dependency that looks like "I B<(E>= IB<)>". Note that in debhelper compatibility levels before v4, the Debian part of the package version number is also included. If B<-V> is specified with parameters, the parameters can be used to specify the exact dependency information needed (be sure to include the package name). Beware of using B<-V> without any parameters; this is a conservative setting that always ensures that other packages' shared library dependencies are at least as tight as they need to be (unless your library is prone to changing ABI without updating the upstream version number), so that if the maintainer screws up then they won't break. The flip side is that packages might end up with dependencies that are too tight and so find it harder to be upgraded. =item B<-n>, B<--noscripts> Do not modify F/F scripts. =item B<-X>I, B<--exclude=>I Exclude files that contain I anywhere in their filename or directory from being treated as shared libraries. =item B<--add-udeb=>I Create an additional line for udebs in the shlibs file and use I as the package name for udebs to depend on instead of the regular library package. =item B<--> I Pass I to L. =back =head1 EXAMPLES =over 4 =item B Assuming this is a package named F, generates a shlibs file that looks something like: libfoobar 1 libfoobar1 =item B Assuming the current version of the package is 1.1-3, generates a shlibs file that looks something like: libfoobar 1 libfoobar1 (>= 1.1) =item B= 1.0)'> Generates a shlibs file that looks something like: libfoobar 1 libfoobar1 (>= 1.0) =back =cut init(options => { "m=s", => \$dh{M_PARAMS}, "major=s" => \$dh{M_PARAMS}, "version-info:s" => \$dh{V_FLAG}, "add-udeb=s" => \$dh{SHLIBS_UDEB}, }); my $objdump=cross_command("objdump"); my $multiarch=dpkg_architecture_value("DEB_HOST_MULTIARCH"); foreach my $package (@{$dh{DOPACKAGES}}) { next if is_udeb($package); my $tmp=tmpdir($package); my %seen; my $need_ldconfig = 0; my $is_multiarch = 0; doit("rm", "-f", "$tmp/DEBIAN/shlibs"); # So, we look for files or links to existing files with names that # match "*.so.*". And we only look at real files not # symlinks, so we don't accidentally add shlibs data to -dev # packages. This may have a few false positives, which is ok, # because only if we can get a library name and a major number from # objdump is anything actually added. my $exclude=''; my (@udeb_lines, @lib_files); if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne '') { $exclude="! \\( $dh{EXCLUDE_FIND} \\) "; } open (FIND, "find $tmp -type f \\( -name '*.so' -or -name '*.so.*' \\) $exclude |"); while () { my ($library, $major); push @lib_files, $_; if (defined $multiarch && $multiarch ne '' && m,/$multiarch/,) { $is_multiarch=1; } my $ret=`$objdump -p $_`; if ($ret=~m/\s+SONAME\s+(.+)\.so\.(.+)/) { # proper soname format $library=$1; $major=$2; } elsif ($ret=~m/\s+SONAME\s+(.+)-(.+)\.so/) { # idiotic crap soname format $library=$1; $major=$2; } if (defined($dh{M_PARAMS}) && $dh{M_PARAMS} ne '') { $major=$dh{M_PARAMS}; } if (! -d "$tmp/DEBIAN") { doit("install","-d","$tmp/DEBIAN"); } my $deps=$package; if ($dh{V_FLAG_SET}) { if ($dh{V_FLAG} ne '') { $deps=$dh{V_FLAG}; } else { # Call isnative because it sets $dh{VERSION} # as a side effect. isnative($package); my $version = $dh{VERSION}; # Old compatibility levels include the # debian revision, while new do not. if (! compat(3)) { # Remove debian version, if any. $version =~ s/-[^-]+$//; } $deps="$package (>= $version)"; } } if (defined($library) && defined($major) && defined($deps) && $library ne '' && $major ne '' && $deps ne '') { $need_ldconfig=1; # Prevent duplicate lines from entering the file. my $line="$library $major $deps"; if (! $seen{$line}) { $seen{$line}=1; complex_doit("echo '$line' >>$tmp/DEBIAN/shlibs"); if (defined($dh{SHLIBS_UDEB}) && $dh{SHLIBS_UDEB} ne '') { my $udeb_deps = $deps; $udeb_deps =~ s/\Q$package\E/$dh{SHLIBS_UDEB}/e; $line="udeb: "."$library $major $udeb_deps"; push @udeb_lines, $line; } } } } close FIND; # Write udeb: lines last. foreach (@udeb_lines) { complex_doit("echo '$_' >>$tmp/DEBIAN/shlibs"); } # New as of dh_v3. if (! compat(2) && ! $dh{NOSCRIPTS} && $need_ldconfig) { autoscript($package,"postinst","postinst-makeshlibs"); autoscript($package,"postrm","postrm-makeshlibs"); } if (-e "$tmp/DEBIAN/shlibs") { doit("chmod",644,"$tmp/DEBIAN/shlibs"); doit("chown","0:0","$tmp/DEBIAN/shlibs"); } # dpkg-gensymbols files my $symbols=pkgfile($package, "symbols"); if (-e $symbols) { my @liblist; if (! compat(7)) { @liblist=map { "-e$_" } @lib_files; } # -I is used rather than using dpkg-gensymbols # own search for symbols files, since that search # is not 100% compatible with debhelper. (For example, # this supports --ignore being used.) doit("dpkg-gensymbols", "-p$package", "-I$symbols", "-P$tmp", @liblist, @{$dh{U_PARAMS}}); if (-s "$tmp/DEBIAN/symbols" == 0) { doit("rm", "-f", "$tmp/DEBIAN/symbols"); } } if ($is_multiarch) { addsubstvar($package, "misc:Pre-Depends", "multiarch-support"); } } =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_installppp0000775000000000000000000000261712164264535015077 0ustar #!/usr/bin/perl -w =head1 NAME dh_installppp - install ppp ip-up and ip-down files =cut use strict; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B [S>] [B<--name=>I] =head1 DESCRIPTION B is a debhelper program that is responsible for installing ppp ip-up and ip-down scripts into package build directories. =head1 FILES =over 4 =item debian/I.ppp.ip-up Installed into etc/ppp/ip-up.d/I in the package build directory. =item debian/I.ppp.ip-down Installed into etc/ppp/ip-down.d/I in the package build directory. =back =head1 OPTIONS =over 4 =item B<--name=>I Look for files named F and install them as F, instead of using the usual files and installing them as the package name. =back =cut init(); # PROMISE: DH NOOP WITHOUT ppp.ip-up ppp.ip-down foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); foreach my $script (qw(up down)) { my $file=pkgfile($package, "ppp.ip-$script"); if ($file ne '') { if (! -d "$tmp/etc/ppp/ip-$script.d") { doit("install","-d","$tmp/etc/ppp/ip-$script.d"); } doit("install","-p","-m755",$file,"$tmp/etc/ppp/ip-$script.d/".pkgfilename($package)); } } } =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/Debian/0000775000000000000000000000000012301136553013453 5ustar debhelper-9.20131227ubuntu1/Debian/Debhelper/0000775000000000000000000000000012301136554015346 5ustar debhelper-9.20131227ubuntu1/Debian/Debhelper/Buildsystem/0000775000000000000000000000000012301136554017652 5ustar debhelper-9.20131227ubuntu1/Debian/Debhelper/Buildsystem/perl_build.pm0000664000000000000000000000306312251330333022326 0ustar # A build system class for handling Perl Build based projects. # # Copyright: © 2008-2009 Joey Hess # © 2008-2009 Modestas Vainius # License: GPL-2+ package Debian::Debhelper::Buildsystem::perl_build; use strict; use Debian::Debhelper::Dh_Lib qw(compat); use base 'Debian::Debhelper::Buildsystem'; use Config; sub DESCRIPTION { "Perl Module::Build (Build.PL)" } sub check_auto_buildable { my ($this, $step) = @_; # Handles everything my $ret = -e $this->get_sourcepath("Build.PL"); if ($step ne "configure") { $ret &&= -e $this->get_sourcepath("Build"); } return $ret ? 1 : 0; } sub do_perl { my $this=shift; $this->doit_in_sourcedir("perl", @_); } sub new { my $class=shift; my $this= $class->SUPER::new(@_); $this->enforce_in_source_building(); return $this; } sub configure { my $this=shift; my @flags; $ENV{PERL_MM_USE_DEFAULT}=1; if ($ENV{CFLAGS} && ! compat(8)) { push @flags, "--config", "optimize=$ENV{CFLAGS} $ENV{CPPFLAGS}"; } if ($ENV{LDFLAGS} && ! compat(8)) { push @flags, "--config", "ld=$Config{ld} $ENV{CFLAGS} $ENV{LDFLAGS}"; } $this->do_perl("Build.PL", "--installdirs", "vendor", @flags, @_); } sub build { my $this=shift; $this->do_perl("Build", @_); } sub test { my $this=shift; $this->do_perl("Build", "test", @_); } sub install { my $this=shift; my $destdir=shift; $this->do_perl("Build", "install", "--destdir", "$destdir", "--create_packlist", 0, @_); } sub clean { my $this=shift; if (-e $this->get_sourcepath("Build")) { $this->do_perl("Build", "distclean", "--allow_mb_mismatch", 1, @_); } } 1 debhelper-9.20131227ubuntu1/Debian/Debhelper/Buildsystem/ant.pm0000664000000000000000000000117112164264535021002 0ustar # A debhelper build system class for handling Ant based projects. # # Copyright: © 2009 Joey Hess # License: GPL-2+ package Debian::Debhelper::Buildsystem::ant; use strict; use base 'Debian::Debhelper::Buildsystem'; sub DESCRIPTION { "Ant (build.xml)" } sub check_auto_buildable { my $this=shift; return (-e $this->get_sourcepath("build.xml")) ? 1 : 0; } sub new { my $class=shift; my $this=$class->SUPER::new(@_); $this->enforce_in_source_building(); return $this; } sub build { my $this=shift; $this->doit_in_sourcedir("ant", @_); } sub clean { my $this=shift; $this->doit_in_sourcedir("ant", "clean", @_); } 1 debhelper-9.20131227ubuntu1/Debian/Debhelper/Buildsystem/autoconf.pm0000664000000000000000000000411412164264535022036 0ustar # A debhelper build system class for handling Autoconf based projects # # Copyright: © 2008 Joey Hess # © 2008-2009 Modestas Vainius # License: GPL-2+ package Debian::Debhelper::Buildsystem::autoconf; use strict; use Debian::Debhelper::Dh_Lib qw(dpkg_architecture_value sourcepackage compat); use base 'Debian::Debhelper::Buildsystem::makefile'; sub DESCRIPTION { "GNU Autoconf (configure)" } sub check_auto_buildable { my $this=shift; my ($step)=@_; # Handle configure; the rest - next class (compat with 7.0.x code path) if ($step eq "configure") { return 1 if -x $this->get_sourcepath("configure"); } return 0; } sub configure { my $this=shift; # Standard set of options for configure. my @opts; push @opts, "--build=" . dpkg_architecture_value("DEB_BUILD_GNU_TYPE"); push @opts, "--prefix=/usr"; push @opts, "--includedir=\${prefix}/include"; push @opts, "--mandir=\${prefix}/share/man"; push @opts, "--infodir=\${prefix}/share/info"; push @opts, "--sysconfdir=/etc"; push @opts, "--localstatedir=/var"; my $multiarch=dpkg_architecture_value("DEB_HOST_MULTIARCH"); if (! compat(8)) { if (defined $multiarch) { push @opts, "--libdir=\${prefix}/lib/$multiarch"; push @opts, "--libexecdir=\${prefix}/lib/$multiarch"; } else { push @opts, "--libexecdir=\${prefix}/lib"; } } else { push @opts, "--libexecdir=\${prefix}/lib/" . sourcepackage(); } push @opts, "--disable-maintainer-mode"; push @opts, "--disable-dependency-tracking"; # Provide --host only if different from --build, as recommended in # autotools-dev README.Debian: When provided (even if equal) # autoconf 2.52+ switches to cross-compiling mode. if (dpkg_architecture_value("DEB_BUILD_GNU_TYPE") ne dpkg_architecture_value("DEB_HOST_GNU_TYPE")) { push @opts, "--host=" . dpkg_architecture_value("DEB_HOST_GNU_TYPE"); } $this->mkdir_builddir(); eval { $this->doit_in_builddir($this->get_source_rel2builddir("configure"), @opts, @_); }; if ($@) { if (-e $this->get_buildpath("config.log")) { $this->doit_in_builddir("tail -v -n +0 config.log"); } die $@; } } 1 debhelper-9.20131227ubuntu1/Debian/Debhelper/Buildsystem/cmake.pm0000664000000000000000000000370112301133020021252 0ustar # A debhelper build system class for handling CMake based projects. # It prefers out of source tree building. # # Copyright: © 2008-2009 Modestas Vainius # License: GPL-2+ package Debian::Debhelper::Buildsystem::cmake; use strict; use Debian::Debhelper::Dh_Lib qw(compat); use base 'Debian::Debhelper::Buildsystem::makefile'; sub DESCRIPTION { "CMake (CMakeLists.txt)" } sub check_auto_buildable { my $this=shift; my ($step)=@_; if (-e $this->get_sourcepath("CMakeLists.txt")) { my $ret = ($step eq "configure" && 1) || $this->SUPER::check_auto_buildable(@_); # Existence of CMakeCache.txt indicates cmake has already # been used by a prior build step, so should be used # instead of the parent makefile class. $ret++ if ($ret && -e $this->get_buildpath("CMakeCache.txt")); return $ret; } return 0; } sub new { my $class=shift; my $this=$class->SUPER::new(@_); $this->prefer_out_of_source_building(@_); return $this; } sub configure { my $this=shift; my @flags; # Standard set of cmake flags push @flags, "-DCMAKE_INSTALL_PREFIX=/usr"; push @flags, "-DCMAKE_VERBOSE_MAKEFILE=ON"; push @flags, "-DCMAKE_BUILD_TYPE=None"; # CMake doesn't respect CPPFLAGS, see #653916. if ($ENV{CPPFLAGS} && ! compat(8)) { $ENV{CFLAGS} .= ' ' . $ENV{CPPFLAGS}; $ENV{CXXFLAGS} .= ' ' . $ENV{CPPFLAGS}; } $this->mkdir_builddir(); eval { $this->doit_in_builddir("cmake", $this->get_source_rel2builddir(), @flags, @_); }; if ($@) { if (-e $this->get_buildpath("CMakeCache.txt")) { $this->doit_in_builddir("tail -v -n +0 CMakeCache.txt"); } die $@; } } sub test { my $this=shift; # Unlike make, CTest does not have "unlimited parallel" setting (-j implies # -j1). So in order to simulate unlimited parallel, allow to fork a huge # number of threads instead. my $parallel = ($this->get_parallel() > 0) ? $this->get_parallel() : 999; $ENV{CTEST_OUTPUT_ON_FAILURE} = 1; return $this->SUPER::test(@_, "ARGS+=-j$parallel"); } 1 debhelper-9.20131227ubuntu1/Debian/Debhelper/Buildsystem/qmake_qt4.pm0000664000000000000000000000053212164264535022106 0ustar package Debian::Debhelper::Buildsystem::qmake_qt4; use strict; use warnings; use Debian::Debhelper::Dh_Lib qw(error); use base 'Debian::Debhelper::Buildsystem::qmake'; sub DESCRIPTION { "qmake for QT 4 (*.pro)"; } sub configure { my $this=shift; $Debian::Debhelper::Buildsystem::qmake::qmake="qmake-qt4"; $this->SUPER::configure(@_); } 1 debhelper-9.20131227ubuntu1/Debian/Debhelper/Buildsystem/qmake.pm0000664000000000000000000000357712164264535021332 0ustar # A debhelper build system class for Qt projects # (based on the makefile class). # # Copyright: © 2010 Kelvin Modderman # License: GPL-2+ package Debian::Debhelper::Buildsystem::qmake; use strict; use warnings; use Debian::Debhelper::Dh_Lib qw(error); use base 'Debian::Debhelper::Buildsystem::makefile'; our $qmake="qmake"; sub DESCRIPTION { "qmake (*.pro)"; } sub check_auto_buildable { my $this=shift; my @projects=glob($this->get_sourcepath('*.pro')); my $ret=0; if (@projects > 0) { $ret=1; # Existence of a Makefile generated by qmake indicates qmake # class has already been used by a prior build step, so should # be used instead of the parent makefile class. my $mf=$this->get_buildpath("Makefile"); if (-e $mf) { $ret = $this->SUPER::check_auto_buildable(@_); open(my $fh, '<', $mf) or error("unable to open Makefile: $mf"); while(<$fh>) { if (m/^# Generated by qmake/i) { $ret++; last; } } close($fh); } } return $ret; } sub configure { my $this=shift; my @options; my @flags; push @options, '-makefile'; push @options, '-nocache'; if ($ENV{CFLAGS}) { push @flags, "QMAKE_CFLAGS_RELEASE=$ENV{CFLAGS} $ENV{CPPFLAGS}"; push @flags, "QMAKE_CFLAGS_DEBUG=$ENV{CFLAGS} $ENV{CPPFLAGS}"; } if ($ENV{CXXFLAGS}) { push @flags, "QMAKE_CXXFLAGS_RELEASE=$ENV{CXXFLAGS} $ENV{CPPFLAGS}"; push @flags, "QMAKE_CXXFLAGS_DEBUG=$ENV{CXXFLAGS} $ENV{CPPFLAGS}"; } if ($ENV{LDFLAGS}) { push @flags, "QMAKE_LFLAGS_RELEASE=$ENV{LDFLAGS}"; push @flags, "QMAKE_LFLAGS_DEBUG=$ENV{LDFLAGS}"; } push @flags, "QMAKE_STRIP=:"; push @flags, "PREFIX=/usr"; $this->doit_in_builddir($qmake, @options, @flags, @_); } sub install { my $this=shift; my $destdir=shift; # qmake generated Makefiles use INSTALL_ROOT in install target # where one would expect DESTDIR to be used. $this->SUPER::install($destdir, "INSTALL_ROOT=$destdir", @_); } 1 debhelper-9.20131227ubuntu1/Debian/Debhelper/Buildsystem/python_distutils.pm0000664000000000000000000001245012251330333023632 0ustar # A debhelper build system class for building Python Distutils based # projects. It prefers out of source tree building. # # Copyright: © 2008 Joey Hess # © 2008-2009 Modestas Vainius # License: GPL-2+ package Debian::Debhelper::Buildsystem::python_distutils; use strict; use Cwd (); use Debian::Debhelper::Dh_Lib qw(error); use base 'Debian::Debhelper::Buildsystem'; sub DESCRIPTION { "Python Distutils (setup.py)" } sub DEFAULT_BUILD_DIRECTORY { my $this=shift; return $this->canonpath($this->get_sourcepath("build")); } sub new { my $class=shift; my $this=$class->SUPER::new(@_); # Out of source tree building is preferred. $this->prefer_out_of_source_building(@_); return $this; } sub check_auto_buildable { my $this=shift; return -e $this->get_sourcepath("setup.py") ? 1 : 0; } sub not_our_cfg { my $this=shift; my $ret; if (open(my $cfg, $this->get_buildpath(".pydistutils.cfg"))) { $ret = not "# Created by dh_auto\n" eq <$cfg>; close $cfg; } return $ret; } sub create_cfg { my $this=shift; if (open(my $cfg, ">", $this->get_buildpath(".pydistutils.cfg"))) { print $cfg "# Created by dh_auto", "\n"; print $cfg "[build]\nbuild-base=", $this->get_build_rel2sourcedir(), "\n"; close $cfg; return 1; } return 0; } sub pre_building_step { my $this=shift; my $step=shift; return unless grep /$step/, qw(build install clean); if ($this->get_buildpath() ne $this->DEFAULT_BUILD_DIRECTORY()) { # --build-base can only be passed to the build command. However, # it is always read from the config file (really weird design). # Therefore create such a cfg config file. # See http://bugs.python.org/issue818201 # http://bugs.python.org/issue1011113 not $this->not_our_cfg() or error("cannot set custom build directory: .pydistutils.cfg is in use"); $this->mkdir_builddir(); $this->create_cfg() or error("cannot set custom build directory: unwritable .pydistutils.cfg"); # Distutils reads $HOME/.pydistutils.cfg $ENV{HOME} = Cwd::abs_path($this->get_buildpath()); } $this->SUPER::pre_building_step($step); } sub dbg_build_needed { my $this=shift; my $act=shift; # Return a list of python-dbg package which are listed # in the build-dependencies. This is kinda ugly, but building # dbg extensions without checking if they're supposed to be # built may result in various FTBFS if the package is not # built in a clean chroot. my @dbg; open (CONTROL, 'debian/control') || error("cannot read debian/control: $!\n"); foreach my $builddeps (join('', ) =~ /^Build-Depends[^:]*:.*\n(?:^[^\w\n].*\n)*/gmi) { while ($builddeps =~ /(python[^, ]*-dbg)/g) { push @dbg, $1; } } close CONTROL; return @dbg; } sub setup_py { my $this=shift; my $act=shift; # We need to to run setup.py with the default python last # as distutils/setuptools modifies the shebang lines of scripts. # This ensures that #!/usr/bin/python is installed last and # not pythonX.Y # Take into account that the default Python must not be in # the requested Python versions. # Then, run setup.py with each available python, to build # extensions for each. my $python_default = `pyversions -d`; if ($? == -1) { error("failed to run pyversions") } my $ecode = $? >> 8; if ($ecode != 0) { error("pyversions -d failed [$ecode]") } $python_default =~ s/^\s+//; $python_default =~ s/\s+$//; my @python_requested = split ' ', `pyversions -r`; if ($? == -1) { error("failed to run pyversions") } $ecode = $? >> 8; if ($ecode != 0) { error("pyversions -r failed [$ecode]") } if (grep /^\Q$python_default\E/, @python_requested) { @python_requested = ( grep(!/^\Q$python_default\E/, @python_requested), "python", ); } my @python_dbg; my @dbg_build_needed = $this->dbg_build_needed(); foreach my $python (map { $_."-dbg" } @python_requested) { if (grep /^(python-all-dbg|\Q$python\E)/, @dbg_build_needed) { push @python_dbg, $python; } elsif (($python eq "python-dbg") and (grep /^\Q$python_default\E/, @dbg_build_needed)) { push @python_dbg, $python_default."-dbg"; } } foreach my $python (@python_dbg, @python_requested) { if (-x "/usr/bin/".$python) { # To allow backports of debhelper we don't pass # --install-layout=deb to 'setup.py install` for # those Python versions where the option is # ignored by distutils/setuptools. if ( $act eq "install" and not ( ($python =~ /^python(?:-dbg)?$/ and $python_default =~ /^python2\.[2345]$/) or $python =~ /^python2\.[2345](?:-dbg)?$/ )) { $this->doit_in_sourcedir($python, "setup.py", $act, @_, "--install-layout=deb"); } else { $this->doit_in_sourcedir($python, "setup.py", $act, @_); } } } } sub build { my $this=shift; $this->setup_py("build", "--force", @_); } sub install { my $this=shift; my $destdir=shift; $this->setup_py("install", "--force", "--root=$destdir", "--no-compile", "-O0", @_); } sub clean { my $this=shift; $this->setup_py("clean", "-a", @_); # Config file will remain if it was created by us if (!$this->not_our_cfg()) { unlink($this->get_buildpath(".pydistutils.cfg")); $this->rmdir_builddir(1); # only if empty } # The setup.py might import files, leading to python creating pyc # files. $this->doit_in_sourcedir('find', '.', '-name', '*.pyc', '-exec', 'rm', '{}', '+'); } 1 debhelper-9.20131227ubuntu1/Debian/Debhelper/Buildsystem/makefile.pm0000664000000000000000000001035712251330374021773 0ustar # A debhelper build system class for handling simple Makefile based projects. # # Copyright: © 2008 Joey Hess # © 2008-2009 Modestas Vainius # License: GPL-2+ package Debian::Debhelper::Buildsystem::makefile; use strict; use Debian::Debhelper::Dh_Lib qw(escape_shell clean_jobserver_makeflags); use base 'Debian::Debhelper::Buildsystem'; # make makes things difficult by not providing a simple way to test # whether a Makefile target exists. Using -n and checking for a nonzero # exit status is not good enough, because even with -n, make will # run commands needed to eg, generate include files -- and those commands # could fail even though the target exists -- and we should let the target # run and propagate any failure. # # Using -n and checking for at least one line of output is better. # That will indicate make either wants to run one command, or # has output a "nothing to be done" message if the target exists but is a # noop. # # However, that heuristic is also not good enough, because a Makefile # could run code that outputs something, even though the -n is asking # it not to run anything. (Again, done for includes.) To detect this false # positive, there is unfortunately only one approach left: To # look for the error message printed by make when a target does not exist. # # This could break if make's output changes. It would only break a minority # of packages where this latter test is needed. The best way to avoid that # problem would be to fix make to have this simple and highly useful # missing feature. # # A final option would be to use -p and parse the output data base. # It's more practical for dh to use that method, since it operates on # only special debian/rules files, and not arbitrary Makefiles which # can be arbitrarily complicated, use implicit targets, and so on. sub exists_make_target { my $this=shift; my $target=shift; my @opts=("-s", "-n", "--no-print-directory"); my $buildpath = $this->get_buildpath(); unshift @opts, "-C", $buildpath if $buildpath ne "."; my $pid = open(MAKE, "-|"); defined($pid) || die "can't fork: $!"; if (! $pid) { open(STDERR, ">&STDOUT"); $ENV{LC_ALL}='C'; exec($this->{makecmd}, @opts, $target, @_); exit(1); } local $/=undef; my $output=; chomp $output; close MAKE; return defined $output && length $output && $output !~ /\*\*\* No rule to make target (`|')\Q$target\E'/; } sub do_make { my $this=shift; # Avoid possible warnings about unavailable jobserver, # and force make to start a new jobserver. clean_jobserver_makeflags(); # Note that this will override any -j settings in MAKEFLAGS. unshift @_, "-j" . ($this->get_parallel() > 0 ? $this->get_parallel() : ""); $this->doit_in_builddir($this->{makecmd}, @_); } sub make_first_existing_target { my $this=shift; my $targets=shift; foreach my $target (@$targets) { if ($this->exists_make_target($target, @_)) { $this->do_make($target, @_); return $target; } } return undef; } sub DESCRIPTION { "simple Makefile" } sub new { my $class=shift; my $this=$class->SUPER::new(@_); $this->{makecmd} = (exists $ENV{MAKE}) ? $ENV{MAKE} : "make"; return $this; } sub check_auto_buildable { my $this=shift; my ($step) = @_; if (-e $this->get_buildpath("Makefile") || -e $this->get_buildpath("makefile") || -e $this->get_buildpath("GNUmakefile")) { # This is always called in the source directory, but generally # Makefiles are created (or live) in the build directory. return 1; } elsif ($step eq "clean" && defined $this->get_builddir() && $this->check_auto_buildable("configure")) { # Assume that the package can be cleaned (i.e. the build directory can # be removed) as long as it is built out-of-source tree and can be # configured. This is useful for derivative buildsystems which # generate Makefiles. return 1; } return 0; } sub build { my $this=shift; $this->do_make(@_); } sub test { my $this=shift; $this->make_first_existing_target(['test', 'check'], @_); } sub install { my $this=shift; my $destdir=shift; $this->make_first_existing_target(['install'], "DESTDIR=$destdir", "AM_UPDATE_INFO_DIR=no", @_); } sub clean { my $this=shift; if (!$this->rmdir_builddir()) { $this->make_first_existing_target(['distclean', 'realclean', 'clean'], @_); } } 1 debhelper-9.20131227ubuntu1/Debian/Debhelper/Buildsystem/perl_makemaker.pm0000664000000000000000000000373612164264535023210 0ustar # A debhelper build system class for handling Perl MakeMaker based projects. # # Copyright: © 2008-2009 Joey Hess # © 2008-2009 Modestas Vainius # License: GPL-2+ package Debian::Debhelper::Buildsystem::perl_makemaker; use strict; use Debian::Debhelper::Dh_Lib qw(compat); use base 'Debian::Debhelper::Buildsystem::makefile'; use Config; sub DESCRIPTION { "Perl ExtUtils::MakeMaker (Makefile.PL)" } sub check_auto_buildable { my $this=shift; my ($step)=@_; # Handles everything if Makefile.PL exists. Otherwise - next class. if (-e $this->get_sourcepath("Makefile.PL")) { if ($step eq "configure") { return 1; } else { return $this->SUPER::check_auto_buildable(@_); } } return 0; } sub new { my $class=shift; my $this=$class->SUPER::new(@_); $this->enforce_in_source_building(); return $this; } sub configure { my $this=shift; my @flags; # If set to a true value then MakeMaker's prompt function will # # always return the default without waiting for user input. $ENV{PERL_MM_USE_DEFAULT}=1; # This prevents Module::Install from interactive behavior. $ENV{PERL_AUTOINSTALL}="--skipdeps"; if ($ENV{CFLAGS} && ! compat(8)) { push @flags, "OPTIMIZE=$ENV{CFLAGS} $ENV{CPPFLAGS}"; } if ($ENV{LDFLAGS} && ! compat(8)) { push @flags, "LD=$Config{ld} $ENV{CFLAGS} $ENV{LDFLAGS}"; } $this->doit_in_sourcedir("perl", "Makefile.PL", "INSTALLDIRS=vendor", # if perl_build is not tested first, need to pass packlist # option to handle fallthrough case (compat(7) ? "create_packlist=0" : ()), @flags, @_); } sub install { my $this=shift; my $destdir=shift; # Special case for Makefile.PL that uses # Module::Build::Compat. PREFIX should not be passed # for those; it already installs into /usr by default. my $makefile=$this->get_sourcepath("Makefile"); if (system(qq{grep -q "generated automatically by MakeMaker" $makefile}) != 0) { $this->SUPER::install($destdir, @_); } else { $this->SUPER::install($destdir, "PREFIX=/usr", @_); } } 1 debhelper-9.20131227ubuntu1/Debian/Debhelper/Buildsystem.pm0000664000000000000000000003032712164264535020225 0ustar # Defines debhelper build system class interface and implementation # of common functionality. # # Copyright: © 2008-2009 Modestas Vainius # License: GPL-2+ package Debian::Debhelper::Buildsystem; use strict; use warnings; use Cwd (); use File::Spec; use Debian::Debhelper::Dh_Lib; # Build system name. Defaults to the last component of the class # name. Do not override this method unless you know what you are # doing. sub NAME { my $this=shift; my $class = ref($this) || $this; if ($class =~ m/^.+::([^:]+)$/) { return $1; } else { error("ınvalid build system class name: $class"); } } # Description of the build system to be shown to the users. sub DESCRIPTION { error("class lacking a DESCRIPTION"); } # Default build directory. Can be overriden in the derived # class if really needed. sub DEFAULT_BUILD_DIRECTORY { "obj-" . dpkg_architecture_value("DEB_HOST_GNU_TYPE"); } # Constructs a new build system object. Named parameters: # - sourcedir- specifies source directory (relative to the current (top) # directory) where the sources to be built live. If not # specified or empty, defaults to the current directory. # - builddir - specifies build directory to use. Path is relative to the # current (top) directory. If undef or empty, # DEFAULT_BUILD_DIRECTORY directory will be used. # - parallel - max number of parallel processes to be spawned for building # sources (-1 = unlimited; 1 = no parallel) # Derived class can override the constructor to initialize common object # parameters. Do NOT use constructor to execute commands or otherwise # configure/setup build environment. There is absolutely no guarantee the # constructed object will be used to build something. Use pre_building_step(), # $build_step() or post_building_step() methods for this. sub new { my ($class, %opts)=@_; my $this = bless({ sourcedir => '.', builddir => undef, parallel => undef, cwd => Cwd::getcwd() }, $class); if (exists $opts{sourcedir}) { # Get relative sourcedir abs_path (without symlinks) my $abspath = Cwd::abs_path($opts{sourcedir}); if (! -d $abspath || $abspath !~ /^\Q$this->{cwd}\E/) { error("invalid or non-existing path to the source directory: ".$opts{sourcedir}); } $this->{sourcedir} = File::Spec->abs2rel($abspath, $this->{cwd}); } if (exists $opts{builddir}) { $this->_set_builddir($opts{builddir}); } if (defined $opts{parallel}) { $this->{parallel} = $opts{parallel}; } return $this; } # Private method to set a build directory. If undef, use default. # Do $this->{builddir} = undef or pass $this->get_sourcedir() to # unset the build directory. sub _set_builddir { my $this=shift; my $builddir=shift || $this->DEFAULT_BUILD_DIRECTORY; if (defined $builddir) { $builddir = $this->canonpath($builddir); # Canonicalize # Sanitize $builddir if ($builddir =~ m#^\.\./#) { # We can't handle those as relative. Make them absolute $builddir = File::Spec->catdir($this->{cwd}, $builddir); } elsif ($builddir =~ /\Q$this->{cwd}\E/) { $builddir = File::Spec->abs2rel($builddir, $this->{cwd}); } # If build directory ends up the same as source directory, drop it if ($builddir eq $this->get_sourcedir()) { $builddir = undef; } } $this->{builddir} = $builddir; return $builddir; } # This instance method is called to check if the build system is able # to build a source package. It will be called during the build # system auto-selection process, inside the root directory of the debian # source package. The current build step is passed as an argument. # Return 0 if the source is not buildable, or a positive integer # otherwise. # # Generally, it is enough to look for invariant unique build system # files shipped with clean source to determine if the source might # be buildable or not. However, if the build system is derived from # another other auto-buildable build system, this method # may also check if the source has already been built with this build # system partitially by looking for temporary files or other common # results the build system produces during the build process. The # latter checks must be unique to the current build system and must # be very unlikely to be true for either its parent or other build # systems. If it is determined that the source has already built # partitially with this build system, the value returned must be # greater than the one of the SUPER call. sub check_auto_buildable { my $this=shift; my ($step)=@_; return 0; } # Derived class can call this method in its constructor # to enforce in source building even if the user requested otherwise. sub enforce_in_source_building { my $this=shift; if ($this->get_builddir()) { $this->{warn_insource} = 1; $this->{builddir} = undef; } } # Derived class can call this method in its constructor to *prefer* # out of source building. Unless build directory has already been # specified building will proceed in the DEFAULT_BUILD_DIRECTORY or # the one specified in the 'builddir' named parameter (which may # match the source directory). Typically you should pass @_ from # the constructor to this call. sub prefer_out_of_source_building { my $this=shift; my %args=@_; if (!defined $this->get_builddir()) { if (!$this->_set_builddir($args{builddir}) && !$args{builddir}) { # If we are here, DEFAULT_BUILD_DIRECTORY matches # the source directory, building might fail. error("default build directory is the same as the source directory." . " Please specify a custom build directory"); } } } # Enhanced version of File::Spec::canonpath. It collapses .. # too so it may return invalid path if symlinks are involved. # On the other hand, it does not need for the path to exist. sub canonpath { my ($this, $path)=@_; my @canon; my $back=0; foreach my $comp (split(m%/+%, $path)) { if ($comp eq '.') { next; } elsif ($comp eq '..') { if (@canon > 0) { pop @canon; } else { $back++; } } else { push @canon, $comp; } } return (@canon + $back > 0) ? join('/', ('..')x$back, @canon) : '.'; } # Given both $path and $base are relative to the $root, converts and # returns path of $path being relative to the $base. If either $path or # $base is absolute, returns another $path (converted to) absolute. sub _rel2rel { my ($this, $path, $base, $root)=@_; $root = $this->{cwd} unless defined $root; if (File::Spec->file_name_is_absolute($path)) { return $path; } elsif (File::Spec->file_name_is_absolute($base)) { return File::Spec->rel2abs($path, $root); } else { return File::Spec->abs2rel( File::Spec->rel2abs($path, $root), File::Spec->rel2abs($base, $root) ); } } # Get path to the source directory # (relative to the current (top) directory) sub get_sourcedir { my $this=shift; return $this->{sourcedir}; } # Convert path relative to the source directory to the path relative # to the current (top) directory. sub get_sourcepath { my ($this, $path)=@_; return File::Spec->catfile($this->get_sourcedir(), $path); } # Get path to the build directory if it was specified # (relative to the current (top) directory). undef if the same # as the source directory. sub get_builddir { my $this=shift; return $this->{builddir}; } # Convert path that is relative to the build directory to the path # that is relative to the current (top) directory. # If $path is not specified, always returns build directory path # relative to the current (top) directory regardless if builddir was # specified or not. sub get_buildpath { my ($this, $path)=@_; my $builddir = $this->get_builddir() || $this->get_sourcedir(); if (defined $path) { return File::Spec->catfile($builddir, $path); } return $builddir; } # When given a relative path to the source directory, converts it # to the path that is relative to the build directory. If $path is # not given, returns a path to the source directory that is relative # to the build directory. sub get_source_rel2builddir { my $this=shift; my $path=shift; my $dir = '.'; if ($this->get_builddir()) { $dir = $this->_rel2rel($this->get_sourcedir(), $this->get_builddir()); } if (defined $path) { return File::Spec->catfile($dir, $path); } return $dir; } sub get_parallel { my $this=shift; return $this->{parallel}; } # When given a relative path to the build directory, converts it # to the path that is relative to the source directory. If $path is # not given, returns a path to the build directory that is relative # to the source directory. sub get_build_rel2sourcedir { my $this=shift; my $path=shift; my $dir = '.'; if ($this->get_builddir()) { $dir = $this->_rel2rel($this->get_builddir(), $this->get_sourcedir()); } if (defined $path) { return File::Spec->catfile($dir, $path); } return $dir; } # Creates a build directory. sub mkdir_builddir { my $this=shift; if ($this->get_builddir()) { doit("mkdir", "-p", $this->get_builddir()); } } sub _cd { my ($this, $dir)=@_; verbose_print("cd $dir"); if (! $dh{NO_ACT}) { chdir $dir or error("error: unable to chdir to $dir"); } } # Changes working directory to the source directory (if needed), # calls doit(@_) and changes working directory back to the top # directory. sub doit_in_sourcedir { my $this=shift; if ($this->get_sourcedir() ne '.') { my $sourcedir = $this->get_sourcedir(); $this->_cd($sourcedir); doit(@_); $this->_cd($this->_rel2rel($this->{cwd}, $sourcedir)); } else { doit(@_); } return 1; } # Changes working directory to the build directory (if needed), # calls doit(@_) and changes working directory back to the top # directory. sub doit_in_builddir { my $this=shift; if ($this->get_buildpath() ne '.') { my $buildpath = $this->get_buildpath(); $this->_cd($buildpath); doit(@_); $this->_cd($this->_rel2rel($this->{cwd}, $buildpath)); } else { doit(@_); } return 1; } # In case of out of source tree building, whole build directory # gets wiped (if it exists) and 1 is returned. If build directory # had 2 or more levels, empty parent directories are also deleted. # If build directory does not exist, nothing is done and 0 is returned. sub rmdir_builddir { my $this=shift; my $only_empty=shift; if ($this->get_builddir()) { my $buildpath = $this->get_buildpath(); if (-d $buildpath) { my @dir = File::Spec->splitdir($this->get_build_rel2sourcedir()); my $peek; if (not $only_empty) { doit("rm", "-rf", $buildpath); pop @dir; } # If build directory is relative and had 2 or more levels, delete # empty parent directories until the source or top directory level. if (not File::Spec->file_name_is_absolute($buildpath)) { while (($peek=pop @dir) && $peek ne '.' && $peek ne '..') { my $dir = $this->get_sourcepath(File::Spec->catdir(@dir, $peek)); doit("rmdir", "--ignore-fail-on-non-empty", $dir); last if -d $dir; } } } return 1; } return 0; } # Instance method that is called before performing any step (see below). # Action name is passed as an argument. Derived classes overriding this # method should also call SUPER implementation of it. sub pre_building_step { my $this=shift; my ($step)=@_; # Warn if in source building was enforced but build directory was # specified. See enforce_in_source_building(). if ($this->{warn_insource}) { warning("warning: " . $this->NAME() . " does not support building out of source tree. In source building enforced."); delete $this->{warn_insource}; } } # Instance method that is called after performing any step (see below). # Action name is passed as an argument. Derived classes overriding this # method should also call SUPER implementation of it. sub post_building_step { my $this=shift; my ($step)=@_; } # The instance methods below provide support for configuring, # building, testing, install and cleaning source packages. # In case of failure, the method may just error() out. # # These methods should be overriden by derived classes to # implement build system specific steps needed to build the # source. Arbitary number of custom step arguments might be # passed. Default implementations do nothing. sub configure { my $this=shift; } sub build { my $this=shift; } sub test { my $this=shift; } # destdir parameter specifies where to install files. sub install { my $this=shift; my $destdir=shift; } sub clean { my $this=shift; } 1 debhelper-9.20131227ubuntu1/Debian/Debhelper/Sequence/0000775000000000000000000000000012301136554017116 5ustar debhelper-9.20131227ubuntu1/Debian/Debhelper/Sequence/python_support.pm0000664000000000000000000000054312164264535022603 0ustar #!/usr/bin/perl # debhelper sequence file for python-support use warnings; use strict; use Debian::Debhelper::Dh_Lib; # Test if dh_pysupport is available before inserting it. # (This would not be needed if this file was contained in the python-support # package.) if (-x "/usr/bin/dh_pysupport") { insert_before("dh_installinit", "dh_pysupport"); } 1 debhelper-9.20131227ubuntu1/Debian/Debhelper/Dh_Lib.pm0000664000000000000000000006150112251330333017023 0ustar #!/usr/bin/perl -w # # Library functions for debhelper programs, perl version. # # Joey Hess, GPL copyright 1997-2008. package Debian::Debhelper::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 &pkgfilename &isnative &autoscript &filearray &filedoublearray &getpackages &basename &dirname &xargs %dh &compat &addsubstvar &delsubstvar &excludefile &package_arch &is_udeb &udeb_filename &debhelper_script_subst &escape_shell &inhibit_log &load_log &write_log &commit_override_log &dpkg_architecture_value &sourcepackage &is_make_jobserver_unavailable &clean_jobserver_makeflags &cross_command &set_buildflags &get_buildoption); my $max_compat=10; # The Makefile changes this if debhelper is installed in a PREFIX. my $prefix="/usr"; sub init { my %params=@_; # Check to see if an option line starts with a dash, # or DH_OPTIONS is set. # 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. if ((defined $ENV{DH_OPTIONS} && length $ENV{DH_OPTIONS}) || (defined $ENV{DH_INTERNAL_OPTIONS} && length $ENV{DH_INTERNAL_OPTIONS}) || grep /^-/, @ARGV) { eval "use Debian::Debhelper::Dh_Getopt"; error($@) if $@; Debian::Debhelper::Dh_Getopt::parseopts(%params); } # Another way to set excludes. if (exists $ENV{DH_ALWAYS_EXCLUDE} && length $ENV{DH_ALWAYS_EXCLUDE}) { push @{$dh{EXCLUDE}}, split(":", $ENV{DH_ALWAYS_EXCLUDE}); } # Generate EXCLUDE_FIND. if ($dh{EXCLUDE}) { $dh{EXCLUDE_FIND}=''; foreach (@{$dh{EXCLUDE}}) { my $x=$_; $x=escape_shell($x); $x=~s/\./\\\\./g; $dh{EXCLUDE_FIND}.="-regex .\\*$x.\\* -or "; } $dh{EXCLUDE_FIND}=~s/ -or $//; } # 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). Only if the main package was not set on the # command line. if (! exists $dh{MAINPACKAGE} || ! defined $dh{MAINPACKAGE}) { my @allpackages=getpackages(); $dh{MAINPACKAGE}=$allpackages[0]; } # Check if packages to build have been specified, if not, fall back to # the default, building all relevant packages. if (! defined $dh{DOPACKAGES} || ! @{$dh{DOPACKAGES}}) { push @{$dh{DOPACKAGES}}, getpackages('both'); } # 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]; # If no error handling function was specified, just propagate # errors out. if (! exists $dh{ERROR_HANDLER} || ! defined $dh{ERROR_HANDLER}) { $dh{ERROR_HANDLER}='exit \$?'; } } # Run at exit. Add the command to the log files for the packages it acted # on, if it's exiting successfully. my $write_log=1; sub END { if ($? == 0 && $write_log) { write_log(basename($0), @{$dh{DOPACKAGES}}); } } sub logfile { my $package=shift; my $ext=pkgext($package); return "debian/${ext}debhelper.log" } sub add_override { my $line=shift; $line="override_$ENV{DH_INTERNAL_OVERRIDE} $line" if defined $ENV{DH_INTERNAL_OVERRIDE}; return $line; } sub remove_override { my $line=shift; $line=~s/^\Qoverride_$ENV{DH_INTERNAL_OVERRIDE}\E\s+// if defined $ENV{DH_INTERNAL_OVERRIDE}; return $line; } sub load_log { my ($package, $db)=@_; my @log; open(LOG, "<", logfile($package)) || return; while () { chomp; my $command=remove_override($_); push @log, $command; $db->{$package}{$command}=1 if defined $db; } close LOG; return @log; } sub write_log { my $cmd=shift; my @packages=@_; return if $dh{NO_ACT}; foreach my $package (@packages) { my $log=logfile($package); open(LOG, ">>", $log) || error("failed to write to ${log}: $!"); print LOG add_override($cmd)."\n"; close LOG; } } sub commit_override_log { my @packages=@_; return if $dh{NO_ACT}; foreach my $package (@packages) { my @log=map { remove_override($_) } load_log($package); my $log=logfile($package); open(LOG, ">", $log) || error("failed to write to ${log}: $!"); print LOG $_."\n" foreach @log; close LOG; } } sub inhibit_log { $write_log=0; } # Pass it an array containing the arguments of a shell command like would # be run by exec(). It turns that into a line like you might enter at the # shell, escaping metacharacters and quoting arguments that contain spaces. sub escape_shell { my @args=@_; my $line=""; my @ret; foreach my $word (@args) { if ($word=~/\s/) { # Escape only a few things since it will be quoted. # Note we use double quotes because you cannot # escape ' in single quotes, while " can be escaped # in double. # This does make -V"foo bar" turn into "-Vfoo bar", # but that will be parsed identically by the shell # anyway.. $word=~s/([\n`\$"\\])/\\$1/g; push @ret, "\"$word\""; } else { # This list is from _Unix in a Nutshell_. (except '#') $word=~s/([\s!"\$()*+#;<>?@\[\]\\`|~])/\\$1/g; push @ret,$word; } } return join(' ', @ret); } # 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(escape_shell(@_)); if (! $dh{NO_ACT}) { system(@_) == 0 || _error_exitcode(join(" ", @_)); } } # 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_exitcode(join(" ", @_)) } } sub _error_exitcode { my $command=shift; if ($? == -1) { error("$command failed to to execute: $!"); } elsif ($? & 127) { error("$command died with signal ".($? & 127)); } else { error("$command returned exit code ".($? >> 8)); } } # 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; # LINUX SPECIFIC!! # (And obsolete; it's bigger now.) # I could use POSIX::ARG_MAX, but that would be slow. # 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 + length($_) + 1; } } 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 die (can be caught). sub error { my $message=shift; die basename($0).": $message\n"; } # 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/\/$//g; # ignore trailing slashes $fn=~s:^.*/(.*?)$:$1:; return $fn; } # Returns the directory name of the argument passed to it. sub dirname { my $fn=shift; $fn=~s/\/$//g; # ignore trailing slashes $fn=~s:^(.*)/.*?$:$1:; return $fn; } # Pass in a number, will return true iff the current compatibility level # is less than or equal to that number. { my $warned_compat=0; my $c; sub compat { my $num=shift; my $nowarn=shift; if (! defined $c) { $c=1; if (-e 'debian/compat') { open (COMPAT_IN, "debian/compat") || error "debian/compat: $!"; my $l=; close COMPAT_IN; if (! defined $l || ! length $l) { warning("debian/compat is empty, assuming level $c") unless defined $ENV{DH_COMPAT}; } else { chomp $l; $c=$l; } } else { warning("No compatibility level specified in debian/compat"); warning("This package will soon FTBFS; time to fix it!"); } if (defined $ENV{DH_COMPAT}) { $c=$ENV{DH_COMPAT}; } } if ($c <= 4 && ! $warned_compat && ! $nowarn) { warning("Compatibility levels before 5 are deprecated (level $c in use)"); $warned_compat=1; } if ($c > $max_compat) { error("Sorry, but $max_compat is the highest compatibility level supported by this debhelper."); } 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-compatibility 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 existing filename to use. # # It tries several filenames: # * debian/package.filename.buildarch # * debian/package.filename.buildos # * debian/package.filename # * debian/filename (if the package is the main package) # If --name was specified then the files # must have the name after the package name: # * debian/package.name.filename.buildarch # * debian/package.name.filename.buildos # * debian/package.name.filename # * debian/name.filename (if the package is the main package) sub pkgfile { my $package=shift; my $filename=shift; if (defined $dh{NAME}) { $filename="$dh{NAME}.$filename"; } # First, check for files ending in buildarch and buildos. my $match; foreach my $file (glob("debian/$package.$filename.*")) { next if ! -f $file; next if $dh{IGNORE} && exists $dh{IGNORE}->{$file}; if ($file eq "debian/$package.$filename.".buildarch()) { $match=$file; # buildarch files are used in preference to buildos files. last; } elsif ($file eq "debian/$package.$filename.".buildos()) { $match=$file; } } return $match if defined $match; my @try=("debian/$package.$filename"); if ($package eq $dh{MAINPACKAGE}) { push @try, "debian/$filename"; } foreach my $file (@try) { if (-f $file && (! $dh{IGNORE} || ! exists $dh{IGNORE}->{$file})) { return $file; } } 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 (compat(1) and $package eq $dh{MAINPACKAGE}) { return ""; } return "$package."; } # Pass it the name of a binary package, it returns the name to install # files by in eg, etc. Normally this is the same, but --name can override # it. sub pkgfilename { my $package=shift; if (defined $dh{NAME}) { return $dh{NAME}; } return $package; } # 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; return $isnative_cache{$package} 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:\s*(.*)/m; # Did the changelog parse fail? if (! defined $dh{VERSION}) { error("changelog parse failure"); } # Is this a native Debian package? if ($dh{VERSION}=~m/.*-/) { return $isnative_cache{$package}=0; } else { return $isnative_cache{$package}=1; } } } # 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: either text: shell-quoted sed to run on the snippet. Ie, 's/#PACKAGE#/$PACKAGE/' # or a sub to run on each line of the snippet. Ie sub { s/#PACKAGE#/$PACKAGE/ } sub autoscript { my $package=shift; my $script=shift; my $filename=shift; my $sed=shift || ""; # This is the file we will modify. 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 "$prefix/share/debhelper/autoscripts/$filename") { $infile="$prefix/share/debhelper/autoscripts/$filename"; } else { error("$prefix/share/debhelper/autoscripts/$filename does not exist"); } } if (-e $outfile && ($script eq 'postrm' || $script eq 'prerm') && !compat(5)) { # Add fragments to top so they run in reverse order when removing. complex_doit("echo \"# Automatically added by ".basename($0)."\"> $outfile.new"); autoscript_sed($sed, $infile, "$outfile.new"); complex_doit("echo '# End automatically added section' >> $outfile.new"); complex_doit("cat $outfile >> $outfile.new"); complex_doit("mv $outfile.new $outfile"); } else { complex_doit("echo \"# Automatically added by ".basename($0)."\">> $outfile"); autoscript_sed($sed, $infile, $outfile); complex_doit("echo '# End automatically added section' >> $outfile"); } } sub autoscript_sed { my $sed = shift; my $infile = shift; my $outfile = shift; if (ref($sed) eq 'CODE') { open(IN, $infile) or die "$infile: $!"; open(OUT, ">>$outfile") or die "$outfile: $!"; while () { $sed->(); print OUT } close(OUT) or die "$outfile: $!"; close(IN) or die "$infile: $!"; } else { complex_doit("sed \"$sed\" $infile >> $outfile"); } } # Removes a whole substvar line. sub delsubstvar { my $package=shift; my $substvar=shift; my $ext=pkgext($package); my $substvarfile="debian/${ext}substvars"; if (-e $substvarfile) { complex_doit("grep -s -v '^${substvar}=' $substvarfile > $substvarfile.new || true"); doit("mv", "$substvarfile.new","$substvarfile"); } } # Adds a dependency on some package to the specified # substvar in a package's substvar's file. sub addsubstvar { my $package=shift; my $substvar=shift; my $deppackage=shift; my $verinfo=shift; my $remove=shift; my $ext=pkgext($package); my $substvarfile="debian/${ext}substvars"; my $str=$deppackage; $str.=" ($verinfo)" if defined $verinfo && length $verinfo; # Figure out what the line will look like, based on what's there # now, and what we're to add or remove. my $line=""; if (-e $substvarfile) { my %items; open(SUBSTVARS_IN, "$substvarfile") || error "read $substvarfile: $!"; while () { chomp; if (/^\Q$substvar\E=(.*)/) { %items = map { $_ => 1} split(", ", $1); last; } } close SUBSTVARS_IN; if (! $remove) { $items{$str}=1; } else { delete $items{$str}; } $line=join(", ", sort keys %items); } elsif (! $remove) { $line=$str; } if (length $line) { complex_doit("(grep -s -v ${substvar} $substvarfile; echo ".escape_shell("${substvar}=$line").") > $substvarfile.new"); doit("mv", "$substvarfile.new", $substvarfile); } else { delsubstvar($package,$substvar); } } # Reads in the specified file, one line at a time. splits on words, # and returns an array of arrays of the contents. # If a value is passed in as the second parameter, then glob # expansion is done in the directory specified by the parameter ("." is # frequently a good choice). sub filedoublearray { my $file=shift; my $globdir=shift; # executable config files are a v9 thing. my $x=! compat(8) && -x $file; if ($x) { require Cwd; my $cmd=Cwd::abs_path($file); open (DH_FARRAY_IN, "$cmd |") || error("cannot run $file: $!"); } else { open (DH_FARRAY_IN, $file) || error("cannot read $file: $!"); } my @ret; while () { chomp; # Only ignore comments and empty lines in v5 mode. if (! compat(4) && ! $x) { next if /^#/ || /^$/; } my @line; # Only do glob expansion in v3 mode. # # The tricky bit is that the glob expansion is done # as if we were in the specified directory, so the # filenames that come out are relative to it. if (defined $globdir && ! compat(2) && ! $x) { foreach (map { glob "$globdir/$_" } split) { s#^$globdir/##; push @line, $_; } } else { @line = split; } push @ret, [@line]; } close DH_FARRAY_IN || error("problem reading $file: $!"); return @ret; } # Reads in the specified file, one word at a time, and returns an array of # the result. Can do globbing as does filedoublearray. sub filearray { return map { @$_ } filedoublearray(@_); } # Passed a filename, returns true if -X says that file should be excluded. sub excludefile { my $filename = shift; foreach my $f (@{$dh{EXCLUDE}}) { return 1 if $filename =~ /\Q$f\E/; } return 0; } { my %dpkg_arch_output; sub dpkg_architecture_value { my $var = shift; if (! exists($dpkg_arch_output{$var})) { local $_; open(PIPE, '-|', 'dpkg-architecture') or error("dpkg-architecture failed"); while () { chomp; my ($k, $v) = split(/=/, $_, 2); $dpkg_arch_output{$k} = $v; } close(PIPE); } return $dpkg_arch_output{$var}; } } # Returns the build architecture. sub buildarch { dpkg_architecture_value('DEB_HOST_ARCH'); } # Returns the build OS. sub buildos { dpkg_architecture_value("DEB_HOST_ARCH_OS"); } # Passed an arch and a list of arches to match against, returns true if matched { my %knownsame; sub samearch { my $arch=shift; my @archlist=split(/\s+/,shift); foreach my $a (@archlist) { # Avoid expensive dpkg-architecture call to compare # with a simple architecture name. "linux-any" and # other architecture wildcards are (currently) # always hypenated. if ($a !~ /-/) { return 1 if $arch eq $a; } elsif (exists $knownsame{$arch}{$a}) { return 1 if $knownsame{$arch}{$a}; } elsif (system("dpkg-architecture", "-a$arch", "-i$a") == 0) { return $knownsame{$arch}{$a}=1; } else { $knownsame{$arch}{$a}=0; } } return 0; } } # Returns source package name sub sourcepackage { open (CONTROL, 'debian/control') || error("cannot read debian/control: $!\n"); while () { chomp; s/\s+$//; if (/^Source:\s*(.*)/) { close CONTROL; return $1; } } close CONTROL; error("could not find Source: line in control file."); } # Returns a list of packages in the control file. # Pass "arch" or "indep" to specify arch-dependant (that will be built # for the system's arch) or independant. If nothing is specified, # returns all packages. Also, "both" returns the union of "arch" and "indep" # packages. # As a side effect, populates %package_arches and %package_types with the # types of all packages (not only those returned). my (%package_types, %package_arches); sub getpackages { my $type=shift; %package_types=(); %package_arches=(); $type="" if ! defined $type; my $package=""; my $arch=""; my $package_type; my @list=(); my %seen; open (CONTROL, 'debian/control') || error("cannot read debian/control: $!\n"); while () { chomp; s/\s+$//; if (/^Package:\s*(.*)/) { $package=$1; # Detect duplicate package names in the same control file. if (! $seen{$package}) { $seen{$package}=1; } else { error("debian/control has a duplicate entry for $package"); } $package_type="deb"; } if (/^Architecture:\s*(.*)/) { $arch=$1; } if (/^(?:X[BC]*-)?Package-Type:\s*(.*)/) { $package_type=$1; } if (!$_ or eof) { # end of stanza. if ($package) { $package_types{$package}=$package_type; $package_arches{$package}=$arch; } if ($package && ((($type eq 'indep' || $type eq 'both') && $arch eq 'all') || (($type eq 'arch' || $type eq 'both') && ($arch eq 'any' || ($arch ne 'all' && samearch(buildarch(), $arch)))) || ! $type)) { push @list, $package; $package=""; $arch=""; } } } close CONTROL; return @list; } # Returns the arch a package will build for. sub package_arch { my $package=shift; if (! exists $package_arches{$package}) { warning "package $package is not in control info"; return buildarch(); } return $package_arches{$package} eq 'all' ? "all" : buildarch(); } # Return true if a given package is really a udeb. sub is_udeb { my $package=shift; if (! exists $package_types{$package}) { warning "package $package is not in control info"; return 0; } return $package_types{$package} eq 'udeb'; } # Generates the filename that is used for a udeb package. sub udeb_filename { my $package=shift; my $filearch=package_arch($package); isnative($package); # side effect my $version=$dh{VERSION}; $version=~s/^[0-9]+://; # strip any epoch return "${package}_${version}_$filearch.udeb"; } # Handles #DEBHELPER# substitution in a script; also can generate a new # script from scratch if none exists but there is a .debhelper file for it. sub debhelper_script_subst { my $package=shift; my $script=shift; my $tmp=tmpdir($package); my $ext=pkgext($package); my $file=pkgfile($package,$script); if ($file ne '') { if (-f "debian/$ext$script.debhelper") { # Add this into the script, where it has #DEBHELPER# complex_doit("perl -pe 's~#DEBHELPER#~qx{cat debian/$ext$script.debhelper}~eg' < $file > $tmp/DEBIAN/$script"); } else { # Just get rid of any #DEBHELPER# in the script. complex_doit("sed s/#DEBHELPER#// < $file > $tmp/DEBIAN/$script"); } doit("chown","0:0","$tmp/DEBIAN/$script"); doit("chmod",755,"$tmp/DEBIAN/$script"); } elsif ( -f "debian/$ext$script.debhelper" ) { complex_doit("printf '#!/bin/sh\nset -e\n' > $tmp/DEBIAN/$script"); complex_doit("cat debian/$ext$script.debhelper >> $tmp/DEBIAN/$script"); doit("chown","0:0","$tmp/DEBIAN/$script"); doit("chmod",755,"$tmp/DEBIAN/$script"); } } # Checks if make's jobserver is enabled via MAKEFLAGS, but # the FD used to communicate with it is actually not available. sub is_make_jobserver_unavailable { if (exists $ENV{MAKEFLAGS} && $ENV{MAKEFLAGS} =~ /(?:^|\s)--jobserver-fds=(\d+)/) { if (!open(my $in, "<&$1")) { return 1; # unavailable } else { close $in; return 0; # available } } return; # no jobserver specified } # Cleans out jobserver options from MAKEFLAGS. sub clean_jobserver_makeflags { if (exists $ENV{MAKEFLAGS}) { if ($ENV{MAKEFLAGS} =~ /(?:^|\s)--jobserver-fds=(\d+)/) { $ENV{MAKEFLAGS} =~ s/(?:^|\s)--jobserver-fds=\S+//g; $ENV{MAKEFLAGS} =~ s/(?:^|\s)-j\b//g; } delete $ENV{MAKEFLAGS} if $ENV{MAKEFLAGS} =~ /^\s*$/; } } # If cross-compiling, returns appropriate cross version of command. sub cross_command { my $command=shift; if (dpkg_architecture_value("DEB_BUILD_GNU_TYPE") ne dpkg_architecture_value("DEB_HOST_GNU_TYPE")) { return dpkg_architecture_value("DEB_HOST_GNU_TYPE")."-$command"; } else { return $command; } } # Sets environment variables from dpkg-buildflags. Avoids changing # any existing environment variables. sub set_buildflags { return if $ENV{DH_INTERNAL_BUILDFLAGS} || compat(8); $ENV{DH_INTERNAL_BUILDFLAGS}=1; eval "use Dpkg::BuildFlags"; if ($@) { warning "unable to load build flags: $@"; return; } my $buildflags = Dpkg::BuildFlags->new(); $buildflags->load_config(); foreach my $flag ($buildflags->list()) { next unless $flag =~ /^[A-Z]/; # Skip flags starting with lowercase if (! exists $ENV{$flag}) { $ENV{$flag} = $buildflags->get($flag); } } } # Gets a DEB_BUILD_OPTIONS option, if set. sub get_buildoption { my $wanted=shift; return undef unless exists $ENV{DEB_BUILD_OPTIONS}; foreach my $opt (split(/\s+/, $ENV{DEB_BUILD_OPTIONS})) { # currently parallel= is the only one with a parameter if ($opt =~ /^parallel=(-?\d+)$/ && $wanted eq 'parallel') { return $1; } elsif ($opt eq $wanted) { return 1; } } } 1 debhelper-9.20131227ubuntu1/Debian/Debhelper/Dh_Getopt.pm0000664000000000000000000001547212164264535017602 0ustar #!/usr/bin/perl -w # # Debhelper option processing library. # # Joey Hess GPL copyright 1998-2002 package Debian::Debhelper::Dh_Getopt; use strict; use Debian::Debhelper::Dh_Lib; use Getopt::Long; my %exclude_package; sub showhelp { my $prog=basename($0); print "Usage: $prog [options]\n\n"; print " $prog is a part of debhelper. See debhelper(7)\n"; print " and $prog(1) for complete usage instructions.\n"; exit(1); } # 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 @{$dh{DOPACKAGES}}, getpackages('indep'); $dh{DOINDEP}=1; } elsif ($option eq 'a' or $option eq 'arch' or $option eq 's' or $option eq 'same-arch') { push @{$dh{DOPACKAGES}}, getpackages('arch'); $dh{DOARCH}=1; } elsif ($option eq 'p' or $option eq 'package') { push @{$dh{DOPACKAGES}}, $value; } else { error("bad option $option - should never happen!\n"); } } # Adds packages to the list of debug packages. sub AddDebugPackage { my($option,$value)=@_; push @{$dh{DEBUGPACKAGES}}, $value; } # 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 @{$dh{EXCLUDE}},$value; } # Add a file to the ignore list. sub AddIgnore { my($option,$file)=@_; $dh{IGNORE}->{$file}=1; } # This collects non-options values. sub NonOption { push @{$dh{ARGV}}, @_; } sub getoptions { my $array=shift; my %params=@_; if (! exists $params{bundling} || $params{bundling}) { Getopt::Long::config("bundling"); } my @test; my %options=( "v" => \$dh{VERBOSE}, "verbose" => \$dh{VERBOSE}, "no-act" => \$dh{NO_ACT}, "i" => \&AddPackage, "indep" => \&AddPackage, "a" => \&AddPackage, "arch" => \&AddPackage, "p=s" => \&AddPackage, "package=s" => \&AddPackage, "N=s" => \&ExcludePackage, "no-package=s" => \&ExcludePackage, "remaining-packages" => \$dh{EXCLUDE_LOGGED}, "dbg-package=s" => \&AddDebugPackage, "s" => \&AddPackage, "same-arch" => \&AddPackage, "n" => \$dh{NOSCRIPTS}, "noscripts" => \$dh{NOSCRIPTS}, "o" => \$dh{ONLYSCRIPTS}, "onlyscripts" => \$dh{ONLYSCRIPTS}, "X=s" => \&AddExclude, "exclude=s" => \&AddExclude, "d" => \$dh{D_FLAG}, "k" => \$dh{K_FLAG}, "keep" => \$dh{K_FLAG}, "P=s" => \$dh{TMPDIR}, "tmpdir=s" => \$dh{TMPDIR}, "u=s", => \$dh{U_PARAMS}, "V:s", => \$dh{V_FLAG}, "A" => \$dh{PARAMS_ALL}, "all" => \$dh{PARAMS_ALL}, "priority=s" => \$dh{PRIORITY}, "h|help" => \&showhelp, "mainpackage=s" => \$dh{MAINPACKAGE}, "name=s" => \$dh{NAME}, "error-handler=s" => \$dh{ERROR_HANDLER}, "ignore=s" => \&AddIgnore, "O=s" => sub { push @test, $_[1] }, (ref $params{options} ? %{$params{options}} : ()) , "<>" => \&NonOption, ); if ($params{test}) { foreach my $key (keys %options) { $options{$key}=sub {}; } } my $oldwarn; if ($params{test} || $params{ignore_unknown_options}) { $oldwarn=$SIG{__WARN__}; $SIG{__WARN__}=sub {}; } my $ret=Getopt::Long::GetOptionsFromArray($array, %options); if ($oldwarn) { $SIG{__WARN__}=$oldwarn; } foreach my $opt (@test) { # Try to parse an option, and skip it # if it is not known. if (getoptions([$opt], %params, ignore_unknown_options => 0, test => 1)) { getoptions([$opt], %params); } } return 1 if $params{ignore_unknown_options}; return $ret; } sub split_options_string { my $str=shift; $str=~s/^\s+//; return split(/\s+/,$str); } # Parse options and set %dh values. sub parseopts { my %params=@_; my @ARGV_extra; # DH_INTERNAL_OPTIONS is used to pass additional options from # dh through an override target to a command. if (defined $ENV{DH_INTERNAL_OPTIONS}) { @ARGV_extra=split(/\x1e/, $ENV{DH_INTERNAL_OPTIONS}); getoptions(\@ARGV_extra, %params); # Avoid forcing acting on packages specified in # DH_INTERNAL_OPTIONS. This way, -p can be specified # at the command line to act on a specific package, but when # nothing is specified, the excludes will cause the set of # packages DH_INTERNAL_OPTIONS specifies to be acted on. if (defined $dh{DOPACKAGES}) { foreach my $package (getpackages()) { if (! grep { $_ eq $package } @{$dh{DOPACKAGES}}) { $exclude_package{$package}=1; } } } delete $dh{DOPACKAGES}; delete $dh{DOINDEP}; delete $dh{DOARCH}; } # DH_OPTIONS can contain additional options to be parsed like @ARGV if (defined $ENV{DH_OPTIONS}) { @ARGV_extra=split_options_string($ENV{DH_OPTIONS}); my $ret=getoptions(\@ARGV_extra, %params); if (!$ret) { warning("warning: ignored unknown options in DH_OPTIONS"); } } my $ret=getoptions(\@ARGV, %params); if (!$ret) { if (! compat(7)) { 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($dh{V_FLAG})) { $dh{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 $dh{DOPACKAGES} || ! @{$dh{DOPACKAGES}}) { if ($dh{DOINDEP} || $dh{DOARCH}) { # User specified that all arch (in)dep package be # built, and there are none of that type. if (! $dh{BLOCK_NOOP_WARNINGS}) { warning("You asked that all arch in(dep) packages be built, but there are none of that type."); } exit(0); } push @{$dh{DOPACKAGES}},getpackages("both"); } # Remove excluded packages from the list of packages to act on. # Also unique the list, in case some options were specified that # added a package to it twice. my @package_list; my $package; my %packages_seen; foreach $package (@{$dh{DOPACKAGES}}) { if (defined($dh{EXCLUDE_LOGGED}) && grep { $_ eq basename($0) } load_log($package)) { $exclude_package{$package}=1; } if (! $exclude_package{$package}) { if (! exists $packages_seen{$package}) { $packages_seen{$package}=1; push @package_list, $package; } } } @{$dh{DOPACKAGES}}=@package_list; if (! defined $dh{DOPACKAGES} || ! @{$dh{DOPACKAGES}}) { if (! $dh{BLOCK_NOOP_WARNINGS}) { warning("No packages to build."); } exit(0); } if (defined $dh{U_PARAMS}) { # Split the U_PARAMS up into an array. my $u=$dh{U_PARAMS}; undef $dh{U_PARAMS}; push @{$dh{U_PARAMS}}, split(/\s+/,$u); } # Anything left in @ARGV is options that appeared after a -- # These options are added to the U_PARAMS array, while the # non-option values we collected replace them in @ARGV; push @{$dh{U_PARAMS}}, @ARGV, @ARGV_extra; @ARGV=@{$dh{ARGV}} if exists $dh{ARGV}; } 1 debhelper-9.20131227ubuntu1/Debian/Debhelper/Dh_Buildsystems.pm0000664000000000000000000001332712164264535021024 0ustar # A module for loading and managing debhelper build system classes. # This module is intended to be used by all dh_auto_* programs. # # Copyright: © 2009 Modestas Vainius # License: GPL-2+ package Debian::Debhelper::Dh_Buildsystems; use strict; use warnings; use Debian::Debhelper::Dh_Lib; use File::Spec; use base 'Exporter'; our @EXPORT=qw(&buildsystems_init &buildsystems_do &load_buildsystem &load_all_buildsystems); use constant BUILD_STEPS => qw(configure build test install clean); # Historical order must be kept for backwards compatibility. New # build systems MUST be added to the END of the list. our @BUILDSYSTEMS = ( "autoconf", (! compat(7) ? "perl_build" : ()), "perl_makemaker", "makefile", "python_distutils", (compat(7) ? "perl_build" : ()), "cmake", "ant", "qmake", "qmake_qt4", ); my $opt_buildsys; my $opt_sourcedir; my $opt_builddir; my $opt_list; my $opt_parallel; sub create_buildsystem_instance { my $system=shift; my %bsopts=@_; my $module = "Debian::Debhelper::Buildsystem::$system"; eval "use $module"; if ($@) { error("unable to load build system class '$system': $@"); } if (!exists $bsopts{builddir} && defined $opt_builddir) { $bsopts{builddir} = ($opt_builddir eq "") ? undef : $opt_builddir; } if (!exists $bsopts{sourcedir} && defined $opt_sourcedir) { $bsopts{sourcedir} = ($opt_sourcedir eq "") ? undef : $opt_sourcedir; } if (!exists $bsopts{parallel}) { $bsopts{parallel} = $opt_parallel; } return $module->new(%bsopts); } # Autoselect a build system from the list of instances sub autoselect_buildsystem { my $step=shift; my $selected; my $selected_level = 0; foreach my $inst (@_) { # Only derived (i.e. more specific) build system can be # considered beyond the currently selected one. next if defined $selected && !$inst->isa(ref $selected); # If the build system says it is auto-buildable at the current # step and it can provide more specific information about its # status than its parent (if any), auto-select it. my $level = $inst->check_auto_buildable($step); if ($level > $selected_level) { $selected = $inst; $selected_level = $level; } } return $selected; } # Similar to create_build system_instance(), but it attempts to autoselect # a build system if none was specified. In case autoselection fails, undef # is returned. sub load_buildsystem { my $system=shift; my $step=shift; if (defined $system) { my $inst = create_buildsystem_instance($system, @_); return $inst; } else { # Try to determine build system automatically my @buildsystems; foreach $system (@BUILDSYSTEMS) { push @buildsystems, create_buildsystem_instance($system, @_); } return autoselect_buildsystem($step, @buildsystems); } } sub load_all_buildsystems { my $incs=shift || \@INC; my (%buildsystems, @buildsystems); foreach my $inc (@$incs) { my $path = File::Spec->catdir($inc, "Debian/Debhelper/Buildsystem"); if (-d $path) { foreach my $module_path (glob "$path/*.pm") { my $name = basename($module_path); $name =~ s/\.pm$//; next if exists $buildsystems{$name}; $buildsystems{$name} = create_buildsystem_instance($name, @_); } } } # Standard debhelper build systems first foreach my $name (@BUILDSYSTEMS) { error("standard debhelper build system '$name' could not be found/loaded") if not exists $buildsystems{$name}; push @buildsystems, $buildsystems{$name}; delete $buildsystems{$name}; } # The rest are 3rd party build systems foreach my $name (keys %buildsystems) { my $inst = $buildsystems{$name}; $inst->{thirdparty} = 1; push @buildsystems, $inst; } return @buildsystems; } sub buildsystems_init { my %args=@_; my $max_parallel=1; # Available command line options my %options = ( "D=s" => \$opt_sourcedir, "sourcedirectory=s" => \$opt_sourcedir, "B:s" => \$opt_builddir, "builddirectory:s" => \$opt_builddir, "S=s" => \$opt_buildsys, "buildsystem=s" => \$opt_buildsys, "l" => \$opt_list, "list" => \$opt_list, "parallel" => sub { $max_parallel = -1 }, "max-parallel=i" => \$max_parallel, ); $args{options}{$_} = $options{$_} foreach keys(%options); Debian::Debhelper::Dh_Lib::init(%args); Debian::Debhelper::Dh_Lib::set_buildflags(); set_parallel($max_parallel); } sub set_parallel { my $max=shift; # Get number of processes from parallel=n option, limiting it # with $max if needed $opt_parallel=get_buildoption("parallel") || 1; if ($max > 0 && $opt_parallel > $max) { $opt_parallel = $max; } } sub buildsystems_list { my $step=shift; my @buildsystems = load_all_buildsystems(); my $auto = autoselect_buildsystem($step, grep { ! $_->{thirdparty} } @buildsystems); my $specified; # List build systems (including auto and specified status) foreach my $inst (@buildsystems) { if (! defined $specified && defined $opt_buildsys && $opt_buildsys eq $inst->NAME()) { $specified = $inst; } printf("%-20s %s", $inst->NAME(), $inst->DESCRIPTION()); print " [3rd party]" if $inst->{thirdparty}; print "\n"; } print "\n"; print "Auto-selected: ", $auto->NAME(), "\n" if defined $auto; print "Specified: ", $specified->NAME(), "\n" if defined $specified; print "No system auto-selected or specified\n" if ! defined $auto && ! defined $specified; } sub buildsystems_do { my $step=shift; if (!defined $step) { $step = basename($0); $step =~ s/^dh_auto_//; } if (grep(/^\Q$step\E$/, BUILD_STEPS) == 0) { error("unrecognized build step: " . $step); } if ($opt_list) { buildsystems_list($step); exit 0; } my $buildsystem = load_buildsystem($opt_buildsys, $step); if (defined $buildsystem) { $buildsystem->pre_building_step($step); $buildsystem->$step(@_, @{$dh{U_PARAMS}}); $buildsystem->post_building_step($step); } return 0; } 1 debhelper-9.20131227ubuntu1/dh_link0000775000000000000000000001260412164264535013643 0ustar #!/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 [S>] [B<-A>] [B<-X>I] [S ...>] =head1 DESCRIPTION B is a debhelper program that creates symlinks in package build directories. B 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 be an equal number of source and destination files specified. Be sure you B specify the full filename to both the source and destination files (unlike you would do if you were using something like L). B 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. Any pre-existing destination files will be replaced with symlinks. B also scans the package build tree for existing symlinks which do not conform to Debian policy, and corrects them (v4 or later). =head1 FILES =over 4 =item debian/I.links Lists pairs of source and destination files to be symlinked. Each pair should be put on its own line, with the source and destination separated by whitespace. =back =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 B<-X>I, B<--exclude=>I Exclude symlinks that contain I anywhere in their filename from being corrected to comply with Debian policy. =item I ... Create a file named I as a link to a file named I. Do this in the package build directory of the first package acted on. (Or in all packages if B<-A> is specified.) =back =head1 EXAMPLES dh_link usr/share/man/man1/foo.1 usr/share/man/man1/bar.1 Make F be a symlink to F dh_link var/lib/foo usr/lib/foo \ usr/share/man/man1/foo.1 usr/share/man/man1/bar.1 Make F be a link to F, and F be a symlink to the F =cut # This expand_path expands all path "." and ".." components, but doesn't # resolve symbolic links. sub expand_path { my $start = @_ ? shift : '.'; my @pathname = split(m:/+:,$start); my $entry; my @respath; foreach $entry (@pathname) { if ($entry eq '.' || $entry eq '') { # Do nothing } elsif ($entry eq '..') { if ($#respath == -1) { # Do nothing } else { pop @respath; } } else { push @respath, $entry; } } my $result; foreach $entry (@respath) { $result .= '/' . $entry; } if (! defined $result) { $result="/"; # special case } return $result; } 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 or later 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; return if excludefile($_); 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/$_"; }, $tmp); } while (@links) { my $dest=pop @links; my $src=expand_path(pop @links); $src=~s:^/::; $dest=~s:^/::; if ($src eq $dest) { warning("skipping link from $src to self"); next; } # 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 && $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[$_]."/"; } if ($x > $#src_dirs && ! length $src) { $src.="."; # special case } $src=~s:/$::; } else { # Make sure it's properly absolute. $src="/$src"; } if (-d "$tmp/$dest" && ! -l "$tmp/$dest") { error("link destination $tmp/$dest is a directory"); } doit("rm", "-f", "$tmp/$dest"); doit("ln","-sf", $src, "$tmp/$dest"); } } =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_auto_configure0000775000000000000000000000275112164264535015721 0ustar #!/usr/bin/perl -w =head1 NAME dh_auto_configure - automatically configure a package prior to building =cut use strict; use Debian::Debhelper::Dh_Buildsystems; =head1 SYNOPSIS B [S>] [S>] [S I>] =head1 DESCRIPTION B is a debhelper program that tries to automatically configure a package prior to building. It does so by running the appropriate command for the build system it detects the package uses. For example, it looks for and runs a F<./configure> script, F, F, or F. A standard set of parameters is determined and passed to the program that is run. Some build systems, such as make, do not need a configure step; for these B will exit without doing anything. This is intended to work for about 90% of packages. If it doesn't work, you're encouraged to skip using B at all, and just run F<./configure> or its equivalent manually. =head1 OPTIONS See L> for a list of common build system selection and control options. =over 4 =item B<--> I Pass I to the program that is run, after the parameters that B usually passes. For example: dh_auto_configure -- --with-foo --enable-bar =back =cut buildsystems_init(); buildsystems_do(); =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/run0000775000000000000000000000077212164264535013042 0ustar #!/bin/sh # Run a debhelper command using files from this directory. # Run items from current directory by preference. PATH=.:$PATH export PATH # Ensure that builds are self-hosting, which means I have to use the .pm # files in this package, not any that may be on the system. export PERL5LIB=$(pwd) # If any automatic script generation is done in building this package, # be sure to use the new templates from this package. export DH_AUTOSCRIPTDIR=$(pwd)/autoscripts prog=$1 shift 1 exec $prog "$@" debhelper-9.20131227ubuntu1/dh_prep0000775000000000000000000000310112164264535013644 0ustar #!/usr/bin/perl -w =head1 NAME dh_prep - perform cleanups in preparation for building a binary package =cut use strict; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B [S>] [B<-X>I] =head1 DESCRIPTION B is a debhelper program that performs some file cleanups in preparation for building a binary package. (This is what B used to do.) It removes the package build directories, F, and some temp files that are generated when building a binary package. It is typically run at the top of the B and B targets, or at the top of a target such as install that they depend on. =head1 OPTIONS =over 4 =item B<-X>I B<--exclude=>I Exclude files that contain F 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. =back =cut init(); foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); my $ext=pkgext($package); 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","-rf",$tmp."/") unless excludefile($tmp); } doit('rm', '-rf', 'debian/tmp') if -x 'debian/tmp' && ! compat(1) && ! excludefile("debian/tmp"); =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_installinfo0000775000000000000000000000260412164264535015227 0ustar #!/usr/bin/perl -w =head1 NAME dh_installinfo - install info files =cut use strict; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B [S>] [B<-A>] [S ...>] =head1 DESCRIPTION B is a debhelper program that is responsible for installing info files into F in the package build directory. =head1 FILES =over 4 =item debian/I.info List info files to be installed. =back =head1 OPTIONS =over 4 =item B<-A>, B<--all> Install all files specified by command line parameters in ALL packages acted on. =item I ... Install these info files into the first package acted on. (Or in all packages if B<-A> is specified). =back =cut init(); # PROMISE: DH NOOP WITHOUT info foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); my $file=pkgfile($package,"info"); my @info; if ($file) { @info=filearray($file, "."); } if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { push @info, @ARGV; } if (@info) { if ( ! -d "$tmp/usr/share/info") { doit("install","-d","$tmp/usr/share/info"); } doit("cp",@info,"$tmp/usr/share/info"); doit("chmod","-R", "go=rX","$tmp/usr/share/info/"); doit("chmod","-R", "u+rw","$tmp/usr/share/info/"); } } =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_installifupdown0000775000000000000000000000275712164264535016140 0ustar #!/usr/bin/perl -w =head1 NAME dh_installifupdown - install if-up and if-down hooks =cut use strict; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B [S>] [B<--name=>I] =head1 DESCRIPTION B is a debhelper program that is responsible for installing F, F, F, and F hook scripts into package build directories. =head1 FILES =over 4 =item debian/I.if-up =item debian/I.if-down =item debian/I.if-pre-up =item debian/I.if-post-down These files are installed into etc/network/if-*.d/I in the package build directory. =back =head1 OPTIONS =over 4 =item B<--name=>I Look for files named F and install them as F, instead of using the usual files and installing them as the package name. =back =cut init(); # PROMISE: DH NOOP WITHOUT if-pre-up if-up if-down if-post-down foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); foreach my $script (qw(pre-up up down post-down)) { my $file=pkgfile($package, "if-$script"); if ($file ne '') { if (! -d "$tmp/etc/network/if-$script.d") { doit("install","-d","$tmp/etc/network/if-$script.d"); } doit("install","-p","-m755",$file,"$tmp/etc/network/if-$script.d/".pkgfilename($package)); } } } =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_installmenu0000775000000000000000000000432512164264535015242 0ustar #!/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 [S>] [B<-n>] =head1 DESCRIPTION B is a debhelper program that is responsible for installing files used by the Debian B package into package build directories. It also automatically generates the F and F commands needed to interface with the Debian B package. These commands are inserted into the maintainer scripts by L. =head1 FILES =over 4 =item debian/I.menu Debian menu files, installed into usr/share/menu/I in the package build directory. See L for its format. =item debian/I.menu-method Debian menu method files, installed into etc/menu-methods/I in the package build directory. =back =head1 OPTIONS =over 4 =item B<-n>, B<--noscripts> Do not modify F/F scripts. =back =cut init(); # PROMISE: DH NOOP WITHOUT menu menu-method 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/share/menu") { doit("install","-d","$tmp/usr/share/menu"); } doit("install","-p","-m644",$menu,"$tmp/usr/share/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","-m644",$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 L L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh0000775000000000000000000006070712251330333012620 0ustar #!/usr/bin/perl -w =head1 NAME dh - debhelper command sequencer =cut use strict; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B I [B<--with> I[B<,>I ...]] [B<--list>] [S>] =head1 DESCRIPTION B runs a sequence of debhelper commands. The supported Is correspond to the targets of a F file: B, B, B, B, B, B, B, B, B, and B. =head1 OVERRIDE TARGETS A F file using B can override the command that is run at any step in a sequence, by defining an override target. To override I, add a target named BI to the rules file. When it would normally run I, B will instead call that target. The override target can then run the command with additional options, or run entirely different commands instead. See examples below. Override targets can also be defined to run only when building architecture dependent or architecture independent packages. Use targets with names like BIB<-arch> and BIB<-indep>. (Note that to use this feature, you should Build-Depend on debhelper 8.9.7 or above.) =head1 OPTIONS =over 4 =item B<--with> I[B<,>I ...] Add the debhelper commands specified by the given addon to appropriate places in the sequence of commands that is run. This option can be repeated more than once, or multiple addons can be listed, separated by commas. This is used when there is a third-party package that provides debhelper commands. See the F file for documentation about the sequence addon interface. =item B<--without> I The inverse of B<--with>, disables using the given addon. This option can be repeated more than once, or multiple addons to disable can be listed, separated by commas. =item B<--list>, B<-l> List all available addons. =item B<--no-act> Prints commands that would run for a given sequence, but does not run them. Note that dh normally skips running commands that it knows will do nothing. With --no-act, the full list of commands in a sequence is printed. =back Other options passed to B are passed on to each command it runs. This can be used to set an option like B<-v> or B<-X> or B<-N>, as well as for more specialised options. =head1 EXAMPLES To see what commands are included in a sequence, without actually doing anything: dh binary-arch --no-act This is a very simple rules file, for packages where the default sequences of commands work with no additional options. #!/usr/bin/make -f %: dh $@ Often you'll want to pass an option to a specific debhelper command. The easy way to do with is by adding an override target for that command. #!/usr/bin/make -f %: dh $@ override_dh_strip: dh_strip -Xfoo override_dh_auto_configure: dh_auto_configure -- --with-foo --disable-bar Sometimes the automated L and L can't guess what to do for a strange package. Here's how to avoid running either and instead run your own commands. #!/usr/bin/make -f %: dh $@ override_dh_auto_configure: ./mondoconfig override_dh_auto_build: make universe-explode-in-delight Another common case is wanting to do something manually before or after a particular debhelper command is run. #!/usr/bin/make -f %: dh $@ override_dh_fixperms: dh_fixperms chmod 4755 debian/foo/usr/bin/foo If your package uses autotools and you want to freshen F and F with newer versions from the B package at build time, you can use some commands provided in B that automate it, like this. #!/usr/bin/make -f %: dh $@ --with autotools_dev Python tools are not run by dh by default, due to the continual change in that area. (Before compatibility level v9, dh does run B.) Here is how to use B. #!/usr/bin/make -f %: dh $@ --with python2 Here is how to force use of Perl's B build system, which can be necessary if debhelper wrongly detects that the package uses MakeMaker. #!/usr/bin/make -f %: dh $@ --buildsystem=perl_build Here is an example of overriding where the BI<*> commands find the package's source, for a package where the source is located in a subdirectory. #!/usr/bin/make -f %: dh $@ --sourcedirectory=src And here is an example of how to tell the BI<*> commands to build in a subdirectory, which will be removed on B. #!/usr/bin/make -f %: dh $@ --builddirectory=build If your package can be built in parallel, you can support parallel building as follows. Then B will work. #!/usr/bin/make -f %: dh $@ --parallel Here is a way to prevent B from running several commands that you don't want it to run, by defining empty override targets for each command. #!/usr/bin/make -f %: dh $@ # Commands not to run: override_dh_auto_test override_dh_compress override_dh_fixperms: A long build process for a separate documentation package can be separated out using architecture independent overrides. These will be skipped when running build-arch and binary-arch sequences. #!/usr/bin/make -f %: dh $@ override_dh_auto_build-indep: $(MAKE) -C docs # No tests needed for docs override_dh_auto_test-indep: override_dh_auto_install-indep: $(MAKE) -C docs install Adding to the example above, suppose you need to chmod a file, but only when building the architecture dependent package, as it's not present when building only documentation. override_dh_fixperms-arch: dh_fixperms chmod 4755 debian/foo/usr/bin/foo =head1 INTERNALS If you're curious about B's internals, here's how it works under the hood. Each debhelper command will record when it's successfully run in F. (Which B deletes.) So B can tell which commands have already been run, for which packages, and skip running those commands again. Each time B is run, it examines the log, and finds the last logged command that is in the specified sequence. It then continues with the next command in the sequence. The B<--until>, B<--before>, B<--after>, and B<--remaining> options can override this behavior. A sequence can also run dependent targets in debian/rules. For example, the "binary" sequence runs the "install" target. B uses the B environment variable to pass information through to debhelper commands that are run inside override targets. The contents (and indeed, existence) of this environment variable, as the name might suggest, is subject to change at any time. Commands in the B, B and B sequences are passed the B<-i> option to ensure they only work on architecture independent packages, and commands in the B, B and B sequences are passed the B<-a> option to ensure they only work on architecture dependent packages. =head1 DEPRECATED OPTIONS The following options are deprecated. It's much better to use override targets instead. =over 4 =item B<--until> I Run commands in the sequence until and including I, then stop. =item B<--before> I Run commands in the sequence before I, then stop. =item B<--after> I Run commands in the sequence that come after I. =item B<--remaining> Run all commands in the sequence that have yet to be run. =back In the above options, I can be a full name of a debhelper command, or a substring. It'll first search for a command in the sequence exactly matching the name, to avoid any ambiguity. If there are multiple substring matches, the last one in the sequence will be used. =cut # Stash this away before init modifies it. my @ARGV_orig=@ARGV; if (compat(8, 1)) { # python-support was enabled by default before v9. # (and comes first so python-central loads later and can disable it). unshift @ARGV, "--with=python-support"; } init(options => { "until=s" => \$dh{UNTIL}, "after=s" => \$dh{AFTER}, "before=s" => \$dh{BEFORE}, "remaining" => \$dh{REMAINING}, "with=s" => sub { my ($option,$value)=@_; push @{$dh{WITH}},split(",", $value); }, "without=s" => sub { my ($option,$value)=@_; my %without = map { $_ => 1 } split(",", $value); @{$dh{WITH}} = grep { ! $without{$_} } @{$dh{WITH}}; }, "l" => \&list_addons, "list" => \&list_addons, }, # Disable complaints about unknown options; they are passed on to # the debhelper commands. ignore_unknown_options => 1, # Bundling does not work well since there are unknown options. bundling => 0, ); inhibit_log(); set_buildflags(); warn_deprecated(); # If make is using a jobserver, but it is not available # to this process, clean out MAKEFLAGS. This avoids # ugly warnings when calling make. if (is_make_jobserver_unavailable()) { clean_jobserver_makeflags(); } # Process the sequence parameter. my $sequence; if (! compat(7)) { # From v8, the sequence is the very first parameter. $sequence=shift @ARGV_orig; if (defined $sequence && $sequence=~/^-/) { error "Unknown sequence $sequence (options should not come before the sequence)"; } } else { # Before v8, the sequence could be at any position in the parameters, # so was what was left after parsing. $sequence=shift; if (defined $sequence) { @ARGV_orig=grep { $_ ne $sequence } @ARGV_orig; } } if (! defined $sequence) { error "specify a sequence to run"; } # make -B causes the rules file to be run as a target. # Also support completely empty override targets. # Note: it's not safe to use rules_explicit_target before this check, # since it causes dh to be run. my $dummy_target="debhelper-fail-me"; if ($sequence eq 'debian/rules' || $sequence =~ /^override_dh_/ || $sequence eq $dummy_target) { exit 0; } # Definitions of sequences. my %sequences; my @bd_minimal = qw{ dh_testdir }; my @bd = qw{ dh_testdir dh_auto_configure dh_auto_build dh_auto_test }; my @i = qw{ dh_testroot dh_prep dh_installdirs dh_auto_install dh_install dh_installdocs dh_installchangelogs dh_installexamples dh_installman dh_installcatalogs dh_installcron dh_installdebconf dh_installemacsen dh_installifupdown dh_installinfo dh_installinit dh_installmenu dh_installmime dh_installmodules dh_installlogcheck dh_installlogrotate dh_installpam dh_installppp dh_installudev dh_installwm dh_installgsettings dh_bugfiles dh_ucf dh_lintian dh_gconf dh_icons dh_perl dh_usrlocal dh_link dh_installxfonts dh_compress dh_fixperms }; my @ba=qw{ dh_strip dh_makeshlibs dh_shlibdeps }; if (! getpackages("arch")) { @ba=(); } my @b=qw{ dh_installdeb dh_gencontrol dh_md5sums dh_builddeb }; $sequences{clean} = [qw{ dh_testdir dh_auto_clean dh_clean }]; $sequences{'build-indep'} = [@bd]; $sequences{'build-arch'} = [@bd]; if (! compat(8)) { # From v9, sequences take standard rules targets into account. $sequences{build} = [@bd_minimal, rules("build-arch"), rules("build-indep")]; $sequences{'install-indep'} = [rules("build-indep"), @i]; $sequences{'install-arch'} = [rules("build-arch"), @i]; $sequences{'install'} = [rules("build"), rules("install-arch"), rules("install-indep")]; $sequences{'binary-indep'} = [rules("install-indep"), @b]; $sequences{'binary-arch'} = [rules("install-arch"), @ba, @b]; $sequences{binary} = [rules("install"), rules("binary-arch"), rules("binary-indep")]; } else { $sequences{build} = [@bd]; $sequences{'install'} = [@{$sequences{build}}, @i]; $sequences{'install-indep'} = [@{$sequences{'build-indep'}}, @i]; $sequences{'install-arch'} = [@{$sequences{'build-arch'}}, @i]; $sequences{binary} = [@{$sequences{install}}, @ba, @b]; $sequences{'binary-indep'} = [@{$sequences{'install-indep'}}, @b]; $sequences{'binary-arch'} = [@{$sequences{'install-arch'}}, @ba, @b]; } # Additional command options my %command_opts; # sequence addon interface sub _insert { my $offset=shift; my $existing=shift; my $new=shift; foreach my $sequence (keys %sequences) { my @list=@{$sequences{$sequence}}; next unless grep $existing, @list; my @new; foreach my $command (@list) { if ($command eq $existing) { push @new, $new if $offset < 0; push @new, $command; push @new, $new if $offset > 0; } else { push @new, $command; } } $sequences{$sequence}=\@new; } } sub insert_before { _insert(-1, @_); } sub insert_after { _insert(1, @_); } sub remove_command { my $command=shift; foreach my $sequence (keys %sequences) { $sequences{$sequence}=[grep { $_ ne $command } @{$sequences{$sequence}}]; } } sub add_command { my $command=shift; my $sequence=shift; unshift @{$sequences{$sequence}}, $command; } sub add_command_options { my $command=shift; push @{$command_opts{$command}}, @_; } sub remove_command_options { my $command=shift; if (@_) { # Remove only specified options if (my $opts = $command_opts{$command}) { foreach my $opt (@_) { $opts = [ grep { $_ ne $opt } @$opts ]; } $command_opts{$command} = $opts; } } else { # Clear all additional options delete $command_opts{$command}; } } sub list_addons { my %addons; for my $inc (@INC) { eval q{use File::Spec}; my $path = File::Spec->catdir($inc, "Debian/Debhelper/Sequence"); if (-d $path) { for my $module_path (glob "$path/*.pm") { my $name = basename($module_path); $name =~ s/\.pm$//; $name =~ s/_/-/g; $addons{$name} = 1; } } } for my $name (sort keys %addons) { print "$name\n"; } exit 0; } # Load addons, which can modify sequences. foreach my $addon (@{$dh{WITH}}) { my $mod="Debian::Debhelper::Sequence::$addon"; $mod=~s/-/_/g; eval "use $mod"; if ($@) { error("unable to load addon $addon: $@"); } } if (! exists $sequences{$sequence}) { error "Unknown sequence $sequence (choose from: ". join(" ", sort keys %sequences).")"; } my @sequence=optimize_sequence(@{$sequences{$sequence}}); # The list of all packages that can be acted on. my @packages=@{$dh{DOPACKAGES}}; # Get the options to pass to commands in the sequence. # Filter out options intended only for this program. my @options; my $user_specified_options=0; if ($sequence eq 'build-arch' || $sequence eq 'install-arch' || $sequence eq 'binary-arch') { push @options, "-a"; # as an optimisation, remove from the list any packages # that are not arch dependent my %arch_packages = map { $_ => 1 } getpackages("arch"); @packages = grep { $arch_packages{$_} } @packages; } elsif ($sequence eq 'build-indep' || $sequence eq 'install-indep' || $sequence eq 'binary-indep') { push @options, "-i"; # ditto optimisation for arch indep my %indep_packages = map { $_ => 1 } getpackages("indep"); @packages = grep { $indep_packages{$_} } @packages; } while (@ARGV_orig) { my $opt=shift @ARGV_orig; if ($opt =~ /^--?(after|until|before|with|without)$/) { shift @ARGV_orig; next; } elsif ($opt =~ /^--?(no-act|remaining|(after|until|before|with|without)=)/) { next; } elsif ($opt=~/^-/) { push @options, "-O".$opt; $user_specified_options=1 unless $opt =~ /^--(parallel|buildsystem|sourcedirectory|builddirectory|)/; } elsif (@options) { $user_specified_options=1; if ($options[$#options]=~/^-O--/) { $options[$#options].="=".$opt; } else { $options[$#options].=$opt; } } } # Figure out at what point in the sequence to start for each package. my %logged; my %startpoint; foreach my $package (@packages) { my @log=load_log($package, \%logged); if ($dh{AFTER}) { # Run commands in the sequence that come after the # specified command. $startpoint{$package}=command_pos($dh{AFTER}, @sequence) + 1; # Write a dummy log entry indicating that the specified # command was, in fact, run. This handles the case where # no commands remain to run after it, communicating to # future dh instances that the specified command should not # be run again. write_log($sequence[$startpoint{$package}-1], $package); } elsif ($dh{REMAINING}) { # Start at the beginning so all remaining commands will get # run. $startpoint{$package}=0; } else { # Find the last logged command that is in the sequence, and # continue with the next command after it. If no logged # command is in the sequence, we're starting at the beginning.. $startpoint{$package}=0; COMMAND: foreach my $command (reverse @log) { foreach my $i (0..$#sequence) { if ($command eq $sequence[$i]) { $startpoint{$package}=$i+1; last COMMAND; } } } } } # Figure out what point in the sequence to go to. my $stoppoint=$#sequence; if ($dh{UNTIL}) { $stoppoint=command_pos($dh{UNTIL}, @sequence); } elsif ($dh{BEFORE}) { $stoppoint=command_pos($dh{BEFORE}, @sequence) - 1; } # Now run the commands in the sequence. foreach my $i (0..$stoppoint) { my $command=$sequence[$i]; # Figure out which packages need to run this command. my @todo; my @opts=@options; foreach my $package (@packages) { if ($startpoint{$package} > $i || $logged{$package}{$sequence[$i]}) { push @opts, "-N$package"; } else { push @todo, $package; } } next unless @todo; my $rules_target = rules_target($command); if (defined $rules_target) { # Don't pass DH_ environment variables, since this is # a fresh invocation of debian/rules and any sub-dh commands. delete $ENV{DH_INTERNAL_OPTIONS}; delete $ENV{DH_INTERNAL_OVERRIDE}; run("debian/rules", $rules_target); next; } # Check for override targets in debian/rules, and run instead of # the usual command. (The non-arch-specific override is tried first, # for simplest semantics; mixing it with arch-specific overrides # makes little sense.) my @oldtodo=@todo; foreach my $override_type (undef, "arch", "indep") { @todo = run_override($override_type, $command, \@todo, @opts); } next unless @todo; if (can_skip($command, @todo) && ! $dh{NO_ACT}) { # This mkdir is to avoid skipping the command causing # breakage if some later command assumed that the # command ran, and created the tmpdir, as a side effect. # No commands in debhelper should make such an assuption, # but there may be third party commands or other things # in the rules file that does. if (! compat(10)) { foreach my $package (@todo) { mkdir(tmpdir($package)); } } next; } # No need to run the command for any packages handled by the # override targets. my %todo=map { $_ => 1 } @todo; foreach my $package (@oldtodo) { if (! $todo{$package}) { push @opts, "-N$package"; } } run($command, @opts); } sub run { my $command=shift; my @options=@_; # Include additional command options if any unshift @options, @{$command_opts{$command}} if exists $command_opts{$command}; # 3 space indent lines the command being run up under the # sequence name after "dh ". print " ".escape_shell($command, @options)."\n"; return if $dh{NO_ACT}; my $ret=system($command, @options); if ($ret >> 8 != 0) { exit $ret >> 8; } elsif ($ret) { exit 1; } } # Tries to run an override target for a command. Returns the list of # packages that it was unable to run an override target for. sub run_override { my $override_type=shift; # arch, indep, or undef my $command=shift; my @packages=@{shift()}; my @options=@_; my $override="override_$command". (defined $override_type ? "-".$override_type : ""); # Check which packages are of the right architecture for the # override_type. my (@todo, @rest); if (defined $override_type) { foreach my $package (@packages) { my $isall=package_arch($package) eq 'all'; if (($override_type eq 'indep' && $isall) || ($override_type eq 'arch' && !$isall)) { push @todo, $package; } else { push @rest, $package; push @options, "-N$package"; } } } else { @todo=@packages; } my $has_explicit_target = rules_explicit_target($override); return @packages unless defined $has_explicit_target; # no such override return @rest if ! $has_explicit_target; # has empty override return @rest unless @todo; # has override, but no packages to act on if (defined $override_type) { # Ensure appropriate -a or -i option is passed when running # an arch-specific override target. my $opt=$override_type eq "arch" ? "-a" : "-i"; push @options, $opt unless grep { $_ eq $opt } @options; } # This passes the options through to commands called # inside the target. $ENV{DH_INTERNAL_OPTIONS}=join("\x1e", @options); $ENV{DH_INTERNAL_OVERRIDE}=$command; run("debian/rules", $override); delete $ENV{DH_INTERNAL_OPTIONS}; delete $ENV{DH_INTERNAL_OVERRIDE}; # Update log for overridden command now that it has # finished successfully. # (But avoid logging for dh_clean since it removes # the log earlier.) if (! $dh{NO_ACT} && $command ne 'dh_clean') { write_log($command, @todo); commit_override_log(@todo); } return @rest; } sub optimize_sequence { my @sequence; my %seen; my $add=sub { # commands can appear multiple times when sequences are # inlined together; only the first should be needed my $command=shift; if (! $seen{$command}) { $seen{$command}=1; push @sequence, $command; } }; foreach my $command (@_) { my $rules_target=rules_target($command); if (defined $rules_target && ! defined rules_explicit_target($rules_target)) { # inline the sequence for this implicit target $add->($_) foreach optimize_sequence(@{$sequences{$rules_target}}); } else { $add->($command); } } return @sequence; } sub rules_target { my $command=shift; if ($command =~ /^debian\/rules\s+(.*)/) { return $1 } else { return undef; } } sub rules { return "debian/rules ".join(" ", @_); } { my %targets; my $rules_parsed; sub rules_explicit_target { # Checks if a specified target exists as an explicit target # in debian/rules. # undef is returned if target does not exist, 0 if target is noop # and 1 if target has dependencies or executes commands. my $target=shift; if (! $rules_parsed) { my $processing_targets = 0; my $not_a_target = 0; my $current_target; open(MAKE, "LC_ALL=C make -Rrnpsf debian/rules $dummy_target 2>/dev/null |"); while () { if ($processing_targets) { if (/^# Not a target:/) { $not_a_target = 1; } else { if (!$not_a_target && /^([^#:]+)::?\s*(.*)$/) { # Target is defined. NOTE: if it is a dependency of # .PHONY it will be defined too but that's ok. # $2 contains target dependencies if any. $current_target = $1; $targets{$current_target} = ($2) ? 1 : 0; } else { if (defined $current_target) { if (/^#/) { # Check if target has commands to execute if (/^#\s*(commands|recipe) to execute/) { $targets{$current_target} = 1; } } else { # Target parsed. $current_target = undef; } } } # "Not a target:" is always followed by # a target name, so resetting this one # here is safe. $not_a_target = 0; } } elsif (/^# Files$/) { $processing_targets = 1; } } close MAKE; $rules_parsed = 1; } return $targets{$target}; } } sub warn_deprecated { foreach my $deprecated ('until', 'after', 'before', 'remaining') { if (defined $dh{uc $deprecated}) { warning("The --$deprecated option is deprecated. Use override targets instead."); } } } sub command_pos { my $command=shift; my @sequence=@_; foreach my $i (0..$#sequence) { if ($command eq $sequence[$i]) { return $i; } } my @matches; foreach my $i (0..$#sequence) { if ($sequence[$i] =~ /\Q$command\E/) { push @matches, $i; } } if (! @matches) { error "command specification \"$command\" does not match any command in the sequence" } else { return pop @matches; } } my %skipinfo; sub can_skip { my $command=shift; my @packages=@_; return 0 if $user_specified_options || (exists $ENV{DH_OPTIONS} && length $ENV{DH_OPTIONS}); if (! defined $skipinfo{$command}) { $skipinfo{$command}=[extract_skipinfo($command)]; } my @skipinfo=@{$skipinfo{$command}}; return 0 unless @skipinfo; foreach my $package (@packages) { foreach my $skipinfo (@skipinfo) { if ($skipinfo=~/^tmp\((.*)\)$/) { my $need=$1; my $tmp=tmpdir($package); return 0 if -e "$tmp/$need"; } elsif (pkgfile($package, $skipinfo) ne '') { return 0; } } } return 1; } sub extract_skipinfo { my $command=shift; foreach my $dir (split (':', $ENV{PATH})) { if (open (my $h, "<", "$dir/$command")) { while (<$h>) { if (m/PROMISE: DH NOOP WITHOUT\s+(.*)/) { close $h; return split(' ', $1); } } close $h; return (); } } } =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_installmanpages0000775000000000000000000001162112164264535016066 0ustar #!/usr/bin/perl -w =head1 NAME dh_installmanpages - old-style man page installer (deprecated) =cut use strict; use File::Find; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B [S>] [S ...>] =head1 DESCRIPTION B is a debhelper program that is responsible for automatically installing man pages into F in package build directories. This is a DWIM-style program, with an interface unlike the rest of debhelper. It is deprecated, and you are encouraged to use L instead. B scans the current directory and all subdirectories for filenames that look like man pages. (Note that only real files are looked at; symlinks are ignored.) It uses L to verify that the files are in the correct format. Then, based on the files' extensions, it installs them into the correct man directory. All filenames specified as parameters will be skipped by B. This is useful if by default it installs some man pages that you do not want to be installed. After the man page installation step, B will check to see if any of the man pages are F<.so> links. If so, it changes them to symlinks. =head1 OPTIONS =over 4 =item I ... Do not install these files as man pages, even if they look like valid man pages. =back =head1 BUGS B will install the man pages it finds into B packages you tell it to act on, since it can't tell what package the man pages belong in. This is almost never what you really want (use B<-p> to work around this, or use the much better L program instead). Files ending in F<.man> will be ignored. Files specified as parameters that contain spaces in their filenames will not be processed properly. =cut warning("This program is deprecated, switch to dh_installman."); init(); # Check if a file is a man page, for use by File::Find. my @manpages; my @allpackages; sub find_man { # Does its filename look like a man page? # .ex files are examples installed by deb-make, # we don't want those, or .in files, which are # from configure, nor do we want CVS .#* files. if (! (-f $_ && /^.*\.[1-9].*$/ && ! /\.(ex|in)$/ && ! /^\.#/)) { return; } # It's not in a tmp directory is it? if ($File::Find::dir=~m:debian/.*tmp.*:) { return; } foreach my $dir (@allpackages) { if ($File::Find::dir=~m:debian/\Q$dir\E:) { return; } } # And file does think it's a real man page? my $type=`file -z $_`; if ($type !~ m/:.*roff/) { return; } # Good enough. push @manpages,"$File::Find::dir/$_"; } # Check if a file is a .so man page, for use by File::Find. my @sofiles; my @sodests; sub find_so_man { # The -s test is becuase a .so file tends to be small. We don't want # to open every man page. 1024 is arbitrary. if (! -f $_ || -s $_ > 1024) { return; } # Test first line of file for the .so thing. open (SOTEST,$_); my $l=; close SOTEST; if ($l=~m/\.so\s+(.*)/) { my $solink=$1; # This test is here to prevent links like ... man8/../man8/foo.8 if (basename($File::Find::dir) eq dirname($solink)) { $solink=basename($solink); } else { $solink="../$solink"; } push @sofiles,"$File::Find::dir/$_"; push @sodests,$solink; } } foreach my $package (@{$dh{DOPACKAGES}}) { next if is_udeb($package); my $tmp=tmpdir($package); # Find all filenames that look like man pages. @manpages=(); @allpackages=getpackages(''); find(\&find_man,'.'); # populates @manpages foreach my $page (@manpages) { $page=~s:^\./::; # just for looks my $basename=basename($page); # Skip all files listed on command line. my $install=1; foreach my $skip (@ARGV) { # Look at basename of what's on connect line # for backwards compatibility. if ($basename eq basename($skip)) { $install=undef; last; } } if ($install) { my $extdir="share"; my ($section)=$basename=~m/.*\.([1-9])/; my $destdir="$tmp/usr/$extdir/man/man$section/"; # Handle translated man pages. my $instname=$basename; my ($langcode)=$basename=~m/.*\.([a-z][a-z])\.([1-9])/; if (defined $langcode && $langcode ne '') { $destdir="$tmp/usr/$extdir/man/$langcode/man$section/"; $instname=~s/\.$langcode\./\./; } $destdir=~tr:/:/:s; # just for looks if (! -e "$destdir/$basename" && !-l "$destdir/$basename") { if (! -d $destdir) { doit "install","-d",$destdir; } doit "install","-p","-m644",$page,$destdir.$instname; } } } # Now the .so conversion. @sofiles=@sodests=(); foreach my $dir (qw{usr/share/man}) { if (-e "$tmp/$dir") { find(\&find_so_man, "$tmp/$dir"); } } foreach my $sofile (@sofiles) { my $sodest=shift(@sodests); doit "rm","-f",$sofile; doit "ln","-sf",$sodest,$sofile; } } =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_installwm0000775000000000000000000000474012164264535014722 0ustar #!/usr/bin/perl -w =head1 NAME dh_installwm - register a window manager =cut use strict; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B [S>] [B<-n>] [B<--priority=>I] [S ...>] =head1 DESCRIPTION B is a debhelper program that is responsible for generating the F and F commands that register a window manager with L. The window manager's man page is also registered as a slave symlink (in v6 mode and up), if it is found in F in the package build directory. =head1 FILES =over 4 =item debian/I.wm List window manager programs to register. =back =head1 OPTIONS =over 4 =item B<--priority=>I 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 F/F scripts. Turns this command into a no-op. =item I ... Window manager programs to register. =back =head1 NOTES Note that this command is not idempotent. L 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}=20; } if (@ARGV) { # This is here for backwards compatibility. If the filename doesn't # include a path, assume it's in /usr/bin. if ($ARGV[0] !~ m:/:) { $ARGV[0]="/usr/bin/$ARGV[0]"; } } # PROMISE: DH NOOP WITHOUT wm 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}) { WM: foreach my $wm (@wm) { autoscript($package,"prerm","prerm-wm","s:#WM#:$wm:"); my $wmman; if (! compat(5)) { foreach my $ext (".1", ".1x") { $wmman="/usr/share/man/man1/".basename($wm).$ext; if (-e "$tmp$wmman" || -e "$tmp$wmman.gz") { autoscript($package,"postinst","postinst-wm","s:#WM#:$wm:;s:#WMMAN#:$wmman.gz:;s/#PRIORITY#/$dh{PRIORITY}/",); next WM; } } } autoscript($package,"postinst","postinst-wm-noman","s:#WM#:$wm:;s/#PRIORITY#/$dh{PRIORITY}/",); } } } =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/doc/0000775000000000000000000000000012301136554013037 5ustar debhelper-9.20131227ubuntu1/doc/README0000664000000000000000000000007012164264535013724 0ustar Please see the debhelper(7) man page for documentation. debhelper-9.20131227ubuntu1/doc/PROGRAMMING0000664000000000000000000003230512164264535014557 0ustar This file documents things you should know to write a new debhelper program. Any program with a name that begins with dh_ should conform to these guidelines (with the historical exception of dh_make). Standardization: --------------- There are lots of debhelper commands. To make the learning curve shallower, I want them all to behave in a standard manner: All debhelper programs have names beginning with "dh_". This is so we don't pollute the name space too much. Debhelper programs should never output anything to standard output except error messages, important warnings, and the actual commands they run that modify files under debian/ (this last only if they are passed -v, and if you output the commands, you should indent them with 1 tab). This is so we don't have a lot of noise output when all the debhelper commands in a debian/rules are run, so the important stuff is clearly visible. Debhelper programs should accept all options listed in the "SHARED DEBHELPER OPTIONS" section of debhelper(7), including any long forms of these options, like --verbose . If necessary, the options may be ignored. If debhelper commands need config files, they should use debian/package.filename as the name of the config file (replace filename with whatever your command wants), and debian/filename should also be checked for config information for the first binary package in debian/control. Also, debhelper commands should accept the same sort of information that appears in the config files, on their command lines, if possible, and apply that information to the first package they act on. The config file format should be as simple as possible, generally just a list of files to act on. Debhelper programs should never modify the debian/postinst, debian/prerm, etc scripts. Instead, they can add lines to debian/postinst.debhelper, etc. The autoscript() function (see below) is one easy way to do this. dh_installdeb is an exception, it will run after the other commands and merge these modifications into the actual postinst scripts. In general, files named debian/*.debhelper are internal to debhelper, and their existence or use should not be relied on by external programs such as the build process of a package. These files will be deleted by dh_clean. Debhelper programs should default to doing exactly what policy says to do. There are always exceptions. Just ask me. Introducing Dh_Lib: ------------------ Dh_Lib is the library used by all debhelper programs to parse their arguments and set some useful variables. It's not mandatory that your program use Dh_Lib.pm, but it will make it a lot easier to keep it in sync with the rest of debhelper if it does, so this is highly encouraged. Use Dh_Lib like this: use Debian::Debhelper::Dh_Lib init(); The init() function causes Dh_lib to parse the command line and do some other initialization tasks. Argument processing: ------------------- All debhelper programs should respond to certain arguments, such as -v, -i, -a, and -p. To help you make this work right, Dh_Lib.pm handles argument processing. Just call init(). You can add support for additional options to your command by passing an options hash to init(). The hash is then passed on the Getopt::Long to parse the command line options. For example, to add a --foo option, which sets $dh{FOO}: init(options => { foo => \$dh{FOO} }); After argument processing, some global variables are used to hold the results; programs can use them later. These variables are elements of the %dh hash. switch variable description -v VERBOSE should the program verbosely output what it is doing? --no-act NO_ACT should the program not actually do anything? -i,-a,-p,-N DOPACKAGES a space delimited list of the binary packages to act on (in Dh_Lib.pm, this is an array) -i DOINDEP set if we're acting on binary independent packages -a DOARCH set if we're acting on binary dependent packages -n NOSCRIPTS if set, do not make any modifications to the package's postinst, postrm, etc scripts. -o ONLYSCRIPTS if set, only make modifications to the package's scripts, but don't look for or install associated files. -X EXCLUDE exclude a something from processing (you decide what this means for your program) (This is an array) -X EXCLUDE_FIND same as EXCLUDE, except all items are put into a string in a way that they will make find find them. (Use ! in front to negate that, of course) Note that this should only be used inside complex_doit(), not in doit(). -d D_FLAG you decide what this means to your program -k K_FLAG used to turn on keeping of something -P TMPDIR package build directory (implies only one package is being acted on) -u U_PARAMS will be set to a string, that is typically parameters your program passes on to some other program. (This is an array) -V V_FLAG will be set to a string, you decide what it means to your program -V V_FLAG_SET will be 1 if -V was specified, even if no parameters were passed along with the -V -A PARAMS_ALL generally means that additional command line parameters passed to the program (other than those processed here), will apply to all binary packages the program acts on, not just the first --priority PRIORITY will be set to a number --mainpackage MAINPACKAGE controls which package is treated as the main package to act on --name NAME a name to use for installed files, instead of the package name --error-handler ERROR_HANDLER a function to call on error Any additional command line parameters that do not start with "-" will be ignored, and you can access them later just as you normally would. Global variables: ---------------- The following keys are also set in the %dh hash when you call init(): MAINPACKAGE the name of the first binary package listed in debian/control FIRSTPACKAGE the first package we were instructed to act on. This package typically gets special treatment; additional arguments specified on the command line may effect it. Functions: --------- Dh_Lib.pm also contains a number of functions you may find useful. doit(@command) Pass this function an array that is a shell command. It will run the command (unless $dh{NO_ACT} is set), and if $dh{VERBOSE} is set, it will also output the command to stdout. You should use this function for almost all commands your program performs that manipulate files in the package build directories. complex_doit($command) Pass this function a string that is a shell command, it will run it similarly to how doit() does. You can pass more complicated commands to this (ie, commands involving piping redirection), however, you have to worry about things like escaping shell metacharacters. verbose_print($message) Pass this command a string, and it will echo it if $dh{VERBOSE} is set. error($errormsg) Pass this command a string, it will output it to standard error and exit. warning($message) Pass this command a string, and it will output it to standard error as a warning message. tmpdir($dir) Pass this command the name of a binary package, it will return the name of the tmp directory that will be used as this package's package build directory. Typically, this will be "debian/package". compat($num) Pass this command a number, and if the current compatibility level is less than or equal to that number, it will return true. Looks at DH_COMPAT to get the compatibility level. pkgfile($package, $basename) Pass this command the name of a binary package, and the base name of a file, and it will return the actual filename to use. This is used for allowing debhelper programs to have configuration files in the debian/ directory, so there can be one config file per binary package. The convention is that the files are named debian/package.filename, and debian/filename is also allowable for the $dh{MAINPACKAGE}. If the file does not exist, nothing is returned. If the *entire* behavior of a command, when run without any special options, is determined by the existence of 1 or more pkgfiles, or by the existence of a file or directory in a location in the tmpdir, it can be marked as such, which allows dh to automatically skip running it. This is done by inserting a special comment, of the form: # PROMISE: DH NOOP WITHOUT pkgfilea pkgfileb tmp(need/this) pkgext($package) Pass this command the name of a binary package, and it will return the name to prefix to files in debian/ for this package. For the $dh{MAINPACKAGE}, it returns nothing (there is no prefix), for the other packages, it returns "package.". isnative($package) Pass this command the name of a package, it returns 1 if the package is a native debian package. As a side effect, $dh{VERSION} is set to the version number of the package. autoscript($package, $scriptname, $snippetname, $sedcommands || $sub) Pass parameters: - binary package to be affected - script to add to - filename of snippet - (optional) EITHER sed commands to run on the snippet. Ie, s/#PACKAGE#/$PACKAGE/ Note: Passed to the shell inside double quotes. OR a perl sub to invoke with $_ set to each line of the snippet in turn. This command automatically adds shell script snippets to a debian maintainer script (like the postinst or prerm). Note that in v6 mode and up, the snippets are added in reverse order for the removal scripts. dirname($pathname) Return directory part of pathname. basename($pathname) Return base of pathname, addsubstvar($package, $substvar, $deppackage, $verinfo, $remove) This function adds a dependency on some package to the specified substvar in a package's substvar's file. It needs all these parameters: - binary package that gets the item - name of the substvar to add the item to - the package that will be depended on - version info for the package (optional) (ie: ">= 1.1") - if this last parameter is passed, the thing that would be added is removed instead. This can be useful to ensure that a debhelper command is idempotent. (However, we generally don't bother, and rely on the user calling dh_prep.) Note that without this parameter, if you call the function twice with the same values it will only add one item to the substvars file. delsubstvar($package, $substvar) This function removes the entire line for the substvar from the package's shlibs file. excludefile($filename) This function returns true if -X has been used to ask for the file to be excluded. is_udeb($package) Returns true if the package is marked as a udeb in the control file. udeb_filename($package) Returns the filename of the udeb package. getpackages($type) Returns a list of packages in the control file. Pass "arch" or "indep" to specify arch-dependent or -independent. If nothing is specified, returns all packages (including packages that are not built for this architecture). Pass "both" to get the union of "arch" and "indep" packages. As a side effect, populates %package_arches and %package_types with the types of all packages (not only those returned). inhibit_log() Prevent logging the program's successful finish to debian/*debhelper.log load_log($package, $hashref) Loads the log file for the given package and returns a list of logged commands. (Passing a hashref also causes it to populate the hash.) write_log($cmd, $package ...) Writes the log files for the specified package(s), adding the cmd to the end. Sequence Addons: --------------- The dh(1) command has a --with parameter that ca be used to load a sequence addon module named Debian::Debhelper::Sequence::. These modules can add/remove commands to the dh command sequences, by calling some functions from Dh_Lib: insert_before($existing_command, $new_command) Insert $new_command in sequences before $existing_command insert_after($existing_command, $new_command) Insert $new_command in sequences after $existing_command remove_command($existing_command) Remove $existing_command from the list of commands to run in all sequences. add_command($new_command, $sequence) Add $new_command to the beginning of the specified sequence. If the sequence does not exist, it will be created. add_command_options($command, $opt1, $opt2, ...) Append $opt1, $opt2 etc. to the list of additional options which dh passes when running the specified $command. These options are not relayed to debhelper commands called via $command override. remove_command_options($command) Clear all additional $command options previously added with add_command_options(). remove_command_options($command, $opt1, $opt2, ...) Remove $opt1, $opt2 etc. from the list of additional options which dh passes when running the specified $command. Buildsystem Classes: ------------------- The dh_auto_* commands are frontends that use debhelper buildsystem classes. These classes have names like Debian::Debhelper::Buildsystem::foo, and are derived from Debian::Debhelper::Buildsystem, or other, related classes. A buildsystem class needs to inherit or define these methods: DESCRIPTION, check_auto_buildable, configure, build, test, install, clean. See the comments inside Debian::Debhelper::Buildsystem for details. Note that this interface is still subject to change. Note that third-party buildsystems will not automatically be used by default, but can be forced to be used via the --buildsystem parameter. -- Joey Hess debhelper-9.20131227ubuntu1/doc/TODO0000664000000000000000000000254212251330333013525 0ustar v10: * escaping in config files (for whitespace)? * dh_installinit --restart-after-upgrade as default? Deprecated: * make a missing debian/compat an error. (started printing warning messages in 20120115) * DH_COMPAT 1, 2, 3, 4. Can be removed once all packages are seen to be using a newer version. I won't hold my breath. (2 and 3 are getting close though.) * dh_suidregister. Once nothing in the archive uses it. * dh_installmanpages. * dh_movefiles. I won't hold my breath. Have not added deprecation docs or message yet. * dh_undocumented * dh_installinit --init-script (make it warn) * dh_clean -k * dh_desktop, dh_scrollkeeper. Remove eventually.. * -s flag, not formally deprecated yet; remove eventually * -u flag; add a warning on use and remove eventually * delsubstvar() and the last parameter to addsubstvar that makes it remove a string are not used in debhelper itself, but have been left in the library in case other things use them. Deprecate and remove. * dh --before , --after , --until , --remaining * debian/compress files * deprecate dh_gconf for dh_installgsettings (stuff should be migrating away from gconf, and then I can just remove it -- have not added warning or depreaction docs yet) Also, grep the entire archive for all dh_* command lines, and check to see what other switches are not being used, and maybe remove some of them. debhelper-9.20131227ubuntu1/dh_installudev0000775000000000000000000000536412301136424015231 0ustar #!/usr/bin/perl -w =head1 NAME dh_installudev - install udev rules files =cut use strict; use Debian::Debhelper::Dh_Lib; use File::Find; =head1 SYNOPSIS B [S>] [B<-n>] [B<--name=>I] [B<--priority=>I] =head1 DESCRIPTION B is a debhelper program that is responsible for installing B rules files. Code is added to the F and F to handle the upgrade from the old B rules file location. =head1 FILES =over 4 =item debian/I.udev Installed into F in the package build directory. =back =head1 OPTIONS =over 4 =item B<--name=>I When this parameter is used, B looks for and installs files named debian/I.I.udev instead of the usual debian/I.udev. =item B<--priority=>I Sets the priority the file. Default is 40. =item B<-n>, B<--noscripts> Do not modify F/F scripts. =back =head1 NOTES Note that this command is not idempotent. L 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(); # The priority used to look like z60_; # we need to calculate that old value to handle # conffile moves correctly. my $old_priority=$dh{PRIORITY}; # In case a caller still uses the `z` prefix, remove it. if (defined $dh{PRIORITY}) { $dh{PRIORITY}=~s/^z//; } if (! defined $dh{PRIORITY}) { $dh{PRIORITY}="40"; $old_priority="z60"; } if ($dh{PRIORITY}) { $dh{PRIORITY}.="-"; $old_priority.="_"; } # PROMISE: DH NOOP WITHOUT udev foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); my $rules_file=pkgfile($package,"udev"); my $filename=basename($rules_file); if ($filename eq 'udev') { $filename = "$package.udev"; } $filename=~s/\.udev$/.rules/; my $oldfilename=$filename; if (defined $dh{NAME}) { $filename="$dh{NAME}.rules"; } if ($rules_file) { if (! -e "$tmp/lib/udev/rules.d") { doit("install","-d","$tmp/lib/udev/rules.d"); } my $rule="/lib/udev/rules.d/$dh{PRIORITY}$filename"; doit("install","-m","0644",$rules_file,$tmp.$rule); if (! $dh{NOSCRIPTS}) { # Remove old rule from /etc, unless it's modified, # in which case we rename it to match the new # file in /lib, so it will override. my $old="/etc/udev/rules.d/$old_priority$oldfilename"; $rule=~s/^\/lib/\/etc/; autoscript($package,"preinst","preinst-moveconffile","s!#OLD#!$old!g;s!#NEW#!$rule!g;s!#PACKAGE#!$package!g"); autoscript($package,"postinst","postinst-moveconffile","s!#OLD#!$old!g;s!#NEW#!$rule!g"); } } } =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_usrlocal0000775000000000000000000000642312164264535014534 0ustar #!/usr/bin/perl =head1 NAME dh_usrlocal - migrate usr/local directories to maintainer scripts =cut use warnings; use strict; use Debian::Debhelper::Dh_Lib; use File::Find; use File::stat; =head1 SYNOPSIS B [S>] [B<-n>] =head1 DESCRIPTION B is a debhelper program that can be used for building packages that will provide a subdirectory in F when installed. It finds subdirectories of F in the package build directory, and removes them, replacing them with maintainer script snippets (unless B<-n> is used) to create the directories at install time, and remove them when the package is removed, in a manner compliant with Debian policy. These snippets are inserted into the maintainer scripts by B. See L for an explanation of debhelper maintainer script snippets. If the directories found in the build tree have unusual owners, groups, or permissions, then those values will be preserved in the directories made by the F script. However, as a special exception, if a directory is owned by root.root, it will be treated as if it is owned by root.staff and is mode 2775. This is useful, since that is the group and mode policy recommends for directories in F. =head1 OPTIONS =over 4 =item B<-n>, B<--noscripts> Do not modify F/F scripts. =back =head1 NOTES Note that this command is not idempotent. L should be called between invocations of this command. Otherwise, it may cause multiple instances of the same text to be added to maintainer scripts. =head1 CONFORMS TO Debian policy, version 2.2 =cut init(); # PROMISE: DH NOOP WITHOUT tmp(usr/local) foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp = tmpdir($package); if (-d "$tmp/usr/local") { my (@dirs, @justdirs); find({bydepth => 1, no_chdir => 1, wanted => sub { my $fn = $File::Find::name; if (-d $fn) { my $stat = stat $fn; my $user = getpwuid $stat->uid; my $group = getgrgid $stat->gid; my $mode = sprintf "%04lo", ($stat->mode & 07777); if ($stat->uid == 0 && $stat->gid == 0) { $group = 'staff'; $mode = '2775'; } $fn =~ s!^\Q$tmp\E!!; return if $fn eq '/usr/local'; # @dirs is in parents-first order for dir creation... unshift @dirs, "$fn $mode $user $group"; # ...whereas @justdirs is depth-first for removal. push @justdirs, $fn; doit("rmdir $_"); } else { warning("$fn is not a directory"); } }}, "$tmp/usr/local"); doit("rmdir $tmp/usr/local"); my $bs = "\\"; # A single plain backslash my $ebs = $bs x 2; # Escape the backslash from the shell # This constructs the body of a 'sed' c\ expression which # is parsed by the shell in double-quotes my $dirs = join("$ebs\n", @dirs); pop @justdirs; # don't remove directories directly in /usr/local my $justdirs = join("$ebs\n", @justdirs); if (! $dh{NOSCRIPTS}) { autoscript($package,"postinst", "postinst-usrlocal", "/#DIRS#/ c${ebs}\n${dirs}"); autoscript($package,"prerm", "prerm-usrlocal", "/#JUSTDIRS#/ c${ebs}\n${justdirs}") if length $justdirs; } } } =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Andrew Stribblehill =cut debhelper-9.20131227ubuntu1/dh_installdeb0000775000000000000000000000722712301133020015005 0ustar #!/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 [S>] =head1 DESCRIPTION B is a debhelper program that is responsible for installing files into the F directories in package build directories with the correct permissions. =head1 FILES =over 4 =item I.postinst =item I.preinst =item I.postrm =item I.prerm These maintainer scripts are installed into the F directory. Inside the scripts, the token B<#DEBHELPER#> is replaced with shell script snippets generated by other debhelper commands. =item I.triggers =item I.shlibs These control files are installed into the F directory. =item I.conffiles This control file will be installed into the F directory. In v3 compatibility mode and higher, all files in the F directory in a package will automatically be flagged as conffiles by this program, so there is no need to list them manually here. =item I.maintscript Lines in this file correspond to L commands and parameters. Any shell metacharacters will be escaped, so arbitrary shell code cannot be inserted here. For example, a line such as C will insert maintainer script snippets into all maintainer scripts sufficient to move that conffile. =back =cut init(); # dpkg-maintscript-helper commands with their associated dpkg pre-dependency # versions. my %maintscript_predeps = ( "rm_conffile" => "", "mv_conffile" => "", "symlink_to_dir" => "1.17.5", "dir_to_symlink" => "1.17.5", ); foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); if (! -d "$tmp/DEBIAN") { doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN"); } if (is_udeb($package)) { # For udebs, only do the postinst, and no #DEBHELPER#. # Udebs also support menutest and isinstallable scripts. foreach my $script (qw{postinst menutest isinstallable}) { my $f=pkgfile($package,$script); if ($f) { doit("install", "-o", 0, "-g", 0, "-m", 755, $f, "$tmp/DEBIAN/$script"); } } # stop here for udebs next; } my $maintscriptfile=pkgfile($package, "maintscript"); if ($maintscriptfile) { foreach my $line (filedoublearray($maintscriptfile)) { my $cmd=$line->[0]; error("unknown dpkg-maintscript-helper command: $cmd") unless exists $maintscript_predeps{$cmd}; addsubstvar($package, "misc:Pre-Depends", "dpkg", ">= $maintscript_predeps{$cmd}") if length $maintscript_predeps{$cmd}; my $params=escape_shell(@$line); foreach my $script (qw{postinst preinst prerm postrm}) { autoscript($package, $script, "maintscript-helper", "s!#PARAMS#!$params!g"); } } } # Install debian scripts. foreach my $script (qw{postinst preinst prerm postrm}) { debhelper_script_subst($package, $script); } # Install non-executable files foreach my $file (qw{shlibs conffiles triggers}) { 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 This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_installdebconf0000775000000000000000000000640012164264535015672 0ustar #!/usr/bin/perl -w =head1 NAME dh_installdebconf - install files used by debconf in package build directories =cut use strict; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B [S>] [B<-n>] [S I>] =head1 DESCRIPTION B is a debhelper program that is responsible for installing files used by debconf into package build directories. It also automatically generates the F commands needed to interface with debconf. The commands are added to the maintainer scripts by B. See L for an explanation of how that works. Note that if you use debconf, your package probably needs to depend on it (it will be added to B<${misc:Depends}> by this program). Note that for your config script to be called by B, your F needs to source debconf's confmodule. B does not install this statement into the F automatically as it is too hard to do it right. =head1 FILES =over 4 =item debian/I.config This is the debconf F script, and is installed into the F directory in the package build directory. Inside the script, the token B<#DEBHELPER#> is replaced with shell script snippets generated by other debhelper commands. =item debian/I.templates This is the debconf F file, and is installed into the F directory in the package build directory. =item F If this directory is present, this program will automatically use L to generate merged templates files that include the translations from there. For this to work, your package should build-depend on F. =back =head1 OPTIONS =over 4 =item B<-n>, B<--noscripts> Do not modify F script. =item B<--> I Pass the params to B. =back =cut init(); my @extraparams; if (defined($dh{U_PARAMS})) { @extraparams=@{$dh{U_PARAMS}}; } # PROMISE: DH NOOP WITHOUT config templates foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); my $config=pkgfile($package,"config"); my $templates=pkgfile($package,"templates"); if (! -d "$tmp/DEBIAN") { doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN"); } if (! is_udeb($package)) { debhelper_script_subst($package, "config"); } if ($templates ne '') { # Are there old-style translated templates? if (glob("$templates.??"), glob("$templates.??_??")) { warning "Ignoring debian/templates.ll files. Switch to po-debconf!"; } umask(0022); # since I do a redirect below if (-d "debian/po") { complex_doit("po2debconf @extraparams $templates > $tmp/DEBIAN/templates"); } else { doit("install", "-o", 0, "-g", 0, "-m", 644, "-p", $templates, "$tmp/DEBIAN/templates"); } } # I'm going with debconf 0.5 because it was the first # "modern" one. udebs just need cdebconf. my $debconfdep=is_udeb($package) ? "cdebconf-udeb" : "debconf (>= 0.5) | debconf-2.0"; if ($config ne '' || $templates ne '') { addsubstvar($package, "misc:Depends", $debconfdep); } if (($config ne '' || $templates ne '') && ! $dh{NOSCRIPTS}) { autoscript($package,"postrm","postrm-debconf"); } } =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_gconf0000775000000000000000000000547412164264535014011 0ustar #!/usr/bin/perl -w =head1 NAME dh_gconf - install GConf defaults files and register schemas =cut use strict; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B [S>] [B<--priority=>I] =head1 DESCRIPTION B is a debhelper program that is responsible for installing GConf defaults files and registering GConf schemas. An appropriate dependency on gconf2 will be generated in B<${misc:Depends}>. =head1 FILES =over 4 =item debian/I.gconf-defaults Installed into F in the package build directory, with I replaced by the package name. =item debian/I.gconf-mandatory Installed into F in the package build directory, with I replaced by the package name. =back =head1 OPTIONS =over 4 =item B<--priority> I Use I (which should be a 2-digit number) as the defaults priority instead of B<10>. Higher values than ten can be used by derived distributions (B<20>), CDD distributions (B<50>), or site-specific packages (B<90>). =back =cut init(); my $priority=10; if (defined $dh{PRIORITY}) { $priority=$dh{PRIORITY}; } # PROMISE: DH NOOP WITHOUT gconf-mandatory gconf-defaults tmp(etc/gconf/schemas) tmp(usr/share/gconf/schemas) foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); my $gconf_dep = 0; my $mandatory = pkgfile($package, "gconf-mandatory"); if ($mandatory ne '') { doit("mkdir","-p","$tmp/usr/share/gconf/mandatory"); doit("install","-p","-m644",$mandatory,"$tmp/usr/share/gconf/mandatory/${priority}_$package"); addsubstvar($package, "misc:Depends", "gconf2 (>= 2.28.1-2)"); $gconf_dep = 1; } my $defaults = pkgfile($package,"gconf-defaults"); if ($defaults ne '') { doit("mkdir","-p","$tmp/usr/share/gconf/defaults"); doit("install","-p","-m644",$defaults,"$tmp/usr/share/gconf/defaults/${priority}_$package"); addsubstvar($package, "misc:Depends", "gconf2 (>= 2.28.1-2)") unless $gconf_dep; $gconf_dep = 1; } my $old_schemas_dir = "$tmp/etc/gconf/schemas"; my $new_schemas_dir = "$tmp/usr/share/gconf/schemas"; # Migrate schemas from /etc/gconf/schemas to /usr/share/gconf/schemas if (-d $old_schemas_dir) { doit("mkdir -p $new_schemas_dir") unless -d $new_schemas_dir; doit("mv $old_schemas_dir/*.schemas $new_schemas_dir/"); doit("rmdir -p --ignore-fail-on-non-empty $old_schemas_dir"); } if (-d "$new_schemas_dir") { # Get a list of the schemas my $schemas = `find $new_schemas_dir -type f -name \\*.schemas -printf '%P '`; if ($schemas ne '') { addsubstvar($package, "misc:Depends", "gconf2 (>= 2.28.1-2)") unless $gconf_dep; } } } =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Ross Burton Josselin Mouette =cut debhelper-9.20131227ubuntu1/dh_compress0000775000000000000000000001370412251330374014533 0ustar #!/usr/bin/perl -w =head1 NAME dh_compress - compress files and fix symlinks in package build directories =cut use strict; use Cwd; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B [S>] [B<-X>I] [B<-A>] [S ...>] =head1 DESCRIPTION B is a debhelper program that is responsible for compressing the files in package build directories, and makes sure that any symlinks that pointed to the files before they were compressed are updated to point to the new files. By default, B compresses files that Debian policy mandates should be compressed, namely all files in F, F, files in F that are larger than 4k in size, (except the F file, F<.html> and other web files, image files, and files that appear to be already compressed based on their extensions), and all F files. Plus PCF fonts underneath F =head1 FILES =over 4 =item debian/I.compress These files are deprecated. If this file exists, the default files are not compressed. Instead, the file is ran as a shell script, and all filenames that the shell script outputs will be compressed. The shell script will be run from inside the package build directory. Note though that using B<-X> is a much better idea in general; you should only use a F file if you really need to. =back =head1 OPTIONS =over 4 =item B<-X>I, B<--exclude=>I Exclude files that contain F anywhere in their filename from being compressed. For example, B<-X.tiff> will exclude TIFF files from compression. You may use this option multiple times to build up a list of things to exclude. =item B<-A>, B<--all> Compress all files specified by command line parameters in ALL packages acted on. =item I ... Add these files to the list of files to compress. =back =head1 CONFORMS TO Debian policy, version 3.0 =cut init(); foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); my $compress=pkgfile($package,"compress"); # Run the file name gathering commands from within the directory # structure that will be effected. next unless -d $tmp; my $olddir=getcwd(); verbose_print("cd $tmp"); chdir($tmp) || error("Can't cd to $tmp: $!"); # Figure out what files to compress. my @files; # First of all, deal with any files specified right on the command line. if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { push @files, @ARGV; } if ($compress) { # The compress file is a sh script that outputs the files to be compressed # (typically using find). warning("$compress is deprecated; use -X or avoid calling dh_compress instead"); push @files, split(/\n/,`sh $olddir/$compress 2>/dev/null`); } else { # Note that all the excludes of odd things like _z # are because gzip refuses to compress such files, assuming # they are zip files. I looked at the gzip source to get the # complete list of such extensions: ".gz", ".z", ".taz", # ".tgz", "-gz", "-z", "_z" push @files, split(/\n/,` find usr/info usr/share/info usr/man usr/share/man usr/X11*/man -type f ! -iname "*.gz" \\ ! -iname "*.gif" ! -iname "*.png" ! -iname "*.jpg" \\ ! -iname "*.jpeg" \\ 2>/dev/null || true; find usr/share/doc \\ \\( -type d -name _sources -prune -false \\) -o \\ -type f \\( -size +4k -or -name "changelog*" -or -name "NEWS*" \\) \\ \\( -name changelog.html -or ! -iname "*.htm*" \\) \\ ! -iname "*.gif" ! -iname "*.png" ! -iname "*.jpg" \\ ! -iname "*.jpeg" ! -iname "*.gz" ! -iname "*.taz" \\ ! -iname "*.tgz" ! -iname "*.z" ! -iname "*.bz2" \\ ! -iname "*-gz" ! -iname "*-z" ! -iname "*_z" \\ ! -iname "*.epub" ! -iname "*.jar" ! -iname "*.zip" \\ ! -iname "*.odg" ! -iname "*.odp" ! -iname "*.odt" \\ ! -iname ".htaccess" ! -iname "*.css" \\ ! -iname "*.svg" ! -iname "*.svgz" ! -iname "*.js" \\ ! -name "index.sgml" ! -name "objects.inv" \\ ! -name "copyright" 2>/dev/null || true; find usr/share/fonts/X11 -type f -name "*.pcf" 2>/dev/null || true; `); } # Exclude files from compression. if (@files && defined($dh{EXCLUDE}) && $dh{EXCLUDE}) { my @new=(); foreach (@files) { my $ok=1; foreach my $x (@{$dh{EXCLUDE}}) { if (/\Q$x\E/) { $ok=''; last; } } push @new,$_ if $ok; } @files=@new; } # Look for files with hard links. If we are going to compress both, # we can preserve the hard link across the compression and save # space in the end. my @f=(); my %hardlinks; my %seen; foreach (@files) { my ($dev, $inode, undef, $nlink)=stat($_); if ($nlink > 1) { if (! $seen{"$inode.$dev"}) { $seen{"$inode.$dev"}=$_; push @f, $_; } else { # This is a hardlink. $hardlinks{$_}=$seen{"$inode.$dev"}; } } else { push @f, $_; } } if (@f) { # Make executables not be anymore. xargs(\@f,"chmod","a-x"); xargs(\@f,"gzip","-9nf"); } # Now change over any files we can that used to be hard links so # they are again. foreach (keys %hardlinks) { # Remove old file. doit("rm","-f","$_"); # Make new hardlink. doit("ln","$hardlinks{$_}.gz","$_.gz"); } verbose_print("cd '$olddir'"); chdir($olddir); # Fix up symlinks that were pointing to the uncompressed files. my %links = map { chomp; $_ => 1 } `find $tmp -type l`; my $changed; # Keep looping through looking for broken links until no more # changes are made. This is done in case there are links pointing # to links, pointing to compressed files. do { $changed = 0; foreach my $link (keys %links) { my ($directory) = $link =~ m:(.*)/:; my $linkval = readlink($link); if (! -e "$directory/$linkval" && -e "$directory/$linkval.gz") { doit("rm","-f",$link); doit("ln","-sf","$linkval.gz","$link.gz"); delete $links{$link}; $changed++; } } } while $changed; } =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_installpam0000775000000000000000000000221012164264535015042 0ustar #!/usr/bin/perl -w =head1 NAME dh_installpam - install pam support files =cut use strict; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B [S>] [B<--name=>I] =head1 DESCRIPTION B is a debhelper program that is responsible for installing files used by PAM into package build directories. =head1 FILES =over 4 =item debian/I.pam Installed into etc/pam.d/I in the package build directory. =back =head1 OPTIONS =over 4 =item B<--name=>I Look for files named debian/I.I.pam and install them as etc/pam.d/I, instead of using the usual files and installing them using the package name. =back =cut init(); # PROMISE: DH NOOP WITHOUT pam 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/".pkgfilename($package)); } } =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_installemacsen0000775000000000000000000000772112251330374015704 0ustar #!/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 [S>] [B<-n>] [B<--priority=>I] [B<--flavor=>I] =head1 DESCRIPTION B is a debhelper program that is responsible for installing files used by the Debian B package into package build directories. It also automatically generates the F F and F commands needed to register a package as an Emacs add on package. The commands are added to the maintainer scripts by B. See L for an explanation of how this works. =head1 FILES =over 4 =item debian/I.emacsen-compat Installed into F in the package build directory. =item debian/I.emacsen-install Installed into F in the package build directory. =item debian/I.emacsen-remove Installed into F in the package build directory. =item debian/I.emacsen-startup Installed into etc/emacs/site-start.d/50I.el in the package build directory. Use B<--priority> to use a different priority than 50. =back =head1 OPTIONS =over 4 =item B<-n>, B<--noscripts> Do not modify F/F scripts. =item B<--priority=>I Sets the priority number of a F file. Default is 50. =item B<--flavor=>I Sets the flavor a F file will be installed in. Default is B, alternatives include B and B. =back =head1 NOTES Note that this command is not idempotent. L 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(options => { "flavor=s" => \$dh{FLAVOR}, }); if (! defined $dh{PRIORITY}) { $dh{PRIORITY}=50; } if (! defined $dh{FLAVOR}) { $dh{FLAVOR}='emacs'; } # PROMISE: DH NOOP WITHOUT emacsen-common emacsen-install emacsen-remove emacsen-startup foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); my $emacsen_compat=pkgfile($package,"emacsen-compat"); my $emacsen_install=pkgfile($package,"emacsen-install"); my $emacsen_remove=pkgfile($package,"emacsen-remove"); my $emacsen_startup=pkgfile($package,"emacsen-startup"); if ($emacsen_compat ne '') { if (! -d "$tmp/usr/lib/emacsen-common/packages/compat") { doit("install","-d","$tmp/usr/lib/emacsen-common/packages/compat"); } doit("install","-m0644",$emacsen_compat,"$tmp/usr/lib/emacsen-common/packages/compat/$package"); } 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,"preinst","preinst-emacsen", "s/#PACKAGE#/$package/"); autoscript($package,"postinst","postinst-emacsen", "s/#PACKAGE#/$package/"); autoscript($package,"prerm","prerm-emacsen", "s/#PACKAGE#/$package/"); } } } =head1 SEE ALSO L L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_movefiles0000775000000000000000000001157312164264535014703 0ustar #!/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 [S>] [B<--sourcedir=>I] [B<-X>I] [S ...>] =head1 DESCRIPTION B is a debhelper program that is responsible for moving files out of F or some other directory and into other package build directories. This may be useful if your package has a F that installs everything into F, and you need to break that up into subpackages. Note: B is a much better program, and you are recommended to use it instead of B. =head1 FILES =over 4 =item debian/I.files Lists the files to be moved into a package, separated by whitespace. The filenames listed should be relative to F. You can also list directory names, and the whole directory will be moved. =back =head1 OPTIONS =over 4 =item B<--sourcedir=>I Instead of moving files out of F (the default), this option makes it move files out of some other directory. Since the entire contents of the sourcedir is moved, specifying something like B<--sourcedir=/> is very unsafe, so to prevent mistakes, the sourcedir must be a relative filename; it cannot begin with a `B'. =item B<-Xitem>, B<--exclude=item> Exclude files that contain B anywhere in their filename from being installed. =item I ... Lists files to move. The filenames listed should be relative to F. You can also list directory names, and the whole directory will be moved. It is an error to list files here unless you use B<-p>, B<-i>, or B<-a> to tell B which subpackage to put them in. =back =head1 NOTES Note that files are always moved out of F 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 F, and then files can be moved by B from that directory. Any files or directories that remain are ignored, and get deleted by B later. =cut init(options => { "sourcedir=s" => \$dh{SOURCEDIR}, }); 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 # expansion 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)"); } else { $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 ; tr '\\n' '\\0' < $pwd/debian/movelist | xargs -0 rm -f)"); doit("rm","-f","debian/movelist"); } } # If $ret is set, we weren'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 aren't always sure exactly which files need # to be moved. exit $ret; =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_auto_build0000775000000000000000000000235112164264535015033 0ustar #!/usr/bin/perl -w =head1 NAME dh_auto_build - automatically builds a package =cut use strict; use Debian::Debhelper::Dh_Buildsystems; =head1 SYNOPSIS B [S>] [S>] [S I>] =head1 DESCRIPTION B is a debhelper program that tries to automatically build a package. It does so by running the appropriate command for the build system it detects the package uses. For example, if a F is found, this is done by running B (or B, if the environment variable is set). If there's a F, or F, it is run to build the package. This is intended to work for about 90% of packages. If it doesn't work, you're encouraged to skip using B at all, and just run the build process manually. =head1 OPTIONS See L> for a list of common build system selection and control options. =over 4 =item B<--> I Pass I to the program that is run, after the parameters that B usually passes. =back =cut buildsystems_init(); buildsystems_do(); =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_scrollkeeper0000775000000000000000000000111712164264535015375 0ustar #!/usr/bin/perl -w =head1 NAME dh_scrollkeeper - deprecated no-op =cut use strict; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B [S>] [B<-n>] [S>] =head1 DESCRIPTION B was a debhelper program that handled registering OMF files for ScrollKeeper. However, it no longer does anything, and is now deprecated. =cut init(); warning("This program is deprecated, and does nothing anymore."); =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Ross Burton =cut debhelper-9.20131227ubuntu1/dh_suidregister0000775000000000000000000000656212164264535015425 0ustar #!/usr/bin/perl -w =head1 NAME dh_suidregister - suid registration program (deprecated) =head1 SYNOPSIS Do not run! =head1 DESCRIPTION This program used to register suid and sgid files with L, but with the introduction of L, registration of files in this way is unnecessary, and even harmful, so this program is deprecated and 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 B from F, and add a versioned conflicts into your F 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 This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_testroot0000775000000000000000000000111312164264535014562 0ustar #!/usr/bin/perl -w =head1 NAME dh_testroot - ensure that a package is built as root =head1 SYNOPSIS B [S>] =head1 DESCRIPTION B 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 =cut use strict; use Debian::Debhelper::Dh_Lib; inhibit_log(); if ($< != 0) { error("You must run this as root (or use fakeroot)."); } =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_install0000775000000000000000000001743712251330333014350 0ustar #!/usr/bin/perl -w =head1 NAME dh_install - install files into package build directories =cut use strict; use File::Find; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B [B<-X>I] [B<--autodest>] [B<--sourcedir=>I] [S>] [S ... I>] =head1 DESCRIPTION B is a debhelper program that handles installing files into package build directories. There are many BI<*> commands that handle installing specific types of files such as documentation, examples, man pages, and so on, and they should be used when possible as they often have extra intelligence for those particular tasks. B, then, is useful for installing everything else, for which no particular intelligence is needed. It is a replacement for the old B command. This program may be used in one of two ways. If you just have a file or two that the upstream Makefile does not install for you, you can run B on them to move them into place. On the other hand, maybe you have a large package that builds multiple binary packages. You can use the upstream F to install it all into F, and then use B to copy directories and files from there into the proper package build directories. From debhelper compatibility level 7 on, B will fall back to looking in F for files, if it doesn't find them in the current directory (or whereever you've told it to look using B<--sourcedir>). =head1 FILES =over 4 =item debian/I.install List the files to install into each package and the directory they should be installed to. The format is a set of lines, where each line lists a file or files to install, and at the end of the line tells the directory it should be installed in. The name of the files (or directories) to install should be given relative to the current directory, while the installation directory is given relative to the package build directory. You may use wildcards in the names of the files to install (in v3 mode and above). Note that if you list exactly one filename or wildcard-pattern on a line by itself, with no explicit destination, then B will automatically guess the destination to use, the same as if the --autodest option were used. =back =head1 OPTIONS =over 4 =item B<--list-missing> This option makes B keep track of the files it installs, and then at the end, compare that list with the files in the source directory. If any of the files (and symlinks) in the source directory were not installed to somewhere, it will warn on stderr about that. This may be useful if you have a large package and want to make sure that you don't miss installing newly added files in new upstream releases. Note that files that are excluded from being moved via the B<-X> option are not warned about. =item B<--fail-missing> This option is like B<--list-missing>, except if a file was missed, it will not only list the missing files, but also fail with a nonzero exit code. =item B<-X>I, B<--exclude=>I Exclude files that contain I anywhere in their filename from being installed. =item B<--sourcedir=>I Look in the specified directory for files to be installed. Note that this is not the same as the B<--sourcedirectory> option used by the BI<*> commands. You rarely need to use this option, since B automatically looks for files in F in debhelper compatibility level 7 and above. =item B<--autodest> Guess as the destination directory to install things to. If this is specified, you should not list destination directories in F files or on the command line. Instead, B will guess as follows: Strip off F (or the sourcedir if one is given) from the front of the filename, if it is present, and install into the dirname of the filename. So if the filename is F, then that directory will be copied to F. If the filename is F, it will be copied to F. =item I ... I Lists files (or directories) to install and where to install them to. The files will be installed into the first package F acts on. =back =cut init(options => { "autodest" => \$dh{AUTODEST}, "list-missing" => \$dh{LIST_MISSING}, "fail-missing" => \$dh{FAIL_MISSING}, "sourcedir=s" => \$dh{SOURCEDIR}, }); my @installed; my $srcdir = '.'; $srcdir = $dh{SOURCEDIR} if defined $dh{SOURCEDIR}; # PROMISE: DH NOOP WITHOUT install foreach my $package (getpackages()) { # Look at the install files for all packages to handle # list-missing/fail-missing, but skip really installing for # packages that are not being acted on. my $skip_install=! grep { $_ eq $package } @{$dh{DOPACKAGES}}; my $tmp=tmpdir($package); my $file=pkgfile($package,"install"); my @install; if ($file) { @install=filedoublearray($file); # no globbing here; done below } if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { push @install, [@ARGV]; } # Support for -X flag. my $exclude = ''; if ($dh{EXCLUDE_FIND}) { $exclude = '! \( '.$dh{EXCLUDE_FIND}.' \)'; } foreach my $set (@install) { my $dest; my $tmpdest=0; if (! defined $dh{AUTODEST} && @$set > 1) { $dest=pop @$set; } my @filelist; foreach my $glob (@$set) { my @found = glob "$srcdir/$glob"; if (! compat(6)) { # Fall back to looking in debian/tmp. if (! @found || ! (-e $found[0] || -l $found[0])) { @found = glob "debian/tmp/$glob"; } } push @filelist, @found; } if (! compat(4)) { # check added in v5 if (! @filelist && ! $skip_install) { error("$package missing files (@$set), aborting"); } } foreach my $src (@filelist) { next if excludefile($src); push @installed, $src; next if $skip_install; if (! defined $dest) { # Guess at destination directory. $dest=$src; $dest=~s/^(.*\/)?\Q$srcdir\E\///; $dest=~s/^(.*\/)?debian\/tmp\///; $dest=dirname("/".$dest); $tmpdest=1; } # Make sure the destination directory exists. if (! -e "$tmp/$dest") { doit("install","-d","$tmp/$dest"); } if (-d $src && $exclude) { my $basename = basename($src); my $dir = ($basename eq '.') ? $src : "$src/.."; my $pwd=`pwd`; chomp $pwd; complex_doit("cd '$dir' && find '$basename' $exclude \\( -type f -or -type l \\) -print0 | xargs -0 -I {} cp --parents -dp {} $pwd/$tmp/$dest/"); # cp is annoying so I need a separate pass # just for empty directories complex_doit("cd '$dir' && find '$basename' $exclude \\( -type d -and -empty \\) -print0 | xargs -0 -I {} cp --parents -a {} $pwd/$tmp/$dest/"); } else { doit("cp", "-a", $src, "$tmp/$dest/"); } if ($tmpdest) { $dest=undef; } } } } if ($dh{LIST_MISSING} || $dh{FAIL_MISSING}) { # . as srcdir makes no sense, so this is a special case. if ($srcdir eq '.') { $srcdir='debian/tmp'; } my @missing; my $installed=join("|", map { # Kill any extra slashes, for robustness. y:/:/:s; s:/+$::; s:^(\./)*::; "\Q$_\E\/.*|\Q$_\E"; } @installed); $installed=qr{^($installed)$}; find(sub { -f || -l || return; $_="$File::Find::dir/$_"; if (! /$installed/ && ! excludefile($_)) { my $file=$_; $file=~s/^\Q$srcdir\E\///; push @missing, $file; } }, $srcdir); if (@missing) { warning "$_ exists in $srcdir but is not installed to anywhere" foreach @missing; if ($dh{FAIL_MISSING}) { error("missing files, aborting"); } } } =head1 LIMITATIONS B cannot rename files or directories, it can only install them with the names they already have into wherever you want in the package build tree. =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_installman0000775000000000000000000001606412164264535015054 0ustar #!/usr/bin/perl -w =head1 NAME dh_installman - install man pages into package build directories =cut use strict; use File::Find; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B [S>] [S ...>] =head1 DESCRIPTION B is a debhelper program that handles installing man pages into the correct locations in package build directories. You tell it what man pages go in your packages, and it figures out where to install them based on the section field in their B<.TH> or B<.Dt> line. If you have a properly formatted B<.TH> or B<.Dt> line, your man page will be installed into the right directory, with the right name (this includes proper handling of pages with a subsection, like B<3perl>, which are placed in F, and given an extension of F<.3perl>). If your B<.TH> or B<.Dt> line is incorrect or missing, the program may guess wrong based on the file extension. It also supports translated man pages, by looking for extensions like F<.ll.8> and F<.ll_LL.8>, or by use of the B<--language> switch. If B seems to install a man page into the wrong section or with the wrong extension, this is because the man page has the wrong section listed in its B<.TH> or B<.Dt> line. Edit the man page and correct the section, and B will follow suit. See L for details about the B<.TH> section, and L for the B<.Dt> section. If B seems to install a man page into a directory like F, that is because your program has a name like F, and B assumes that means it is translated into Polish. Use B<--language=C> to avoid this. After the man page installation step, B will check to see if any of the man pages in the temporary directories of any of the packages it is acting on contain F<.so> links. If so, it changes them to symlinks. Also, B will use man to guess the character encoding of each manual page and convert it to UTF-8. If the guesswork fails for some reason, you can override it using an encoding declaration. See L for details. =head1 FILES =over 4 =item debian/I.manpages Lists man pages to be installed. =back =head1 OPTIONS =over 4 =item B<-A>, B<--all> Install all files specified by command line parameters in ALL packages acted on. =item B<--language=>I Use this to specify that the man pages being acted on are written in the specified language. =item I ... Install these man pages into the first package acted on. (Or in all packages if B<-A> is specified). =back =head1 NOTES An older version of this program, L, is still used by some packages, and so is still included in debhelper. It is, however, deprecated, due to its counterintuitive and inconsistent interface. Use this program instead. =cut init(options => { "language=s" => \$dh{LANGUAGE}, }); my @sofiles; my @sodests; # PROMISE: DH NOOP WITHOUT manpages tmp(usr/share/man) foreach my $package (@{$dh{DOPACKAGES}}) { next if is_udeb($package); my $tmp=tmpdir($package); my $file=pkgfile($package,"manpages"); my @manpages; @manpages=filearray($file, ".") if $file; if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { push @manpages, @ARGV; } foreach my $page (@manpages) { my $basename=basename($page); # Support compressed pages. my $gz=''; if ($basename=~m/(.*)(\.gz)/) { $basename=$1; $gz=$2; } my $section; # See if there is a .TH or .Dt entry in the man page. If so, # we'll pull the section field from that. if ($gz) { open (IN, "zcat $page|") or die "$page: $!"; } else { open (IN, $page) or die "$page: $!"; } while () { if (/^\.TH\s+\S+\s+"?(\d+[^"\s]*)"?/ || /^\.Dt\s+\S+\s+(\d+[^\s]*)/) { $section=$1; last; } } # Failing that, we can try to get it from the filename. if (! $section) { ($section)=$basename=~m/.*\.([1-9]\S*)/; } # Now get the numeric component of the section. my ($realsection)=$section=~m/^(\d)/ if defined $section; if (! $realsection) { error("Could not determine section for $page"); } # Get the man page's name -- everything up to the last dot. my ($instname)=$basename=~m/^(.*)\./; my $destdir="$tmp/usr/share/man/man$realsection/"; my $langcode; if (! defined $dh{LANGUAGE} || ! exists $dh{LANGUAGE}) { # Translated man pages are typically specified by adding the # language code to the filename, so detect that and # redirect to appropriate directory, stripping the code. ($langcode)=$basename=~m/.*\.([a-z][a-z](?:_[A-Z][A-Z])?)\.(?:[1-9]|man)/; } elsif ($dh{LANGUAGE} ne 'C') { $langcode=$dh{LANGUAGE}; } if (defined $langcode && $langcode ne '') { # Strip the language code from the instname. $instname=~s/\.$langcode$//; } if (defined $langcode && $langcode ne '') { $destdir="$tmp/usr/share/man/$langcode/man$realsection/"; } $destdir=~tr:/:/:s; # just for looks my $instpage="$destdir$instname.$section"; next if -l $instpage; next if compat(5) && -e $instpage; if (! -d $destdir) { doit "install","-d",$destdir; } if ($gz) { complex_doit "zcat \Q$page\E > \Q$instpage\E"; } else { doit "install","-p","-m644",$page,$instpage; } } # Now the .so conversion. @sofiles=@sodests=(); foreach my $dir (qw{usr/share/man}) { if (-e "$tmp/$dir") { find(\&find_so_man, "$tmp/$dir"); } } foreach my $sofile (@sofiles) { my $sodest=shift(@sodests); doit "rm","-f",$sofile; doit "ln","-sf",$sodest,$sofile; } # Now utf-8 conversion. if (defined `man --version`) { foreach my $dir (qw{usr/share/man}) { next unless -e "$tmp/$dir"; find(sub { return if ! -f $_ || -l $_; my ($tmp, $orig)=($_.".new", $_); complex_doit "man --recode UTF-8 ./\Q$orig\E > \Q$tmp\E"; # recode uncompresses compressed pages doit "rm", "-f", $orig if s/\.(gz|Z)$//; doit "chmod", 644, $tmp; doit "mv", "-f", $tmp, $_; }, "$tmp/$dir"); } } } # Check if a file is a .so man page, for use by File::Find. sub find_so_man { # The -s test is becuase a .so file tends to be small. We don't want # to open every man page. 1024 is arbitrary. if (! -f $_ || -s $_ > 1024 || -s == 0) { return; } # Test first line of file for the .so thing. if (/\.gz$/) { open (SOTEST, "zcat $_|") or die "$_: $!"; } else { open (SOTEST,$_) || die "$_: $!"; } my $l=; close SOTEST; if (! defined $l) { error("failed to read $_"); } if ($l=~m/\.so\s+(.*)\s*/) { my $solink=$1; # This test is here to prevent links like ... man8/../man8/foo.8 if (basename($File::Find::dir) eq dirname($solink)) { $solink=basename($solink); } # A so link with a path is relative to the base of the man # page hierarchy, but without a path, is relative to the # current section. elsif ($solink =~ m!/!) { $solink="../$solink"; } if (-e $solink || -e "$solink.gz") { push @sofiles,"$File::Find::dir/$_"; push @sodests,$solink; } } } =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/dh_lintian0000775000000000000000000000243112164264535014341 0ustar #!/usr/bin/perl -w =head1 NAME dh_lintian - install lintian override files into package build directories =cut use strict; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B [S>] =head1 DESCRIPTION B is a debhelper program that is responsible for installing override files used by lintian into package build directories. =head1 FILES =over 4 =item debian/I.lintian-overrides Installed into usr/share/lintian/overrides/I in the package build directory. This file is used to suppress erroneous lintian diagnostics. =item F These files are not installed, but will be scanned by lintian to provide overrides for the source package. =back =cut init(); # PROMISE: DH NOOP WITHOUT lintian-overrides foreach my $package (@{$dh{DOPACKAGES}}) { next if is_udeb($package); my $tmp=tmpdir($package); my $or_dir = "$tmp/usr/share/lintian/overrides"; my $overrides=pkgfile($package,"lintian-overrides"); if ($overrides ne '') { if (! -d "$or_dir") { doit("install","-d","$or_dir"); } doit("install","-p","-m644",$overrides,"$or_dir/$package"); } } =head1 SEE ALSO L This program is a part of debhelper. L =head1 AUTHOR Steve Robbins =cut debhelper-9.20131227ubuntu1/dh_installmodules0000775000000000000000000000555512164264535015754 0ustar #!/usr/bin/perl -w =head1 NAME dh_installmodules - register kernel modules =cut use strict; use Debian::Debhelper::Dh_Lib; use File::Find; =head1 SYNOPSIS B [S>] [B<-n>] [B<--name=>I] =head1 DESCRIPTION B is a debhelper program that is responsible for registering kernel modules. Kernel modules are searched for in the package build directory and if found, F, F and F commands are automatically generated to run B and register the modules when the package is installed. These commands are inserted into the maintainer scripts by L. =head1 FILES =over 4 =item debian/I.modprobe Installed to etc/modprobe.d/I.conf in the package build directory. =back =head1 OPTIONS =over 4 =item B<-n>, B<--noscripts> Do not modify F/F/F scripts. =item B<--name=>I When this parameter is used, B looks for and installs files named debian/I.I.modprobe instead of the usual debian/I.modprobe =back =head1 NOTES Note that this command is not idempotent. L 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(); # Looks for kernel modules in the passed directory. If any are found, # returns the kernel version (or versions) that the modules seem to be for. sub find_kernel_modules { my $searchdir=shift; my %versions; return unless -d $searchdir; find(sub { if (/\.k?o$/) { my ($kvers)=$File::Find::dir=~m!lib/modules/([^/]+)/!; if (! defined $kvers || ! length $kvers) { warning("Cannot determine kernel version for module $File::Find::name"); } else { $versions{$kvers}=1; } } }, $searchdir); return keys %versions; } # PROMISE: DH NOOP WITHOUT modprobe tmp(lib/modules) foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); my $modprobe_file=pkgfile($package,"modprobe"); if (! -e $tmp) { doit("install","-d",$tmp); } if ($modprobe_file) { if (! -e "$tmp/etc/modprobe.d") { doit("install","-d","$tmp/etc/modprobe.d"); } my $old="/etc/modprobe.d/".pkgfilename($package); my $new=$old.".conf"; doit("install","-m","0644",$modprobe_file,"$tmp/$new"); autoscript($package,"preinst","preinst-moveconffile","s!#OLD#!$old!g;s!#PACKAGE#!$package!g"); autoscript($package,"postinst","postinst-moveconffile","s!#OLD#!$old!g;s!#NEW#!$new!g"); } if (! $dh{NOSCRIPTS}) { foreach my $kvers (find_kernel_modules("$tmp/lib/modules")) { autoscript($package,"postinst","postinst-modules","s/#KVERS#/$kvers/g"); autoscript($package,"postrm","postrm-modules","s/#KVERS#/$kvers/g"); } } } =head1 SEE ALSO L This program is a part of debhelper. =head1 AUTHOR Joey Hess =cut debhelper-9.20131227ubuntu1/man/0000775000000000000000000000000012301136553013044 5ustar debhelper-9.20131227ubuntu1/man/po4a/0000775000000000000000000000000012301136554013710 5ustar debhelper-9.20131227ubuntu1/man/po4a/add3.es0000664000000000000000000000024012164264535015060 0ustar PO4A-HEADER:mode=after;position=AUTOR;beginboundary=\=head1 =head1 TRADUCTOR Traducción de Omar Campagne Polaino =cut debhelper-9.20131227ubuntu1/man/po4a/add2.es0000664000000000000000000000027412164264535015066 0ustar PO4A-HEADER:mode=after;position=AUTOR;beginboundary=\=head1 =head1 TRADUCTOR Traducción de Rudy Godoy Actualización de Omar Campagne Polaino =cut debhelper-9.20131227ubuntu1/man/po4a/add.de0000664000000000000000000000102612164264535014761 0ustar PO4A-HEADER:mode=after;position=SIEHE\ AUCH;beginboundary=\=head1 =head1 ÜBERSETZUNG Diese Übersetzung wurde mit dem Werkzeug B L durch Chris Leick I und das deutsche Debian-Übersetzer-Team im Dezember 2011 erstellt. Bitte melden Sie alle Fehler in der Übersetzung an I oder als Fehlerbericht an das Paket I. Sie können mit dem folgenden Befehl das englische Original anzeigen S =cut debhelper-9.20131227ubuntu1/man/po4a/po4a.cfg0000664000000000000000000001710312251330333015231 0ustar [po4a_langs] fr es de [po4a_paths] man/po4a/po/debhelper.pot $lang:man/po4a/po/$lang.po [po4a_alias:pod] pod opt_fr:"-L ISO-8859-15 -A UTF-8" [po4a_alias:pod] pod opt_es:"-L UTF-8 -A ISO-8859-15" [po4a_alias:pod] pod opt_de:"-L ISO-8859-15 -A UTF-8" [type: pod] debhelper.pod $lang:man/$lang/debhelper.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh $lang:man/$lang/dh.pod add_fr:man/po4a/add.fr add_es:man/po4a/add3.es add_de:man/po4a/add.de [type: pod] dh_auto_build $lang:man/$lang/dh_auto_build.pod add_fr:man/po4a/add.fr add_es:man/po4a/add3.es add_de:man/po4a/add.de [type: pod] dh_auto_clean $lang:man/$lang/dh_auto_clean.pod add_fr:man/po4a/add.fr add_es:man/po4a/add3.es add_de:man/po4a/add.de [type: pod] dh_auto_configure $lang:man/$lang/dh_auto_configure.pod add_fr:man/po4a/add.fr add_es:man/po4a/add3.es add_de:man/po4a/add.de [type: pod] dh_auto_install $lang:man/$lang/dh_auto_install.pod add_fr:man/po4a/add.fr add_es:man/po4a/add3.es add_de:man/po4a/add.de [type: pod] dh_auto_test $lang:man/$lang/dh_auto_test.pod add_fr:man/po4a/add.fr add_es:man/po4a/add3.es add_de:man/po4a/add.de [type: pod] dh_bugfiles $lang:man/$lang/dh_bugfiles.pod add_fr:man/po4a/add.fr add_es:man/po4a/add3.es add_de:man/po4a/add.de [type: pod] dh_builddeb $lang:man/$lang/dh_builddeb.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_clean $lang:man/$lang/dh_clean.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_compress $lang:man/$lang/dh_compress.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_desktop $lang:man/$lang/dh_desktop.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_fixperms $lang:man/$lang/dh_fixperms.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_gconf $lang:man/$lang/dh_gconf.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_gencontrol $lang:man/$lang/dh_gencontrol.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_icons $lang:man/$lang/dh_icons.pod add_fr:man/po4a/add.fr add_es:man/po4a/add3.es add_de:man/po4a/add.de [type: pod] dh_install $lang:man/$lang/dh_install.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installcatalogs $lang:man/$lang/dh_installcatalogs.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installchangelogs $lang:man/$lang/dh_installchangelogs.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installcron $lang:man/$lang/dh_installcron.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installdeb $lang:man/$lang/dh_installdeb.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installdebconf $lang:man/$lang/dh_installdebconf.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installdirs $lang:man/$lang/dh_installdirs.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installdocs $lang:man/$lang/dh_installdocs.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installemacsen $lang:man/$lang/dh_installemacsen.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installexamples $lang:man/$lang/dh_installexamples.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installifupdown $lang:man/$lang/dh_installifupdown.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installinfo $lang:man/$lang/dh_installinfo.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installinit $lang:man/$lang/dh_installinit.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installlogcheck $lang:man/$lang/dh_installlogcheck.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installlogrotate $lang:man/$lang/dh_installlogrotate.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installman $lang:man/$lang/dh_installman.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installmanpages $lang:man/$lang/dh_installmanpages.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installmenu $lang:man/$lang/dh_installmenu.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installmime $lang:man/$lang/dh_installmime.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installmodules $lang:man/$lang/dh_installmodules.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installpam $lang:man/$lang/dh_installpam.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installppp $lang:man/$lang/dh_installppp.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installudev $lang:man/$lang/dh_installudev.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installwm $lang:man/$lang/dh_installwm.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_installxfonts $lang:man/$lang/dh_installxfonts.pod add_fr:man/po4a/add.fr add_es:man/po4a/add1.es add_de:man/po4a/add.de [type: pod] dh_link $lang:man/$lang/dh_link.pod add_fr:man/po4a/add.fr add_es:man/po4a/add2.es add_de:man/po4a/add.de [type: pod] dh_lintian $lang:man/$lang/dh_lintian.pod add_fr:man/po4a/add.fr add_es:man/po4a/add2.es add_de:man/po4a/add.de [type: pod] dh_listpackages $lang:man/$lang/dh_listpackages.pod add_fr:man/po4a/add.fr add_es:man/po4a/add2.es add_de:man/po4a/add.de [type: pod] dh_makeshlibs $lang:man/$lang/dh_makeshlibs.pod add_fr:man/po4a/add.fr add_es:man/po4a/add2.es add_de:man/po4a/add.de [type: pod] dh_md5sums $lang:man/$lang/dh_md5sums.pod add_fr:man/po4a/add.fr add_es:man/po4a/add2.es add_de:man/po4a/add.de [type: pod] dh_movefiles $lang:man/$lang/dh_movefiles.pod add_fr:man/po4a/add.fr add_es:man/po4a/add2.es add_de:man/po4a/add.de [type: pod] dh_perl $lang:man/$lang/dh_perl.pod add_fr:man/po4a/add.fr add_es:man/po4a/add2.es add_de:man/po4a/add.de [type: pod] dh_prep $lang:man/$lang/dh_prep.pod add_fr:man/po4a/add.fr add_es:man/po4a/add2.es add_de:man/po4a/add.de [type: pod] dh_scrollkeeper $lang:man/$lang/dh_scrollkeeper.pod add_fr:man/po4a/add.fr add_es:man/po4a/add2.es add_de:man/po4a/add.de [type: pod] dh_shlibdeps $lang:man/$lang/dh_shlibdeps.pod add_fr:man/po4a/add.fr add_es:man/po4a/add2.es add_de:man/po4a/add.de [type: pod] dh_strip $lang:man/$lang/dh_strip.pod add_fr:man/po4a/add.fr add_es:man/po4a/add2.es add_de:man/po4a/add.de [type: pod] dh_suidregister $lang:man/$lang/dh_suidregister.pod add_fr:man/po4a/add.fr add_es:man/po4a/add2.es add_de:man/po4a/add.de [type: pod] dh_testdir $lang:man/$lang/dh_testdir.pod add_fr:man/po4a/add.fr add_es:man/po4a/add2.es add_de:man/po4a/add.de [type: pod] dh_testroot $lang:man/$lang/dh_testroot.pod add_fr:man/po4a/add.fr add_es:man/po4a/add2.es add_de:man/po4a/add.de [type: pod] dh_undocumented $lang:man/$lang/dh_undocumented.pod add_fr:man/po4a/add.fr add_es:man/po4a/add2.es add_de:man/po4a/add.de [type: pod] dh_usrlocal $lang:man/$lang/dh_usrlocal.pod add_fr:man/po4a/add.fr add_es:man/po4a/add2.es add_de:man/po4a/add.de debhelper-9.20131227ubuntu1/man/po4a/add1.es0000664000000000000000000000030412164264535015057 0ustar PO4A-HEADER:mode=after;position=AUTOR;beginboundary=\=head1 =head1 TRADUCTOR Traducción de Rubén Porras Campo Actualización de Omar Campagne Polaino =cut debhelper-9.20131227ubuntu1/man/po4a/po/0000775000000000000000000000000012301136554014326 5ustar debhelper-9.20131227ubuntu1/man/po4a/po/fr.po0000664000000000000000000116747112301136451015312 0ustar # Translation of debhelper manpages to French # Valery Perrin , 2005, 2006, 2010, 2011. # David Prévot , 2012. msgid "" msgstr "" "Project-Id-Version: debhelper manpages\n" "POT-Creation-Date: 2014-02-19 14:18+0000\n" "PO-Revision-Date: 2012-11-03 11:13-0400\n" "Last-Translator: Valery Perrin \n" "Language-Team: French \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Lokalize 1.4\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" # type: =head1 #. type: =head1 #: debhelper.pod:1 dh:3 dh_auto_build:3 dh_auto_clean:3 dh_auto_configure:3 #: dh_auto_install:3 dh_auto_test:3 dh_bugfiles:3 dh_builddeb:3 dh_clean:3 #: dh_compress:3 dh_desktop:3 dh_fixperms:3 dh_gconf:3 dh_gencontrol:3 #: dh_icons:3 dh_install:3 dh_installcatalogs:3 dh_installchangelogs:3 #: dh_installcron:3 dh_installdeb:3 dh_installdebconf:3 dh_installdirs:3 #: dh_installdocs:3 dh_installemacsen:3 dh_installexamples:3 #: dh_installifupdown:3 dh_installinfo:3 dh_installinit:3 dh_installlogcheck:3 #: dh_installlogrotate:3 dh_installman:3 dh_installmanpages:3 dh_installmenu:3 #: dh_installmime:3 dh_installmodules:3 dh_installpam:3 dh_installppp:3 #: dh_installudev:3 dh_installwm:3 dh_installxfonts:3 dh_link:3 dh_lintian:3 #: dh_listpackages:3 dh_makeshlibs:3 dh_md5sums:3 dh_movefiles:3 dh_perl:3 #: dh_prep:3 dh_scrollkeeper:3 dh_shlibdeps:3 dh_strip:3 dh_suidregister:3 #: dh_testdir:3 dh_testroot:3 dh_undocumented:3 dh_usrlocal:3 msgid "NAME" msgstr "NOM" # type: textblock #. type: textblock #: debhelper.pod:3 msgid "debhelper - the debhelper tool suite" msgstr "debhelper - Ensemble d'outils regroupés sous le nom de debhelper" # type: =head1 #. type: =head1 #: debhelper.pod:5 dh:12 dh_auto_build:12 dh_auto_clean:13 #: dh_auto_configure:12 dh_auto_install:15 dh_auto_test:13 dh_bugfiles:12 #: dh_builddeb:12 dh_clean:12 dh_compress:13 dh_desktop:12 dh_fixperms:12 #: dh_gconf:12 dh_gencontrol:12 dh_icons:13 dh_install:13 #: dh_installcatalogs:14 dh_installchangelogs:12 dh_installcron:12 #: dh_installdeb:12 dh_installdebconf:12 dh_installdirs:12 dh_installdocs:12 #: dh_installemacsen:12 dh_installexamples:12 dh_installifupdown:12 #: dh_installinfo:12 dh_installinit:13 dh_installlogcheck:12 #: dh_installlogrotate:12 dh_installman:13 dh_installmanpages:13 #: dh_installmenu:12 dh_installmime:12 dh_installmodules:13 dh_installpam:12 #: dh_installppp:12 dh_installudev:13 dh_installwm:12 dh_installxfonts:12 #: dh_link:13 dh_lintian:12 dh_listpackages:12 dh_makeshlibs:12 dh_md5sums:13 #: dh_movefiles:12 dh_perl:14 dh_prep:12 dh_scrollkeeper:12 dh_shlibdeps:13 #: dh_strip:13 dh_suidregister:7 dh_testdir:12 dh_testroot:7 #: dh_undocumented:12 dh_usrlocal:15 msgid "SYNOPSIS" msgstr "SYNOPSIS" # type: textblock #. type: textblock #: debhelper.pod:7 msgid "" "BI<*> [B<-v>] [B<-a>] [B<-i>] [B<-s>] [B<--no-act>] [B<-p>I] " "[B<-N>I] [B<-P>I]" msgstr "" "BI<*> [B<-v>] [B<-a>] [B<-i>] [B<-s>] [B<--no-act>] [B<-p>I] " "[B<-N>I] [B<-P>I]" # type: =head1 #. type: =head1 #: debhelper.pod:9 dh:16 dh_auto_build:16 dh_auto_clean:17 #: dh_auto_configure:16 dh_auto_install:19 dh_auto_test:17 dh_bugfiles:16 #: dh_builddeb:16 dh_clean:16 dh_compress:17 dh_desktop:16 dh_fixperms:16 #: dh_gconf:16 dh_gencontrol:16 dh_icons:17 dh_install:17 #: dh_installcatalogs:18 dh_installchangelogs:16 dh_installcron:16 #: dh_installdeb:16 dh_installdebconf:16 dh_installdirs:16 dh_installdocs:16 #: dh_installemacsen:16 dh_installexamples:16 dh_installifupdown:16 #: dh_installinfo:16 dh_installinit:17 dh_installlogcheck:16 #: dh_installlogrotate:16 dh_installman:17 dh_installmanpages:17 #: dh_installmenu:16 dh_installmime:16 dh_installmodules:17 dh_installpam:16 #: dh_installppp:16 dh_installudev:17 dh_installwm:16 dh_installxfonts:16 #: dh_link:17 dh_lintian:16 dh_listpackages:16 dh_makeshlibs:16 dh_md5sums:17 #: dh_movefiles:16 dh_perl:18 dh_prep:16 dh_scrollkeeper:16 dh_shlibdeps:17 #: dh_strip:17 dh_suidregister:11 dh_testdir:16 dh_testroot:11 #: dh_undocumented:16 dh_usrlocal:19 msgid "DESCRIPTION" msgstr "DESCRIPTION" # type: textblock #. type: textblock #: debhelper.pod:11 msgid "" "Debhelper is used to help you build a Debian package. The philosophy behind " "debhelper is to provide a collection of small, simple, and easily understood " "tools that are used in F to automate various common aspects of " "building a package. This means less work for you, the packager. It also, to " "some degree means that these tools can be changed if Debian policy changes, " "and packages that use them will require only a rebuild to comply with the " "new policy." msgstr "" "Debhelper facilite la construction des paquets Debian. La philosophie qui " "sous-tend debhelper est de fournir une collection de petits outils simples " "et facilement compréhensibles qui seront exploités dans F pour " "automatiser les tâches courantes liées à la construction des paquets, d'où " "un travail allégé pour le responsable. Dans une certaine mesure, cela " "signifie également que ces outils peuvent être adaptés aux modifications " "éventuelles de la Charte Debian. Les paquets qui utiliseront debhelper ne " "nécessiteront qu'une simple reconstruction pour être conformes aux nouvelles " "règles." # type: textblock #. type: textblock #: debhelper.pod:19 msgid "" "A typical F file that uses debhelper will call several " "debhelper commands in sequence, or use L to automate this process. " "Examples of rules files that use debhelper are in F" msgstr "" "Un fichier F typique, exploitant debhelper, appellera " "séquentiellement plusieurs des commandes de debhelper ou bien utilisera " "L pour automatiser ce processus. Des exemples de fichiers debian/" "rules qui exploitent debhelper se trouvent dans F" # type: textblock #. type: textblock #: debhelper.pod:23 msgid "" "To create a new Debian package using debhelper, you can just copy one of the " "sample rules files and edit it by hand. Or you can try the B " "package, which contains a L command that partially " "automates the process. For a more gentle introduction, the B " "Debian package contains a tutorial about making your first package using " "debhelper." msgstr "" "Pour créer un nouveau paquet Debian en utilisant debhelper, il suffit de " "copier un des fichiers d'exemple et de le modifier manuellement. Il est " "possible également d'essayer le paquet B qui contient une commande " "L automatisant partiellement le processus. Pour se " "familiariser avec ces concepts, le paquet Debian B contient un " "cours sur la construction d'un premier paquet avec debhelper." # type: =head1 #. type: =head1 #: debhelper.pod:29 msgid "DEBHELPER COMMANDS" msgstr "COMMANDES DE DEBHELPER" # type: textblock #. type: textblock #: debhelper.pod:31 msgid "" "Here is the list of debhelper commands you can use. See their man pages for " "additional documentation." msgstr "" "Voici la liste des commandes debhelper disponibles. Consulter leurs pages de " "manuel respectives pour obtenir des informations complémentaires." # type: textblock #. type: textblock #: debhelper.pod:36 msgid "#LIST#" msgstr "#LIST#" #. type: =head2 #: debhelper.pod:40 msgid "Deprecated Commands" msgstr "Commandes obsolètes" #. type: textblock #: debhelper.pod:42 msgid "A few debhelper commands are deprecated and should not be used." msgstr "" "Quelques commandes debhelper sont obsolètes et ne devraient plus être " "utilisées." #. type: textblock #: debhelper.pod:46 msgid "#LIST_DEPRECATED#" msgstr "#LIST_DEPRECATED#" # type: =head2 #. type: =head2 #: debhelper.pod:50 msgid "Other Commands" msgstr "Autres commandes" # type: textblock #. type: textblock #: debhelper.pod:52 msgid "" "If a program's name starts with B, and the program is not on the above " "lists, then it is not part of the debhelper package, but it should still " "work like the other programs described on this page." msgstr "" "Si le nom d'un programme commence par B et qu'il n'est pas dans les " "listes ci-dessus, cela signifie qu'il ne fait pas partie de la suite " "debhelper. Cependant, il devrait tout de même fonctionner comme les autres " "programmes décrits dans cette page." # type: =head1 #. type: =head1 #: debhelper.pod:56 msgid "DEBHELPER CONFIG FILES" msgstr "FICHIERS DE CONFIGURATION DE DEBHELPER" # type: textblock #. type: textblock #: debhelper.pod:58 msgid "" "Many debhelper commands make use of files in F to control what they " "do. Besides the common F and F, which are " "in all packages, not just those using debhelper, some additional files can " "be used to configure the behavior of specific debhelper commands. These " "files are typically named debian/I.foo (where I of course, " "is replaced with the package that is being acted on)." msgstr "" "Beaucoup de commandes de debhelper utilisent des fichiers du répertoire " "F pour piloter leur fonctionnement. Outre les fichiers F et F, qui se trouvent dans tous les paquets, et " "pas seulement dans ceux qui emploient debhelper, d'autres fichiers peuvent " "servir à configurer le comportement des commandes spécifiques de debhelper. " "Ces fichiers sont, en principe, nommés debian/I.toto (où I " "est, bien sûr, à remplacer par le nom du paquet concerné)." # type: textblock #. type: textblock #: debhelper.pod:65 msgid "" "For example, B uses files named F to " "list the documentation files it will install. See the man pages of " "individual commands for details about the names and formats of the files " "they use. Generally, these files will list files to act on, one file per " "line. Some programs in debhelper use pairs of files and destinations or " "slightly more complicated formats." msgstr "" "Par exemple, B utilise un fichier appelé F pour énumérer les fichiers de documentation qu'il installera. " "Consulter les pages de manuel des différentes commandes pour connaître le " "détail des noms et des formats des fichiers employés. D'une façon générale, " "ces fichiers de configuration énumèrent les fichiers sur lesquels devra " "porter l'action, à raison d'un fichier par ligne. Quelques programmes de " "debhelper emploient des paires fichier/destination voire des formats " "légèrement plus compliqués." # type: textblock #. type: textblock #: debhelper.pod:72 msgid "" "Note for the first (or only) binary package listed in F, " "debhelper will use F when there's no F file." msgstr "" "Nota : pour le premier (ou le seul) paquet binaire énuméré dans le fichier " "F, debhelper exploitera F quand aucun fichier " "F n'est présent." # type: textblock #. type: textblock #: debhelper.pod:76 msgid "" "In some rare cases, you may want to have different versions of these files " "for different architectures or OSes. If files named debian/I.foo." "I or debian/I.foo.I exist, where I and I are " "the same as the output of \"B\" / " "\"B\", then they will be used in " "preference to other, more general files." msgstr "" "Dans quelques rares cas, il peut être utile d'exploiter différentes versions " "de ces fichiers pour des architectures ou des systèmes d'exploitation " "différents. S'il existe des fichiers appelés debian/I.toto.I " "ou debian/I.toto.I, dans lesquels I et I correspondent " "respectivement au résultat de « B » ou de " "« B », alors ils seront utilisés de " "préférence aux autres fichiers plus généraux." # type: textblock #. type: textblock #: debhelper.pod:83 msgid "" "Mostly, these config files are used to specify lists of various types of " "files. Documentation or example files to install, files to move, and so on. " "When appropriate, in cases like these, you can use standard shell wildcard " "characters (B and B<*> and B<[>I<..>B<]> character classes) in the " "files. You can also put comments in these files; lines beginning with B<#> " "are ignored." msgstr "" "En général, ces fichiers de configuration sont employés pour indiquer des " "listes de divers types de fichiers. Documentation, fichiers d'exemples à " "installer, fichiers à déplacer et ainsi de suite. Lorsque cela se justifie, " "dans des cas comme ceux-ci, il est possible d'employer, dans ces fichiers, " "les jokers (wildcard) standard de l'interpréteur de commandes (shell) (B " "et B<*> et B<[>I<..>B<]>). Des commentaires peuvent être ajoutés dans ces " "fichiers : les lignes commençant par B<#> sont ignorées." #. type: textblock #: debhelper.pod:90 msgid "" "The syntax of these files is intentionally kept very simple to make them " "easy to read, understand, and modify. If you prefer power and complexity, " "you can make the file executable, and write a program that outputs whatever " "content is appropriate for a given situation. When you do so, the output is " "not further processed to expand wildcards or strip comments." msgstr "" "La syntaxe de ces fichiers est volontairement gardée très simple pour les " "rendre faciles à lire, comprendre et modifier. Si vous préférez la puissance " "et la complexité, vous pouvez rendre le fichier exécutable, et écrire un " "programme qui affiche n'importe quel contenu approprié à la situation. Dans " "ce cas, la sortie n'est plus traitée pour développer les jokers (wildcards) " "ou supprimer les commentaires." # type: =head1 #. type: =head1 #: debhelper.pod:96 msgid "SHARED DEBHELPER OPTIONS" msgstr "OPTIONS PARTAGÉES DE DEBHELPER" # type: textblock #. type: textblock #: debhelper.pod:98 msgid "" "The following command line options are supported by all debhelper programs." msgstr "Tous les programmes de debhelper acceptent les options suivantes." # type: =item #. type: =item #: debhelper.pod:102 msgid "B<-v>, B<--verbose>" msgstr "B<-v>, B<--verbose>" # type: textblock #. type: textblock #: debhelper.pod:104 msgid "" "Verbose mode: show all commands that modify the package build directory." msgstr "" "Mode verbeux : affiche toutes les commandes qui modifient le répertoire de " "construction du paquet." # type: =item #. type: =item #: debhelper.pod:106 dh:64 msgid "B<--no-act>" msgstr "B<--no-act>" # type: textblock #. type: textblock #: debhelper.pod:108 msgid "" "Do not really do anything. If used with -v, the result is that the command " "will output what it would have done." msgstr "" "Empêche la construction de s'effectuer réellement. Si cette option est " "utilisée avec -v, le résultat sera l'affichage de ce que la commande aurait " "fait." # type: =item #. type: =item #: debhelper.pod:111 msgid "B<-a>, B<--arch>" msgstr "B<-a>, B<--arch>" # type: textblock #. type: textblock #: debhelper.pod:113 msgid "" "Act on architecture dependent packages that should be built for the build " "architecture." msgstr "Construit tous les paquets dépendants de l'architecture." # type: =item #. type: =item #: debhelper.pod:116 msgid "B<-i>, B<--indep>" msgstr "B<-i>, B<--indep>" # type: textblock #. type: textblock #: debhelper.pod:118 msgid "Act on all architecture independent packages." msgstr "Construit tous les paquets indépendants de l'architecture." # type: =item #. type: =item #: debhelper.pod:120 msgid "B<-p>I, B<--package=>I" msgstr "B<-p>I, B<--package=>I" # type: textblock #. type: textblock #: debhelper.pod:122 msgid "" "Act on the package named I. This option may be specified multiple " "times to make debhelper operate on a given set of packages." msgstr "" "Construit le paquet nommé « paquet ». Cette option peut être répétée afin de " "faire agir debhelper sur plusieurs paquets." # type: =item #. type: =item #: debhelper.pod:125 msgid "B<-s>, B<--same-arch>" msgstr "B<-s>, B<--same-arch>" # type: textblock #. type: textblock #: debhelper.pod:127 msgid "" "This used to be a smarter version of the B<-a> flag, but the B<-a> flag is " "now equally smart." msgstr "" "Cette option était plus intelligente que l'option B<-a>, mais l'option B<-a> " "est maintenant tout aussi intelligente." # type: =item #. type: =item #: debhelper.pod:130 msgid "B<-N>I, B<--no-package=>I" msgstr "B<-N>I, B<--no-package=>I" # type: textblock #. type: textblock #: debhelper.pod:132 msgid "" "Do not act on the specified package even if an B<-a>, B<-i>, or B<-p> option " "lists the package as one that should be acted on." msgstr "" "Exclut le paquet indiqué du processus de construction, même si l'option B<-" "a>, B<-i> ou B<-p> l'impliquait." # type: =item #. type: =item #: debhelper.pod:135 msgid "B<--remaining-packages>" msgstr "B<--remaining-packages>" #. type: textblock #: debhelper.pod:137 msgid "" "Do not act on the packages which have already been acted on by this " "debhelper command earlier (i.e. if the command is present in the package " "debhelper log). For example, if you need to call the command with special " "options only for a couple of binary packages, pass this option to the last " "call of the command to process the rest of packages with default settings." msgstr "" "Exclut du processus de construction les paquets qui ont déjà été construits " "préalablement par cette commande debhelper (c'est-à-dire, si la commande est " "présente dans le journal de debhelper du paquet). Par exemple, si vous avez " "besoin d'invoquer la commande avec des options spéciales seulement pour " "certains paquets binaires, utilisez cette option lors de la dernière " "invocation de la commande pour construire le reste des paquets avec les " "options par défaut." # type: =item #. type: =item #: debhelper.pod:143 msgid "B<--ignore=>I" msgstr "B<--ignore=>I" # type: textblock #. type: textblock #: debhelper.pod:145 msgid "" "Ignore the specified file. This can be used if F contains a " "debhelper config file that a debhelper command should not act on. Note that " "F, F, and F can't be " "ignored, but then, there should never be a reason to ignore those files." msgstr "" "Ignore le fichier indiqué. Cela peut être utilisé si F contient un " "fichier de configuration debhelper avec une commande qui ne doit pas être " "pris en compte. Nota : F, F, et F ne peuvent pas être ignorés, mais il n'existe aucune raison " "valable de les ignorer." # type: textblock #. type: textblock #: debhelper.pod:150 msgid "" "For example, if upstream ships a F that you don't want " "B to install, use B<--ignore=debian/init>" msgstr "" "Par exemple, si vous récupérez en amont un fichier F que vous " "ne voulez pas que B installe, utilisez B<--ignore=debian/" "init>" # type: =item #. type: =item #: debhelper.pod:153 msgid "B<-P>I, B<--tmpdir=>I" msgstr "B<-P>I, B<--tmpdir=>I" # type: textblock #. type: textblock #: debhelper.pod:155 msgid "" "Use I for package build directory. The default is debian/I" msgstr "" "Utilise le répertoire I pour construire les paquets. Sinon, par " "défaut, le répertoire utilisé est « debian/I »" # type: =item #. type: =item #: debhelper.pod:157 msgid "B<--mainpackage=>I" msgstr "B<--mainpackage=>I" # type: textblock #. type: textblock #: debhelper.pod:159 msgid "" "This little-used option changes the package which debhelper considers the " "\"main package\", that is, the first one listed in F, and " "the one for which F files can be used instead of the usual " "F files." msgstr "" "Cette option, peu utilisée, indique à debhelper le nom du « paquet principal " "» pour lequel les fichiers F peuvent être utilisés à la place " "des fichiers habituels F. Par défaut, debhelper " "considère que le « paquet principal » est le premier paquet énuméré dans le " "fichier F." #. type: =item #: debhelper.pod:164 msgid "B<-O=>I