Package gbp :: Package scripts :: Module import_orig

[hide private]
[frames] | no frames]

# Module import_orig

Import a new upstream version into a Git repository

Functions | [hide private]

`str`

prepare_pristine_tar(archive, pkg, version) Prepare the upstream source for pristine tar import. |

upstream_import_commit_msg(options, version) |

detect_name_and_version(repo, source, options) |

string

find_source(use_uscan, args) Find the tarball to import - either via uscan or via command line argument |

debian_branch_merge(repo, tag, version, options) |

debian_branch_merge_by_replace(repo, tag, version, options) |

debian_branch_merge_by_merge(repo, tag, version, options) |

set_bare_repo_options(options) Modify options for import into a bare repository |

build_parser(name) |

parse_args(argv) Parse the command line arguments |

main(argv) |

Variables | [hide private]

| __package__ = ``'``gbp.scripts``'``

Function Details | [hide private]

### prepare_pristine_tar(archive, pkg, version)

Prepare the upstream source for pristine tar import.

This checks if the upstream source is actually a tarball and creates a symlink from archive to <pkg>_<version>.orig.tar.<ext> so pristine-tar will see the correct basename.

Parameters:
  - `archive` (`str`) - the upstream source's name
  - `pkg` (`str`) - the source package's name
  - `version` (`str`) - the upstream version number
Returns: `str`

### find_source(use_uscan, args)

Find the tarball to import - either via uscan or via command line argument

Returns: string
  upstream source filename or None if nothing to import
Raises:
  - `GbpError` - raised on all detected errors

        >>> find_source(False, ['too', 'much'])
        Traceback (most recent call last):
        ...
        GbpError: More than one archive specified. Try --help.
        >>> find_source(False, [])
        Traceback (most recent call last):
        ...
        GbpError: No archive to import specified. Try --help.
        >>> find_source(True, ['tarball'])
        Traceback (most recent call last):
        ...
        GbpError: you can't pass both --uscan and a filename.
        >>> find_source(False, ['tarball']).path
        'tarball'

### parse_args(argv)

Parse the command line arguments

Returns:
  options and arguments

  # Silence error output >>> _gbp_log_error_bak = gbp.log.error >>> gbp.log.error = lambda x: None >>> parse_args(['arg0', '--download', '--uscan']) (None, None) >>> parse_args(['arg0', '--download', 'first', 'second']) (None, None) >>> gbp.log.error = _gbp_log_error_bak