summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcin Juszkiewicz <marcin@juszkiewicz.com.pl>2007-01-26 17:55:11 +0000
committerMarcin Juszkiewicz <marcin@juszkiewicz.com.pl>2007-01-26 17:55:11 +0000
commita4bf425650dfc30641f5a7e6382fc1494cd183af (patch)
tree72cb17d8ac5efdb2143f78f3737b3a783f1a9b16
parent3755bff8fd7247fc3047953c2956eff0bed16af3 (diff)
downloadbitbake-a4bf425650dfc30641f5a7e6382fc1494cd183af.tar.gz
svn fetcher: use 'svn update' to update sources - close OE#1367
For first fetch we use 'svn checkout' but for next updates we need to use 'svn update' to fetch only changes. Patch written by Paul Sokolovsky.
-rw-r--r--lib/bb/fetch/svn.py46
1 files changed, 23 insertions, 23 deletions
diff --git a/lib/bb/fetch/svn.py b/lib/bb/fetch/svn.py
index 8856500ba..610b0b46b 100644
--- a/lib/bb/fetch/svn.py
+++ b/lib/bb/fetch/svn.py
@@ -29,6 +29,7 @@ This implementation is for svn. It is based on the cvs implementation.
# 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
@@ -139,33 +140,34 @@ class Svn(Fetch):
data.setVar('SVNCOOPTS', " ".join(options), localdata)
data.setVar('SVNMODULE', module, localdata)
svncmd = data.getVar('FETCHCOMMAND', localdata, 1)
+ svnupcmd = data.getVar('UPDATECOMMAND', localdata, 1)
if svn_rsh:
svncmd = "svn_RSH=\"%s\" %s" % (svn_rsh, 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)
+ 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 '%s'" % 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)
if myret != 0:
- try:
- os.rmdir(tmpfile)
- except OSError:
- pass
raise FetchError(module)
- os.chdir(os.path.join(tmpfile, os.path.dirname(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)))
if myret != 0:
@@ -173,7 +175,5 @@ class Svn(Fetch):
os.unlink(tarfn)
except OSError:
pass
-# cleanup
- os.system('rm -rf %s' % tmpfile)
os.chdir(olddir)
del localdata