Esempio n. 1
0
  def test_create_git_tgz(self):
    content = [ 
      'file a/b/c/foo.txt "foo content" 755',
      'file d/e/bar.txt "bar content" 644',
      'dir  baz     ""            700',
    ]
    r = git_temp_repo(content = content, prefix = 'test_archive_', debug = self.DEBUG)
    commit = r.last_commit_hash(short_hash = True)
    
    tmp_archive = self.make_temp_file(suffix = '.tgz')

    prefix = 'foo-{}'.format(commit)
    
    args = [
      'archive',
      'create_git',
      '--root-dir', r.root,
      '--format', 'tgz',
      prefix,
      commit,
      tmp_archive,
    ]
    rv = self.run_program(self._program, args)
    self.assertEqual( 0, rv.exit_code )
    self.assertEqual( 'tgz', archiver.format_name(tmp_archive) )
    expected = [
      '{}/a/b/c/foo.txt'.format(prefix),
      '{}/d/e/bar.txt'.format(prefix),
    ]
    actual = archiver.members(tmp_archive)
    self.assert_filename_list_equal( expected, actual )
Esempio n. 2
0
 def test_filenames_with_brackets_tar(self):
   tmp_dir = temp_content.write_items_to_temp_dir([
       'file .foo/bar-[baz].ext-kiwi.apple.lemon "something" 644',
   ], delete = not self.DEBUG)
   tmp_archive = self.make_temp_file()
   archiver.create(tmp_archive, tmp_dir, extension = 'tar.gz')
   self.assertEqual( [
     '.foo/bar-[baz].ext-kiwi.apple.lemon',
   ], archiver.members(tmp_archive) )
   self.assertEqual( 'tgz', archiver.format_name(tmp_archive) )
   self.assertEqual( '3fc9b689459d738f8c88a3a48aa9e33542016b7a4052e001aaa536fca74813cb',
                     archiver.member_checksum(tmp_archive, '.foo/bar-[baz].ext-kiwi.apple.lemon') )
Esempio n. 3
0
 def test_create_force_tar_gz(self):
   tmp_dir = temp_content.write_items_to_temp_dir([
       'file a/b/c/foo.txt "foo content" 755',
       'file d/e/bar.txt "bar content" 644',
       'dir  baz     ""            700',
   ])
   tmp_archive = self.make_temp_file()
   archiver.create(tmp_archive, tmp_dir, extension = 'tar.gz')
   self.assertEqual( [
     'a/b/c/foo.txt',
     'd/e/bar.txt',
   ], archiver.members(tmp_archive) )
   self.assertEqual( 'tgz', archiver.format_name(tmp_archive) )
Esempio n. 4
0
 def test_create_zip(self):
   tmp_dir = temp_content.write_items_to_temp_dir([
       'file a/b/c/foo.txt "foo content" 755',
       'file d/e/bar.txt "bar content" 644',
       'dir  baz     ""            700',
   ])
   tmp_archive = self.make_temp_file(suffix = '.zip')
   archiver.create(tmp_archive, tmp_dir)
   self.assertEqual( [
     'a/b/c/foo.txt',
     'd/e/bar.txt',
   ], archiver.members(tmp_archive) )
   self.assertEqual( 'zip', archiver.format_name(tmp_archive) )