Skip to content

Commit 318572a

Browse files
committed
Tweaked the mkrelease verbose output.
- Legacy-Id: 10175
1 parent a6deb80 commit 318572a

1 file changed

Lines changed: 27 additions & 23 deletions

File tree

bin/mkrelease

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,14 @@ function die() {
5757
exit 1
5858
}
5959

60-
function note() {
60+
function say() {
6161
if [ -n "$VERBOSE" ]; then echo -e "$*"; fi
6262
}
6363

64+
function note() {
65+
if [ -n "$VERBOSE" ]; then echo -e "\n$*"; fi
66+
}
67+
6468
# ----------------------------------------------------------------------
6569
function version() {
6670
echo -e "$program $version"
@@ -101,7 +105,7 @@ while true ; do
101105
case "$1" in
102106
-h| --help) usage; exit;; # Show this help, then exit
103107
-m| --message) MSG=$2; shift;; # Specify a commit message
104-
-n| --dry-run) do="echo";; # Show what would be done
108+
-n| --dry-run) do="echo ==>";; # Show what would be done
105109
-v| --verbose) VERBOSE=1;; # Be more talkative
106110
-V| --version) version; exit;; # Show program version, then exit
107111
--) shift; break;;
@@ -137,10 +141,10 @@ elif [ "${DIR%%/*}" = "branch" ]; then
137141
SRC="branch/${tmp%%/*}" # keep first subdir under branch/
138142
fi
139143

140-
note ""
144+
141145
note "Releasing from $SRC"
142146

143-
note "Locating the root of the working copy..."
147+
note "Locating the root of the working copy ..."
144148
while [ "${#DIR}" -gt "${#SRC}" ]; do
145149
[ "$DIR" = "$prev" ] && die "Internal error"
146150
cd ..
@@ -151,7 +155,7 @@ done
151155
if [ "$DIR" != "$SRC" ]; then
152156
die "Couldn't find the root of your '$SRC' working copy"
153157
fi
154-
note " $DIR"
158+
say " $DIR"
155159

156160
REPO=${REPO%/} # remove trailing slash
157161
SRC=${SRC#/} # remove leading slash
@@ -166,7 +170,7 @@ DEV="$(printf %d.%d.%d.dev0 $MAJOR $MINOR $NEXT)"
166170

167171
#cd $DIR ??
168172

169-
note "Collecting static files"
173+
note "Collecting static files ..."
170174
$do ietf/manage.py collectstatic --noinput --ignore=bower.json --ignore='README.*'
171175
$do svn commit static/lib/ -m "Updated static files under static/lib/"
172176

@@ -175,13 +179,13 @@ $do svn commit static/lib/ -m "Updated static files under static/lib/"
175179
# TCLOG=$(ls -t ../test-crawl-*.log | head -n 1)
176180
# [ $TCLOG -nt .svn/.latest-commit ] || die "Looked for ../test-crawl-*.log, but didn't find one newer than the latest repository commit ($RDATE)"
177181

178-
note "Checking that changelog information is available"
182+
note "Checking that changelog information is available ..."
179183
changes=$( sed -n "/^$PROJ ($VER.*)/,/^ -- /p" changelog )
180184
[ "$changes" ] || die "No changelog information for $VER found"
181185
#note "$changes"
182186

183-
note "Checking that we don't have any model changes that haven't been captured in migrations"
184-
ietf/manage.py makemigrations | tee /dev/stderr | grep "^No changes detected$" || die "Model changes without migrations found."
187+
note "Checking that we don't have any model changes that haven't been captured in migrations ..."
188+
ietf/manage.py makemigrations | tee /dev/stderr | grep -q "^No changes detected$" || die "Model changes without migrations found."
185189

186190
note "Running the tests suite and writing release coverage data ..."
187191
$do ietf/manage.py test --settings=ietf.settings_releasetest --save-version-coverage=$VER
@@ -191,50 +195,50 @@ $do svn commit release-coverage.json -m "Code coverage data for release $VER"
191195

192196
contributors=$(echo "$changes" | sed 's/\.[ \t\n]/ /'| tr -c "a-z0-9.@-" "\n" | sort | uniq | grep '@' | sed -r -e 's/^\.+//' -e 's/\.+$//' -e 's/^/-c /' || true)
193197

194-
note "Set the current time on the release notes in the changelog file"
198+
note "Setting the current time on the release notes in the changelog file ..."
195199
$do sed -r -i -e "1,/^ -- /s/([A-Za-z-]+ <[a-z0-9.-]+@[a-z0-9.-]+> ).*$/\1$(TZ=UTC date +'%d %b %Y %H:%M:%S %z')/" changelog
196-
note " $(grep -m1 "^ -- " changelog)"
200+
say " $(grep -m1 "^ -- " changelog)"
197201

198-
note "Verifying that version $VER doesn't already exist..."
202+
note "Verifying that version $VER doesn't already exist ..."
199203
$do svn info $REPO/tags/$VER 2>&1 | $do egrep -q "(Not a valid URL|URL .* non-existent)" || die "The tag '$VER' already exists (or there was an error testing for it)."
200-
note " Ok"
204+
say " Ok"
201205

202-
note "Committing the changelog..."
206+
note "Committing the changelog ..."
203207
$do svn commit changelog -m "Changelog entry for $VER"
204208

205-
note "Verifying there's no uncommitted changes..."
209+
note "Verifying there's no uncommitted changes ..."
206210
$do svn st | grep "^[AMGRD] " && die "There seems to be uncommitted changes in this working copy"
207211

208-
note "\nUpdating the version info in $VERFILE and making sure'\$Rev\$' is Ok"
212+
note "Updating the version info in $VERFILE and making sure'\$Rev\$' is Ok"
209213
$do sed -i -r -e "/^__version__/s/\"[.0-9]+(dev[0-9]+)?\"/\"$VER\"/" \
210214
-e "/^__rev__/s/\".*\"/\"\$Rev:\$\"/" \
211215
$VERFILE
212216

213-
note "\nUpdating the deployment settings in settings.py"
217+
note "Updating the deployment settings in settings.py"
214218
$do sed -i -r -e 's/^DEBUG *= *.*$/DEBUG = False/' \
215219
-e "s/^SERVER_MODE *= *.*\$/SERVER_MODE = 'production'/" \
216220
$SETTINGS
217221

218-
note "\nCommitting version information for version $VER: $MSG"
222+
note "Committing version information for version $VER: $MSG ..."
219223
$do svn commit $VERFILE $SETTINGS -m "Set version info to release version $VER before branching. $MSG"
220224

221-
note "\nCreating new tag 'tags/$VER' from $SRC"
225+
note "Creating new tag 'tags/$VER' from $SRC ..."
222226
$do svn cp $REPO/$SRC $REPO/tags/$VER -m "Creating new tag 'tags/$VER' from $SRC"
223227

224-
note "\nUpdating version and revision info to indicate that the source and branch aren't releases"
228+
note "Updating version and revision info to indicate that the source and branch aren't releases"
225229
$do sed -i -r -e "/^__version__/s/\"[0-9.]*\"/\"$DEV\"/" \
226230
-e "/^__rev__/s/\"\\\$Rev: (.*) \\\$\"/\"\$Rev:\$ (dev) Latest release: Rev. \1 \"/" \
227231
$VERFILE
228232

229-
note "\nUpdating the deployment settings in settings.py to development mode"
233+
note "Updating the deployment settings in settings.py to development mode"
230234
$do sed -i -r -e 's/^DEBUG *= *.*$/DEBUG = True/' \
231235
-e "s/^SERVER_MODE *= *.*\$/SERVER_MODE = 'development'/" \
232236
$SETTINGS
233237

234-
note "\nCommitting the updated version and deployment settings"
238+
note "Committing the updated version and deployment settings"
235239
$do svn commit $VERFILE $SETTINGS -m "Set version info and settings back to development mode"
236240

237-
note "\nCreating new tag 'tags/dev/$DEV' from $SRC"
241+
note "Creating new tag 'tags/dev/$DEV' from $SRC"
238242
$do svn cp $REPO/$SRC $REPO/tags/dev/$DEV -m "Creating new tag 'tags/dev/$DEV' from $SRC"
239243

240244
$do svn update -q

0 commit comments

Comments
 (0)