Manpages

Manpage of DEBUILD

DEBUILD

Section: User Commands (1)
Updated: Debian Utilities
Index
Return to Main Contents
 

NAME

debuild - build a Debian package  

SYNOPSIS

debuild [debuild-options] [dpkg-buildpackage-options] [--lintian|-L lintian-options]
debuild [debuild-options] binary|binary-arch|binary-indep|clean ...  

DESCRIPTION

debuild creates all the files necessary for uploading a Debian package. It first runs dpkg-buildpackage and then runs lintian on the .changes file created (assuming that lintian is installed). Parameters can be passed to both dpkg-buildpackage and lintian, where the parameters are separated by the -L or --lintian option. The allowable options in this case are --no-lintian to skip the lintian step and the --preserve-envvar/-e or --preserve-env/-E options described below in the Environment Variables section. One can also use --lintian to force lintian to be run independent of any configuration file settings.

An alternative way of using debuild is to use one or more of the parameters binary, binary-arch, binary-indep and clean, in which case debuild will attempt to gain root privileges and then run debian/rules with the given parameters. A -rootcmd=gain-root-command or -rgain-root-command option may be used to specify a method of gaining root privileges. The gain-root-command is likely to be one of fakeroot, sudo or super. See below for further discussion of this point. Again, the environment preservation options may be used.

debuild reads the devscripts configuration files as described below. This allows default options to be given.

debuild has to be invoked from within the source code package directory tree.  

ENVIRONMENT VARIABLES

As environment variables can affect the building of a package, often unintentionally, debuild sanitises the environment by removing all environment variables except for TERM, HOME, LOGNAME, GNUPGHOME, PGPPASS, PGPPATH, FAKEROOTKEY, DEB_* and the locale variables LANG and LC_*. TERM is set to `dumb' if it is unset, and PATH is set to "/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11".

If a particular environment variable is required to be passed through untouched to the build process, this may be specified by using a --preserve-envvar envvar (which can also be written as -e envvar option). The environment may be left untouched by using the --preserve-env or -E option. However, even in this case, the PATH will be set to the sane value described above. The only way to prevent PATH from being reset is to specify a --preserve-envvar PATH option. But you are warned that using programs from non-standard locations can easily result in the package being broken, as it will not be able to be built on standard systems.

It is also possible to avoid having to type something like FOO=bar debuild -e FOO by writing debuild -e FOO=bar or the long form debuild --set-envvar FOO=bar.  

SUPERUSER REQUIREMENTS

debuild needs to be run as superuser to function properly. There are three fundamentally different ways to do this. The first, and preferable, method is to use some root-gaining command. The best one to use is probably fakeroot(1), since it does not involve granting any genuine privileges. super(1) and sudo(1) are also possibilities. If no -r (or --rootcmd) option is given (and recall that dpkg-buildpackage also accepts a -r option) and neither of the following methods is used, then -rfakeroot will silently be assumed.

The second method is to use some command such as su(1) to become root, and then to do everything as root. Note, though, that lintian will abort if it is run as root or setuid root; this can be overcome using the --allow-root option of lintian if you know what you are doing.

The third possible method is to have debuild installed as setuid root. This is not the default method, and will have to be installed as such by the system administrator. It must also be realised that anyone who can run debuild as root or setuid root has full access to the whole machine. This method is therefore not recommended, but will work. debuild could be installed with mode 4754, so that only members of the owning group could run it. A disadvantage of this method would be that other users would then not be able to use the program. There are many other variants of this option involving multiple copies of debuild, or the use of programs such as sudo or super to grant root privileges to users selectively. If the sysadmin wishes to do this, she should use the dpkg-statoverride program to change the permissions of /usr/bin/debuild. This will ensure that these permissions are preserved across upgrades.  

OPTIONS

For details, see above.
--no-conf, --noconf
Do not read the devscripts configuration files. This must be given as the first option.
--rootcmd=gain-root-command, -rgain-root-command
Command to gain root (or fake root) privileges.
--preserve-env, -E
Do not clean the environment, except for PATH.
--preserve-envvar=var, -evar
Do not clean the var variable from the environment.
--set-envvar=var=value, -evar=value
Set the environment variable var to value and do not remove it from the environment.
--no-lintian
Do not run lintian after dpkg-buildpackage.
--lintian
Do run lintian after dpkg-buildpackage (overriding any configuration file directive).
 

CONFIGURATION VARIABLES

The two configuration files /etc/devscripts.conf and ~/.devscripts are sourced by a shell in that order to set configuration variables. Command line options can be used to override some of these configuration file settings, otherwise the --no-conf option can be used to prevent reading these files. Environment variable settings are ignored when these configuration files are read. The currently recognised variables are:
DEBUILD_PRESERVE_ENV
If this is set to yes, then it is the same as the --preserve-env or -E command line parameter being used.
DEBUILD_PRESERVE_ENVVARS
Which environment variables to preserve. This should be a comma-separated list of variables. This corresponds to using possibly multiple --preserve-envvar or -e options.
DEBUILD_SET_ENVVAR_var=value
This corresponds to --set-envvar=var=value.
DEBUILD_LINTIAN
Should we run lintian? If this is set to no, then lintian will not be run.
DEBUILD_ROOTCMD
Setting this variable to prog is the equivalent of -rprog.
DEBUILD_DPKG_BUILDPACKAGE_OPTS
These are options which should be passed to the invocation of dpkg-buildpackage. They are given before any command-line options. Due to issues of shell quoting, if a word containing spaces is required as a single option, extra quotes will be required. For example, the config file might contain the line:
DEBUILD_DPKG_BUILDPACKAGE_OPTS="-k'Julian Gilbey <jdg@debian.org>' -sa"
which gives precisely two options. Without the extra single quotes, dpkg-buildpackage would reasonably complain that Gilbey is an unrecognised option (it doesn't start with a `-' sign).
DEBUILD_LINTIAN_OPTS
These are options which should be passed to the invocation of lintian. They are given before any command-line options, and the usage of this variable is as described for the DEBUILD_DPKG_BUILDPACKAGE_OPTS variable.
 

SEE ALSO

dpkg-buildpackage(1), fakeroot(1), lintian(1), chmod(1), dpkg-statoverride(8), su(1), sudo(1) and super(1).  

AUTHOR

The original debuild program was written by Christoph Lameter <clameter@debian.org>. The current version has been written by Julian Gilbey <jdg@debian.org>.


 

Index

NAME
SYNOPSIS
DESCRIPTION
ENVIRONMENT VARIABLES
SUPERUSER REQUIREMENTS
OPTIONS
CONFIGURATION VARIABLES
SEE ALSO
AUTHOR

This document was created by man2html, using the manual pages.
Time: 05:54:17 GMT, August 09, 2020