示例#1
0
 def testZipUnpack(self):
     spec = SpecFile('repos/pardus-2007/system/base/openssl/pspec.xml')
     targetDir = '/tmp/tests'
     archiv = sourcearchive.SourceArchive(spec, targetDir)
     archiv.fetch()
     archiv.unpack()
     assert not exists(targetDir + '/openssl')
示例#2
0
 def testUnpackTarCond(self):
     spec = SpecFile('repos/pardus-2007/system/base/curl/pspec.xml')
     targetDir = '/tmp'
     archiv = sourcearchive.SourceArchive(spec, targetDir)
     url = uri.URI(spec.source.archive.uri)
     filePath = join(pisi.context.config.archives_dir(), url.filename())
     if util.sha1_file(filePath) != spec.source.archive.sha1sum:
         fetch = fetcher.Fetcher(spec.source.archive.uri, targetDir)
         fetch.fetch()
     assert spec.source.archive.type == 'targz'
示例#3
0
    def testMakeZip(self):
        spec = SpecFile('repos/pardus-2007/system/base/openssl/pspec.xml')
        targetDir = '/tmp/tests'
        archiv = sourcearchive.SourceArchive(spec, targetDir)
        archiv.fetch(interactive = False)
        archiv.unpack(clean_dir = True)
        del archiv

        newDir = targetDir + '/newZip'
        zip = archive.ArchiveZip(newDir, 'zip', 'w')
        sourceDir = '/tmp/pisi-root'
        zip.add_to_archive(sourceDir)
        zip.close()
示例#4
0
    def testMakeZip(self):
        # first unpack our dear sandbox.zip
        spec = SpecFile("tests/pccts/pspec.xml")
        targetDir = '/tmp/pisitest'
        achv = sourcearchive.SourceArchive(spec, targetDir)
        achv.fetch(interactive=False)
        achv.unpack(clean_dir=True)
        del achv

        newZip = targetDir + "/new.zip"
        zip = archive.ArchiveZip(newZip, 'zip', 'w')
        sourceDir = targetDir + "/pccts"
        zip.add_to_archive(sourceDir)
        zip.close()
        self.assertEqual(os.path.exists(newZip), True)
        self.assertEqual(len(zip.list_archive()),326)
示例#5
0
    def testUnpackZipCond(self):
        spec = SpecFile("tests/pccts/pspec.xml")
        targetDir = '/tmp'
        achv = sourcearchive.SourceArchive(spec, targetDir)
        url = uri.URI(spec.source.archive.uri)
        filePath = join(ctx.config.archives_dir(), url.filename())

        # check cached
        if util.sha1_file(filePath) != spec.source.archive.sha1sum:
            fetch = fetcher.Fetcher(spec.source.archive.uri, targetDir)
            fetch.fetch()
        assert spec.source.archive.type == "zip"

        achv = archive.Archive(filePath, spec.source.archive.type)
        achv.unpack_files(["pccts/history.txt"], targetDir)
        assert pathexists(targetDir + "/pccts")
        testfile = targetDir + "/pccts/history.txt"
        assert pathexists(testfile)
示例#6
0
    def testUnpackZip(self):
        spec = SpecFile("tests/pccts/pspec.xml")
        targetDir = '/tmp/pisitest'

        assert spec.source.archive.type == "zip"

        achv = sourcearchive.SourceArchive(spec, targetDir)
        achv.fetch(interactive=False)
        achv.unpack(clean_dir=True)

        assert pathexists(targetDir + "/pccts")

        testfile = targetDir + "/pccts/history.txt"
        assert pathexists(testfile)
    
        # check file integrity
        self.assertEqual(util.sha1_file(testfile),
             "f2be0f9783e84e98fe4e2b8201a8f506fcc07a4d")
示例#7
0
    def testUnpackTar(self):
        spec = SpecFile("tests/popt/pspec.xml")
        targetDir = '/tmp/pisitest'
        achv = sourcearchive.SourceArchive(spec, targetDir)
    
        assert spec.source.archive.type == "targz"

        # skip fetching and directly unpack the previously fetched (by
        # fetchertests) archive
        if not achv.is_cached(interactive=False):
            achv.fetch(interactive=False)
        achv.unpack()
    
        # but testing is hard
        # "var/tmp/pisi/popt-1.7-3/work" (targetDir)
        assert pathexists(targetDir + "/popt-1.7")

        testfile = targetDir + "/popt-1.7/Makefile.am"
        assert pathexists(testfile)
    
        # check file integrity
        self.assertEqual(util.sha1_file(testfile),
             "5af9dd7d754f788cf511c57ce0af3d555fed009d")
示例#8
0
 def testTarUnpack(self):
     spec = SpecFile('repos/pardus-2007/system/base/curl/pspec.xml')
     targetDir = '/tmp/tests'
     archiv = sourcearchive.SourceArchive(spec, targetDir)
     archiv.unpack()
     assert spec.source.archive.type == 'targz'