source: LMDZ6/branches/Amaury_dev/tools/fcm/tutorial/fcm-tutorial-repos-create @ 5095

Last change on this file since 5095 was 5095, checked in by abarral, 2 months ago

Revert cosp*/ from the trunk, as it's external code
Add missing bits from FCM2 source

  • Property svn:executable set to *
File size: 2.6 KB
Line 
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#-------------------------------------------------------------------------------
20set -eu
21if (($# < 1)); then
22    echo "Usage: $(basename $0) DEST" >&2
23    exit 1
24fi
25DEST=$1
26if [[ -e $DEST ]]; then
27    echo "$DEST: destination already exists." >&2
28    exit 1
29fi
30THIS_HOME=$(cd $(dirname $0) && pwd)
31WORK_DIR=
32function FINALLY() {
33    trap '' ERR
34    trap '' EXIT
35    cd ~
36    if [[ -n $WORK_DIR ]]; then
37        rm -rf $WORK_DIR
38    fi
39}
40#-------------------------------------------------------------------------------
41function rsyncs() {
42    rsync -a --exclude=".svn" --checksum "$@"
43}
44#-------------------------------------------------------------------------------
45
46WORK_DIR=$(mktemp -d)
47trap FINALLY ERR
48trap FINALLY EXIT
49cd $WORK_DIR
50
51svnadmin create repos
52REPOS_URL=file://$PWD/repos
53svn checkout -q $REPOS_URL working-copy
54mkdir -p working-copy/tutorial/{trunk,branches,tags}
55
56# r1
57rsyncs $THIS_HOME/trunk-r1/* working-copy/tutorial/trunk/
58svn add -q working-copy/tutorial
59svn commit -q -m'tutorial: initial import.' working-copy
60svn update -q working-copy
61
62# r2
63TRUNK_SRC=working-copy/tutorial/trunk/src
64svn move -q $TRUNK_SRC/module/hello_num.f90 $TRUNK_SRC/module/hello_number.f90
65sed -i 's/Hello World/Hello Earth/' $TRUNK_SRC/module/hello_constants.f90
66sed -i 's/Hello World/Hello Earth/' $TRUNK_SRC/subroutine/hello_c.c
67svn commit -q -m'tutorial: World=Earth, and correct module name.' working-copy
68svn update -q working-copy
69
70rsyncs $THIS_HOME/hooks/* repos/hooks/
71curl -o repos/hooks/svnperms.py \
72    http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/svnperms.py
73chmod +x repos/hooks/svnperms.py
74cat >repos/hooks/svnperms.conf <<__SVNPERMS_CONF__
75[$(basename $DEST)]
76tutorial/branches/[^/]+/.* = *(add,remove,update)
77__SVNPERMS_CONF__
78mkdir -p $(dirname $DEST)
79svnadmin hotcopy repos $DEST
80echo "$DEST: tutorial repository created."
Note: See TracBrowser for help on using the repository browser.