[Libreoffice-commits] .: 3 commits - configure.in g

Norbert Thiebaud nthiebaud at kemper.freedesktop.org
Sat Aug 27 21:42:32 PDT 2011


 configure.in |   11 +++-
 g            |  138 +++++++++++++++++++++++++++++++++++++++++------------------
 2 files changed, 106 insertions(+), 43 deletions(-)

New commits:
commit b216943255ec64463b62da9f34cae4278957cc6d
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sat Aug 27 23:41:47 2011 -0500

    add ./g -z to just refresh the hooks and possibly other housekeeping

diff --git a/g b/g
index 6244764..b66c476 100755
--- a/g
+++ b/g
@@ -13,6 +13,7 @@ if [ "$#" -eq "0" ] ; then
     echo "   -f         Force - act on all the repos, not only the changed ones"
     echo "   -s         Silent - do not report the repo names."
     echo "   -1         report the repos name on the first line of the output as <repo>:"
+    echo "   -z         just to some house cleaning (hooks mostly). this is a stand-alone option as in ./g -z"
     echo "   --set-push-user [username] re-write an existing tree's config with an fd.o commit account name"
     exit $?
 fi
@@ -112,12 +113,16 @@ while [ "${COMMAND:0:1}" = "-" ] ; do
             ;;
         -s) REPORT_REPOS=0
             ;;
-		-1) REPORT_COMPACT=1
+	-1) REPORT_COMPACT=1
             ;;
-	    --set-push-user)
-	        shift
-	        PUSH_USER="$1"
-	        ;;
+	--set-push-user)
+	    shift
+	    PUSH_USER="$1"
+	    ;;
+	-z)
+	    DO_HOOK_REFRESH=true
+	    postprocess 0
+	    ;;
     esac
     shift
     COMMAND="$1"
commit 71e5200756bb73f69a4951ea89f85824edfdd31d
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sat Aug 27 23:41:18 2011 -0500

    use translations' own hooks. update the hooks after the clone/fetch/pull

diff --git a/g b/g
index 0e4165e..6244764 100755
--- a/g
+++ b/g
@@ -17,30 +17,83 @@ if [ "$#" -eq "0" ] ; then
     exit $?
 fi
 
-CLONEDIR=$(perl -e 'use Cwd "abs_path"; print abs_path(shift);' $0 | sed -e ' s/\/g$/\/clone/')
-if [ ! -e ${CLONEDIR} ]; then mkdir -p $CLONEDIR; fi
-RAWBUILDDIR=$(perl -e 'use Cwd "abs_path"; print abs_path(shift);' $0 | sed -e ' s/\/g$//')
-if [ ! -e ${RAWBUILDDIR} ]; then mkdir -p $RAWBUILDDIR; fi
 
-# should we need to update the hooks
-function update_hooks()
+pushd $(dirname $0) > /dev/null
+COREDIR=$(pwd)
+popd > /dev/null
+
+refresh_hooks()
 {
-    HOOKDIR="$1"
-    for H in $(cd "$RAWBUILDDIR/git-hooks" ; echo *) ; do
-        HOOK=".git/hooks/$H"
-        if [ ! -x "$HOOK" -a ! -L "$HOOK" ] ; then
-            rm -f "$HOOK"
-            ln -s "$HOOKDIR/$H" "$HOOK"
-        fi
+    repo=$1
+    case "$repo" in
+	core)
+	    pushd $COREDIR > /dev/null
+	    for hook_name in $(ls -1 $COREDIR/git-hooks) ; do
+		hook=".git/hooks/$hook_name"
+		if [ ! -x "$hook" -a ! -L "$hook" ] ; then
+		    rm -f "$hook"
+		    ln -s "git-hooks/$hook_name" "$hook"
+		fi
+	    done
+	    popd > /dev/null
+	    ;;
+	translations)
+	    if [ -d $COREDIR/clone/translations ] ; then
+		pushd $COREDIR/clone/translations > /dev/null
+		for hook_name in $(ls -1 $COREDIR/clone/translations/git-hooks) ; do
+		    hook=".git/hooks/$hook_name"
+		    rm -f "$hook"
+		    ln -sf "git-hooks/$hook_name" "$hook"
+		done
+		# .gitattribute should be per-repo, avoid entangling repos
+		if [ -L .gitattributes ] ; then
+		    rm -f .gitattributes
+		fi
+		popd > /dev/null
+	    fi
+	    ;;
+	help|dictionaries)
+	    if [ -d $COREDIR/clone/$core ] ; then
+		pushd $COREDIR/clone/$core > /dev/null
+		# fixme: we should really keep these per-repo to
+		# keep the repos independant. since these two
+		# are realy not independant yet, we keep using core's hooks
+		for hook_name in $(ls -1 $COREDIR/git-hooks) ; do
+		    hook=".git/hooks/$hook_name"
+		    rm -f "$hook"
+		    ln -sf "$COREDIR/git-hooks/$hook_name" "$hook"
+		done
+		# .gitattribute should be per-repo, avoid entangling repos
+		if [ -L .gitattributes ] ; then
+		    rm -f .gitattributes
+		fi
+		popd > /dev/null
+	    fi
+	    ;;
+    esac
+}
+
+refresh_all_hooks()
+{
+    repos="core $(cat "$COREDIR/bin/repo-list")"
+    for repo in $repos ; do
+	refresh_hooks $repo
     done
-    if [ -z "$(git config push.default)" ] ; then
-        git config push.default tracking
-    fi
-    if [ "$PWD" != "$RAWBUILDDIR" -a ! -e .gitattributes ]; then
-        ln -s $RAWBUILDDIR/.gitattributes .
+}
+
+postprocess()
+{
+    rc=$1
+    if $DO_HOOK_REFRESH ; then
+	refresh_all_hooks
     fi
+
+    exit $rc;
 }
 
+CLONEDIR="$COREDIR/clone"
+if [ ! -e ${CLONEDIR} ]; then mkdir -p "$CLONEDIR"; fi
+
 # extra params for some commands, like log
 EXTRA=
 COMMAND="$1"
@@ -51,6 +104,7 @@ ALLOW_EMPTY=
 KEEP_GOING=0
 REPORT_REPOS=1
 REPORT_COMPACT=0
+DO_HOOK_REFRESH=false
 
 while [ "${COMMAND:0:1}" = "-" ] ; do
     case "$COMMAND" in
@@ -74,6 +128,9 @@ case "$COMMAND" in
         EXTRA="-p0 --stat --apply --index --ignore-space-change --whitespace=error"
         RELATIVIZE=0
         ;;
+    clone|fetch|pull)
+	DO_HOOK_REFRESH=true
+	;;
     diff)
         PAGER='--no-pager'
         REPORT_REPOS=0
@@ -147,18 +204,14 @@ done
 # do it!
 DIRS="core $(cd $CLONEDIR ; ls)"
 if [ "$COMMAND" = "clone" ] ; then
-    DIRS=$(cat "$RAWBUILDDIR/bin/repo-list")
-    # update hooks in the main repo too
-    ( cd "$RAWBUILDDIR" ; update_hooks "../../git-hooks" )
+    DIRS=$(cat "$COREDIR/bin/repo-list")
 fi
 for REPO in $DIRS ; do
     DIR="$CLONEDIR/$REPO"
     NAME="$REPO"
-    HOOKDIR="../../../../git-hooks"
     if [ "$REPO" = "core" ] ; then
-        DIR="$RAWBUILDDIR"
+        DIR="$COREDIR"
         NAME="main repo"
-        HOOKDIR="../../git-hooks"
     fi
 
     if [ -d "$DIR" -a "z$PUSH_USER" != "z" ]; then
@@ -169,7 +222,6 @@ for REPO in $DIRS ; do
             # executed in a subshell
             if [ "$COMMAND" != "clone" ] ; then
                 cd "$DIR"
-                update_hooks "$HOOKDIR"
             else
                 cd "$CLONEDIR"
             fi
@@ -248,21 +300,20 @@ for REPO in $DIRS ; do
             # now we can change the dir in case of clone as well
             if [ "$COMMAND" = "clone" ] ; then
                 cd $DIR
-                update_hooks "$HOOKDIR"
             fi
 
             case "$COMMAND" in
                 pull|clone)
                     # update links
-		    if [ "$DIR" != "$RAWBUILDDIR" ]; then
+		    if [ "$DIR" != "$COREDIR" ]; then
 			for link in $(ls) ; do
-			    if [ ! -e "$RAWBUILDDIR/$link" ] ; then
-			        if test -h "$RAWBUILDDIR/$link"; then
-				    rm "$RAWBUILDDIR/$link"
+			    if [ ! -e "$COREDIR/$link" ] ; then
+			        if test -h "$COREDIR/$link"; then
+				    rm "$COREDIR/$link"
 				    echo -n "re-"
 			        fi
                                 echo "creating missing link $link"
-                                ln -s "$DIR/$link" "$RAWBUILDDIR/$link"
+                                ln -s "$DIR/$link" "$COREDIR/$link"
                             fi
                         done
 		    fi
@@ -282,16 +333,16 @@ for REPO in $DIRS ; do
             fi
 
             exit $RETURN
-        ) || exit $?
+        ) || postprocess $?
     fi
 done
 
 # Cleanup the broken links
 if [ "$COMMAND" = "pull" ] ; then
-    for link in $(ls $RAWBUILDDIR) ; do
-        if [ -h "$RAWBUILDDIR/$link" -a ! -e "$RAWBUILDDIR/$link" ]; then
+    for link in $(ls $COREDIR) ; do
+        if [ -h "$COREDIR/$link" -a ! -e "$COREDIR/$link" ]; then
             echo "Removing broken link $link"
-            rm $RAWBUILDDIR/$link
+            rm $COREDIR/$link
         fi
     done
 fi
@@ -303,4 +354,6 @@ if [ "$COMMAND" = "apply" ] ; then
     echo
 fi
 
+postprocess $?
+
 # vi:set shiftwidth=4 expandtab:
commit 76c1ec0caa956a37c28c4fe395c6554f70c55172
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sat Aug 27 22:29:03 2011 -0500

    language check in configure.in was causing command line overflow issue

diff --git a/configure.in b/configure.in
index ded4219..37f537d 100755
--- a/configure.in
+++ b/configure.in
@@ -8877,9 +8877,14 @@ for lang in $WITH_LANG ; do
     test "$lang" = "ALL" && continue;
     test "$lang" = "kid" && continue;
     # need to check for the exact string, so add space before and after the list of all languages
-    all_langs=" $ALL_LANGS "
-    test `echo "$all_langs" | sed "s|.* $lang .*|found|"` = "found" && continue;
-    AC_MSG_ERROR([invalid language: $lang; supported languages are: $ALL_LANGS])
+    for vl in $ALL_LANGS ; do
+        if test "$vl" = "$lang" ; then
+           break;
+        fi
+    done
+    if test "$vl" != "$lang" ; then
+        AC_MSG_ERROR([invalid language: $lang; supported languages are: $ALL_LANGS])
+    fi
 done
 # list with substituted ALL
 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`


More information about the Libreoffice-commits mailing list