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')
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'
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()
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)
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)
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")
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")
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'