root/releases/bedework-3.8/util/svncopy.sh

Revision 3323 (checked in by douglm, 2 years ago)

Remove all debug parameters from the code.

Remove all setting of such in web.xml files

Remove all debugging targets. It's all done at run time now.

Move all project dependencies into the bw and bw.bat scripts

Line 
1 #!/bin/bash
2
3 # Copy the current trunk to a new location and adjust the bedework externals property
4
5 usage() {
6   echo "This script will copy the trunk (or named location) to a new location and"
7   echo "adjust the svn:externals property to refer to the new copies"
8   echo " "
9   echo " $0 help"
10   echo " $0 (branch | tag | release) name comment-text [ from (branch | tag | release) name]"
11   echo " "
12   echo " par 1: branch tag or release specifies what kind of copy"
13   echo " par 2: name e.g. my-copy or bedework-4.0.1"
14   echo " par 3: comment text"
15   echo " "
16   echo ' e.g. svncopy branch my-copy "my personal branch"'
17   echo " "
18   exit
19 }
20
21 # Check a parameter is set
22 #
23 # par 1: branch/tag/release
24 #
25 checkbranchtag() {
26   if [ "${1}x" = "x" ]
27   then
28       usage
29   fi
30
31   case "$1" in
32     branch)
33       BTR="branches"
34       ;;
35     tag)
36       BTR="tags"
37       ;;
38     release)
39       BTR="releases"
40       ;;
41     help)
42       usage
43       ;;
44     *)
45       echo " "
46       echo "**** "
47       echo "**** First parameter must be branch tag or release"
48       echo "**** "
49       echo " "
50       usage
51    esac
52 }
53
54 # Check a parameter is set
55 #
56 # par 1: Name of parameter
57 # par 2: value
58 #
59 check() {
60   if [ "${2}x" = "x" ]
61   then
62     echo " "
63     echo "**** "
64     echo "**** Parameter $1 is not set"
65     echo "**** "
66     echo " "
67     usage
68   fi
69 }
70
71 # ------------------------------------------------------------------
72 # copyproject - copy a single project. At the same time build up an
73 #               externals property file
74 #
75 # par 1 - project name
76 # par 2 - destination
77 # par 3 - comment
78 # par 4 - source
79 # ------------------------------------------------------------------
80 copyproject() {
81   echo "copyproject $1 $2 from $4"
82   if [ "${1}" = "buildTools" ]
83   then
84     echo "build/$1 $SVNREPOSITORY/$1/$2" >> $SCTEMPFILE
85   elif [ "${1}" = "caldavimpl" ]
86   then
87     echo "projects/$1 $SVNREPOSITORY/$1/$2" >> $SCTEMPFILE
88   elif [ "${1}" = "calendarapi" ]
89   then
90     echo "projects/$1 $SVNREPOSITORY/$1/$2" >> $SCTEMPFILE
91   elif [ "${1}" = "dumprestore" ]
92   then
93     echo "projects/$1 $SVNREPOSITORY/$1/$2" >> $SCTEMPFILE
94   elif [ "${1}" = "indexer" ]
95   then
96     echo "projects/$1 $SVNREPOSITORY/$1/$2" >> $SCTEMPFILE
97   elif [ "${1}" = "webapps" ]
98   then
99     echo "projects/$1 $SVNREPOSITORY/$1/$2" >> $SCTEMPFILE
100   fi
101   svn copy -m "$3" -rHEAD $SVNREPOSITORY/$1/$4 $SVNREPOSITORY/$1/$2
102 }
103
104 SOURCE="trunk"
105
106 if [ "${4}" = "from" ]
107 then
108   checkbranchtag "$5"
109   check "from-Name" "$6"
110   SOURCE=$BTR/$6
111 fi
112
113 checkbranchtag "$1"
114 check "Name" "$2"
115 check "Comment" "$3"
116
117 SVNREPOSITORY="https://www.bedework.org/svn"
118 TARGET="$BTR/$2"
119 COMMENT="$3"
120
121 PROJECTS=""
122 PROJECTS="$PROJECTS access"
123 PROJECTS="$PROJECTS bedework"
124 PROJECTS="$PROJECTS buildTools"
125 PROJECTS="$PROJECTS bwtools"
126 PROJECTS="$PROJECTS bwtzsvr"
127 PROJECTS="$PROJECTS bwxml"
128 PROJECTS="$PROJECTS cachedfeeder"
129 PROJECTS="$PROJECTS caldav"
130 PROJECTS="$PROJECTS caldavimpl"
131 PROJECTS="$PROJECTS caldavTest"
132 PROJECTS="$PROJECTS calendarapi"
133 PROJECTS="$PROJECTS carddav"
134 PROJECTS="$PROJECTS clientapp"
135 PROJECTS="$PROJECTS contrib"
136 PROJECTS="$PROJECTS davutil"
137 PROJECTS="$PROJECTS dumprestore"
138 # PROJECTS="$PROJECTS synch"
139 PROJECTS="$PROJECTS indexer"
140 PROJECTS="$PROJECTS monitor"
141 PROJECTS="$PROJECTS naming"
142 PROJECTS="$PROJECTS rpiutil"
143 PROJECTS="$PROJECTS testsuite"
144 PROJECTS="$PROJECTS webapps"
145 PROJECTS="$PROJECTS webdav"
146
147 SCTEMPDIR="${TMPDIR:=/tmp}/svncopydir$$"
148 SCTEMPFILE=$SCTEMPDIR/svncopy
149
150 mkdir $SCTEMPDIR
151
152 # Assure the file is removed at program termination
153 # or after we received a signal:
154 trap 'rm -rf "$SCTEMPDIR" >/dev/null 2>&1' 0
155 trap "exit 2" 1 2 3 15
156
157 for project in $PROJECTS
158 do
159    copyproject "$project" "$TARGET" "$COMMENT" "$SOURCE"
160 done
161
162 svn co -N $SVNREPOSITORY/bedework/$TARGET $SCTEMPDIR/bedework
163 svn propset svn:externals -F $SCTEMPFILE $SCTEMPDIR/bedework
164 svn commit -N -m "Change externals to new copies" $SCTEMPDIR/bedework
165
166 #more $SCTEMPFILE
Note: See TracBrowser for help on using the browser.