|
From: <za...@us...> - 2006-03-18 01:22:00
|
Revision: 11 Author: zaufi Date: 2006-03-17 17:21:35 -0800 (Fri, 17 Mar 2006) ViewCVS: http://svn.sourceforge.net/halfs/?rev=11&view=rev Log Message: ----------- refactoring configration support Added Paths: ----------- admin/trunk/devel.d/ admin/trunk/devel.d/00-init-globals.sh admin/trunk/devel.d/01-echo.sh admin/trunk/devel.d/02-check-admindir.sh admin/trunk/devel.d/40-help-support.sh admin/trunk/devel.d/50-detect-vcs.sh admin/trunk/devel.d/99-registrator.sh admin/trunk/devel.d/bootstrap.tgt.sh admin/trunk/devel.d/change-log.tgt.sh admin/trunk/devel.d/code-stats.tgt.sh admin/trunk/devel.d/help.tgt.sh admin/trunk/devel.d/scan-includes.tgt.sh admin/trunk/devel.d/total-cleanup.tgt.sh admin/trunk/devel.d/vcs-cvs-support.sh admin/trunk/devel.d/vcs-subversion-support.sh admin/trunk/devel.d/versioning-support.tgt.sh admin/trunk/devel.sh Removed Paths: ------------- admin/trunk/cvs.sh Deleted: admin/trunk/cvs.sh =================================================================== --- admin/trunk/cvs.sh 2006-03-18 01:15:50 UTC (rev 10) +++ admin/trunk/cvs.sh 2006-03-18 01:21:35 UTC (rev 11) @@ -1,659 +0,0 @@ -#!/bin/sh -# -# $Header$ -# - -# Most used strings :) -STR1="\n\n!Error: No working autoconf found." -STR2="\n\n!Error: No working automake found." -STR3="You can get it from http://www.gnu.org/software/autoconf" -STR4="You can get it from http://www.gnu.org/software/automake" -STR5="\n\n!Error: Can't run not in CVS repository!" - -RES_COL=${COLUMNS:-0} -(( RES_COL == 0 )) && RES_COL=$(stty size 2>/dev/null | cut -d' ' -f2) -(( RES_COL > 0 )) || (( RES_COL = 80 )) -(( RES_COL = RES_COL - 7 )) -MOVE_TO_COL="echo -en \\033[${RES_COL}G" -SETCOLOR_BRACKET="echo -en \\033[1;34m" -SETCOLOR_SUCCESS="echo -en \\033[1;32m" -SETCOLOR_FAILURE="echo -en \\033[1;31m" -SETCOLOR_WARNING="echo -en \\033[1;33m" -SETCOLOR_NORMAL="echo -en \\033[0;39m" - -function echo_success() -{ - if test "$tty" == "not a tty"; then - echo " OK" | tee -a $log - else - $MOVE_TO_COL - $SETCOLOR_BRACKET - echo -n "[" - $SETCOLOR_SUCCESS - echo -n " ok " - $SETCOLOR_BRACKET - echo "]" - $SETCOLOR_NORMAL - echo "OK" >> $log - fi -} - -function echo_failure() -{ - if test "$tty" == "not a tty"; then - echo " FAIL" | tee -a $log - else - $MOVE_TO_COL - $SETCOLOR_BRACKET - echo -n "[" - $SETCOLOR_FAILURE - echo -n " fail " - $SETCOLOR_BRACKET - echo "]" - $SETCOLOR_NORMAL - echo "FAIL" >> $log - fi -} -# -# Reconfigure request -# -function cvs_reconf() -{ - echo "Current tty is: `tty`" >> $log - echo "*** `date` Reconfiguration started *** " >> $log - # - echo "*** admindir set to '$admindir'" | tee -a $log - check_CVS - # Check than all requiered tools are present - echo -n "*** Looking whether needed tools are installed... " | tee -a $log - if test -d $top_srcdir/po; then - gt_version=`gettextize --version | head -n 1` - echo "Found gettext version: $gt_version" >> $log - case "$gt_version" in - *0.11.* | *0.12* | *0.13* | *0.14*) ;; - *) echo_failure - echo -e "\n\n!Error: GNU gettext >= 0.11.x not found." | tee -a $log - echo "You can get it from http://www.gnu.org/software/gettext" | tee -a $log - exit 1 ;; - esac - fi - # No special checking for autotools version needed -- all done in configure.ac - if ! `autoconf --version > /dev/null 2>&1`; then - echo_failure - echo -e "$STR1\n$STR3" | tee -a $log - exit 1 - fi - if ! `autoheader --version > /dev/null 2>&1`; then - echo_failure - echo -e "$STR1\n$STR3" | tee -a $log - exit 1 - fi - if ! `aclocal --version > /dev/null 2>&1`; then - echo_failure - echo -e "$STR2\n$STR4" | tee -a $log - exit 1 - fi - if ! `automake --version > /dev/null 2>&1`; then - echo_failure - echo -e "$STR2\n$STR4" | tee -a $log - exit 1 - fi - echo_success - echo "OK" >> $log - # Creating top level configure.ac file (if needed) - if test -f $top_srcdir/configure.ac.in; then - echo -n "*** Creating top level configuration files..." | tee -a $log - if test -d "$top_srcdir/tests"; then - sed_cmd='s,^#[ |\t]*maintmode:,,' - else - sed_cmd='/^#[ |\t]*maintmode:/d' - fi - cat "$top_srcdir/configure.ac.in" | sed "$sed_cmd" > "$top_srcdir/configure.ac" 2>> $log - if test "x$?" = "x0"; then - echo_success - else - echo_failure - fi - fi - if test -d $top_srcdir/po; then - # Prepeare to run gettextize - echo -n "*** Create po/POTFILES.in..." | tee -a $log - echo "# List of source files containing translatable strings." > $top_srcdir/po/POTFILES.in - for i in `find $top_srcdir/main -name *.cc | sort`; do - echo -n "Checking $i ... " >> $log - if `grep -q '_("' $i`; then - echo $i | sed "s,$top_srcdir/,," >> $top_srcdir/po/POTFILES.in - echo "Add" >> $log - else - echo "Skip" >> $log - fi - done - echo_success - echo -n "*** Create po/LINGUAS..." | tee -a $log - ALL_LINGUAS=`ls $top_srcdir/po/*.po | sed -e 's,\.po,,g' -e "s,$top_srcdir/po/,,g"` - echo $ALL_LINGUAS | tee -a $log > $top_srcdir/po/LINGUAS - echo_success - # Force gettext to install needed files - echo -n "*** Installing GNU gettext files..." | tee -a $log - rm -f $top_srcdir/Makefile.am~ $top_srcdir/configure.in~ - if ! `autopoint --force >> $log 2>&1`; then - echo_failure - exit 1 - fi - # GNU gettext 0.11.x have a buggy Makefile.am and configure.in patching procedure - # so to avoid using its hacked files here originals restored... - test -f $top_srcdir/Makefile.am~ && mv -f $top_srcdir/Makefile.am~ $top_srcdir/Makefile.am - test -f $top_srcdir/configure.in~ && mv -f $top_srcdir/configure.in~ $top_srcdir/configure.in - rm -f $top_srcdir/po/*~ >/dev/null 2>&1 - rm -f $top_srcdir/admin/*~ >/dev/null 2>&1 - echo_success - fi - # Run remaining autotools - echo -n "*** Creating aclocal.m4... " | tee -a $log - if `aclocal -I m4 >> $log 2>&1`; then - echo_success - else - echo_failure - exit 1 - fi - echo -n "*** Creating configure script... " | tee -a $log - if `autoconf >> $log 2>&1`; then - echo_success - else - echo_failure - exit 1 - fi - if `grep -q '^[^#]*AC_CONFIG_HEADERS' $top_srcdir/configure.ac`; then - echo -n "*** Creating config.h template... " | tee -a $log - if `autoheader >> $log 2>&1`; then - echo_success - else - echo_failure - exit 1 - fi - fi - echo -n "*** Creating Makefile templates... " | tee -a $log - if `automake -a >> $log 2>&1`; then - echo_success - else - echo_failure - exit 1 - fi - if test -f "$top_srcdir/support/am_edit"; then - echo -n "*** Postprocessing Makefile templates..." | tee -a $log - if `perl -w support/am_edit >> $log 2>&1`; then - echo_success - else - echo_failure - exit 1 - fi - fi - if test -f "$top_srcdir/support/post-bootstrap.sh"; then - . "$top_srcdir/support/post-bootstrap.sh" - test $(type -t "post_bootstrap") = "function" && post_bootstrap - fi - echo -n "*** Creating maintainer program links ... " | tee -a $log - test -f $top_srcdir/reconf || ln -s $admindir/cvs.sh $top_srcdir/reconf - # Misc - if test -f "$top_srcdir/support/directory"; then - icon=`ls -1 $top_srcdir/support/project-icon.* 2>/dev/null | head -n 1` - cat $top_srcdir/support/directory | sed "s,@icon@,$icon," > $top_srcdir/.directory - fi - echo_success -} -# -# Check if current directory is a CVS repository -# -function check_CVS() -{ - echo -n "*** Checking CVS repository... " | tee -a $log - cvsdir=$top_srcdir/CVS - if test -d $cvsdir; then - if test -f $cvsdir/Entries \ - -a -f $cvsdir/Root \ - -a -f $cvsdir/Entries; then - echo_success - echo "yes" >> $log - else - echo_failure - echo -e "$STR5" | tee -a $log - exit 1 - fi - else - echo -e "$STR5" | tee -a $log - exit 1 - fi -} -# -# Get current version -# -function get_current_version() -{ - local version_info=`cat $top_srcdir/support/version.m4 \ - | grep '^[ |\t]*m4_define.*$' \ - | grep -v 'VERSION_STR' \ - | sed -e 's/\(.*\)dnl.*/\1/' \ - -e 's/\(.*\)#.*/\1/' \ - -e 's/m4_define(\[\([A-Z_]\+\)\],[ |\t]*\[\(.*\)\])/\1="\2"/g'` - eval $version_info -} -# -# Get filename of maintainers README -# -function set_maintainer_README() -{ - if test -f "$top_srcdir/README.maint"; then - README="README.maint" - else - README="README" - fi -} -# -# Make Release -# -function make_release() -{ - echo "*** Parse current version info..." | tee -a $log - # Get current versioninfo - get_current_version - # Save previous version - O_MAJOR=$MAJOR; O_MINOR=$MINOR; O_PATCH_LEVEL=$PATCH_LEVEL; O_EXTRA_VERSION=$EXTRA_VERSION - # Increment version number - # Is current version already marked as beta or RC? - if test -z "$EXTRA_VERSION"; then - case "$1" in - release | beta | rc ) - echo "!Error: You can't make this target 'couse current version $MAJOR.$MINOR.$PATCH_LEVEL is not beta or RC" \ - | tee -a $log - echo " Targets you can make: (major | minor | patch)-release, next-(major | minor | patch)-(beta | rc)" \ - | tee -a $log - exit 1 ;; - esac - # No. - case "$1" in - major ) MAJOR=$((MAJOR+1)); MINOR=0; PATCH_LEVEL=0 ;; - minor ) MINOR=$((MINOR+1)); PATCH_LEVEL=0 ;; - patch ) PATCH_LEVEL=$((PATCH_LEVEL+1)) ;; - *) echo "Hmm... Smth wrong with arg to make_release()" | tee -a $log; exit 1 ;; - esac - # Should we start RC or beta branch? - if test -n "$2"; then - EXTRA_VERSION="${2}1" - fi - else - case "$1" in - major | minor | patch ) - echo "!Error: You can't make this target while $MAJOR.$MINOR.$PATCH_LEVEL version is not released" \ - | tee -a $log - echo " Maybe you need one of 'release', 'next-rc' or 'next-beta' ??" | tee -a $log - exit 1 ;; - esac - # If $2 == '' it will be release! :) - if test -z "$2"; then - # Yes. Just clear extra version mark and leave main digits as is... - EXTRA_VERSION="" - else - # Continue to make next beta or RC... - # Is current extra version will be the same? - local ce=`echo "$EXTRA_VERSION" | sed 's,\(.*\)[0-9]\+,\1,'` - if test "$2" == "$ce"; then - # Yes. Increment version number... - local cn=`echo "$EXTRA_VERSION" | sed 's,.*\([0-9]\+\),\1,'` - EXTRA_VERSION="${2}$((cn+1))" - else - # No. Only beta can become RC but not reverse... - if test "$2" == "rc" -a "$ce" == "beta"; then - EXTRA_VERSION="rc1" - else - echo "!Error: Can't make $MAJOR.$MINOR.$PATCH_LEVEL-${2}1' version from $MAJOR.$MINOR.$PATCH_LEVEL-$EXTRA_VERSION." \ - | tee -a $log - echo " You can make 'next-rc' or 'release' only." | tee -a $log - exit 1 - fi - fi - fi - fi - # Commit changes - post_increment_actions -} -# All functions below can be started only at release state... -function major_release() # Major Release -{ - echo "*** `date` -- Making 'major release' ***" | tee -a $log - make_release "major" -} -function minor_release() # Minor Release -{ - echo "*** `date` -- Making 'minor release' ***" | tee -a $log - make_release "minor" -} -function patch_release() # Next Patch Level -{ - echo "*** `date` -- Making 'patch release' ***" | tee -a $log - make_release "patch" -} -function next_major_beta() # Major Release (beta) -{ - echo "*** `date` -- Making 'major beta' ***" | tee -a $log - make_release "major" "beta" -} -function next_minor_beta() # Minor Release (beta) -{ - echo "*** `date` -- Making 'minor beta' ***" | tee -a $log - make_release "minor" "beta" -} -function next_patch_beta() # Patch Level Release (beta) -{ - echo "*** `date` -- Making 'patch beta' ***" | tee -a $log - make_release "patch" "beta" -} -function next_major_rc() # Major Release (RC) -{ - echo "*** `date` -- Making 'major release candidate' ***" | tee -a $log - make_release "major" "rc" -} -function next_minor_rc() # Minor Release (RC) -{ - echo "*** `date` -- Making 'minor release candidate' ***" | tee -a $log - make_release "minor" "rc" -} -function next_patch_rc() # Patch Level Release (RC) -{ - echo "*** `date` -- Making 'patch release candidate' ***" | tee -a $log - make_release "patch" "rc" -} -function release() # Make release of current version -{ - echo "*** `date` -- Making 'release' ***" | tee -a $log - make_release "release" -} -function next_beta() # Make next beta of current version -{ - echo "*** `date` -- Making 'next beta' ***" | tee -a $log - make_release "beta" "beta" -} -function next_rc() # Make next rc of current version -{ - echo "*** `date` -- Making 'next release candidate' ***" | tee -a $log - make_release "rc" "rc" -} -# -# -# -function post_increment_actions() -{ - set_maintainer_README - local old_version_str="$O_MAJOR.$O_MINOR.$O_PATCH_LEVEL"`test -n "$O_EXTRA_VERSION" && echo -$O_EXTRA_VERSION` - local new_version_str="$MAJOR.$MINOR.$PATCH_LEVEL"`test -n "$EXTRA_VERSION" && echo -$EXTRA_VERSION` - local new_version_tag=`echo $new_version_str | sed 's/\./-/g'` - local branch_prefix='rel' - - echo "*** Version info: $old_version_str ==> $new_version_str" | tee -a $log - echo "*** Patch version depended files..." | tee -a $log - - # Rewrite new versioninfo - VERSION_STR="$MAJOR.$MINOR.$PATCH_LEVEL"`test -n "$EXTRA_VERSION" && echo "-$EXTRA_VERSION"` - cat "$top_srcdir/support/version.m4" \ - | sed -e "s/\(m4_define(\[MAJOR\],[ |\t]*\[\).*\(\])\)/\1$MAJOR\2/g" \ - -e "s/\(m4_define(\[MINOR\],[ |\t]*\[\).*\(\])\)/\1$MINOR\2/g" \ - -e "s/\(m4_define(\[PATCH_LEVEL\],[ |\t]*\[\).*\(\])\)/\1$PATCH_LEVEL\2/g" \ - -e "s/\(m4_define(\[EXTRA_VERSION\],[ |\t]*\[\).*\(\])\)/\1$EXTRA_VERSION\2/g" \ - -e "s/\(m4_define(\[VERSION_STR\],[ |\t]*\[\).*\(\])\)/\1$VERSION_STR\2/g" \ - > "$top_srcdir/support/version.m4.new" - mv -f "$top_srcdir/support/version.m4.new" "$top_srcdir/support/version.m4" - - tr_new_version_str=`echo $new_version_str | sed 's,-,,'` - - # Append tag info in README - echo -e "\n`LC_ALL=en date +'%a %b %d %Y'` - release $new_version_str tagged." \ - " Tag: \"$branch_prefix-$new_version_tag\"" >> $README - # Commit changes - echo "*** Commit version depended files..." | tee -a $log - if test -z "$DEBUG_CVS_SH"; then - cvs commit -m "Release $new_version_str tagged" $README support/version.m4 >> $log || exit 1 - else - echo "cvs commit -m \"Release $new_version_str tagged\" $README support/version.m4" - fi - # Tag current sources - echo "*** Making CVS tag $branch_prefix-$new_version_tag" | tee -a $log - if test -z "$DEBUG_CVS_SH"; then - cvs -q tag $branch_prefix-$new_version_tag >> $log || exit 1 - else - echo "cvs -q tag $branch_prefix-$new_version_tag" - fi -} -# -# Spam current version -# -function report_version() -{ - # Get current versioninfo - get_current_version - echo "Current version info: $MAJOR.$MINOR.$PATCH_LEVEL"`test -n "$EXTRA_VERSION" && echo "-$EXTRA_VERSION"` -} -# -# -# -function make_a_branch() -{ - echo "*** Parse current version info..." | tee -a $log - # Get current versioninfo - get_current_version - # Increment version number - local major_increment=$1 - local minor_increment=$2 - local new_MAJOR=$((MAJOR+major_increment)) - local new_MINOR=`test "$major_increment" == '0' && echo "$((MINOR+minor_increment))" || echo '0'` - local new_version_str="$new_MAJOR.$new_MINOR" - local new_version_tag=`echo $new_version_str | sed 's/\./-/g'` - local branch_prefix='version' - - # Append tag info in README - set_maintainer_README - echo -e "\n`LC_ALL=en date +'%a %b %d %Y'` - made a branch for upcoming release ${new_version_str}." \ - " Tag: \"${branch_prefix}-${new_version_tag}\"" >> $README - # Commit changes - echo "*** Commit version depended files..." | tee -a $log - if test -z "$DEBUG_CVS_SH"; then - cvs commit -m "Made a branch for upcoming release $new_version_str" $README >> $log || exit 1 - else - echo "cvs commit -m \"Made a branch for upcoming release ${new_version_str}\" $README" - fi - # Tag current sources - echo "*** Making CVS branch ${branch_prefix}-${new_version_tag}" | tee -a $log - if test -z "$DEBUG_CVS_SH"; then - cvs -q tag -b ${branch_prefix}-${new_version_tag} >> $log || exit 1 - else - echo "cvs -q tag -b ${branch_prefix}-${new_version_tag}" - fi -} -# -# -# -function next_major_branch() -{ - make_a_branch 1 0 -} -function next_minor_branch() -{ - make_a_branch 0 1 -} -# -# -# -function code_stats() -{ - find_cmd=`echo find -name\ \'*.{c,h,cc,hh,icc,tcc,hxx,cpp,hpp}\'\ -o -false` - for i in `eval $find_cmd`; do - wc -l $i - done | awk ' \ - BEGIN \ - { \ - s=0; \ - f=0; \ - } \ - { \ - print $1"\t"$2; \ - s+=$1; \ - f++; \ - } \ - END \ - { \ - print "\n" s "\tTotal lines in " f " files"; \ - }' -} -# -# Update ChangeLog -# -function ChangeLog() -{ - cvs2cl=${CVS2CL:-`whereis cvs2cl | sed 's,cvs2cl: \(.*\),\1,' | awk '{print $1}'`} - test -z $cvs2cl && echo "Error: No cvs2cl tool found" && exit 1 - $cvs2cl -} - -# -# Remove files not registered in CVS -# -cvs_clean() -{ - check_CVS - perl $admindir/cvs-clean.pl -} - -# -# Simple reconfig -# -function simple_reconf() -{ - make -f Makefile.cvs cvs-clean - # - cvs_reconf - # Start configure with predefined args - ./configure --prefix=`pwd`/install -} - -# -# Full reconfig -# -function full_reconf() -{ - make -f Makefile.cvs cvs-clean - # - cvs_reconf - # - mkdir -p build - cd build - # Start configure with predefined args - ../configure --prefix=`pwd`/install -} - -# -# Scan source files for include files and show the result list -# -function scan_includes() -{ - list=`grep -r '^# *include *<.*>' * --include *.cc --include *.hh --include *.icc --include *.tcc --include *.hpp --include *.c --include *.h \ - | sed 's,^\(.*\):# *include *<\(.*\)>.*$,\1:\2,' \ - | grep -v '^test' \ - | sed 's,^.*:\(.*\)$,\1,' \ - | sort | uniq` - find_cmd=`echo find -name\ \'*.{c,h,cc,hh,icc,tcc,hxx,cpp,hpp}\'\ -o -false` - local_list=`eval $find_cmd` - final_list='' - for i in $list; do - if test -z "`echo $local_list | grep $i`"; then - final_list="$final_list $i" - fi - done - - header_printed='no' - for i in $final_list; do - if `echo $i | grep -q '^.*\.h$'`; then - if test "$header_printed" = 'no'; then - echo "C header files:" - header_printed='yes' - fi - echo $i | grep -v '.*cmdline\.h' - fi - done - - if test "$header_printed" = 'yes'; then - echo -ne '\n' - fi - header_printed='no' - for i in $final_list; do - if `echo $i | grep -v '\.' | grep -q '[a-z]'`; then - if test "$header_printed" = 'no'; then - echo -e "Std. C++ header files:" - header_printed='yes' - fi - echo $i - fi - done - - if test "$header_printed" = 'yes'; then - echo -ne '\n' - fi - header_printed='no' - for i in $final_list; do - if `echo $i | grep -q '^boost.*\.hpp$'`; then - if test "$header_printed" = 'no'; then - echo -e "Boost header files:" - header_printed='yes' - fi - echo $i - fi - done - - if test "$header_printed" = 'yes'; then - echo -ne '\n' - fi - header_printed='no' - for i in $final_list; do - if test -z "`echo $local_list | grep $i | grep -v '^boost.*\.hpp$' | grep -v '^.*\.h$' | grep -v '^[a-z]\+$'`"; then - if test "$header_printed" = 'no'; then - echo -e "Other headers:" - header_printed='yes' - fi - echo $i | grep -v '^boost.*\.hpp$' | grep -v '^.*\.h$' | grep -v '^[a-z]\+$' - fi - done -} - -# -# Main -# -top_srcdir=`pwd -P` -arg=`echo $1 | tr '\-.' __` -log="$admindir/maintainer.log" -tty=`tty` - -# Append blank lines after previous logged actions (if file exist) -if test -f $log; then - echo -e "\n\n" >> $log -fi - - -case $0 in - *reconf ) - make -f Makefile.cvs - ;; - * ) - # Check 1st argument for valid wrapped target name - case $arg in - major_release | minor_release | patch_release | \ - next_major_beta | next_minor_beta | next_patch_beta | \ - next_major_rc | next_minor_rc | next_patch_rc | release | \ - next_beta | next_rc | report_version | \ - next_major_branch | next_minor_branch | cvs_clean | \ - cvs_reconf | full_reconf | simple_reconf | \ - code_stats | scan_includes | ChangeLog ) - echo "*** Call to $arg" >> $log - $arg ;; - * ) echo "Incorrect parameters for $0" - exit 1 ;; - esac - ;; -esac -exit 0 Added: admin/trunk/devel.d/00-init-globals.sh =================================================================== --- admin/trunk/devel.d/00-init-globals.sh (rev 0) +++ admin/trunk/devel.d/00-init-globals.sh 2006-03-18 01:21:35 UTC (rev 11) @@ -0,0 +1,27 @@ +# +# $Id: 00-init-globals.sh,v 1.5 2006/03/16 19:06:02 alex Exp $ +# +# Initialize some global variables +# + +top_srcdir=${top_srcdir:-`pwd -P`} +log=${log:-$admindir/maintainer.log} + +# +# Indent of target name while print help +# +TGT_HELP_INDENT=5 +# +# Indent of help string for target while print help +# +DESCR_HELP_INDENT=25 + +# +# +# +BRANCH_PREFIX='version' + +# +# +# +TAG_PREFIX='rel' Property changes on: admin/trunk/devel.d/00-init-globals.sh ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + "Id Date Revision Author HeadURL" Name: svn:eol-style + native Added: admin/trunk/devel.d/01-echo.sh =================================================================== --- admin/trunk/devel.d/01-echo.sh (rev 0) +++ admin/trunk/devel.d/01-echo.sh 2006-03-18 01:21:35 UTC (rev 11) @@ -0,0 +1,104 @@ +#!/bin/bash +# +# $Id: 01-echo.sh,v 1.5 2006/03/17 14:31:00 alex Exp $ +# + +RES_COL=${COLUMNS:-0} +(( RES_COL == 0 )) && RES_COL=$(stty size 2>/dev/null | cut -d' ' -f2) +(( RES_COL > 0 )) || (( RES_COL = 80 )) +(( RES_COL = RES_COL - 7 )) +MOVE_TO_COL="echo -en \\033[${RES_COL}G" +COLOR_BRACKET="1;34" +COLOR_SUCCESS="1;32" +COLOR_FAILURE="1;31" +COLOR_WARNING="1;33" +COLOR_NORMAL="0;39" +SPAMMED_LINES_DEFAULT=1 +my_tty=`tty` +ebegin_in_action='' +spammed_lines=${SPAMMED_LINES_DEFAULT} + +function move_to_col() +{ + test -n "$1" && echo -en "\\033[$1G" +} +function move_above() +{ + test -n "$1" && echo -en "\\033[$1A" +} +function move_below() +{ + test -n "$1" && echo -en "\\033[$1B" +} + +function set_color() +{ + test -n "$1" && echo -en "\\033[$1m" +} + +function ebegin() +{ + echo -en "*** $1" + ebegin_in_action='y' +} + +function eend() +{ + ebegin_in_action='' + if test ! "${spammed_lines}" == "${SPAMMED_LINES_DEFAULT}"; then + move_above ${spammed_lines} + fi + if test ! "${my_tty}" == "not a tty"; then + move_to_col ${RES_COL} + set_color ${COLOR_BRACKET} + echo -n "[" + if test "$1" = "0"; then + set_color ${COLOR_SUCCESS} + echo -n " ok " + else + set_color ${COLOR_FAILURE} + echo -n " fail " + fi + set_color ${COLOR_BRACKET} + echo "]" + set_color ${COLOR_NORMAL} + fi + if test ! "${spammed_lines}" == "${SPAMMED_LINES_DEFAULT}"; then + move_below ${spammed_lines} + fi + spammed_lines=${SPAMMED_LINES_DEFAULT} + test ! "$1" == "0" -a -n "$2" && exit 1 +} + +function inc_lines_printed() +{ + if test -n "${ebegin_in_action}"; then + if test "${spammed_lines}" == "${SPAMMED_LINES_DEFAULT}"; then + echo + fi + spammed_lines=$((spammed_lines+1)) + fi +} + +function eerror() +{ + inc_lines_printed + echo -e "*** Error: $1" | tee -a ${log} +} + +function ewarning() +{ + inc_lines_printed + echo -e "*** Warning: $1" | tee -a ${log} +} + +function einfo() +{ + inc_lines_printed + echo -e "*** $1" | tee -a ${log} +} +function eecho() +{ + inc_lines_printed + echo -e "$*" +} Property changes on: admin/trunk/devel.d/01-echo.sh ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + "Id Date Revision Author HeadURL" Name: svn:eol-style + native Added: admin/trunk/devel.d/02-check-admindir.sh =================================================================== --- admin/trunk/devel.d/02-check-admindir.sh (rev 0) +++ admin/trunk/devel.d/02-check-admindir.sh 2006-03-18 01:21:35 UTC (rev 11) @@ -0,0 +1,15 @@ +#!/bin/sh +# +# $Id: 02-check-admindir.sh,v 1.3 2006/03/16 15:58:54 alex Exp $ +# +# Check calling correctness +# + +test -z "${admindir}" && eerror "admin/ directory is not set" && exit 1 + +# admin/ directory found -- it is OK to setup log file now ;) + +# Append blank lines after previous logged actions (if file exist) +if test -f $log; then + echo -e "\n\n" >> $log +fi Property changes on: admin/trunk/devel.d/02-check-admindir.sh ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + "Id Date Revision Author HeadURL" Name: svn:eol-style + native Added: admin/trunk/devel.d/40-help-support.sh =================================================================== --- admin/trunk/devel.d/40-help-support.sh (rev 0) +++ admin/trunk/devel.d/40-help-support.sh 2006-03-18 01:21:35 UTC (rev 11) @@ -0,0 +1,20 @@ +#!/bin/sh +# +# $Id: 40-help-support.sh,v 1.1 2006/03/16 15:58:54 alex Exp $ +# +# Functions to check calling correctness +# + +# +# $1 = target name +# $2 = description string +# +function print_target_help +{ + if test -n "$1"; then + move_to_col ${TGT_HELP_INDENT} + echo -n "$1" + move_to_col ${DESCR_HELP_INDENT} + test -n "$2" && echo "$2" || echo "<no description available>" + fi +} Property changes on: admin/trunk/devel.d/40-help-support.sh ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + "Id Date Revision Author HeadURL" Name: svn:eol-style + native Added: admin/trunk/devel.d/50-detect-vcs.sh =================================================================== --- admin/trunk/devel.d/50-detect-vcs.sh (rev 0) +++ admin/trunk/devel.d/50-detect-vcs.sh 2006-03-18 01:21:35 UTC (rev 11) @@ -0,0 +1,38 @@ +#!/bin/sh +# +# $Id: 50-detect-vcs.sh,v 1.3 2006/03/16 23:53:01 alex Exp $ +# + +# +# Current Version Control System used for given work copy +# +current_vcs="unknown" + +function detect_vcs() +{ + if test -d "${top_srcdir}/.svn"; then + current_vcs="subversion" + else if test -d "${top_srcdir}/CVS"; then + current_vcs="cvs" + fi fi + # import corresponding support module + test -f $admindir/devel.d/vcs-${current_vcs}-support.sh \ + && source $admindir/devel.d/vcs-${current_vcs}-support.sh +} + +# +# $1 - action name +# $* - other params +# +function call_vcs_action() +{ + if test -n "$1" -a "`type -t vcs_$1`" == 'function'; then + local fn=$1 + shift 1 + cmd="vcs_${fn} $*" + eval "$cmd" + else + eerror "Function '$1' not implemented for VCS currently used (${current_vcs})" + return 1 + fi +} Property changes on: admin/trunk/devel.d/50-detect-vcs.sh ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + "Id Date Revision Author HeadURL" Name: svn:eol-style + native Added: admin/trunk/devel.d/99-registrator.sh =================================================================== --- admin/trunk/devel.d/99-registrator.sh (rev 0) +++ admin/trunk/devel.d/99-registrator.sh 2006-03-18 01:21:35 UTC (rev 11) @@ -0,0 +1,15 @@ +#!/bin/sh +# +# $Id: 99-registrator.sh,v 1.1 2006/03/16 15:58:54 alex Exp $ +# + +# +# Every target plugin should add all implemented targets to this variable +# +REGISTERED_TARGETS='' + + +function reg_tgt_impl() +{ + test -n "$1" && REGISTERED_TARGETS="${REGISTERED_TARGETS}:$1" +} Property changes on: admin/trunk/devel.d/99-registrator.sh ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + "Id Date Revision Author HeadURL" Name: svn:eol-style + native Added: admin/trunk/devel.d/bootstrap.tgt.sh =================================================================== --- admin/trunk/devel.d/bootstrap.tgt.sh (rev 0) +++ admin/trunk/devel.d/bootstrap.tgt.sh 2006-03-18 01:21:35 UTC (rev 11) @@ -0,0 +1,123 @@ +#!/bin/sh +# +# $Id: bootstrap.tgt.sh,v 1.1 2006/03/17 13:21:37 alex Exp $ +# +# Work copy reconfigurator +# + +function bootstrap_help +{ + print_target_help 'bootstrap' 'Run autotools and friends (this is default target)' +} + +function bootstrap_impl() +{ + # Check than all requiered tools are present + ebegin "Looking whether needed tools are installed..." + if test -d $top_srcdir/po; then + gt_version=`gettextize --version | head -n 1` + einfo "Found gettext version: $gt_version" + case "$gt_version" in + *0.13* | *0.14*) ;; + *) + eerror "GNU gettext >= 0.13.x not found" + eend 1 1 + esac + fi + # No special checking for autotools version needed -- all done in configure.ac + if ! (`autoconf --version > /dev/null 2>&1` && `autoheader --version > /dev/null 2>&1`) ; then + eerror "No working autoconf found" + eend 1 1 + fi + if ! (`aclocal --version > /dev/null 2>&1` && `automake --version > /dev/null 2>&1`); then + eerror "No working automake found" + eend 1 1 + fi + eend 0 + + # Creating top level configure.ac file (if needed) + if test -f $top_srcdir/configure.ac.in; then + ebegin "Creating top level configuration files..." + if test -d "$top_srcdir/tests"; then + sed_cmd='s,^#[ |\t]*maintmode:,,' + else + sed_cmd='/^#[ |\t]*maintmode:/d' + fi + cat "$top_srcdir/configure.ac.in" | sed "$sed_cmd" > "$top_srcdir/configure.ac" 2>> $log + eend $? 1 + fi + + # Configure package to be ready for gettext + if test -d $top_srcdir/po; then + # Prepeare to run gettextize + ebegin "Create po/POTFILES.in..." + echo "# List of source files containing translatable strings." > $top_srcdir/po/POTFILES.in + # + # \todo Code below needs to be generalized!!! (i.e. w/o hardcoded path) + # + for i in `find $top_srcdir/main -name *.cc | sort`; do + echo -n "Checking $i ... " >> $log + if `grep -q '_("' $i`; then + echo $i | sed "s,$top_srcdir/,," >> $top_srcdir/po/POTFILES.in + echo "Add" >> $log + else + echo "Skip" >> $log + fi + done + eend 0 + ebegin "Create po/LINGUAS..." + ALL_LINGUAS=`ls $top_srcdir/po/*.po | sed -e 's,\.po,,g' -e "s,$top_srcdir/po/,,g"` + echo $ALL_LINGUAS | tee -a $log > $top_srcdir/po/LINGUAS + eend 0 + # Force gettext to install needed files + ebegin "Installing GNU gettext files..." + rm -f $top_srcdir/Makefile.am~ $top_srcdir/configure.in~ + if ! `autopoint --force >> $log 2>&1`; then + eend 1 1 + fi + # GNU gettext 0.11.x have a buggy Makefile.am and configure.in patching procedure + # so to avoid using its hacked files here originals restored... + test -f $top_srcdir/Makefile.am~ && mv -f $top_srcdir/Makefile.am~ $top_srcdir/Makefile.am + test -f $top_srcdir/configure.in~ && mv -f $top_srcdir/configure.in~ $top_srcdir/configure.in + rm -f $top_srcdir/po/*~ >/dev/null 2>&1 + rm -f $top_srcdir/admin/*~ >/dev/null 2>&1 + eend 0 + fi + + # Run remaining autotools + ebegin "Creating aclocal.m4... " + aclocal -I m4 >> $log 2>&1 + eend $? 1 + + ebegin "Creating configure script... " + autoconf >> $log 2>&1 + eend $? 1 + # Execute autoheader if needed (used) + if `grep -q '^[^#]*AC_CONFIG_HEADERS' $top_srcdir/configure.ac`; then + ebegin "Creating config.h template... " + autoheader >> $log 2>&1 + eend $? 1 + fi + ebegin "Creating Makefile templates... " + automake -a >> $log 2>&1 + eend $? 1 + if test -f "$top_srcdir/support/am_edit"; then + ebegin "Postprocessing Makefile templates..." + perl -w support/am_edit >> $log 2>&1 + eend $? 1 + fi + if test -f "$top_srcdir/support/post-bootstrap.sh"; then + source "$top_srcdir/support/post-bootstrap.sh" + test $(type -t "post_bootstrap") = "function" && post_bootstrap + fi + ebegin "Creating maintainer program links ... " + test -f $top_srcdir/reconf || ln -s $admindir/devel.sh $top_srcdir/reconf + # Misc + if test -f "$top_srcdir/support/directory"; then + icon=`ls -1 $top_srcdir/support/project-icon.* 2>/dev/null | head -n 1` + cat $top_srcdir/support/directory | sed "s,@icon@,$icon," > $top_srcdir/.directory + fi + eend 0 +} + +reg_tgt_impl 'bootstrap' Property changes on: admin/trunk/devel.d/bootstrap.tgt.sh ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + "Id Date Revision Author HeadURL" Name: svn:eol-style + native Added: admin/trunk/devel.d/change-log.tgt.sh =================================================================== --- admin/trunk/devel.d/change-log.tgt.sh (rev 0) +++ admin/trunk/devel.d/change-log.tgt.sh 2006-03-18 01:21:35 UTC (rev 11) @@ -0,0 +1,28 @@ +#!/bin/sh +# +# $Id: change-log.tgt.sh,v 1.1 2006/03/17 13:04:03 alex Exp $ +# +# Very simple code staticstics ;) +# + +function change_log_help() +{ + print_target_help 'change-log' 'Update ChangeLog file and commit it to CVS' +} +function change_log_impl() +{ + detect_vcs + case "${current_vcs}" in + cvs) + cvs2cl=${CVS2CL:-`whereis cvs2cl | sed 's,cvs2cl: \(.*\),\1,' | awk '{print $1}'`} + test -z $cvs2cl && eerror "Error: No cvs2cl tool found" && exit 1 + $cvs2cl + ;; + subversion) + eerror "Sorry, this functionality is not implemented yet for subversion" ;; + *) + eerror "Unable to detect what VCS do u use" ;; + esac +} + +reg_tgt_impl 'change_log' Property changes on: admin/trunk/devel.d/change-log.tgt.sh ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + "Id Date Revision Author HeadURL" Name: svn:eol-style + native Added: admin/trunk/devel.d/code-stats.tgt.sh =================================================================== --- admin/trunk/devel.d/code-stats.tgt.sh (rev 0) +++ admin/trunk/devel.d/code-stats.tgt.sh 2006-03-18 01:21:35 UTC (rev 11) @@ -0,0 +1,34 @@ +#!/bin/sh +# +# $Id: code-stats.tgt.sh,v 1.1 2006/03/16 15:58:54 alex Exp $ +# +# Very simple code staticstics ;) +# + +function code_stats_help() +{ + print_target_help 'code-stats' 'Collect some code statiscis (very simple ;)' +} +function code_stats_impl() +{ + find_cmd=`echo find -name\ \'*.{c,h,cc,hh,icc,tcc,hxx,cpp,hpp}\'\ -o -false` + for i in `eval $find_cmd`; do + wc -l $i + done | awk ' \ + BEGIN \ + { \ + s=0; \ + f=0; \ + } \ + { \ + print $1"\t"$2; \ + s+=$1; \ + f++; \ + } \ + END \ + { \ + print "\n" s "\tTotal lines in " f " files"; \ + }' +} + +reg_tgt_impl 'code_stats' Property changes on: admin/trunk/devel.d/code-stats.tgt.sh ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + "Id Date Revision Author HeadURL" Name: svn:eol-style + native Added: admin/trunk/devel.d/help.tgt.sh =================================================================== --- admin/trunk/devel.d/help.tgt.sh (rev 0) +++ admin/trunk/devel.d/help.tgt.sh 2006-03-18 01:21:35 UTC (rev 11) @@ -0,0 +1,24 @@ +#!/bin/sh +# +# $Id: help.tgt.sh,v 1.1 2006/03/16 15:58:54 alex Exp $ +# +# Work copy reconfigurator +# + +function help_help +{ + print_target_help 'help' 'Print help on developer targets' +} + +function help_impl() +{ + list=`echo ${REGISTERED_TARGETS} | sed 's,:, ,g'` + for i in ${list}; do + local t=`type -t ${i}_help` + if test "${t}" = "function"; then + ${i}_help + fi + done +} + +reg_tgt_impl 'help' Property changes on: admin/trunk/devel.d/help.tgt.sh ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + "Id Date Revision Author HeadURL" Name: svn:eol-style + native Added: admin/trunk/devel.d/scan-includes.tgt.sh =================================================================== --- admin/trunk/devel.d/scan-includes.tgt.sh (rev 0) +++ admin/trunk/devel.d/scan-includes.tgt.sh 2006-03-18 01:21:35 UTC (rev 11) @@ -0,0 +1,83 @@ +#!/bin/sh +# +# $Id: scan-includes.tgt.sh,v 1.1 2006/03/16 15:58:54 alex Exp $ +# +# Scan source files for include files and show the result list +# + +function scan_includes_help +{ + print_target_help 'scan-includes' 'Rescan source files and show list of external included files' +} + +function scan_includes_impl() +{ + list=`grep -r '^# *include *<.*>' * --include *.cc --include *.hh --include *.icc --include *.tcc --include *.hpp --include *.c --include *.h \ + | sed 's,^\(.*\):# *include *<\(.*\)>.*$,\1:\2,' \ + | grep -v '^test' \ + | sed 's,^.*:\(.*\)$,\1,' \ + | sort | uniq` + find_cmd=`echo find -name\ \'*.{c,h,cc,hh,icc,tcc,hxx,cpp,hpp}\'\ -o -false` + local_list=`eval $find_cmd` + final_list='' + for i in $list; do + if test -z "`echo $local_list | grep $i`"; then + final_list="$final_list $i" + fi + done + + header_printed='no' + for i in $final_list; do + if `echo $i | grep -q '^.*\.h$'`; then + if test "$header_printed" = 'no'; then + echo "C header files:" + header_printed='yes' + fi + echo $i | grep -v '.*cmdline\.h' + fi + done + + if test "$header_printed" = 'yes'; then + echo -ne '\n' + fi + header_printed='no' + for i in $final_list; do + if `echo $i | grep -v '\.' | grep -q '[a-z]'`; then + if test "$header_printed" = 'no'; then + echo -e "Std. C++ header files:" + header_printed='yes' + fi + echo $i + fi + done + + if test "$header_printed" = 'yes'; then + echo -ne '\n' + fi + header_printed='no' + for i in $final_list; do + if `echo $i | grep -q '^boost.*\.hpp$'`; then + if test "$header_printed" = 'no'; then + echo -e "Boost header files:" + header_printed='yes' + fi + echo $i + fi + done + + if test "$header_printed" = 'yes'; then + echo -ne '\n' + fi + header_printed='no' + for i in $final_list; do + if test -z "`echo $local_list | grep $i | grep -v '^boost.*\.hpp$' | grep -v '^.*\.h$' | grep -v '^[a-z]\+$'`"; then + if test "$header_printed" = 'no'; then + echo -e "Other headers:" + header_printed='yes' + fi + echo $i | grep -v '^boost.*\.hpp$' | grep -v '^.*\.h$' | grep -v '^[a-z]\+$' + fi + done +} + +reg_tgt_impl 'scan_includes' Property changes on: admin/trunk/devel.d/scan-includes.tgt.sh ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + "Id Date Revision Author HeadURL" Name: svn:eol-style + native Added: admin/trunk/devel.d/total-cleanup.tgt.sh =================================================================== --- admin/trunk/devel.d/total-cleanup.tgt.sh (rev 0) +++ admin/trunk/devel.d/total-cleanup.tgt.sh 2006-03-18 01:21:35 UTC (rev 11) @@ -0,0 +1,26 @@ +#!/bin/sh +# +# $Id: total-cleanup.tgt.sh,v 1.1 2006/03/17 13:04:03 alex Exp $ +# +# Remove files not registered in CVS +# + +function total_cleanup_help() +{ + print_target_help 'total-cleanup' 'Remove all files and dirs not registered in VCS' +} + +function total_cleanup_impl() +{ + detect_vcs + case "${current_vcs}" in + cvs) + perl $admindir/cvs-clean.pl ;; + subversion) + eerror "Sorry, this functionality is not implemented yet for subversion" ;; + *) + eerror "Unable to detect what VCS do u use" ;; + esac +} + +reg_tgt_impl 'total_cleanup' Property changes on: admin/trunk/devel.d/total-cleanup.tgt.sh ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + "Id Date Revision Author HeadURL" Name: svn:eol-style + native Added: admin/trunk/devel.d/vcs-cvs-support.sh =================================================================== --- admin/trunk/devel.d/vcs-cvs-support.sh (rev 0) +++ admin/trunk/devel.d/vcs-cvs-support.sh 2006-03-18 01:21:35 UTC (rev 11) @@ -0,0 +1,61 @@ +#!/bin/sh +# +# $Id: vcs-cvs-support.sh,v 1.3 2006/03/16 23:53:01 alex Exp $ +# +# VCS support module for CVS +# + +current_vcs_message='' + +# +# Set message which will be used for next operations +# +function vcs_message() +{ + current_vcs_message="$*" +} + +# +# $* = files to commit +# +function vcs_commit() +{ + msg="${current_vcs_message}" + test -z "${msg}" && msg="<no message>" + cmd="cvs commit -m '$msg' $* >> ${log} 2>&1" + if test -n "${DEBUG_DEVEL_SH}"; then + einfo "${cmd}" + else + eval ${cmd} + fi +} + +# +# $1 = tag name +# +function vcs_tag() +{ + tag=$1 + test -z "${tag}" && eerror "No tag given to VCS driver" + cmd="cvs -q tag "${tag}" >> ${log} 2>&1" + if test -n "${DEBUG_DEVEL_SH}"; then + einfo "${cmd}" + else + eval ${cmd} + fi +} + +# +# $1 = tag name +# +function vcs_branch() +{ + tag=$1 + test -z "${tag}" && eerror "No tag given to VCS driver" + cmd="cvs -q tag -b "${tag}" >> ${log} 2>&1" + if test -n "${DEBUG_DEVEL_SH}"; then + einfo "${cmd}" + else + eval ${cmd} + fi +} Property changes on: admin/trunk/devel.d/vcs-cvs-support.sh ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + "Id Date Revision Author HeadURL" Name: svn:eol-style + native Added: admin/trunk/devel.d/vcs-subversion-support.sh =================================================================== --- admin/trunk/devel.d/vcs-subversion-support.sh (rev 0) +++ admin/trunk/devel.d/vcs-subversion-support.sh 2006-03-18 01:21:35 UTC (rev 11) @@ -0,0 +1,28 @@ +#!/bin/sh +# +# $Id: vcs-subversion-support.sh,v 1.3 2006/03/17 14:13:38 alex Exp $ +# +# VCS support module for Subversion +# + +current_vcs_message='' + +# +# Set message which will be used for next operations +# +function vcs_message() +{ + current_vcs_message="$*" +} + +function vcs_commit() +{ +} + +function vcs_tag() +{ +} + +function vcs_branch() +{ +} Property changes on: admin/trunk/devel.d/vcs-subversion-support.sh ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + "Id Date Revision Author HeadURL" Name: svn:eol-style + native Added: admin/trunk/devel.d/versioning-support.tgt.sh =================================================================== --- admin/trunk/devel.d/versioning-support.tgt.sh (rev 0) +++ admin/trunk/devel.d/versioning-support.tgt.sh 2006-03-18 01:21:35 UTC (rev 11) @@ -0,0 +1,340 @@ +#!/bin/sh +# +# $Id: versioning-support.tgt.sh,v 1.3 2006/03/16 23:53:01 alex Exp $ +# +# Packege version management +# + +# +# Get current version +# +function get_current_version() +{ + local version_info=`cat ${top_srcdir}/support/version.m4 \ + | grep '^[ |\t]*m4_define.*$' \ + | grep -v 'VERSION_STR' \ + | sed -e 's/\(.*\)dnl.*/\1/' \ + -e 's/\(.*\)#.*/\1/' \ + -e 's/m4_define(\[\([A-Z_]\+\)\],[ |\t]*\[\(.*\)\])/\1="\2"/g'` + eval ${version_info} +} +# +# Make Release +# +function make_release() +{ + ebegin "Parse current version info..." + if test ! -f ${top_srcdir}/support/version.m4; then + eerror "Version info file not found" + eend 1 1 + fi + # Get current versioninfo + get_current_version + test -n "${MAJOR}" -o -n "${MINOR}" -o -n "${PATCH_LEVEL}" + eend $? 1 + # Save previous version + O_MAJOR=${MAJOR}; O_MINOR=${MINOR}; O_PATCH_LEVEL=${PATCH_LEVEL}; O_EXTRA_VERSION=${EXTRA_VERSION} + # Increment version number + # Is current version already marked as beta or RC? + if test -z "${EXTRA_VERSION}"; then + case "$1" in + release | beta | rc ) + eerror "You can't make this target because current version ${MAJOR}.${MINOR}.${PATCH_LEVEL} is not a beta or RC" + einfo "Targets you can make: (major|minor|patch)-release, next-(major|minor|patch)-(beta|rc)" + exit 1 ;; + esac + # No. + case "$1" in + major ) MAJOR=$((MAJOR+1)); MINOR=0; PATCH_LEVEL=0 ;; + minor ) MINOR=$((MINOR+1)); PATCH_LEVEL=0 ;; + patch ) PATCH_LEVEL=$((PATCH_LEVEL+1)) ;; + *) eerror "Hmm... Smth wrong with arg to make_release()"; exit 1 ;; + esac + # Should we start RC or beta branch? + if test -n "$2"; then + EXTRA_VERSION="${2}1" + fi + else + case "$1" in + major | minor | patch ) + eerror "You can't make this target while ${MAJOR}.${MINOR}.${PATCH_LEVEL} version is not released" + einfo "Maybe you need one of 'release', 'next-rc' or 'next-beta' ??" + exit 1 ;; + esac + # If $2 == '' it will be release! :) + if test -z "$2"; then + # Yes. Just clear extra version mark and leave main digits as is... + EXTRA_VERSION="" + else + # Continue to make next beta or RC... + # Is current extra version will be the same? + local ce=`echo "${EXTRA_VERSION}" | sed 's,[0-9]\+,,'` + if test "$2" == "${ce}"; then + # Yes. Increment version number... + local cn=`echo "${EXTRA_VERSION}" | sed 's,[a-z]\+,,'` + EXTRA_VERSION="${2}$((cn+1))" + else + # No. Only beta can become RC but not reverse... + if test "$2" == "rc" -a "${ce}" == "beta"; then + EXTRA_VERSION="rc1" + else + eerror "Can't make $MAJOR.$MINOR.$PATCH_LEVEL-${2}1' version from $MAJOR.$MINOR.$PATCH_LEVEL-$EXTRA_VERSION." + einfo "You can make 'next-rc' or 'release' only." + exit 1 + fi + fi + fi + fi + # Commit changes + post_increment_actions +} +# All functions below can be started only at release state... +function major_release_impl() # Major Release +{ + einfo "`date` -- Making 'major release'" + make_release "major" +} +function minor_release_impl() # Minor Release +{ + einfo "`date` -- Making 'minor release'" + make_release "minor" +} +function patch_release_impl() # Next Patch Level +{ + einfo "`date` -- Making 'patch release'" + make_release "patch" +} +function next_major_beta_impl() # Major Release (beta) +{ + einfo "`date` -- Making 'major beta'" + make_release "major" "beta" +} +function next_minor_beta_impl() # Minor Release (beta) +{ + einfo "`date` -- Making 'minor beta'" + make_release "minor" "beta" +} +function next_patch_beta_impl() # Patch Level Release (beta) +{ + einfo "`date` -- Making 'patch beta'" + make_release "patch" "beta" +} +function next_major_rc_impl() # Major Release (RC) +{ + einfo "`date` -- Making 'major release candidate'" + make_release "major" "rc" +} +function next_minor_rc_impl() # Minor Release (RC) +{ + einfo "`date` -- Making 'minor release candidate'" + make_release "minor" "rc" +} +function next_patch_rc_impl() # Patch Level Release (RC) +{ + einfo "`date` -- Making 'patch release candidate'" + make_release "patch" "rc" +} +function release_impl() # Make release of current version +{ + einfo "`date` -- Making 'release'" + make_release "release" +} +function next_beta_impl() # Make next beta of current version +{ + einfo "`date` -- Making 'next beta'" + make_release "beta" "beta" +} +function next_rc_impl() # Make next rc of current version +{ + einfo "`date` -- Making 'next release candidate'" + make_release "rc" "rc" +} +# +# Get filename of maintainers README +# +function set_maintainer_README() +{ + if test -f "${top_srcdir}/README.maint"; then + README="README.maint" + else + README="README" + fi +} +# +# +# +function post_increment_actions() +{ + set_maintainer_README + local old_version_str="${O_MAJOR}.${O_MINOR}.${O_PATCH_LEVEL}"`test -n "${O_EXTRA_VERSION}" && echo -${O_EXTRA_VERSION}` + local new_version_str="${MAJOR}.${MINOR}.${PATCH_LEVEL}"`test -n "${EXTRA_VERSION}" && echo -${EXTRA_VERSION}` + local new_version_tag=`echo ${new_version_str} | sed 's/\./-/g'` + local tag_prefix=${TAG_PREFIX} + + einfo "Version info: ${old_version_str} ==> ${new_version_str}" + ebegin "Patch version depended files..." + + # Rewrite new versioninfo + VERSION_STR="${MAJOR}.${MINOR}.${PATCH_LEVEL}"`test -n "${EXTRA_VERSION}" && echo "-${EXTRA_VERSION}"` + cat "${top_srcdir}/support/version.m4" \ + | sed -e "s/\(m4_define(\[MAJOR\],[ |\t]*\[\).*\(\])\)/\1${MAJOR}\2/g" \ + -e "s/\(m4_define(\[MINOR\],[ |\t]*\[\).*\(\])\)/\1${MINOR}\2/g" \ + -e "s/\(m4_define(\[PATCH_LEVEL\],[ |\t]*\[\).*\(\])\)/\1${PATCH_LEVEL}\2/g" \ + -e "s/\(m4_define(\[EXTRA_VERSION\],[ |\t]*\[\).*\(\])\)/\1${EXTRA_VERSION}\2/g" \ + -e "s/\(m4_define(\[VERSION_STR\],[ |\t]*\[\).*\(\])\)/\1${VERSION_STR}\2/g" \ + > "${top_srcdir}/support/version.m4.new" + mv -f "${top_srcdir}/support/version.m4.new" "${top_srcdir}/support/version.m4" 2>>$log + eend $? 1 + tr_new_version_str=`echo ${new_version_str} | sed 's,-,,'` + + # Append tag info in README + echo -e "\n`LC_ALL=en date +'%a %b %d %Y'` - release ${new_version_str} tagged." \ + " Tag: \"${tag_prefix}-${new_version_tag}\"" >> ${README} + detect_vcs + # Commit changes + ebegin "Commit version depended files..." + call_vcs_action message "'Release ${new_version_str} tagged'" + call_vcs_action commit ${README} support/version.m4 + eend $? 1 + # Tag current sources + ebegin "Making CVS tag ${tag_prefix}-${new_version_tag}" + call_vcs_action tag "'${tag_prefix}-${new_version_tag}'" + eend $? 1 +} +# +# +# +function make_a_branch() +{ + ebegin "*** Parse current version info..." + if test ! -f ${top_srcdir}/support/version.m4; then + eend $? + eerror "Version info file not found" + exit 1 + fi + # Get current versioninfo + get_current_version + test -z "${MAJOR}" -o -z "${MINOR}" -o -z "${PATCH_LEVEL}" + eend $? 1 + # Increment version number + local major_increment=$1 + local minor_increment=$2 + local new_MAJOR=$((MAJOR+major_increment)) + local new_MINOR=`test "${major_increment}" == '0' && echo "$((MINOR+minor_increment))" || echo '0'` + local new_version_str="${new_MAJOR}.${new_MINOR}" + local new_version_tag=`echo ${new_version_str} | sed 's/\./-/g'` + local tag_prefix=${BRANCH_PREFIX} + + # Append tag info in README + set_maintainer_README + echo -e "\n`LC_ALL=en date +'%a %b %d %Y'` - made a branch for upcoming release ${new_version_str}." \ + " Tag: \"${tag_prefix}-${new_version_tag}\"" >> ${README} + detect_vcs + # Commit changes + ebegin "Commit version depended files..." + call_vcs_action message "'Made a branch for upcoming release ${new_version_str}'" + call_vcs_action commit ${README} + eend $? 1 + # Tag current sources + ebegin "Making CVS branch ${tag_prefix}-${new_version_tag}" + call_vcs_action branch "${tag_prefix}-${new_version_tag}" + eend $? 1 +} +# +# +# +function next_major_branch_impl() +{ + make_a_branch 1 0 +} +function next_minor_branch_impl() +{ + make_a_branch 0 1 +} + +# +# Spam current version +# +function report_version_impl() +{ + # Get current versioninfo + get_current_version + echo "Current version info: ${MAJOR}.${MINOR}.${PATCH_LEVEL}"`test -n "${EXTRA_VERSION}" && echo "-${EXTRA_VERSION}"` +} + +function major_release_help +{ + print_target_help 'major_release' 'Start next major generation with release (x++.0.0)' +} +function minor_release_help +{ + print_target_help 'minor_release' 'Start next minor generation with release (x.y++.0)' +} +function patch_release_help +{ + print_target_help 'patch_release' 'Start next patch generation with release (x.y.z++)' +} +function next_major_beta_help +{ + print_target_help 'next_major_beta' 'Start next major generation with beta1 version (x++.0.0-beta1)' +} +function next_minor_beta_help +{ + print_target_help 'next_minor_beta' 'Start next minor generation with beta1 version (x.y++.0-beta1)' +} +function next_patch_beta_help +{ + print_target_help 'next_patch_beta' 'Start next patch generation with beta1 version (x.y.z++-beta1)' +} +function next_major_rc_help +{ + print_target_help 'next_major_rc' 'Start next major generation with RC1 extra version (x++.0.0-rc1)' +} +function next_minor_rc_help +{ + print_target_help 'next_minor_rc' 'Start next minor generation with RC1 extra version (x.y++.0-rc1)' +} +function next_patch_rc_help +{ + print_target_help 'next_patch_rc' 'Start next patch generation with RC1 extra version (x.y.z++-rc1)' +} +function release_help +{ + print_target_help 'release' 'Drop extra version info (i.e. x.y.z-[beta|rc]N --> x.y.z)' +} +function next_beta_help +{ + print_target_help 'next_beta' 'Increment current beta number (x.y.z-betaN++)' +} +function next_rc_help +{ + print_target_help 'next_rc' 'Increment current RC number (x.y.z-betaN --> x.y.z-rc1 or x.y.z-rcN++)' +} +function report_version_help +{ + print_target_help 'report_version' 'Just report current version' +} +function next_major_branch_help +{ + print_target_help 'next_major_branch' 'Make a branch for next major version (x++.0) /will not change current version/' +} +function next_minor_branch_help +{ + print_target_help 'next_minor_branch' 'Make a branch for next minor version (x.y++) /will not change current version/' +} + +reg_tgt_impl major_release +reg_tgt_impl minor_release +reg_tgt_impl patch_release +reg_tgt_impl next_major_beta +reg_tgt_impl next_minor_beta +reg_tgt_impl next_patch_beta +reg_tgt_impl next_major_rc +reg_tgt_impl next_minor_rc +reg_tgt_impl next_patch_rc +reg_tgt_impl release +reg_tgt_impl next_beta +reg_tgt_impl next_rc +reg_tgt_impl report_version +reg_tgt_impl next_major_branch +reg_tgt_impl next_minor_branch Property changes on: admin/trunk/devel.d/versioning-support.tgt.sh ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + "Id Date Revision Author HeadURL" Name: svn:eol-style + native Added: admin/trunk/devel.sh =================================================================== --- admin/trunk/devel.sh (rev 0) +++ admin/trunk/devel.sh 2006-03-18 01:21:35 UTC (rev 11) @@ -0,0 +1,47 @@ +#!/bin/sh +# +# $Id: devel.sh,v 1.4 2006/03/17 13:21:37 alex Exp $ +# + +# +# Initialize core -- execute startup actions +# +self=$0 +list=`ls ${admindir}/devel.d/*.sh 2>/dev/null | sort | grep '[0-9]\+'` +for i in ${list}; do + source ${i} +done + +# +# Import Makefile.cvs target implementation plugins +# +list=`ls ${admindir}/devel.d/*.tgt.sh 2>/dev/null | sort` +for i in ${list}; do + source ${i} +done + +# +# Check that requested target registered and call it +# +req_target=`echo $1 | tr '\-.' '__'` +found=`echo ${REGISTERED_TARGETS} | grep "${req_target}"` +if test -n "${req_target}" -a -z "${found}"; then + # Print error if some target requested but not found + eerror "Unknown target ${req_target}" + exit 1 +fi +# Execute target implementation if found and exit +if test -n "${req_target}"; then + echo "*** `date` -- ${req_target} ***" >> ${log} + if test "`type -t ${req_target}_impl`" == "function"; then + ${req_target}_impl + exit 0 + else + eerror "Target defined ${req_target} but not implemented" + exit 1 + fi +fi + +if test -n "`echo ${self} | grep 'reconf'`"; then + make -f Makefile.cvs +fi Property changes on: admin/trunk/devel.sh ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + "Id Date Revision Author HeadURL" Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |