# `gbp.scripts.buildpackage` module documentation

Part of `gbp.scripts`

Build a Debian package out of a Git repository

Function | maybe_write_tree | Write a tree of the index or working copy if necessary
Function | export_source | Export a version of the source tree when building in a separate directory
Function | move_old_export | move a build tree away if it exists
Function | overlay_extract_origs | Overlay extract orig tarballs to export dir before exporting debian dir from git
Function | source_vfs | Init source package info either from git or from working copy
Function | prepare_output_dir | Prepare the directory where the build result will be put
Function | clean_working_tree | Clean the working tree.
Function | check_tag | Perform specified consistency checks on git history
Function | get_pbuilder_dist | Determin the dist to build for with pbuilder/cowbuilder
Function | setup_pbuilder | Setup environment variables for git-pbuilder
Function | mangle_export_wc_opts | Make building with --export=WC simpler
Function | disable_hooks | Disable all hooks (except for builder)
Function | changes_file_suffix | No summary
Function | changes_file_name | Undocumented
Function | check_branch | Check if we're on the right branch and bail out otherwise
Function | build_parser | Undocumented
Function | parse_args | Undocumented
Function | main | Undocumented

def maybe_write_tree(repo, options):

Write a tree of the index or working copy if necessary

Parameters | repo | the git repository we're acting on (type: `GitRepository`)
Returns | the sha1 of the tree (type: `str`)

def export_source(repo, tree, source, options, dest_dir, tarball_dir):

Export a version of the source tree when building in a separate directory

Parameters | repo | the git repository to export from (type: `gbp.git.GitRepository`)
| source | the source package
| options | options to apply
| dest_dir | where to export the source to
| tarball_dir | where to fetch the tarball from in overlay mode
Returns | the temporary directory

def move_old_export(target):

move a build tree away if it exists

def overlay_extract_origs(source, tarball_dir, dest_dir, options):

Overlay extract orig tarballs to export dir before exporting debian dir from git

def source_vfs(repo, options, tree):

Init source package info either from git or from working copy

def prepare_output_dir(dir):

Prepare the directory where the build result will be put

def clean_working_tree(options, repo):

Clean the working tree.

:param options: Program run-time options, as an `optparse.OptionContainer`. :param repo: The Git repository, as a `DebianGitRepository`. :raise GbpError: When the working tree has uncommitted changes. :return: None.

def check_tag(options, repo, source):

Perform specified consistency checks on git history

def get_pbuilder_dist(options, repo, native=(False)):

Determin the dist to build for with pbuilder/cowbuilder

def setup_pbuilder(options, repo, native):

Setup environment variables for git-pbuilder

We return two dictionaries (pbd_env, hook_env) that can be passed as environment when running commands

*pbd_env* is used for the actual build command while *hook_env* is passed to all hooks. They both contain the same information but *pbd_env* contains the depreated variable names not starting with *GBP_*.

def mangle_export_wc_opts(options):

Make building with --export=WC simpler

def disable_hooks(options):

Disable all hooks (except for builder)

def changes_file_suffix(builder, dpkg_args, arch):

    >>> changes_file_suffix('debuild', ['-A'], '')
    'all'
    >>> changes_file_suffix('debuild', ['-S'], '')
    'source'
    >>> changes_file_suffix('debuild -A', ['-uc', '-us'], '')
    'all'
    >>> changes_file_suffix('debuild -S', ['-uc', '-us'], '')
    'source'
    >>> changes_file_suffix('debuild', [], '') == du.get_arch()
    True
    >>> changes_file_suffix('debuild', [], 'arm64')
    'arm64'

def changes_file_name(source, build_dir, builder, dpkg_args, arch):
Undocumented
def check_branch(repo, options):

Check if we're on the right branch and bail out otherwise

returns: the current branch or `None` if in detached head mode

def build_parser(name, prefix=None):
Undocumented
def parse_args(argv, prefix):
Undocumented
def main(argv):
Undocumented