2 # $Id: release_update.sh,v 1.6 2005/02/20 14:51:26 henoheno Exp $
3 # $CVSKNIT_Id: release.sh,v 1.11 2004/05/28 14:26:24 henoheno Exp $
4 # Release automation script for PukiWiki
5 # ==========================================================
6 Copyright='(C) 2002-2004 minix-up project, All Rights Reserved'
7 Homepage='http://cvsknit.sourceforge.net/'
8 License='BSD Licnese, NO WARRANTY'
11 # Functions -----------------------------------------------
12 warn(){ echo "$*" 1>&2 ; }
13 err() { warn "Error: $*" ; exit 1 ; }
16 warn "USAGE: `basename $0` VERSION_FROM VERSION_TO (VERSION = '1.4.3_rc1' like)"
22 [1-9].[0-9] | [1-9].[0-9] ) tag="r$1" ;;
23 [1-9].[0-9]_rc[1-9] | [1-9].[0-9]_rc[1-9] ) tag="r$1" ;;
24 [1-9].[0-9].[0-9] | [1-9].[0-9].[0-9][0-9] ) tag="r$1" ;;
25 [1-9].[0-9].[0-9]_rc[1-9] | [1-9].[0-9].[0-9][0-9]_rc[1-9] ) tag="r$1" ;;
26 [1-9].[0-9].[0-9]_[1-9] | [1-9].[0-9].[0-9][0-9]_[1-9] ) tag="r$1" ;;
27 '' ) usage ; return 1 ;;
28 * ) warn "Error: Invalid string: $1" ; usage ; return 1 ;;
30 echo "$tag" | tr '.' '_'
33 # -------------------------------------------
39 tag_from="` check_versiontag "$rel_from" `" || exit
40 tag_to="` check_versiontag "$rel_to" `" || exit
42 if [ "x$rel_from" = "x$rel_to" ] ; then
43 warn "Error: VERSION_FROM and VERSION_TO is equivalent"
47 # -------------------------------------------
51 CVSROOT=":pserver:anonymous@cvs.sourceforge.jp:/cvsroot/$mod"
55 # -------------------------------------------
57 # Checkout the module with VERSION_FROM
58 test ! -d "$pkg_dir" || err "There's already a directory: $pkg_dir"
59 echo cvs -z3 -d "$CVSROOT" co -r "$tag_from" -d "$pkg_dir" "$mod"
60 cvs -z3 -d "$CVSROOT" co -r "$tag_from" -d "$pkg_dir" "$mod"
61 test -d "$pkg_dir" || err "There isn't a directory: $pkg_dir"
63 # Merge VERSION_FROM to VERSION_TO
65 echo cvs up -dP -j "$tag_from" -j "$tag_to"
66 cvs up -dP -j "$tag_from" -j "$tag_to"
68 # Cleanup backup files by cvs
69 find . -type f -name ".#*" | xargs rm -f
72 # Remove files those are not Added or Modified
75 find . -type f | grep -v /CVS/ | while read line ; do
76 result="` cvs -nq up "$line" 2>/dev/null | grep '^[AM] ' | cut -b 3- `"
77 test "x$result" != "x" || rm -f "$line"
83 # Remove CVS directories
84 find "$pkg_dir" -type d -name "CVS" | xargs rm -Rf
86 # Remove '.cvsignore' if exists
87 echo find "$pkg_dir" -type f -name '.cvsignore' -delete
88 find "$pkg_dir" -type f -name '.cvsignore' -delete
90 # Remove emptied directories
91 find "$pkg_dir" -type d -empty | xargs rmdir
92 find "$pkg_dir" -type d -empty | xargs rmdir
98 find . -type d | while read line; do
101 find . -type f | while read line; do
105 # Add write permission for PukiWiki
106 chmod 777 attach backup cache counter diff trackback wiki* 2>/dev/null
107 chmod 666 wiki*/*.txt cache/*.dat 2>/dev/null
112 echo tar cf - "$pkg_dir" \| gzip -9 \> "update_$rel_to.tar.gz"
113 tar cf - "$pkg_dir" | gzip -9 > "update_$rel_to.tar.gz"
116 #echo zip -r9 "update_$rel_to.zip" "$pkg_dir"
117 # zip -r9 "update_$rel_to.zip" "$pkg_dir"
119 #echo rm -Rf "$pkg_dir"