Package gbp :: Package pkg :: Class PkgPolicy

[hide private]
[frames] | no frames]

# Class PkgPolicy

    object --+
             |
            PkgPolicy

Known Subclasses:
  - deb.policy.DebianPkgPolicy

Common helpers for packaging policy.

Instance Methods | [hide private]

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

Class Methods | [hide private]

is_valid_packagename(cls, name) Is this a valid package name? |

is_valid_upstreamversion(cls, version) Is this a valid upstream version number? |

Static Methods | [hide private]

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 |

Class Variables | [hide private]

| packagename_msg = `None` hash(x)
| packagename_re = `None` hash(x)
| upstreamversion_msg = `None` hash(x)
| upstreamversion_re = `None` hash(x)

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### get_compression(orig_file)
Static Method

Given an orig file return the compression used

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

### is_valid_packagename(cls, name)
Class Method

Is this a valid package name?

    >>> PkgPolicy.is_valid_packagename('doesnotmatter')
    Traceback (most recent call last):
    ...
    NotImplementedError: Class needs to provide packagename_re

### is_valid_upstreamversion(cls, version)
Class Method

Is this a valid upstream version number?

    >>> PkgPolicy.is_valid_upstreamversion('doesnotmatter')
    Traceback (most recent call last):
    ...
    NotImplementedError: Class needs to provide upstreamversion_re

### symlink_orig(orig_file, orig_dir, output_dir, force=False)
Static Method

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