Example #1
0
def test_create_zip_archives():
    """Create an upstream zip archive"""
    git_archive_submodules(REPO, 'HEAD', 'with-submodules.zip', 'test', '', '',
                           '', 'zip')
    # Check that submodules were included
    contents = ls_zip('with-submodules.zip')
    ok_('test/test_submodule/testfile' in contents)

    git_archive_single('HEAD', 'without-submodules.zip', 'test', '', None, '',
                       'zip')
    contents = ls_zip('without-submodules.zip')
    ok_('test/test_submodule/testfile' not in contents)
def test_create_zip_archives():
    """Create an upstream zip archive"""
    REPO.archive_comp('HEAD', 'with-submodules.zip', 'test',
                      None, format='zip', submodules=True)
    # Check that submodules were included
    contents = ls_zip('with-submodules.zip')
    ok_('test/test_submodule/testfile' in contents)

    REPO.archive_comp('HEAD', 'without-submodules.zip', 'test',
                      None, format='zip', submodules=False)
    contents = ls_zip('without-submodules.zip')
    ok_('test/test_submodule/testfile' not in contents)
def test_create_zip_archives():
    """Create an upstream zip archive"""
    git_archive_submodules(REPO, 'HEAD', 'with-submodules.zip', 'test',
                           '', '', '', 'zip')
    # Check that submodules were included
    contents = ls_zip('with-submodules.zip')
    ok_('test/test_submodule/testfile' in contents)

    git_archive_single('HEAD', 'without-submodules.zip', 'test',
                       '', '', '', 'zip')
    contents = ls_zip('without-submodules.zip')
    ok_('test/test_submodule/testfile' not in contents)
Example #4
0
    def test_option_submodules_native(self):
        """Test the --git-submodules option for native packages"""
        repo = self.init_test_repo('gbp-test-native')

        # Create submodule
        sub_repo = self.orig_repos['gbp-test-native2']
        repo.add_submodule(sub_repo.path)
        repo.commit_all('Add submodule')

        sub_files = sub_repo.ls_tree('HEAD')
        master_files = [
            'gbp-test-native-1.0/' + path for path in repo.ls_tree('HEAD')
        ]

        # Test
        eq_(mock_gbp(['--git-submodules']), 0)
        zip_files = ls_zip('../rpmbuild/SOURCES/gbp-test-native-1.0.zip',
                           False)
        ref_files = master_files + [
            'gbp-test-native-1.0/gbp-test-native2.repo/' + path
            for path in sub_files
        ]
        self.check_files(ref_files, zip_files)

        # Test submodule failure
        shutil.rmtree('gbp-test-native2.repo')
        repo.create('gbp-test-native2.repo')
        eq_(mock_gbp(['--git-submodules', '--git-ignore-new']), 1)
    def test_option_submodules_native(self):
        """Test the --git-submodules option for native packages"""
        repo = self.init_test_repo('gbp-test-native')

        # Create submodule
        sub_repo = self.orig_repos['gbp-test-native2']
        repo.add_submodule(sub_repo.path)
        repo.commit_all('Add submodule')

        sub_files = sub_repo.ls_tree('HEAD')
        master_files = ['gbp-test-native-1.0/' + path for
                            path in repo.ls_tree('HEAD')]

        # Test
        eq_(mock_gbp(['--git-submodules']), 0)
        zip_files = ls_zip('../rpmbuild/SOURCES/gbp-test-native-1.0.zip', False)
        ref_files = master_files + \
                    ['gbp-test-native-1.0/gbp-test-native2.repo/' + path for
                                        path in sub_files]
        self.check_files(ref_files, zip_files)

        # Test submodule failure
        shutil.rmtree('gbp-test-native2.repo')
        repo.create('gbp-test-native2.repo')
        eq_(mock_gbp(['--git-submodules', '--git-ignore-new']), 1)
def test_create_zip_archives():
    """Create an upstream zip archive"""
    REPO.archive_comp('HEAD',
                      'with-submodules.zip',
                      'test',
                      None,
                      format='zip',
                      submodules=True)
    # Check that submodules were included
    contents = ls_zip('with-submodules.zip')
    ok_('test/test_submodule/testfile' in contents)

    REPO.archive_comp('HEAD',
                      'without-submodules.zip',
                      'test',
                      None,
                      format='zip',
                      submodules=False)
    contents = ls_zip('without-submodules.zip')
    ok_('test/test_submodule/testfile' not in contents)
 def test_zip(self):
     """Importing zip file"""
     orig = os.path.join(DATA_DIR, 'gbp-test-native-1.0.zip')
     eq_(self.mock_import(['--pristine-tar', orig]), 0)
     files = [
         '.gbp.conf', 'Makefile', 'README', 'dummy.sh',
         'packaging/gbp-test-native.spec'
     ]
     self.check_repo(None, None, [])
     self.check_tree('upstream', files)
     self.check_files(ls_zip(orig),
                      self.ls_pristine_tar('gbp-test-native-1.0.tar.gz'))