aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/wrap/wrap.py
diff options
context:
space:
mode:
authorLeif Middelschulte <leif.middelschulte@gmail.com>2017-09-25 21:00:02 +0200
committerLeif Middelschulte <leif.middelschulte@gmail.com>2017-09-25 22:26:42 +0200
commit667d5d2d9f6f6b4a004616595477f9ac59473525 (patch)
tree83862551d01c1fcdff953f316481058a1aa634ee /mesonbuild/wrap/wrap.py
parent876b2475dd40e47f7fef0a8f6ac85d20c527e9f6 (diff)
downloadmeson-667d5d2d9f6f6b4a004616595477f9ac59473525.zip
meson-667d5d2d9f6f6b4a004616595477f9ac59473525.tar.gz
meson-667d5d2d9f6f6b4a004616595477f9ac59473525.tar.bz2
introduce svn wrap support
Diffstat (limited to 'mesonbuild/wrap/wrap.py')
-rw-r--r--mesonbuild/wrap/wrap.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py
index 933bbd5..3c0e620 100644
--- a/mesonbuild/wrap/wrap.py
+++ b/mesonbuild/wrap/wrap.py
@@ -78,6 +78,8 @@ class PackageDefinition:
self.type = 'git'
elif first == '[wrap-hg]':
self.type = 'hg'
+ elif first == '[wrap-svn]':
+ self.type = 'svn'
else:
raise RuntimeError('Invalid format of package file')
for line in ifile:
@@ -145,6 +147,8 @@ class Resolver:
self.get_git(p)
elif p.type == "hg":
self.get_hg(p)
+ elif p.type == "svn":
+ self.get_svn(p)
else:
raise AssertionError('Unreachable code.')
return p.get('directory')
@@ -228,6 +232,28 @@ class Resolver:
subprocess.check_call(['hg', 'checkout', revno],
cwd=checkoutdir)
+ def get_svn(self, p):
+ checkoutdir = os.path.join(self.subdir_root, p.get('directory'))
+ revno = p.get('revision')
+ is_there = os.path.isdir(checkoutdir)
+ if is_there:
+ if revno.lower() == 'head':
+ # Failure to do pull is not a fatal error,
+ # because otherwise you can't develop without
+ # a working net connection.
+ subprocess.call(['svn', 'update'], cwd=checkoutdir)
+ else:
+ if subprocess.call(['svn', 'update', '-r', revno], cwd=checkoutdir) != 0:
+ subprocess.check_call(['svn', 'update'], cwd=checkoutdir)
+ subprocess.check_call(['svn', 'update', '-r', revno],
+ cwd=checkoutdir)
+ else:
+ subprocess.check_call(['svn', 'checkout', p.get('url'),
+ p.get('directory')], cwd=self.subdir_root)
+ if revno.lower() != 'head':
+ subprocess.check_call(['svn', 'checkout', '-r', revno],
+ cwd=checkoutdir)
+
def get_data(self, url):
blocksize = 10 * 1024
if url.startswith('https://wrapdb.mesonbuild.com'):