aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/fetch/cvs.py
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2006-11-12 00:12:32 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2006-11-12 00:12:32 +0000
commite8c28acecb269b3f115f5a548f5f3897f38d9296 (patch)
treeb0a1369d22336b29ccb19c8faa4f8a545956da2e /lib/bb/fetch/cvs.py
parente9cd560307a02c33452f13f4cd3ab0280af28b69 (diff)
downloadbitbake-e8c28acecb269b3f115f5a548f5f3897f38d9296.tar.gz
fetchers: Refactor interating through urls into the fetcher core (preparing for common md5/tarball stash code)
Diffstat (limited to 'lib/bb/fetch/cvs.py')
-rw-r--r--lib/bb/fetch/cvs.py219
1 files changed, 107 insertions, 112 deletions
diff --git a/lib/bb/fetch/cvs.py b/lib/bb/fetch/cvs.py
index 45d40c163..4a467bef1 100644
--- a/lib/bb/fetch/cvs.py
+++ b/lib/bb/fetch/cvs.py
@@ -67,132 +67,127 @@ class Cvs(Fetch):
return os.path.join(data.getVar("DL_DIR", d, 1),data.expand('%s_%s_%s_%s.tar.gz' % ( module.replace('/', '.'), host, tag, date), d))
localpath = staticmethod(localpath)
- def go(self, d, urls = []):
- """Fetch urls"""
- if not urls:
- urls = self.urls
+ def go(self, d, loc):
localdata = data.createCopy(d)
data.setVar('OVERRIDES', "cvs:%s" % data.getVar('OVERRIDES', localdata), localdata)
data.update_data(localdata)
- for loc in urls:
- (type, host, path, user, pswd, parm) = bb.decodeurl(data.expand(loc, localdata))
- if not "module" in parm:
- raise MissingParameterError("cvs method needs a 'module' parameter")
- else:
- module = parm["module"]
-
- dlfile = self.localpath(loc, localdata)
- dldir = data.getVar('DL_DIR', localdata, 1)
-# if local path contains the cvs
-# module, consider the dir above it to be the
-# download directory
-# pos = dlfile.find(module)
-# if pos:
-# dldir = dlfile[:pos]
-# else:
-# dldir = os.path.dirname(dlfile)
-
-# setup cvs options
- options = []
- if 'tag' in parm:
- tag = parm['tag']
- else:
- tag = ""
+ (type, host, path, user, pswd, parm) = bb.decodeurl(data.expand(loc, localdata))
+ if not "module" in parm:
+ raise MissingParameterError("cvs method needs a 'module' parameter")
+ else:
+ module = parm["module"]
- if 'date' in parm:
- date = parm['date']
- else:
- if not tag:
- date = Fetch.getSRCDate(d)
- else:
- date = ""
+ dlfile = self.localpath(loc, localdata)
+ dldir = data.getVar('DL_DIR', localdata, 1)
+# if local path contains the cvs
+# module, consider the dir above it to be the
+# download directory
+# pos = dlfile.find(module)
+# if pos:
+# dldir = dlfile[:pos]
+# else:
+# dldir = os.path.dirname(dlfile)
+
+# setup cvs options
+ options = []
+ if 'tag' in parm:
+ tag = parm['tag']
+ else:
+ tag = ""
- if "method" in parm:
- method = parm["method"]
+ if 'date' in parm:
+ date = parm['date']
+ else:
+ if not tag:
+ date = Fetch.getSRCDate(d)
else:
- method = "pserver"
+ date = ""
- if "localdir" in parm:
- localdir = parm["localdir"]
- else:
- localdir = module
+ if "method" in parm:
+ method = parm["method"]
+ else:
+ method = "pserver"
- cvs_rsh = None
- if method == "ext":
- if "rsh" in parm:
- cvs_rsh = parm["rsh"]
+ if "localdir" in parm:
+ localdir = parm["localdir"]
+ else:
+ localdir = module
- tarfn = data.expand('%s_%s_%s_%s.tar.gz' % (module.replace('/', '.'), host, tag, date), localdata)
- data.setVar('TARFILES', dlfile, localdata)
- data.setVar('TARFN', tarfn, localdata)
+ cvs_rsh = None
+ if method == "ext":
+ if "rsh" in parm:
+ cvs_rsh = parm["rsh"]
- # try to use the tarball stash
- if Fetch.check_for_tarball(d, tarfn, dldir, date):
- bb.msg.debug(1, bb.msg.domain.Fetcher, "%s already exists or was mirrored, skipping cvs checkout." % tarfn)
- continue
+ tarfn = data.expand('%s_%s_%s_%s.tar.gz' % (module.replace('/', '.'), host, tag, date), localdata)
+ data.setVar('TARFILES', dlfile, localdata)
+ data.setVar('TARFN', tarfn, localdata)
- if date:
- options.append("-D %s" % date)
- if tag:
- options.append("-r %s" % tag)
+ # try to use the tarball stash
+ if Fetch.check_for_tarball(d, tarfn, dldir, date):
+ bb.msg.debug(1, bb.msg.domain.Fetcher, "%s already exists or was mirrored, skipping cvs checkout." % tarfn)
+ return
- olddir = os.path.abspath(os.getcwd())
- os.chdir(data.expand(dldir, localdata))
+ if date:
+ options.append("-D %s" % date)
+ if tag:
+ options.append("-r %s" % tag)
-# setup cvsroot
- if method == "dir":
- cvsroot = path
- else:
- cvsroot = ":" + method + ":" + user
- if pswd:
- cvsroot += ":" + pswd
- cvsroot += "@" + host + ":" + path
-
- data.setVar('CVSROOT', cvsroot, localdata)
- data.setVar('CVSCOOPTS', " ".join(options), localdata)
- data.setVar('CVSMODULE', module, localdata)
- cvscmd = data.getVar('FETCHCOMMAND', localdata, 1)
- cvsupdatecmd = data.getVar('UPDATECOMMAND', localdata, 1)
-
- if cvs_rsh:
- cvscmd = "CVS_RSH=\"%s\" %s" % (cvs_rsh, cvscmd)
- cvsupdatecmd = "CVS_RSH=\"%s\" %s" % (cvs_rsh, cvsupdatecmd)
-
-# create module directory
- bb.msg.debug(2, bb.msg.domain.Fetcher, "Fetch: checking for module directory")
- pkg=data.expand('${PN}', d)
- pkgdir=os.path.join(data.expand('${CVSDIR}', localdata), pkg)
- moddir=os.path.join(pkgdir,localdir)
- if os.access(os.path.join(moddir,'CVS'), os.R_OK):
- bb.msg.note(1, bb.msg.domain.Fetcher, "Update " + loc)
-# update sources there
- os.chdir(moddir)
- myret = os.system(cvsupdatecmd)
- else:
- bb.msg.note(1, bb.msg.domain.Fetcher, "Fetch " + loc)
-# check out sources there
- bb.mkdirhier(pkgdir)
- os.chdir(pkgdir)
- bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % cvscmd)
- myret = os.system(cvscmd)
-
- if myret != 0 or not os.access(moddir, os.R_OK):
- try:
- os.rmdir(moddir)
- except OSError:
- pass
- raise FetchError(module)
+ olddir = os.path.abspath(os.getcwd())
+ os.chdir(data.expand(dldir, localdata))
+# setup cvsroot
+ if method == "dir":
+ cvsroot = path
+ else:
+ cvsroot = ":" + method + ":" + user
+ if pswd:
+ cvsroot += ":" + pswd
+ cvsroot += "@" + host + ":" + path
+
+ data.setVar('CVSROOT', cvsroot, localdata)
+ data.setVar('CVSCOOPTS', " ".join(options), localdata)
+ data.setVar('CVSMODULE', module, localdata)
+ cvscmd = data.getVar('FETCHCOMMAND', localdata, 1)
+ cvsupdatecmd = data.getVar('UPDATECOMMAND', localdata, 1)
+
+ if cvs_rsh:
+ cvscmd = "CVS_RSH=\"%s\" %s" % (cvs_rsh, cvscmd)
+ cvsupdatecmd = "CVS_RSH=\"%s\" %s" % (cvs_rsh, cvsupdatecmd)
+
+# create module directory
+ bb.msg.debug(2, bb.msg.domain.Fetcher, "Fetch: checking for module directory")
+ pkg=data.expand('${PN}', d)
+ pkgdir=os.path.join(data.expand('${CVSDIR}', localdata), pkg)
+ moddir=os.path.join(pkgdir,localdir)
+ if os.access(os.path.join(moddir,'CVS'), os.R_OK):
+ bb.msg.note(1, bb.msg.domain.Fetcher, "Update " + loc)
+# update sources there
os.chdir(moddir)
- os.chdir('..')
-# tar them up to a defined filename
- myret = os.system("tar -czf %s %s" % (os.path.join(dldir,tarfn), os.path.basename(moddir)))
- if myret != 0:
- try:
- os.unlink(tarfn)
- except OSError:
- pass
- os.chdir(olddir)
- del localdata
+ myret = os.system(cvsupdatecmd)
+ else:
+ bb.msg.note(1, bb.msg.domain.Fetcher, "Fetch " + loc)
+# check out sources there
+ bb.mkdirhier(pkgdir)
+ os.chdir(pkgdir)
+ bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % cvscmd)
+ myret = os.system(cvscmd)
+
+ if myret != 0 or not os.access(moddir, os.R_OK):
+ try:
+ os.rmdir(moddir)
+ except OSError:
+ pass
+ raise FetchError(module)
+
+ os.chdir(moddir)
+ os.chdir('..')
+# tar them up to a defined filename
+ myret = os.system("tar -czf %s %s" % (os.path.join(dldir,tarfn), os.path.basename(moddir)))
+ if myret != 0:
+ try:
+ os.unlink(tarfn)
+ except OSError:
+ pass
+ os.chdir(olddir)