Beispiel #1
0
    def test_filter_unpacked_dir(self, repo):
        """
        Test that importing and filtering unpacked upstream source works.
        """
        f = 'hello-debhelper_2.8.orig.tar.gz'
        src = os.path.join(DEB_TEST_DATA_DIR, 'dsc-3.0', f)

        # Create an unpacked tarball we can import
        UnpackTarArchive(src, '..')()
        ok_(os.path.exists('../hello-2.8'))

        ok_(
            import_orig([
                'arg0', '--no-interactive', '--pristine-tar',
                '--filter-pristine-tar', '--filter=README*', '../hello-2.8'
            ]) == 0)
        self._check_repo_state(
            repo,
            'master', ['master', 'upstream', 'pristine-tar'],
            tags=['debian/2.6-2', 'upstream/2.6', 'upstream/2.8'])

        filtered = os.path.join('..', f)
        ok_(os.path.exists(filtered))
        # Check if tar got filtered properly
        t = tarfile.open(name=filtered, mode="r:gz")
        for f in ['hello-2.8/configure']:
            i = t.getmember(f)
            eq_(type(i), tarfile.TarInfo)
        for f in ['hello-2.8/README']:
            with assert_raises(KeyError):
                t.getmember(f)
        t.close()
Beispiel #2
0
 def import_debian_tarball(cls, debian=DEFAULT_OVERLAY, opts=None):
     """Import a 3.0 (quilt) debian dir for overlay mode"""
     repo = GitRepository.create(os.path.split('/')[-1].split('_')[0])
     UnpackTarArchive(debian, repo.path)()
     repo.add_files('.')
     repo.commit_files('.', msg="debian dir")
     expected_branches = ['master']
     ComponentTestBase._check_repo_state(repo, 'master', expected_branches)
     eq_(len(repo.get_commits()), 1)
     os.chdir(repo.path)
     return repo