X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=release.sh;h=968a8cb22627d7477b1e536eece3627bb239d842;hb=ccc91a517bcee4460f5bb556911d6d17b70a550e;hp=ad450ec530f54f3941aa6b9a0ec6741d1cb2c11d;hpb=0fe6ea78160ed1b0c7adb9d7d7817591ec78736a;p=pukiwiki%2Fpukiwiki_devel.git diff --git a/release.sh b/release.sh index ad450ec..968a8cb 100755 --- a/release.sh +++ b/release.sh @@ -1,11 +1,11 @@ #!/bin/sh -# $Id: release.sh,v 1.20 2005/04/17 05:13:18 henoheno Exp $ +# $Id: release.sh,v 1.35 2011/06/05 14:22:51 henoheno Exp $ # $CVSKNIT_Id: release.sh,v 1.11 2004/05/28 14:26:24 henoheno Exp $ # Release automation script for PukiWiki # ========================================================== - Copyright='(C) 2002-2004 minix-up project, All Rights Reserved' + Copyright='(C) 2002-2004,2011 minix-up project, All Rights Reserved' Homepage='http://cvsknit.sourceforge.net/' - License='BSD Licnese, NO WARRANTY' + License='(also revised)BSD Licnese, NO WARRANTY' # # Name and Usage -------------------------------------------- @@ -18,9 +18,13 @@ usage(){ warn " --nopkg Suppress creating archive (Extract and chmod only)" warn " --norm --nopkg, and remove nothing (.cvsignore etc)" warn " --co --norm, and use 'checkout' command instead of 'export'" + warn " --utf8 Create UTF-8 converted archive (EXPERIMENTAL)" warn " -z|--zip Create *.zip archive" warn " --move-dist Move *.ini.php => *.ini-dist.php" warn " --copy-dist Move, and Copy *.ini.php <= *.ini-dist.php" + warn " --git Use git repository" + warn " --repo Git repository_url" + warn " --name package_name" return 1 } @@ -45,7 +49,8 @@ check_versiontag(){ [1-9].[0-9].[0-9] | [1-9].[0-9].[0-9][0-9] ) tag="r$1" ;; [1-9].[0-9].[0-9]_[a-z]* | [1-9].[0-9].[0-9][0-9]_[a-z]* ) tag="r$1" ;; [1-9].[0-9].[0-9]_[1-9] | [1-9].[0-9].[0-9][0-9]_[1-9] ) tag="r$1" ;; - HEAD | r1_3_3_branch ) tag="$rel" ;; + [1-9].[0-9].[0-9]_[1-9]_[a-z]* | [1-9].[0-9].[0-9][0-9]_[1-9]_[a-z]* ) tag="r$1" ;; + HEAD | r1_3_3_branch | branch_r* ) tag="$rel" ;; '' ) usage ; return 1 ;; * ) warn "Error: Invalid string: $1" ; usage ; return 1 ;; esac @@ -82,9 +87,13 @@ getopt(){ _arg=noarg --norm|--noremove ) echo _nopkg _noremove 1 ;; --co|--checkout ) echo _nopkg _noremove _checkout 1 ;; -z|--zip ) echo _zip 1 ;; + --ut|--utf|--utf8|--utf-8 ) echo _utf8 1 ;; --copy-dist ) echo _copy_dist 1 ;; --move-dist ) echo _move_dist 1 ;; -d ) echo _CVSROOT 2 ; _arg="$2" ;; + --git ) echo _git 1 ;; + --repo ) echo _gitrepo 2 ; _arg="$2" ;; + --name ) echo _pkg_name 2 ; _arg="$2" ;; -* ) warn "Error: Unknown option \"$1\"" ; return 1 ;; * ) echo OTHER ;; esac @@ -111,6 +120,8 @@ while [ $# -gt 0 ] ; do _help ) usage ;; _CVSROOT) CVSROOT="$2" ;; + _gitrepo) gitrepo="$2" ;; + _pkg_name) pkg_name="$2" ;; _* ) eval "_$ch"=on ;; * ) break 2 ;; @@ -121,7 +132,40 @@ done # No argument if [ $# -eq 0 ] ; then usage ; exit ; fi -# Archiver check -------------------------------------------- +# Utility check --------------------------------------------- + +if [ "$__utf8" ] ; then + + # nkf + which nkf || err "nkf version 2.0 or later (UTF-8 enabled) not found" + nkf_version="` nkf -v 2>&1 | sed -e '/^Network Kanji Filter/!d' -e 's/.* Version \([1-9]\).*/\1/' `" + if [ "$nkf_version" = '1' -o "$nkf_version" = '0' ] ; then + err "nkf found but not seems 2.x (UTF-8 enabled) or later" + fi + + # encls.php + encls="./encls.php" + if [ ! -f "$encls" ] + then err "encls not found" + else + php="` which php `" || err "php-cli not found" + encls="$php `pwd`/$encls" + fi + + convert(){ + for list in "$@" ; do + # NOTE: Specify '-E'(From EUC-JP) otherwise skin file will be collapsed + nkf -Ew "$list" > "$list.$$.tmp" && mv "$list.$$.tmp" "$list" && echo " $list" + done + } + convert_EUCJP2UTF8(){ + for list in "$@" ; do + # Very rough conversion! + #sed 's/EUC-JP/UTF-8/g' "$list" > "$list.$$.tmp" && mv "$list.$$.tmp" "$list" + sed 's#^//UTF-8:##' "$list" > "$list.$$.tmp" && mv "$list.$$.tmp" "$list" + done + } +fi > /dev/null if [ -z "$__zip" ] then @@ -134,11 +178,19 @@ fi > /dev/null # Argument check -------------------------------------------- rel="$1" -tag="` check_versiontag "$rel" `" -pkg_dir="${mod}-${rel}" -# Export the module ----------------------------------------- +if [ "$pkg_name" ] ; then + pkg_dir="$pkg_name" + tag="$rel" +else + tag="` check_versiontag "$rel" `" || exit 1 + pkg_dir="${mod}-${rel}" + if [ "$__utf8" ] ; then + pkg_dir="${pkg_dir}_utf8" + fi +fi +# Export the module ----------------------------------------- test ! -d "$pkg_dir" || err "There's already a directory: $pkg_dir" if [ -z "$__checkout" ] @@ -146,17 +198,67 @@ then cmd="export" else cmd="checkout" fi -echo cvs -z3 -d "$CVSROOT" -q "$cmd" -r "$tag" -d "$pkg_dir" "$mod" - cvs -z3 -d "$CVSROOT" -q "$cmd" -r "$tag" -d "$pkg_dir" "$mod" +if [ "$__git" ] ; then + echo git clone "$gitrepo" "$pkg_dir" + git clone "$gitrepo" "$pkg_dir" + echo cd $pkg_dir + cd $pkg_dir + echo git reset --hard "$tag" + git reset --hard "$tag" + cd .. +else + exit + echo cvs -z3 -d "$CVSROOT" -q "$cmd" -r "$tag" -d "$pkg_dir" "$mod" + cvs -z3 -d "$CVSROOT" -q "$cmd" -r "$tag" -d "$pkg_dir" "$mod" +fi -test -d "$pkg_dir" || err "There is'nt a directory: $pkg_dir" +test -d "$pkg_dir" || err "There isn't a directory: $pkg_dir" # Remove '.cvsignore' if exists ----------------------------- test -z "$__noremove" && { + if [ "$__git" ] ; then + echo rm -rf "$pkg_dir/.git" + rm -rf "$pkg_dir/.git" + fi echo find "$pkg_dir" -type f -name '.cvsignore' "| xargs rm -f" find "$pkg_dir" -type f -name '.cvsignore' | xargs rm -f } + +# Conversion ------------------------------------------------ + +if [ "$__utf8" ] ; then + echo "Converting EUC-JP => UTF-8 ..." + find "$pkg_dir" -type f \( -name "*.txt" -or -name "*.php" -or -name "*.lng" -or -name "*.dat" -or -name "*.ref" \) | + while read line; do + case "$line" in + "$pkg_dir"/zh-CN.lng.php ) ;; # UTF-8 already, Do nothing + * ) convert "$line" ;; + esac + done + + # Replace 'EUC-JP' => 'UTF-8' + ( cd "$pkg_dir" && + convert_EUCJP2UTF8 lib/init.php skin/pukiwiki.skin*.php + ) + + # Filename encoded 'encoded-EUC-JP' to 'encoded-UTF-8' + echo "Renaming encoded-EUC-JP => encoded-UTF-8 ..." + ( cd "$pkg_dir" && + for dir in wiki wiki.en cache; do + ( cd "$dir" && + ls *.txt *.ref *.rel 2>/dev/null | while read line; do + target="`$encls "$line" 2>/dev/null`" || exit 1 + if [ "x$line" != "x$target" ] ; then + echo " " mv "$dir/$line" "$dir/$target" + mv "$line" "$target" || exit 1 + fi + done + ) || exit 1 + done + ) || err "stop." +fi + # chmod ----------------------------------------------------- chmod_pkg "$pkg_dir"