Example #1
0
    def testUnpackZipCond(self):
        bctx = BuildContext("tests/pccts/pspec.xml")
        url = uri.URI(bctx.spec.source.archiveUri)
        targetDir = bctx.pkg_work_dir()
        filePath = join(config.archives_dir(), url.filename())

        # check cached
        if util.sha1_file(filePath) != bctx.spec.source.archiveSHA1:
            fetch = fetcher.Fetcher(bctx.spec.source.archiveUri, targetDir)
            fetch.fetch()
        assert bctx.spec.source.archiveType == "zip"

        achv = archive.Archive(filePath, bctx.spec.source.archiveType)
        achv.unpack_files(["pccts/history.txt"], targetDir)
        assert pathexists(targetDir + "/pccts")
        testfile = targetDir + "/pccts/history.txt"
        assert pathexists(testfile)
Example #2
0
def isCached(file, sha1sum):
    return util.check_file_hash(os.path.join(config.archives_dir(), file), sha1sum)
Example #3
0
        # dont walk into the versioned stuff
        if ".svn" in dirs:
            dirs.remove(".svn")
    return packages

def isCached(file, sha1sum):
    return util.check_file_hash(os.path.join(config.archives_dir(), file), sha1sum)

if __name__ == "__main__":
    try:
        packages = scanPSPEC(sys.argv[1])
    except:
        print "Usage: fetchAll.py path2repo"
        sys.exit(1)
        
    for package in packages:
        spec = pisi.specfile.SpecFile()
        spec.read(os.path.join(package, "pspec.xml"))

        URI = pisi.uri.URI(spec.source.archiveUri)

        if not isCached(URI.filename(), spec.source.archiveSHA1):
            print URI, " -> " , os.path.join(config.archives_dir(), URI.filename())
            try:
	            fetch_url(URI, config.archives_dir())
            except pisi.fetcher.FetchError, e:
                print e
                pass
        else:
            print URI, "already downloaded..."