aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2006-09-08 21:39:53 +0000
committerHolger Hans Peter Freyther <zecke@selfish.org>2006-09-08 21:39:53 +0000
commit5668456a58dac33b2e1f94420feb9df7097bbf40 (patch)
tree7db61da1c6c9465b1c0700c08e083bbd878aa007
parent51ee10fea0ad16c23504ea0a12f2b7c744953216 (diff)
downloadbitbake-5668456a58dac33b2e1f94420feb9df7097bbf40.tar.gz
bitbake-5668456a58dac33b2e1f94420feb9df7097bbf40.tar.bz2
bitbake-5668456a58dac33b2e1f94420feb9df7097bbf40.zip
bitbake/trunk/bitbake: Do svn co's to a permanent directory (SVNDIR) to be more similiar to the CVS fetcher
Patch courtsey Paul Sokolovsky to address #1367 to have a permanent directory for subversion to ease updating of huge repositories.
-rw-r--r--conf/bitbake.conf5
-rw-r--r--lib/bb/fetch/svn.py63
2 files changed, 36 insertions, 32 deletions
diff --git a/conf/bitbake.conf b/conf/bitbake.conf
index d288fee78..19a3fe8ef 100644
--- a/conf/bitbake.conf
+++ b/conf/bitbake.conf
@@ -26,11 +26,12 @@ DEPLOY_DIR_IMAGE = "${DEPLOY_DIR}/images"
DL_DIR = "${TMPDIR}/downloads"
FETCHCOMMAND = ""
FETCHCOMMAND_cvs = "/usr/bin/env cvs -d${CVSROOT} co ${CVSCOOPTS} ${CVSMODULE}"
-FETCHCOMMAND_svn = "/usr/bin/env svn co http://${SVNROOT} ${SVNCOOPTS} ${SVNMODULE}"
+FETCHCOMMAND_svn = "/usr/bin/env svn co ${SVNCOOPTS} ${SVNROOT} ${SVNMODULE}"
FETCHCOMMAND_wget = "/usr/bin/env wget -t 5 --passive-ftp -P ${DL_DIR} ${URI}"
FILESDIR = "${@bb.which(bb.data.getVar('FILESPATH', d, 1), '.')}"
FILESPATH = "${FILE_DIRNAME}/${PF}:${FILE_DIRNAME}/${P}:${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/files:${FILE_DIRNAME}"
FILE_DIRNAME = "${@os.path.dirname(bb.data.getVar('FILE', d))}"
+GITDIR = "${DL_DIR}/git"
IMAGE_CMD = "_NO_DEFINED_IMAGE_TYPES_"
IMAGE_ROOTFS = "${TMPDIR}/rootfs"
MKTEMPCMD = "mktemp -q ${TMPBASE}"
@@ -47,9 +48,11 @@ RESUMECOMMAND_wget = "/usr/bin/env wget -c -t 5 --passive-ftp -P ${DL_DIR} ${URI
S = "${WORKDIR}/${P}"
SRC_URI = "file://${FILE}"
STAMP = "${TMPDIR}/stamps/${PF}"
+SVNDIR = "${DL_DIR}/svn"
T = "${WORKDIR}/temp"
TARGET_ARCH = "${BUILD_ARCH}"
TMPDIR = "${TOPDIR}/tmp"
UPDATECOMMAND = ""
UPDATECOMMAND_cvs = "/usr/bin/env cvs -d${CVSROOT} update ${CVSCOOPTS}"
+UPDATECOMMAND_svn = "/usr/bin/env svn update ${SVNCOOPTS}"
WORKDIR = "${TMPDIR}/work/${PF}"
diff --git a/lib/bb/fetch/svn.py b/lib/bb/fetch/svn.py
index 04dd4e08d..fbb3f2f03 100644
--- a/lib/bb/fetch/svn.py
+++ b/lib/bb/fetch/svn.py
@@ -26,6 +26,7 @@ Based on functions from the base bb module, Copyright 2003 Holger Schurig
"""
import os, re
+import sys
import bb
from bb import data
from bb.fetch import Fetch
@@ -121,52 +122,52 @@ class Svn(Fetch):
svnroot = host + path
- data.setVar('SVNROOT', svnroot, localdata)
+ # either use the revision, or SRCDATE in braces, or nothing for SRCDATE = "now"
+ if revision:
+ options.append("-r %s" % revision)
+ elif date != "now":
+ options.append("-r {%s}" % date)
+
+ data.setVar('SVNROOT', "%s://%s/%s" % (proto, svnroot, module), localdata)
data.setVar('SVNCOOPTS', " ".join(options), localdata)
data.setVar('SVNMODULE', module, localdata)
svncmd = data.getVar('FETCHCOMMAND', localdata, 1)
- svncmd = "svn co -r {%s} %s://%s/%s" % (date, proto, svnroot, module)
-
- # either use the revision or if SRCDATE is now no braces
- if revision:
- svncmd = "svn co -r %s %s://%s/%s" % (revision, proto, svnroot, module)
- elif date == "now":
- svncmd = "svn co %s://%s/%s" % (proto, svnroot, module)
+ svnupcmd = data.getVar('UPDATECOMMAND', localdata, 1)
if svn_rsh:
svncmd = "svn_RSH=\"%s\" %s" % (svn_rsh, svncmd)
+ svnupcmd = "svn_RSH=\"%s\" %s" % (svn_rsh, svnupcmd)
+
+ pkg=data.expand('${PN}', d)
+ pkgdir=os.path.join(data.expand('${SVNDIR}', localdata), pkg)
+ moddir=os.path.join(pkgdir, module)
+ bb.debug(2, "Fetch: checking for module directory '" + moddir + "'")
+
+ if os.access(os.path.join(moddir,'.svn'), os.R_OK):
+ bb.note("Update " + loc)
+ # update sources there
+ os.chdir(moddir)
+ bb.debug(1, "Running %s" % svnupcmd)
+ myret = os.system(svnupcmd)
+ else:
+ bb.note("Fetch " + loc)
+ # check out sources there
+ bb.mkdirhier(pkgdir)
+ os.chdir(pkgdir)
+ bb.debug(1, "Running %s" % svncmd)
+ myret = os.system(svncmd)
-# create temp directory
- bb.debug(2, "Fetch: creating temporary directory")
- bb.mkdirhier(data.expand('${WORKDIR}', localdata))
- data.setVar('TMPBASE', data.expand('${WORKDIR}/oesvn.XXXXXX', localdata), localdata)
- tmppipe = os.popen(data.getVar('MKTEMPDIRCMD', localdata, 1) or "false")
- tmpfile = tmppipe.readline().strip()
- if not tmpfile:
- bb.error("Fetch: unable to create temporary directory.. make sure 'mktemp' is in the PATH.")
- raise FetchError(module)
-
-# check out sources there
- os.chdir(tmpfile)
- bb.note("Fetch " + loc)
- bb.debug(1, "Running %s" % svncmd)
- myret = os.system(svncmd)
if myret != 0:
- try:
- os.rmdir(tmpfile)
- except OSError:
- pass
raise FetchError(module)
- os.chdir(os.path.join(tmpfile, os.path.dirname(module)))
-# tar them up to a defined filename
+ 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)))
if myret != 0:
try:
os.unlink(tarfn)
except OSError:
pass
-# cleanup
- os.system('rm -rf %s' % tmpfile)
os.chdir(olddir)
+
del localdata