DEBUILDSection: User Commands (1)
Updated: Debian Utilities
Return to Main Contents
NAMEdebuild - build a Debian package
SYNOPSISdebuild [debuild-options] [dpkg-buildpackage-options] [--lintian|-L lintian-options]
debuild [debuild-options] binary|binary-arch|binary-indep|clean ...
DESCRIPTIONdebuild 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.
ENVIRONMENT VARIABLESAs 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.
SUPERUSER REQUIREMENTSdebuild 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.
OPTIONSFor details, see above.
CONFIGURATION VARIABLESThe 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:
SEE ALSOdpkg-buildpackage(1), fakeroot(1), lintian(1), chmod(1), dpkg-statoverride(8), su(1), sudo(1) and super(1).
AUTHORThe original debuild program was written by Christoph Lameter <email@example.com>. The current version has been written by Julian Gilbey <firstname.lastname@example.org>.
This document was created by man2html, using the manual pages.
Time: 05:54:17 GMT, August 09, 2020