Package gbp :: Package pkg :: Class UpstreamSource
[hide private]
[frames] | no frames]

Class UpstreamSource

object --+
         |
        UpstreamSource
Known Subclasses:

Upstream source. Can be either an unpacked dir, a tarball or another type of archive

Instance Methods [hide private]
 
__init__(self, name, unpacked=None, pkg_policy=<class 'gbp.pkg.PkgPolicy'>, prefix=None)
x.__init__(...) initializes x; see help(type(x)) for signature
bool
_check_orig(self)
Check if upstream source format can be used as orig tarball.
 
_determine_prefix(self)
Determine the prefix, i.e.
 
_unpack_archive(self, dir, filters)
Unpack packed upstream sources into a given directory.
 
_unpack_tar(self, dir, filters)
Unpack a tarball to dir applying a list of filters.
 
_unpack_zip(self, dir)
 
guess_version(self, extra_regex='')
bool
is_dir(self)
Returns: True if if upstream sources are an unpacked directory, False otherwise
bool
is_orig(self)
Returns: True if sources are suitable as upstream source, False otherwise
bool
is_tarball(self)
Returns: True if source is a tarball, False otherwise
UpstreamSource
pack(self, newarchive, filters=[], newprefix=None)
Recreate a new archive from the current one
 
unpack(self, dir, filters=[])
Unpack packed upstream sources into a given directory and determine the toplevel of the source tree.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
 
_get_topdir_files(file_list)
Parse content of the top directory from a file list
 
known_compressions()
Class Variables [hide private]
boolean _orig
are the upstream sources already suitable as an upstream tarball
string _path
path to the upstream sources
string _unpacked
path to the unpacked source tree
Properties [hide private]
  archive_fmt
Archive format of the sources, e.g.
  compression
Compression format of the sources, e.g.
  path
  prefix
Prefix, i.e.

Inherited from object: __class__

Method Details [hide private]

__init__(self, name, unpacked=None, pkg_policy=<class 'gbp.pkg.PkgPolicy'>, prefix=None)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

_check_orig(self)

 

Check if upstream source format can be used as orig tarball. This doesn't imply that the tarball is correctly named.

Returns: bool
True if upstream source format is suitable as upstream tarball, False otherwise.

_determine_prefix(self)

 

Determine the prefix, i.e. the "leading directory name

_get_topdir_files(file_list)
Static Method

 

Parse content of the top directory from a file list

>>> UpstreamSource._get_topdir_files([])
set([])
>>> UpstreamSource._get_topdir_files([('-', 'foo/bar')])
set([('d', 'foo')])
>>> UpstreamSource._get_topdir_files([('d', 'foo/'), ('-', 'foo/bar')])
set([('d', 'foo')])
>>> UpstreamSource._get_topdir_files([('d', 'foo'), ('-', 'foo/bar')])
set([('d', 'foo')])
>>> UpstreamSource._get_topdir_files([('-', 'fob'), ('d', 'foo'), ('d', 'foo/bar'), ('-', 'foo/bar/baz')])
set([('-', 'fob'), ('d', 'foo')])
>>> UpstreamSource._get_topdir_files([('-', './foo/bar')])
set([('d', 'foo')])
>>> UpstreamSource._get_topdir_files([('-', 'foo/bar'), ('-', '.foo/bar')])
set([('d', '.foo'), ('d', 'foo')])

_unpack_archive(self, dir, filters)

 

Unpack packed upstream sources into a given directory. Return True if the output was filtered, otherwise False.

_unpack_tar(self, dir, filters)

 

Unpack a tarball to dir applying a list of filters. Leave the cleanup to the caller in case of an error.

is_dir(self)

 
Returns: bool
True if if upstream sources are an unpacked directory, False otherwise

is_orig(self)

 
Returns: bool
True if sources are suitable as upstream source, False otherwise

is_tarball(self)

 
Returns: bool
True if source is a tarball, False otherwise

pack(self, newarchive, filters=[], newprefix=None)

 

Recreate a new archive from the current one

Parameters:
  • newarchive (string) - the name of the new archive
  • filters (array of strings) - tar filters to apply
  • newprefix (string or None) - new prefix, None implies that prefix is not mangled
Returns: UpstreamSource
the new upstream source

Property Details [hide private]

archive_fmt

Archive format of the sources, e.g. 'tar'

Get Method:
unreachable.archive_fmt(self) - Archive format of the sources, e.g.

compression

Compression format of the sources, e.g. 'gzip'

Get Method:
unreachable.compression(self) - Compression format of the sources, e.g.

path

Get Method:
unreachable.path(self)

prefix

Prefix, i.e. the 'leading directory name' of the sources

Get Method:
unreachable.prefix(self) - Prefix, i.e.