Skip to content

Commit f74c8dc

Browse files
committed
Updated mkrelease script, tested on a separate test repository.
- Legacy-Id: 712
1 parent e6343f6 commit f74c8dc

1 file changed

Lines changed: 41 additions & 12 deletions

File tree

test/mkrelease

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ longopts=help,repository,verbose,version
8080
# Default values
8181
MSG=""
8282
VERFILE=ietf/__init__.py
83+
SETTINGS=ietf/settings.py
8384

8485
if [ "$(uname)" = "Linux" ]; then
8586
args=$(getopt -o "$shortopts" --long "$longopts" -n '$program' -- $SV "$@")
@@ -131,10 +132,11 @@ elif [ "${DIR%%/*}" = "branch" ]; then
131132
SRC="branch/${tmp%%/*}" # keep first subdir under branch/
132133
fi
133134

135+
note "Locating the root of the working copy..."
134136
while [ "$RDIR" ]; do
135137
[ "$RDIR" = "$prev" ] && die "Internal error"
136138
cd ..
137-
pwd
139+
note " now at $PWD"
138140
prev=$RDIR
139141
RDIR=${RDIR%/*}
140142
done
@@ -144,27 +146,54 @@ SRC=${SRC#/} # remove leading slash
144146

145147
MAJOR=${VER%.*}
146148
MINOR=${VER#*.}
149+
VER="$(printf %d.%02d $MAJOR $MINOR)"
147150
NEXT=$(( $MINOR + 1 ))
148151
DEV="$(printf %d.%02d-dev $MAJOR $NEXT)"
149152

150-
# update the version and make sure "$Rev$" is Ok
153+
note "Verifying that the version doesn't already exist"
154+
svn info $REPO/tags/$VER 2>&1 | grep -q "Not a valid URL" || die "The tag '$VER' already exists (or there was an error testing for it)."
155+
156+
note "Update the version info in $VERFILE and make sure'\$Rev\$' is Ok"
151157
sed -i -r -e "/^__version__/s/\"[.0-9]+(-dev)?\"/\"$VER\"/" \
152-
-e "/^__rev__/s/\".*\"/\"\$Rev:\$\"/" \
158+
-e "/^__rev__/s/\".*\"/\"\$Rev:\$\"/" \
153159
$SRC/$VERFILE
154-
cat $SRC/$VERFILE
155-
svn commit $SRC/$VERFILE -m "Release version $VER. $MSG"
156160

157-
# create a new tag.
158-
svn info $REPO/tags/$VER 2>&1 | grep -q "Not a valid URL" || die "The tag '$VER' already exists (or there was an error testing for it)."
159-
svn cp $REPO/$SRC $REPO/tags/$VER
161+
note "Update the deployment settings in settings.py"
162+
sed -i -r -e 's/^DEBUG *= *.*$/DEBUG = False/' \
163+
-e "s/^SERVER_MODE *= *.*\$/SERVER_MODE = 'production'/" \
164+
$SRC/$SETTINGS
165+
166+
note "Committing version information for version $VER. $MSG"
167+
svn commit $SRC/$VERFILE $SRC/$SETTINGS -m "Set version info to release version $VER before branching. $MSG"
160168

161-
# update version and revision info to indicate that the source and branch aren't releases
169+
note "Creating new tag 'tags/$VER' from $SRC"
170+
svn cp $REPO/$SRC $REPO/tags/$VER -m "Creating new tag 'tags/$VER' from $SRC"
171+
172+
note "Updating version and revision info to indicate that the source and branch aren't releases"
162173
sed -i -r -e "/^__version__/s/\"[0-9.]*\"/\"$DEV\"/" \
163174
-e "/^__rev__/s/\"\\\$Rev: (.*) \\\$\"/\"\$Rev:\$ (dev) Latest release: Rev. \1 \"/" \
164175
$SRC/$VERFILE
165-
cat $SRC/$VERFILE
166-
svn commit $VERFILE -m "Development branch $DEV"
176+
177+
note "Updating the deployment settings in settings.py to development mode"
178+
sed -i -r -e 's/^DEBUG *= *.*$/DEBUG = True/' \
179+
-e "s/^SERVER_MODE *= *.*\$/SERVER_MODE = 'development'/" \
180+
$SRC/$SETTINGS
181+
167182

168183
# if SRC is 'trunk', then also create a new branch
169-
[ $SRC = "trunk" ] && svn info $REPO/branch/$VER 2>&1 | grep -q "Not a valid URL" && svn cp $REPO/$SRC $REPO/branch/$VER
184+
if [ $SRC = "trunk" ]; then
185+
if svn info $REPO/branch/$VER 2>&1 | grep -q "Not a valid URL"; then
186+
note "Creating new branch 'branch/$VER' from $SRC"
187+
svn cp $REPO/$SRC $REPO/branch/$VER -m "Creating new branch 'branch/$VER' from $SRC"
188+
fi
189+
190+
note "Updating version and revision info on trunk"
191+
sed -i -r -e "/^__version__/s/\"[0-9.]*\"/\"$MAJOR.xx-trunk\"/" \
192+
-e "/^__rev__/s/\"\\\$Rev: (.*) \\\$\"/\"\$Rev:\$ (dev) Latest release: Rev. \1 \"/" \
193+
$SRC/$VERFILE
194+
195+
note "Commit version information '$MAJOR.xx-trunk'"
196+
svn commit $SRC/$VERFILE $SRC/$SETTINGS -m "Set version of the trunk to $MAJOR.xx-trunk after branching off $VER"
197+
fi
170198

199+
svn update

0 commit comments

Comments
 (0)