introduce svn wrap support

pull/2373/head
Leif Middelschulte 7 years ago
parent 876b2475dd
commit 667d5d2d9f
  1. 4
      docs/markdown/snippets/wrap-svn.md
  2. 10
      manual tests/10 svn wrap/meson.build
  3. 6
      manual tests/10 svn wrap/prog.c
  4. 4
      manual tests/10 svn wrap/subprojects/samplesubproject.wrap
  5. 26
      mesonbuild/wrap/wrap.py

@ -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.

@ -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)

@ -0,0 +1,6 @@
#include"subproj.h"
int main(int argc, char **argv) {
subproj_function();
return 0;
}

@ -0,0 +1,4 @@
[wrap-svn]
directory=samplesubproject
url=https://leif.svn.beanstalkapp.com/samplesubproject/trunk
revision=head

@ -78,6 +78,8 @@ class PackageDefinition:
self.type = 'git' self.type = 'git'
elif first == '[wrap-hg]': elif first == '[wrap-hg]':
self.type = 'hg' self.type = 'hg'
elif first == '[wrap-svn]':
self.type = 'svn'
else: else:
raise RuntimeError('Invalid format of package file') raise RuntimeError('Invalid format of package file')
for line in ifile: for line in ifile:
@ -145,6 +147,8 @@ class Resolver:
self.get_git(p) self.get_git(p)
elif p.type == "hg": elif p.type == "hg":
self.get_hg(p) self.get_hg(p)
elif p.type == "svn":
self.get_svn(p)
else: else:
raise AssertionError('Unreachable code.') raise AssertionError('Unreachable code.')
return p.get('directory') return p.get('directory')
@ -228,6 +232,28 @@ class Resolver:
subprocess.check_call(['hg', 'checkout', revno], subprocess.check_call(['hg', 'checkout', revno],
cwd=checkoutdir) 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): def get_data(self, url):
blocksize = 10 * 1024 blocksize = 10 * 1024
if url.startswith('https://wrapdb.mesonbuild.com'): if url.startswith('https://wrapdb.mesonbuild.com'):

Loading…
Cancel
Save