Package gbp :: Package deb
[hide private]
[frames] | no frames]

Package deb

provides some debian source package related helpers

Submodules [hide private]

Classes [hide private]
  DpkgCompareVersions
  UpstreamSource
Upstream source.
  DscFile
Keeps all needed data read from a dscfile
Functions [hide private]
 
parse_dsc(dscfile)
parse dsc by creating a DscFile object
 
parse_changelog_repo(repo, branch, filename)
Parse the changelog file from given branch in the git repository.
 
orig_file(cp, compression)
The name of the orig file belonging to changelog cp
 
is_valid_packagename(name)
Is this a valid Debian package name?
 
is_valid_upstreamversion(version)
Is this a valid upstream version number?
 
get_compression(orig_file)
Given an orig file return the compression used
 
has_orig(orig_file, dir)
Check if orig tarball exists in dir
 
symlink_orig(orig_file, orig_dir, output_dir, force=False)
symlink orig tarball from orig_dir to output_dir
tuple
parse_uscan(out)
Parse the uscan output return (True, tarball) if a new version was downloaded and could be located.
 
do_uscan()
invoke uscan to fetch a new upstream version
 
get_arch()
 
compare_versions(version1, version2)
compares to Debian versionnumbers suitable for sort()
Variables [hide private]
  debian_version_chars = 'a-zA-Z\\d.~+-'
  packagename_re = re.compile(r'^[a-zA-Z0-9][a-zA-Z0-9\.\+-~]+$')
  packagename_msg = 'Package names must be at least two characte...
  upstreamversion_re = re.compile(r'^[0-9][a-z0-9\.\+-:~]*$')
  upstreamversion_msg = 'Upstream version numbers must start wit...
  compressor_opts = {'bzip2': ['', 'bz2'], 'gzip': ['-n', 'gz'],...
  compressor_aliases = {'bz2': 'bzip2', 'gz': 'gzip'}
  __package__ = 'gbp.deb'
Function Details [hide private]

orig_file(cp, compression)

 

The name of the orig file belonging to changelog cp

>>> orig_file({'Source': 'foo', 'Upstream-Version': '1.0'}, "bzip2")
'foo_1.0.orig.tar.bz2'
>>> orig_file({'Source': 'bar', 'Upstream-Version': '0.0~git1234'}, "xz")
'bar_0.0~git1234.orig.tar.xz'

get_compression(orig_file)

 

Given an orig file return the compression used

>>> get_compression("abc.tar.gz")
'gzip'
>>> get_compression("abc.tar.bz2")
'bzip2'
>>> get_compression("abc.tar.foo")
>>> get_compression("abc")

symlink_orig(orig_file, orig_dir, output_dir, force=False)

 

symlink orig tarball from orig_dir to output_dir

Returns:
True if link was created or src == dst False in case of error or src doesn't exist

parse_uscan(out)

 

Parse the uscan output return (True, tarball) if a new version was downloaded and could be located. If the tarball can't be located it returns (True, None). Returns (False, None) if the current version is up to date.

>>> parse_uscan("<status>up to date</status>")
(False, None)
>>> parse_uscan("<target>virt-viewer_0.4.0.orig.tar.gz</target>")
(True, '../virt-viewer_0.4.0.orig.tar.gz')
Parameters:
  • out (string) - uscan output
Returns: tuple
status and tarball name

Variables Details [hide private]

packagename_msg

Value:
'''Package names must be at least two characters long, start with an
alphanumeric and can only containg letters (a-z,A-Z), digits
(0-9), plus signs (+), minus signs (-), periods (.) and hyphens (~)'''

upstreamversion_msg

Value:
'''Upstream version numbers must start with a digit and can only conta\
ing lower case
letters (a-z), digits (0-9), full stops (.), plus signs (+), minus sig\
ns
(-), colons (:) and tildes (~)'''

compressor_opts

Value:
{'bzip2': ['', 'bz2'],
 'gzip': ['-n', 'gz'],
 'lzma': ['', 'lzma'],
 'xz': ['', 'xz']}