X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=release.sh;h=7118f82356b93e5751bd717642fd507aeae4ae6a;hb=dd70e930d981cf149c49446ce932c7287bde24f9;hp=03cf831e991973d278f74aa02fc667ba2bee9cbe;hpb=f58035e76f3314aa2cb2a807026251154465a68a;p=pukiwiki%2Fpukiwiki_devel.git diff --git a/release.sh b/release.sh index 03cf831..7118f82 100755 --- a/release.sh +++ b/release.sh @@ -1,11 +1,11 @@ #!/bin/sh -# $Id: release.sh,v 1.23 2005/09/20 14:37:03 henoheno Exp $ +# $Id: release.sh,v 1.34 2011/06/05 14:22:24 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 -------------------------------------------- @@ -47,7 +47,7 @@ check_versiontag(){ [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" ;; [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 ) tag="$rel" ;; + HEAD | r1_3_3_branch | branch_r1* ) tag="$rel" ;; '' ) usage ; return 1 ;; * ) warn "Error: Invalid string: $1" ; usage ; return 1 ;; esac @@ -127,21 +127,34 @@ if [ $# -eq 0 ] ; then usage ; exit ; fi # 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' ] ; then - err "nkf found but seems 1.x" + 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 collapse - nkf -Ew "$list" > "$list.$$.tmp" && mv "$list.$$.tmp" "$list" + # 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/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 @@ -160,6 +173,10 @@ rel="$1" tag="` check_versiontag "$rel" `" || exit 1 pkg_dir="${mod}-${rel}" +if [ "$__utf8" ] ; then + pkg_dir="${pkg_dir}_utf8" +fi + # Export the module ----------------------------------------- test ! -d "$pkg_dir" || err "There's already a directory: $pkg_dir" @@ -184,10 +201,12 @@ test -z "$__noremove" && { 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" \) | + find "$pkg_dir" -type f \( -name "*.txt" -or -name "*.php" -or -name "*.lng" -or -name "*.dat" -or -name "*.ref" \) | while read line; do - echo " $line" - convert "$line" + case "$line" in + "$pkg_dir"/zh-CN.lng.php ) ;; # UTF-8 already, Do nothing + * ) convert "$line" ;; + esac done # Replace 'EUC-JP' => 'UTF-8' @@ -195,7 +214,21 @@ if [ "$__utf8" ] ; then convert_EUCJP2UTF8 lib/init.php skin/pukiwiki.skin*.php ) - # Filename about wiki/*.txt or something are not coverted yet + # 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 -----------------------------------------------------