1 | #!/bin/bash |
---|
2 | # ------------------------------------------------------------------------------ |
---|
3 | # Copyright (C) 2006-2021 British Crown (Met Office) & Contributors. |
---|
4 | # |
---|
5 | # This file is part of FCM, tools for managing and building source code. |
---|
6 | # |
---|
7 | # FCM is free software: you can redistribute it and/or modify |
---|
8 | # it under the terms of the GNU General Public License as published by |
---|
9 | # the Free Software Foundation, either version 3 of the License, or |
---|
10 | # (at your option) any later version. |
---|
11 | # |
---|
12 | # FCM is distributed in the hope that it will be useful, |
---|
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | # GNU General Public License for more details. |
---|
16 | # |
---|
17 | # You should have received a copy of the GNU General Public License |
---|
18 | # along with FCM. If not, see <http://www.gnu.org/licenses/>. |
---|
19 | # ------------------------------------------------------------------------------ |
---|
20 | # Optional enviroment variables: |
---|
21 | # TEST_REMOTE_HOST (tests using svn+ssh repositories located on given host) |
---|
22 | # ------------------------------------------------------------------------------ |
---|
23 | |
---|
24 | . $(dirname $0)/../lib/bash/svn_test_header |
---|
25 | |
---|
26 | function init_repos_layout_roses() { |
---|
27 | if [[ -n ${TEST_REMOTE_HOST:-} ]]; then |
---|
28 | TEST_REMOTE_DIR=$(ssh $TEST_REMOTE_HOST "mktemp -d") |
---|
29 | ssh $TEST_REMOTE_HOST "svnadmin create --fs-type fsfs $TEST_REMOTE_DIR" |
---|
30 | REPOS_URL="svn+ssh://${TEST_REMOTE_HOST}$TEST_REMOTE_DIR" |
---|
31 | else |
---|
32 | svnadmin create --fs-type fsfs $TEST_DIR/test_repos |
---|
33 | REPOS_URL="file://$TEST_DIR/test_repos" |
---|
34 | fi |
---|
35 | svn mkdir -q -m " " --parents $REPOS_URL/a/a/0/0/0/trunk |
---|
36 | svn import -q $TEST_SOURCE_DIR/../etc/repo_files \ |
---|
37 | $REPOS_URL/a/a/0/0/0/trunk -m "initial trunk import" |
---|
38 | TMPFILE=$(mktemp) |
---|
39 | cat >$TMPFILE <<__LAYOUT__ |
---|
40 | depth-project = 5 |
---|
41 | depth-branch = 1 |
---|
42 | depth-tag = 1 |
---|
43 | dir-trunk = trunk |
---|
44 | dir-branch = |
---|
45 | dir-tag = |
---|
46 | level-owner-branch = |
---|
47 | level-owner-tag = |
---|
48 | template-branch = |
---|
49 | template-tag = |
---|
50 | __LAYOUT__ |
---|
51 | TMPDIR=$(mktemp -d) |
---|
52 | svn checkout -q $REPOS_URL $TMPDIR |
---|
53 | svn propset -q --file=$TMPFILE fcm:layout $TMPDIR |
---|
54 | svn commit -q -m " " $TMPDIR |
---|
55 | rm -f $TMPFILE |
---|
56 | rm -rf $TMPDIR |
---|
57 | ROOT_URL=$REPOS_URL |
---|
58 | } |
---|