module documentation

Test pristine-tar related methods in

and

This testcase creates this reposity:

  • A repository at dirs['repo'] called repo
Function setup_module Undocumented
Function teardown_module Undocumented
Function test_commit_dir Empty repos have no branch pristine-tar branch
Function test_create Create a repository
Function test_create_tarball Create a tarball from a git tree and add a stub signature
Function test_empty_repo Empty repos have no branch pristine-tar branch
Function test_pristine_has_commit Find delta on the pristine tar branch
Function test_pristine_tar_checkout Checkout a tarball using pristine-tar
Function test_pristine_tar_checkout_nonexistent Checkout a tarball that does not exist using pristine-tar
Function test_pristine_tar_checkout_with_sig Checkout a tarball using pristine-tar
Function test_pristine_tar_commit Commit the delta to the pristine-tar branch
Function test_pristine_tar_commit_with_sig Commit the delta to the pristine-tar branch including a signature
Function test_pristine_tar_verify Verify a tarball using pristine-tar
Variable dirs Undocumented
Variable test_data Undocumented
def setup_module():

Undocumented

def teardown_module():

Undocumented

def test_commit_dir():

Empty repos have no branch pristine-tar branch

Methods tested:

>>> import gbp.deb.git
>>> repo = gbp.deb.git.DebianGitRepository(dirs['repo'])
>>> commit = repo.commit_dir(test_data, msg="initial commit", branch=None)
>>> repo.create_branch('upstream')
def test_create():

Create a repository

Methods tested:

  • gbp.deb.git.DebianGitRepository.create
>>> import os, gbp.deb.git
>>> repo = gbp.deb.git.DebianGitRepository.create(dirs['repo'])
def test_create_tarball():

Create a tarball from a git tree and add a stub signature

Methods tested:

  • gbp.deb.git.DebianGitRepository.archive
>>> import gbp.deb.git
>>> repo = gbp.deb.git.DebianGitRepository(dirs['repo'])
>>> repo.archive('tar', 'upstream/', '../upstream_1.0.orig.tar', 'upstream')
>>> gbp.command_wrappers.Command('gzip', [ '-n', '%s/../upstream_1.0.orig.tar' % dirs['repo']])()
>>> with open('%s/../upstream_1.0.orig.tar.gz.asc' % dirs['repo'], 'w') as f: f.write("sig")
3
def test_empty_repo():

Empty repos have no branch pristine-tar branch

Methods tested:

>>> import gbp.deb.git
>>> repo = gbp.deb.git.DebianGitRepository(dirs['repo'])
>>> repo.has_pristine_tar_branch()
False
>>> repo.pristine_tar.has_commit('upstream', '1.0', 'gzip')
False
def test_pristine_has_commit():

Find delta on the pristine tar branch

Methods tested:

>>> import gbp.deb.git
>>> repo = gbp.deb.git.DebianGitRepository(dirs['repo'])
>>> repo.pristine_tar.has_commit('upstream', '1.0', 'bzip2')
False
>>> repo.pristine_tar.has_commit('upstream', '1.0', 'gzip')
True
>>> repo.pristine_tar.has_commit('upstream', '1.0')
True
>>> branch = repo.rev_parse('pristine-tar')
>>> commit, sig = repo.pristine_tar.get_commit('upstream_1.0.orig.tar.gz')
>>> branch == commit
True
>>> sig
True
>>> repo.pristine_tar.commit('../upstream_1.0.orig.tar.gz', 'upstream')
>>> branch = repo.rev_parse('pristine-tar')
>>> commit, sig = repo.pristine_tar.get_commit('upstream_1.0.orig.tar.gz')
>>> branch == commit
True
>>> sig
False
def test_pristine_tar_checkout():

Checkout a tarball using pristine-tar

Methods tested:

>>> import gbp.deb.git
>>> repo = gbp.deb.git.DebianGitRepository(dirs['repo'])
>>> repo.pristine_tar.checkout('upstream', '1.0', 'gzip', '..')
def test_pristine_tar_checkout_nonexistent():

Checkout a tarball that does not exist using pristine-tar

Methods tested:

# Silence error output >>> import gbp.deb.git >>> repo = gbp.deb.git.DebianGitRepository(dirs['repo']) >>> _gbp_log_err_bak = gbp.log.err >>> gbp.log.err = lambda x: None >>> repo.pristine_tar.checkout('upstream', '1.1', 'gzip', '..') # doctest:+IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... gbp.command_wrappers.CommandExecFailed: Pristine-tar couldn't checkout "upstream_1.1.orig.tar.gz": fatal: Path 'upstream_1.1.orig.tar.gz.delta' does not exist in 'refs/heads/pristine-tar' pristine-tar: git show refs/heads/pristine-tar:upstream_1.1.orig.tar.gz.delta failed >>> gbp.log.err = _gbp_log_err_bak

def test_pristine_tar_checkout_with_sig():

Checkout a tarball using pristine-tar

Methods tested:

>>> import gbp.deb.git
>>> from gbp.deb.policy import DebianPkgPolicy
>>> repo = gbp.deb.git.DebianGitRepository(dirs['repo'])
>>> sf = os.path.join(repo.path,
...                   DebianPkgPolicy.build_signature_name('upstream', '1.0', 'gzip', '..'))
>>> os.unlink(sf)
>>> repo.pristine_tar.checkout('upstream', '1.0', 'gzip', '..',
...                             signature=True)
>>> os.path.exists(sf) or not repo.pristine_tar.has_feature_sig()
True
def test_pristine_tar_commit():

Commit the delta to the pristine-tar branch

Methods tested:

>>> import gbp.deb.git
>>> repo = gbp.deb.git.DebianGitRepository(dirs['repo'])
>>> repo.pristine_tar.commit('../upstream_1.0.orig.tar.gz', 'upstream')
def test_pristine_tar_commit_with_sig():

Commit the delta to the pristine-tar branch including a signature

Methods tested:

>>> import gbp.deb.git
>>> repo = gbp.deb.git.DebianGitRepository(dirs['repo'])
>>> repo.pristine_tar.commit('../upstream_1.0.orig.tar.gz', 'upstream',
...                          signaturefile='../upstream_1.0.orig.tar.gz.asc')
def test_pristine_tar_verify():

Verify a tarball using pristine-tar

Methods tested:

>>> import gbp.deb.git
>>> repo = gbp.deb.git.DebianGitRepository(dirs['repo'])
>>> if repo.pristine_tar.has_feature_verify():
...    repo.pristine_tar.verify('../upstream_1.0.orig.tar.gz')
dirs: dict =

Undocumented

test_data =

Undocumented