The possible states that a package can be in are:
Only the configuration files for the package are present on the system.
The package is unpacked and configuration was started but not completed.
Installation was started but not completed.
The package is unpacked and configured.
The package is not installed.
The package is unpacked but not configured.
The possible package selection states are:
The package has been selected for deinstallation (i.e., for removal of everything but configuration files).
The package has been selected for installation.
The package has been selected to be purged (i.e., for removal of everything including the configuration files).
There are two possible package flags that can be set for a package. They are:
The package is not to be handled by dpkg, unless forced with the --force-hold option.
The package is broken and needs to be reinstalled. Such a package cannot be removed, unless forced with the --force-reinstreq option.
In addition to the commands described in the next subsection, several shell and Perl scripts are included with the package manager for use in building packages:
Help automate package building. Shell script.
Add an entry for a file to debian/files. Perl script.
Generate an upload control file from the information in an unpacked, built, source tree and the files it has generated. Perl script.
Read information from an unpacked source tree and display a binary package control file on standard output. Perl script.
Rename Debian packages to their full package names. Shell script.
Read and parse the changelog from an unpacked source tree and write the information to standard output in machine-readable form. Perl script.
Create a Packages file from a tree of binary packages. The Packages file is used by dselect to provide a list of packages available for installation. Perl script.
Calculate shared library dependencies for named executables. Perl script.
Pack and unpack Debian source archives. Perl script.