"""Fetch all urls"""
for m in methods:
for u in m.urls:
+ # RP - is olddir needed?
+ olddir = os.path.abspath(os.getcwd())
m.go(u, urldata[u], d)
+ os.chdir(olddir)
def localpaths(d):
"""Return a list of the local filenames, assuming successful fetch"""
elif ud.tag:
ud.date = ""
- ud.localfile = data.expand('%s_%s_%s_%s.tar.gz' % (module.replace('/', '.'), ud.host, ud.tag, ud.date), d)
+ ud.localfile = data.expand('%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.tag, ud.date), d)
- return os.path.join(data.getVar("DL_DIR", d, 1), ud.localfile)
+ return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def go(self, loc, ud, d):
data.setVar('OVERRIDES', "cvs:%s" % data.getVar('OVERRIDES', localdata), localdata)
data.update_data(localdata)
- if not "module" in ud.parm:
- raise MissingParameterError("cvs method needs a 'module' parameter")
- else:
- module = ud.parm["module"]
-
- dlfile = ud.localpath
- dldir = data.getVar('DL_DIR', localdata, 1)
-
# setup cvs options
options = []
if "localdir" in ud.parm:
localdir = ud.parm["localdir"]
else:
- localdir = module
+ localdir = ud.module
cvs_rsh = None
if method == "ext":
if "rsh" in ud.parm:
cvs_rsh = ud.parm["rsh"]
- tarfn = ud.localfile
-
# try to use the tarball stash
if (date != "now") and Fetch.try_mirror(d, ud.localfile):
- bb.msg.debug(1, bb.msg.domain.Fetcher, "%s already exists or was mirrored, skipping cvs checkout." % tarfn)
+ bb.msg.debug(1, bb.msg.domain.Fetcher, "%s already exists or was mirrored, skipping cvs checkout." % ud.localpath)
return
if ud.date:
if ud.tag:
options.append("-r %s" % ud.tag)
- olddir = os.path.abspath(os.getcwd())
- os.chdir(data.expand(dldir, localdata))
-
# setup cvsroot
if method == "dir":
cvsroot = ud.path
data.setVar('CVSROOT', cvsroot, localdata)
data.setVar('CVSCOOPTS', " ".join(options), localdata)
- data.setVar('CVSMODULE', module, localdata)
+ data.setVar('CVSMODULE', ud.module, localdata)
cvscmd = data.getVar('FETCHCOMMAND', localdata, 1)
cvsupdatecmd = data.getVar('UPDATECOMMAND', localdata, 1)
os.rmdir(moddir)
except OSError:
pass
- raise FetchError(module)
+ raise FetchError(ud.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)))
+ myret = os.system("tar -czf %s %s" % (ud.localpath, os.path.basename(moddir)))
if myret != 0:
try:
- os.unlink(tarfn)
+ os.unlink(ud.localpath)
except OSError:
pass
- os.chdir(olddir)
ud.localfile = data.expand('git_%s%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.tag), d)
- return os.path.join(data.getVar("DL_DIR", d, 1), ud.localfile)
+ return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def go(self, loc, ud, d):
"""Fetch url"""
coname = '%s' % (ud.tag)
codir = os.path.join(repodir, coname)
- cofile = ud.localpath
-
# tag=="master" must always update
if (ud.tag != "master") and Fetch.try_mirror(d, ud.localfile):
- bb.msg.debug(1, bb.msg.domain.Fetcher, "%s already exists (or was stashed). Skipping git checkout." % cofile)
+ bb.msg.debug(1, bb.msg.domain.Fetcher, "%s already exists (or was stashed). Skipping git checkout." % ud.localpath)
return
if not os.path.exists(repodir):
os.chdir(codir)
bb.msg.note(1, bb.msg.domain.Fetcher, "Creating tarball of git checkout")
- rungitcmd("tar -czf %s %s" % (cofile, os.path.join(".", "*") ),d)
+ rungitcmd("tar -czf %s %s" % (ud.localpath, os.path.join(".", "*") ),d)
m = __pattern__.match(url)
path = m.group('path')
host = m.group('host')
- lpath = os.path.join(data.getVar('DL_DIR', d, 1), host, os.path.basename(path))
+ lpath = os.path.join(data.getVar('DL_DIR', d, True), host, os.path.basename(path))
return lpath
def go(self, url, urldata, d):
if not "module" in ud.parm:
raise MissingParameterError("svk method needs a 'module' parameter")
else:
- module = ud.parm["module"]
+ ud.module = ud.parm["module"]
+
+ ud.revision = ""
if 'rev' in ud.parm:
- revision = ud.parm['rev']
- else:
- revision = ""
+ ud.revision = ud.parm['rev']
- ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), revision, ud.date), d)
+ ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision, ud.date), d)
- return os.path.join(data.getVar("DL_DIR", d, 1), ud.localfile)
+ return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def go(self, loc, ud, d):
"""Fetch urls"""
data.setVar('OVERRIDES', "svk:%s" % data.getVar('OVERRIDES', localdata), localdata)
data.update_data(localdata)
- if not "module" in ud.parm:
- raise MissingParameterError("svk method needs a 'module' parameter")
- else:
- module = ud.parm["module"]
-
- dlfile = ud.localpath
- dldir = data.getVar('DL_DIR', localdata, 1)
-
# setup svk options
options = []
- if 'rev' in ud.parm:
- revision = ud.parm['rev']
- else:
- revision = ""
-
- tarfn = ud.localfile
- data.setVar('TARFILES', dlfile, localdata)
- data.setVar('TARFN', tarfn, localdata)
if (date != "now") and Fetch.try_mirror(d, ud.localfile):
return
- olddir = os.path.abspath(os.getcwd())
- os.chdir(data.expand(dldir, localdata))
-
svkroot = ud.host + ud.path
data.setVar('SVKROOT', svkroot, localdata)
data.setVar('SVKCOOPTS', " ".join(options), localdata)
- data.setVar('SVKMODULE', module, localdata)
- svkcmd = "svk co -r {%s} %s/%s" % (date, svkroot, module)
+ data.setVar('SVKMODULE', ud.module, localdata)
+ svkcmd = "svk co -r {%s} %s/%s" % (date, svkroot, ud.module)
- if revision:
- svkcmd = "svk co -r %s/%s" % (revision, svkroot, module)
+ if ud.revision:
+ svkcmd = "svk co -r %s/%s" % (ud.revision, svkroot, ud.module)
# create temp directory
bb.msg.debug(2, bb.msg.domain.Fetcher, "Fetch: creating temporary directory")
tmpfile = tmppipe.readline().strip()
if not tmpfile:
bb.msg.error(bb.msg.domain.Fetcher, "Fetch: unable to create temporary directory.. make sure 'mktemp' is in the PATH.")
- raise FetchError(module)
+ raise FetchError(ud.module)
# check out sources there
os.chdir(tmpfile)
os.rmdir(tmpfile)
except OSError:
pass
- raise FetchError(module)
+ raise FetchError(ud.module)
- os.chdir(os.path.join(tmpfile, os.path.dirname(module)))
+ os.chdir(os.path.join(tmpfile, os.path.dirname(ud.module)))
# tar them up to a defined filename
- myret = os.system("tar -czf %s %s" % (os.path.join(dldir,tarfn), os.path.basename(module)))
+ myret = os.system("tar -czf %s %s" % (ud.localpath, os.path.basename(ud.module)))
if myret != 0:
try:
- os.unlink(tarfn)
+ os.unlink(ud.localpath)
except OSError:
pass
# cleanup
os.system('rm -rf %s' % tmpfile)
- os.chdir(olddir)
-
if not "module" in ud.parm:
raise MissingParameterError("svn method needs a 'module' parameter")
else:
- module = ud.parm["module"]
+ ud.module = ud.parm["module"]
ud.revision = ""
if 'rev' in parm:
ud.revision = ud.parm['rev']
- ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision, ud.date), d)
+ ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision, ud.date), d)
- return os.path.join(data.getVar("DL_DIR", d, 1), )
+ return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def go(self, loc, ud, d):
"""Fetch url"""
data.setVar('OVERRIDES', "svn:%s" % data.getVar('OVERRIDES', localdata), localdata)
data.update_data(localdata)
- if not "module" in ud.parm:
- raise MissingParameterError("svn method needs a 'module' parameter")
- else:
- module = ud.parm["module"]
-
- dlfile = self.localpath(loc, localdata)
- dldir = data.getVar('DL_DIR', localdata, 1)
-
# setup svn options
options = []
+ proto = "svn"
if "proto" in ud.parm:
proto = ud.parm["proto"]
- else:
- proto = "svn"
svn_rsh = None
if proto == "svn+ssh" and "rsh" in ud.parm:
svn_rsh = ud.parm["rsh"]
- tarfn = ud.localfile
-
# try to use the tarball stash
if (date != "now") and Fetch.try_mirror(d, ud.localfile):
- bb.msg.debug(1, bb.msg.domain.Fetcher, "%s already exists or was mirrored, skipping svn checkout." % tarfn)
+ bb.msg.debug(1, bb.msg.domain.Fetcher, "%s already exists or was mirrored, skipping svn checkout." % ud.localpath)
return
- olddir = os.path.abspath(os.getcwd())
- os.chdir(data.expand(dldir, localdata))
-
svnroot = ud.host + ud.path
# either use the revision, or SRCDATE in braces, or nothing for SRCDATE = "now"
elif ud.date != "now":
options.append("-r {%s}" % ud.date)
- data.setVar('SVNROOT', "%s://%s/%s" % (proto, svnroot, module), localdata)
+ data.setVar('SVNROOT', "%s://%s/%s" % (proto, svnroot, ud.module), localdata)
data.setVar('SVNCOOPTS', " ".join(options), localdata)
- data.setVar('SVNMODULE', module, localdata)
+ data.setVar('SVNMODULE', ud.module, localdata)
svncmd = data.getVar('FETCHCOMMAND', localdata, 1)
svnupcmd = data.getVar('UPDATECOMMAND', localdata, 1)
pkg=data.expand('${PN}', d)
pkgdir=os.path.join(data.expand('${SVNDIR}', localdata), pkg)
- moddir=os.path.join(pkgdir, module)
+ moddir=os.path.join(pkgdir, ud.module)
bb.msg.debug(2, bb.msg.domain.Fetcher, "Fetch: checking for module directory '" + moddir + "'")
if os.access(os.path.join(moddir,'.svn'), os.R_OK):
myret = os.system(svncmd)
if myret != 0:
- raise FetchError(module)
+ raise FetchError(ud.module)
os.chdir(pkgdir)
# tar them up to a defined filename
- myret = os.system("tar -czf %s %s" % (os.path.join(dldir,tarfn), os.path.basename(module)))
+ myret = os.system("tar -czf %s %s" % (ud.localpath, os.path.basename(ud.module)))
if myret != 0:
try:
- os.unlink(tarfn)
+ os.unlink(ud.localpath)
except OSError:
pass
- os.chdir(olddir)
url = bb.encodeurl([ud.type, ud.host, ud.path, ud.user, ud.pswd, {}])
- return os.path.join(data.getVar("DL_DIR", d), os.path.basename(url))
+ return data.expand(os.path.join(data.getVar("DL_DIR", d), os.path.basename(url)), d)
def go(self, uri, ud, d):
"""Fetch urls"""