CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/PKGTOOLS/tests/test_DownloadDBS.py

Go to the documentation of this file.
00001 from os.path import join, abspath, exists, dirname
00002 from os import makedirs
00003 from shutil import rmtree
00004 import sys
00005 import md5
00006 from cmsBuild import DownloadOptions, initDownloadHandlers
00007 from cmsBuild import parseCvsUrl, downloadCvs
00008 
00009 downloadDir = join (dirname (abspath (__file__)), "testtmp")
00010 if exists (downloadDir):
00011     rmtree (downloadDir)
00012 makedirs (downloadDir)
00013 
00014 initDownloadHandlers ()
00015 options = DownloadOptions  ()
00016 options.workDir = abspath (downloadDir)
00017 options.verbose = True
00018 
00019 cvsurl = """cvs://:pserver:anonymous@cmscvs.cern.ch:2401/cvs_server/repositories/CMSSW?passwd=AA_:yZZ3e&module=DBS/Clients/Python&export=DBS&tag=-rDBS_1_1_0&output=/dbs-client.tar.gz"""
00020 protocol, cvsroot, args = parseCvsUrl (cvsurl)
00021 print args
00022 assert (protocol == "cvs")
00023 assert (cvsroot == ":pserver:anonymous@cmscvs.cern.ch:2401/cvs_server/repositories/CMSSW")
00024 assert (args["passwd"] == "AA_:yZZ3e")
00025 assert (args["module"] == "DBS/Clients/Python")
00026 assert (args["export"] == "DBS")
00027 assert (args["tag"] == "DBS_1_1_0")
00028 assert (args["output"] == "/dbs-client.tar.gz")
00029 assert (downloadCvs (cvsurl, downloadDir, options))
00030 
00031 m=md5.new ()
00032 m.update (file (join (downloadDir, "dbs-client.tar.gz")).read ())