From a47414ff7be16f5cb148555ebc1a10dbdf42e2f6 Mon Sep 17 00:00:00 2001 From: Bert Burgemeister Date: Sun, 14 Feb 2010 20:17:07 +0100 Subject: [PATCH] New release mechanism. Monikop and Pokinom show their version number. --- .gitignore | 3 ++ NEWS | 16 +++++++ doc/fake-monikop-screenshot.pl | 3 ++ doc/fake-pokinom-screenshot.pl | 3 ++ doc/tag-and-release.sh | 95 +++++++++++++++++++++++++++++++++++++++ doc/{upload.sh => upload-html.sh} | 0 monikop | 10 ++++- pokinom | 11 +++++ 8 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 NEWS create mode 100755 doc/tag-and-release.sh rename doc/{upload.sh => upload-html.sh} (100%) diff --git a/.gitignore b/.gitignore index bf702ac..ab59a31 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ *.html monikop.config +pokinom.config *~ *.png +*.tar.gz +*.xml diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..367fbc4 --- /dev/null +++ b/NEWS @@ -0,0 +1,16 @@ +* Initial release v0.0.0 + + - All tests pass. + + - We release a tarball on ohloh.net (where the release process is + scriptable). + + - Monikop and Pokinom show their version number. + + + +; End of NEWS + +; Local Variables: +; mode: outline +; End: diff --git a/doc/fake-monikop-screenshot.pl b/doc/fake-monikop-screenshot.pl index 0a7df3d..5bd8281 100755 --- a/doc/fake-monikop-screenshot.pl +++ b/doc/fake-monikop-screenshot.pl @@ -16,6 +16,8 @@ my @monikop_banner = ( "_/ _/ _/_/ _/ _/ _/_/_/ _/ _/ _/_/ _/ ", ); +$version = "v0.0.1"; + # Debug mode: # 0 = clean UI; 1 = lots of scrolling junk; anything else = both (pipe to file) my $debug = 0; @@ -259,6 +261,7 @@ unless ($debug == 1) { $window_center->addstr($line_number, 2, $_); ++ $line_number; } @monikop_banner; + $window_center->addstr(4, 72, "$version"); $window_center->move(0, 0); $window_bottom->box(0,0); diff --git a/doc/fake-pokinom-screenshot.pl b/doc/fake-pokinom-screenshot.pl index 1da64f2..2c52977 100755 --- a/doc/fake-pokinom-screenshot.pl +++ b/doc/fake-pokinom-screenshot.pl @@ -15,6 +15,8 @@ my @pokinom_banner = ( "_/ _/_/ _/ _/ _/_/_/ _/ _/ _/_/ _/ _/ ", ); +my $version = "v0.0.1"; + # Debug mode: # 0 = clean UI; 1 = lots of scrolling junk; anything else = both (pipe to file) my $debug = 0; @@ -138,6 +140,7 @@ unless ($debug == 1) { $window_top->box(0,0); $window_top->addstr(0, 30, " P r o g r e s s "); $window_top->attroff($CYAN); + $window_top->addstr(15, 1, "$version"); my $sources_format = "%-25s%-18s%-8s"; $window_top->attron(A_BOLD); $window_top->addstr(1, 12, diff --git a/doc/tag-and-release.sh b/doc/tag-and-release.sh new file mode 100755 index 0000000..85e706f --- /dev/null +++ b/doc/tag-and-release.sh @@ -0,0 +1,95 @@ +#! /bin/bash + +# Make a new git tag and upload a new release. +###################################################################### +# The tag's name (a version string like `v1.2.3') and the commit +# message come from the topmost entry of ../NEWS. Headlines of those +# entries are supposed to start with `* ' and must contain the version +# string unquoted and surrounded by whitespace. + +workdir=`pwd` + +function latest_NEWS_section { + # Extract topmost section from NEWS. + sed -nr \ + -e '/^\* .*v[0-9]+\.[0-9]+\.?[0-9]* .*$/,/(^\* .*v[0-9]+\.[0-9]+\.?[0-9]* .*$)|(^; .*$)/{H}' \ + -e '${g; s/(\n\* .*v[0-9]+\.[0-9]+\.?[0-9]* .*$)|(\n; .*$)//m2; s/^\n//m1; p}' \ + $workdir/../NEWS +} + +function latest_version_number { + # Extract version string from topmost headline in NEWS. + latest_NEWS_section | \ + grep -Eom 1 -e 'v[0-9]+\.[0-9]+\.?[0-9]*' +} + +function naked_version_number { + # Version string without the leading `v'. + version=`latest_version_number` + echo ${version#v} +} + +# program_version_number +function program_version_number { + grep -Em 1 -e '\$version *=.*v[0-9]+\.[0-9]+\.?[0-9]*.*;' $1 | \ + grep -Eom 1 -e 'v[0-9]+\.[0-9]+\.?[0-9]*' +} + +echo "Tagging `latest_version_number`" + +if [[ `program_version_number ../monikop` != `latest_version_number` ]]; then + echo "Version number mismatch between monikop and NEWS. Aborting." + exit +elif [[ `program_version_number ../pokinom` != `latest_version_number` ]]; then + echo "Version number mismatch between pokinom and NEWS. Aborting." + exit +fi + +if ! git-tag -a -m "`latest_NEWS_section`" `latest_version_number`; then + echo "Setting tag `latest_version_number` failed. But maybe things are already in place." +else + echo "Tagging `latest_version_number` successful." +fi + +if [[ `git-describe $(latest_version_number)` != `latest_version_number` ]]; then + echo "Tag `latest_version_number` missing. Aborting." + exit +fi + +echo "Writing archive ../monikop-`naked_version_number`.tar.gz." +if ! ( + cd .. + git-archive \ + --format=tar \ + --prefix=monikop-`naked_version_number`/ `latest_version_number` | \ + gzip > monikop-`naked_version_number`.tar.gz + ) +then + echo "Unsuccessful. Aborting." + exit +fi + +echo "Writing instruct-ohloh-`naked_version_number`.xml." +if ! cat > instruct-ohloh-`naked_version_number`.xml < + + + + + + + + + + +EOF +then + echo "Unsuccessful. Aborting." + exit +fi + +echo "Uploading to upload.ohloh.net." +scp ../monikop-`naked_version_number`.tar.gz trebb@upload.ohloh.net:monikop/files && +scp instruct-ohloh-`naked_version_number`.xml trebb@upload.ohloh.net:monikop/instructs + +exit diff --git a/doc/upload.sh b/doc/upload-html.sh similarity index 100% rename from doc/upload.sh rename to doc/upload-html.sh diff --git a/monikop b/monikop index 67dff8b..cc2cce4 100755 --- a/monikop +++ b/monikop @@ -16,8 +16,15 @@ my @monikop_banner = ( "_/ _/ _/_/ _/ _/ _/_/_/ _/ _/ _/_/ _/ ", ); +# Version number. Should agree with Pokinom's one. +# Format: v<1>.<2>.<3> where +# <3> = bug fix, +# <2> = new feature, +# <1> = incompatible change. +my $version = 'v0.0.0'; + # Debug mode: -# 0 = clean UI; 1 = lots of scrolling junk; anything else = both (pipe to file) +# 0 = clean UI; 1 = lots of scrolling junk; anything else = both (pipe to file). my $debug = 0; $debug = $ARGV[1] if $ARGV[1]; @@ -543,6 +550,7 @@ unless ($debug == 1) { $window_center->addstr($line_number, 2, $_); ++ $line_number; } @monikop_banner; + $window_center->addstr(4, 78 - length $version, "$version"); $window_center->move(0, 0); $window_bottom->box(0,0); diff --git a/pokinom b/pokinom index d116af6..a26099c 100755 --- a/pokinom +++ b/pokinom @@ -15,6 +15,13 @@ my @pokinom_banner = ( "_/ _/_/ _/ _/ _/_/_/ _/ _/ _/_/ _/ _/ ", ); +# Version number. Should agree with Pokinom's one. +# Format: v<1>.<2>.<3> where +# <3> = bug fix, +# <2> = new feature, +# <1> = incompatible change. +my $version = 'v0.0.0'; + # Debug mode: # 0 = clean UI; 1 = lots of scrolling junk; anything else = both (pipe to file) my $debug = 0; @@ -327,6 +334,7 @@ unless ($debug == 1) { $window_top->box(0,0); $window_top->addstr(0, 30, " P r o g r e s s "); $window_top->attroff($CYAN); + $window_top->addstr(LINES() - 9, 1, "$version"); my $sources_format = "%-25s%-18s%-8s"; $window_top->attron(A_BOLD); $window_top->addstr(1, 12, @@ -393,3 +401,6 @@ map { $rsync_worker_thread->join if $rsync_worker_thread; $display_thread->join if $display_thread; + +__END__ + -- 2.11.4.GIT