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)
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.
bool
is_orig(self)
Returns: True if sources are suitable as upstream source, False otherwise
bool
is_dir(self)
Returns: True if if upstream sources are an unpacked directory, False otherwise
 
unpack(self, dir, filters=[])
Unpack packed upstream sources into a given directory and determine the toplevel of the source tree.
 
_unpack_archive(self, dir, filters)
Unpack packed upstream sources into a given directory.
 
_unpack_zip(self, dir)
 
_unpacked_toplevel(self, dir)
unpacked archives can contain a leading directory or not
 
_unpack_tar(self, dir, filters)
Unpack a tarball to dir applying a list of filters.
UpstreamSource
pack(self, newarchive, filters=[])
Recreate a new archive from the current one
tuple
guess_version(self, extra_regex='')
Guess the package name and version from the filename of an upstream archive.

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

Static Methods [hide private]
 
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]
  path

Inherited from object: __class__

Method Details [hide private]

__init__(self, name, unpacked=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.

is_orig(self)

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

is_dir(self)

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

_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.

pack(self, newarchive, filters=[])

 

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
Returns: UpstreamSource
the new upstream source

guess_version(self, extra_regex='')

 

Guess the package name and version from the filename of an upstream archive.

Parameters:
  • extra_regex (raw string
    >>> UpstreamSource('foo-bar_0.2.orig.tar.gz').guess_version()
    ('foo-bar', '0.2')
    >>> UpstreamSource('foo-Bar_0.2.orig.tar.gz').guess_version()
    >>> UpstreamSource('git-bar-0.2.tar.gz').guess_version()
    ('git-bar', '0.2')
    >>> UpstreamSource('git-bar-0.2-rc1.tar.gz').guess_version()
    ('git-bar', '0.2-rc1')
    >>> UpstreamSource('git-bar-0.2:~-rc1.tar.gz').guess_version()
    ('git-bar', '0.2:~-rc1')
    >>> UpstreamSource('git-Bar-0A2d:rc1.tar.bz2').guess_version()
    ('git-Bar', '0A2d:rc1')
    >>> UpstreamSource('git-1.tar.bz2').guess_version()
    ('git', '1')
    >>> UpstreamSource('kvm_87+dfsg.orig.tar.gz').guess_version()
    ('kvm', '87+dfsg')
    >>> UpstreamSource('foo-Bar_0.2.orig.tar.gz').guess_version()
    >>> UpstreamSource('foo-Bar-a.b.tar.gz').guess_version()
    >>> UpstreamSource('foo-bar_0.2.orig.tar.xz').guess_version()
    ('foo-bar', '0.2')
    >>> UpstreamSource('foo-bar_0.2.orig.tar.lzma').guess_version()
    ('foo-bar', '0.2')
    ) - extra regular expression to check
  • extra_regex (raw string
    >>> UpstreamSource('foo-bar_0.2.orig.tar.gz').guess_version()
    ('foo-bar', '0.2')
    >>> UpstreamSource('foo-Bar_0.2.orig.tar.gz').guess_version()
    >>> UpstreamSource('git-bar-0.2.tar.gz').guess_version()
    ('git-bar', '0.2')
    >>> UpstreamSource('git-bar-0.2-rc1.tar.gz').guess_version()
    ('git-bar', '0.2-rc1')
    >>> UpstreamSource('git-bar-0.2:~-rc1.tar.gz').guess_version()
    ('git-bar', '0.2:~-rc1')
    >>> UpstreamSource('git-Bar-0A2d:rc1.tar.bz2').guess_version()
    ('git-Bar', '0A2d:rc1')
    >>> UpstreamSource('git-1.tar.bz2').guess_version()
    ('git', '1')
    >>> UpstreamSource('kvm_87+dfsg.orig.tar.gz').guess_version()
    ('kvm', '87+dfsg')
    >>> UpstreamSource('foo-Bar_0.2.orig.tar.gz').guess_version()
    >>> UpstreamSource('foo-Bar-a.b.tar.gz').guess_version()
    >>> UpstreamSource('foo-bar_0.2.orig.tar.xz').guess_version()
    ('foo-bar', '0.2')
    >>> UpstreamSource('foo-bar_0.2.orig.tar.lzma').guess_version()
    ('foo-bar', '0.2')
    ) - additional regex to apply, needs a 'package' and a 'version' group
Returns: tuple
(package name, version) or None.

Property Details [hide private]

path

Get Method:
unreachable.path(self)