aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-10-01 01:21:12 +0300
committerGitHub <noreply@github.com>2017-10-01 01:21:12 +0300
commit7d49d1d2d77223a4f403cf0c723aa10ac15e8c59 (patch)
tree008ffa447523d2685e6262c0f177f84c2b9da93a
parentea5ae8ef27690fa1682b1f164cdbc96fab08e03d (diff)
parenta90e47bd4f0f81c156c582f00d3cc005887547e2 (diff)
downloadmeson-7d49d1d2d77223a4f403cf0c723aa10ac15e8c59.zip
meson-7d49d1d2d77223a4f403cf0c723aa10ac15e8c59.tar.gz
meson-7d49d1d2d77223a4f403cf0c723aa10ac15e8c59.tar.bz2
Merge pull request #2373 from leiflm/svn-wraps
introduce svn wrap support
-rw-r--r--docs/markdown/snippets/wrap-svn.md4
-rw-r--r--manual tests/10 svn wrap/meson.build10
-rw-r--r--manual tests/10 svn wrap/prog.c6
-rw-r--r--manual tests/10 svn wrap/subprojects/samplesubproject.wrap4
-rw-r--r--mesonbuild/wrap/wrap.py26
5 files changed, 50 insertions, 0 deletions
diff --git a/docs/markdown/snippets/wrap-svn.md b/docs/markdown/snippets/wrap-svn.md
new file mode 100644
index 0000000..cdf155b
--- /dev/null
+++ b/docs/markdown/snippets/wrap-svn.md
@@ -0,0 +1,4 @@
+# wrap-svn
+
+The [Wrap dependency system](Wrap-dependency-system-manual.md) now supports [Subversion](https://subversion.apache.org/) (svn).
+This support is rudimentary. The repository url has to point to a specific (sub)directory containing the `meson.build` file (typically `trunk/`). However, providing a `revision` is supported.
diff --git a/manual tests/10 svn wrap/meson.build b/manual tests/10 svn wrap/meson.build
new file mode 100644
index 0000000..23ef1f1
--- /dev/null
+++ b/manual tests/10 svn wrap/meson.build
@@ -0,0 +1,10 @@
+project('Subversion outchecker', 'c')
+
+sp = subproject('samplesubproject')
+
+exe = executable('gitprog', 'prog.c',
+include_directories : sp.get_variable('subproj_inc'),
+link_with : sp.get_variable('subproj_lib'),
+)
+
+test('maintest', exe)
diff --git a/manual tests/10 svn wrap/prog.c b/manual tests/10 svn wrap/prog.c
new file mode 100644
index 0000000..df38000
--- /dev/null
+++ b/manual tests/10 svn wrap/prog.c
@@ -0,0 +1,6 @@
+#include"subproj.h"
+
+int main(int argc, char **argv) {
+ subproj_function();
+ return 0;
+}
diff --git a/manual tests/10 svn wrap/subprojects/samplesubproject.wrap b/manual tests/10 svn wrap/subprojects/samplesubproject.wrap
new file mode 100644
index 0000000..c8a687e
--- /dev/null
+++ b/manual tests/10 svn wrap/subprojects/samplesubproject.wrap
@@ -0,0 +1,4 @@
+[wrap-svn]
+directory=samplesubproject
+url=https://svn.code.sf.net/p/mesonsubproject/code/trunk
+revision=head
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py
index 81a2f88..26a3489 100644
--- a/mesonbuild/wrap/wrap.py
+++ b/mesonbuild/wrap/wrap.py
@@ -19,6 +19,7 @@ import subprocess
import sys
from pathlib import Path
from . import WrapMode
+from ..mesonlib import Popen_safe
try:
import ssl
@@ -78,6 +79,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 +148,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 +233,27 @@ 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:
+ p, out = Popen_safe(['svn', 'info', '--show-item', 'revision', checkoutdir])
+ current_revno = out
+ if current_revno == revno:
+ return
+
+ 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:
+ subprocess.check_call(['svn', 'update', '-r', revno], cwd=checkoutdir)
+ else:
+ subprocess.check_call(['svn', 'checkout', '-r', revno, p.get('url'),
+ p.get('directory')], cwd=self.subdir_root)
+
def get_data(self, url):
blocksize = 10 * 1024
h = hashlib.sha256()