[ooo-build-commit] .: 16 commits - bin/g bin/setup.in bin/unpack configure.in download.in git-hooks/commit-msg git-hooks/pre-commit git-hooks/prepare-commit-msg .gitignore

Jan Holesovsky kendy at kemper.freedesktop.org
Tue Aug 24 03:02:14 PDT 2010


 .gitignore                   |    2 
 bin/g                        |  126 +++++++++++++++++++++++++++++++++++++++++++
 bin/setup.in                 |    2 
 bin/unpack                   |   61 ++++++++------------
 configure.in                 |   19 ++++--
 download.in                  |   18 ++++--
 git-hooks/commit-msg         |   10 ---
 git-hooks/pre-commit         |   71 ++++++++++++++++++++++++
 git-hooks/prepare-commit-msg |   27 ---------
 9 files changed, 255 insertions(+), 81 deletions(-)

New commits:
commit 145ce95222fba1f9078bbe6eb6a0b08792bedb47
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Tue Aug 24 12:00:35 2010 +0200

    Remove unneeded var.

diff --git a/bin/g b/bin/g
index ba7b11c..7e5cb3d 100755
--- a/bin/g
+++ b/bin/g
@@ -10,7 +10,6 @@ if [ "$#" -eq "0" ] ; then
 fi
 
 CLONEDIR=`readlink -e $0 | sed 's/\/bin\/g$/\/clone/'`
-RAWBUILDDIR=`readlink -e $0 | sed 's/\/bin\/g$/\/rawbuild/'`
 
 # extra params for some commands, like log
 EXTRA=
commit c7145527884eaca8ab17bcc939dcc678a4c4b680
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Tue Aug 24 11:52:54 2010 +0200

    Fix passing params (like g pull -r).

diff --git a/bin/g b/bin/g
index c19c6c5..ba7b11c 100755
--- a/bin/g
+++ b/bin/g
@@ -77,8 +77,11 @@ for DIR in * ; do
                 for I in "${FILES[@]}" ; do
                     unset FILES[$FILESNUM]
                     FILESNUM=$(($FILESNUM+1))
-                    # set only those who belong to this repo
-                    if [ "${I:0:$PWDLEN}" = "$PWD/" ] ; then
+                    # set only those that are parameters, or belong to this repo
+                    if [ "${I:0:1}" = "-" ] ; then
+                        FILES[$INSERTNUM]="$I"
+                        INSERTNUM=$(($INSERTNUM+1))
+                    elif [ "${I:0:$PWDLEN}" = "$PWD/" ] ; then
                         FILES[$INSERTNUM]="${I:$PWDLEN}"
                         INSERTNUM=$(($INSERTNUM+1))
                     fi
commit 715ae633407208e35f021f85e13f6c803b06ee9b
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Tue Aug 24 10:58:44 2010 +0200

    git status returns error in some cases, but we want to continue anyway.

diff --git a/bin/g b/bin/g
index 0ccf199..c19c6c5 100755
--- a/bin/g
+++ b/bin/g
@@ -103,7 +103,13 @@ for DIR in * ; do
             esac
 
             echo "===== $DIR ====="
-            git $PAGER "$COMMAND" $EXTRA "${FILES[@]}" || exit $?
+            git $PAGER "$COMMAND" $EXTRA "${FILES[@]}"
+            RETURN=$?
+
+            # git status returns error in some versions; we want to continue
+            [ "$COMMAND" = "status" ] && RETURN=0
+
+            exit $RETURN
         ) || exit $?
     fi
 done
commit e90a6a0eb2f4cba46a952754cf2db6addfdcac36
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Mon Aug 23 21:57:50 2010 +0200

    Install git hooks even to the repositories in clone/.

diff --git a/download.in b/download.in
index 5b6671d..ad2b427 100755
--- a/download.in
+++ b/download.in
@@ -245,6 +245,15 @@ sub source_file_ooo($)
 
         system( "cd @CLONEDIR@ ; if [ -d $what ] ; then cd $what ; git fetch -t origin ; else git clone @OOO_GIT@/$what ; fi" ) && exit 1;
         system( "cd @CLONEDIR@/$what ; git status | grep 'Your branch is ahead of'" );
+        system( "for file in `cd git-hooks ; echo *`
+                 do
+		     cd @CLONEDIR@/$what
+                     hook=\".git/hooks/\$file\"
+                     if [ ! -x \"\$hook\" -a ! -L \"\$hook\" ] ; then
+                         rm -f \"\$hook\"
+                         ln -s \"../../../../git-hooks/\$file\" \"\$hook\"
+                     fi
+                 done" );
     }
     elsif ( '@SOURCE_TYPE@' eq "UPSTREAM" ) {
         die "Up-stream doesn't have a package split" if ($SPLIT);
commit ce348154977adc6d0edac3e0e6ef6811f9397710
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Mon Aug 23 21:41:06 2010 +0200

    Get rid of the prepare-commit-msg hook.
    
    Nobody was really using it anyway, it was just polluting the log.  Anybody
    interested in the file statistics in the log can use 'git log --stat'.

diff --git a/git-hooks/commit-msg b/git-hooks/commit-msg
index 6b9bb6d..d51a330 100755
--- a/git-hooks/commit-msg
+++ b/git-hooks/commit-msg
@@ -30,14 +30,6 @@ test "" = "$(grep '^Signed-off-by: ' "$1" |
 	abort "$1" "Duplicate Signed-off-by lines."
 }
 
-# Abort the commit if the message is the same as the one prepared by
-# the prepare-commit-msg hook
-
-if [ -f "$1.prepare" ] ; then
-    diff "$1" "$1.prepare" > /dev/null 2>/dev/null && \
-        abort "$1" "No change in the commit message."
-fi
-
 # Check that the first line exists, and is not an asterisk
 
 if [ -z "`head -n 1 $1 | grep -v '^[ \t]*\*'`" ] ; then
diff --git a/git-hooks/prepare-commit-msg b/git-hooks/prepare-commit-msg
deleted file mode 100755
index 0f89b14..0000000
--- a/git-hooks/prepare-commit-msg
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash
-
-# pre-fill the ooo-build commit message
-
-if [ "$2,$3" = "," ] ; then
-    cp "$1" "$1.prepare"
-
-    echo -e '\n' > "$1"
-
-    git diff --cached --name-status -r | sed 's/^.\t\(.*\)/* \1: /' >> "$1"
-
-    cat <<EOF >>"$1"
-
-# The first line should generally describe the change.
-#
-# Then an empty line, followed by a longer description if needed,
-# like here.
-#
-# * patches/dev300/something.diff: Describe the files if needed.
-EOF
-
-    cat "$1.prepare" >> "$1"
-
-    cp "$1" "$1.prepare"
-fi
-
-exit 0
commit d941fba4f5f5925a3b36bbf26747d3780e6f23e9
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Mon Aug 23 21:29:06 2010 +0200

    pre-commit hook to check for correct whitespace.

diff --git a/git-hooks/commit-msg b/git-hooks/commit-msg
index 75bbeb0..6b9bb6d 100755
--- a/git-hooks/commit-msg
+++ b/git-hooks/commit-msg
@@ -51,7 +51,7 @@ if [ "`head -n 1 $1 | wc -c`" -gt 79 ] ; then
 fi
 
 # ...and that it does not continue on the second line
-if [ -n "`head -n 2 $1 | tail -n 1 | sed 's/^#.*//'`" ] ; then
+if [ "`wc -l < $1`" -gt 1 -a -n "`head -n 2 $1 | tail -n 1 | sed 's/^#.*//'`" ] ; then
     abort "$1" "The second line is not empty - maybe the first line continues there?"
 fi
 
diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit
new file mode 100755
index 0000000..36be8a6
--- /dev/null
+++ b/git-hooks/pre-commit
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# An example hook script to verify what is about to be committed.
+# Called by "git commit" with no arguments.  The hook should
+# exit with non-zero status after issuing an appropriate message if
+# it wants to stop the commit.
+#
+# To enable this hook, rename this file to "pre-commit".
+
+if git rev-parse --verify HEAD >/dev/null 2>&1
+then
+    against=HEAD
+else
+    # Initial commit: diff against an empty tree object
+    against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
+fi
+
+# If you want to allow non-ascii filenames set this variable to true.
+allownonascii=$(git config hooks.allownonascii)
+
+# Cross platform projects tend to avoid non-ascii filenames; prevent
+# them from being added to the repository. We exploit the fact that the
+# printable range starts at the space character and ends with tilde.
+if [ "$allownonascii" != "true" ] &&
+    # Note that the use of brackets around a tr range is ok here, (it's
+    # even required, for portability to Solaris 10's /usr/bin/tr), since
+    # the square bracket bytes happen to fall in the designated range.
+    test "$(git diff --cached --name-only --diff-filter=A -z $against |
+      LC_ALL=C tr -d '[ -~]\0')"
+then
+    echo "Error: Attempt to add a non-ascii file name."
+    echo
+    echo "This can cause problems if you want to work"
+    echo "with people on other platforms."
+    echo
+    echo "To be portable it is advisable to rename the file ..."
+    echo
+    echo "If you know what you are doing you can disable this"
+    echo "check using:"
+    echo
+    echo "  git config hooks.allownonascii true"
+    echo
+    exit 1
+fi
+
+# be strict about tabs - we don't want them at all, setup your editor
+# correctly ;-)
+CHECK_EXTENSIONS='\.\(c\|cpp\|cxx\|h\|hrc\|hxx\|idl\|inl\|java\|map\|mk\|MK\|pmk\|pl\|pm\|sdi\|sh\|src\|tab\|xcu\|xml\)$'
+
+ERRORS="$(git diff-index --cached --name-only HEAD | while read FILE ; do
+              if echo "$FILE" | grep -qs "$CHECK_EXTENSIONS" ; then
+                  if git diff-index -p --cached HEAD -- "$FILE" | grep -qs $'^+ *\t' ; then
+                      echo "$FILE"
+                  fi
+              fi
+          done)"
+if test -n "$ERRORS" ; then
+    echo "Error: Your change in the following files introduces tabs in indentation:"
+    echo
+    echo "$ERRORS"
+    echo
+    echo "Please setup your editor not to use tabs, fix the files, and try again."
+    echo "We have had enough trouble with tabs in the past :-("
+    echo
+    exit 1
+fi
+
+# git way of checking whitespace
+exec git diff-index --check --cached $against --
+
+# vi:set shiftwidth=4 expandtab:
commit ae10d2897e448295752272b8f7ab5574bec32e1c
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Mon Aug 23 17:11:17 2010 +0200

    Make the params that take files as arguments work too.
    
    This fixes 'git add/status/log/... file1 file2 ...'

diff --git a/bin/g b/bin/g
index 3e077ed..0ccf199 100755
--- a/bin/g
+++ b/bin/g
@@ -9,14 +9,19 @@ if [ "$#" -eq "0" ] ; then
     exit $?
 fi
 
+CLONEDIR=`readlink -e $0 | sed 's/\/bin\/g$/\/clone/'`
+RAWBUILDDIR=`readlink -e $0 | sed 's/\/bin\/g$/\/rawbuild/'`
+
 # extra params for some commands, like log
 EXTRA=
-PAGER=
 COMMAND="$1"
+PAGER=
+RELATIVIZE=1
 
 case "$COMMAND" in
     apply)
         EXTRA="-p0 --stat --apply --index --ignore-space-change --whitespace=error"
+        RELATIVIZE=0
         ;;
     log)
         EXTRA='-1'
@@ -24,7 +29,8 @@ case "$COMMAND" in
         ;;
 esac
 
-FILES=
+# absolutize the parameters first
+unset FILES
 FILESNUM=0
 while shift ; do
     PARAM="$1"
@@ -44,20 +50,43 @@ while shift ; do
                 exit 1
             }
         fi
-        FILES[$FILESNUM]=`readlink -n -f "$1"`
+        FILES[$FILESNUM]=`readlink -n -e "$1"`
+        if [ -z "${FILES[$FILESNUM]}" ] ; then
+            echo "'$1' not found in `pwd`."
+            exit 1
+        fi
         FILESNUM=$(($FILESNUM+1))
     fi
 done
 
-CLONEDIR=`readlink -e $0 | sed 's/\/bin\/g$/\/clone/'`
-cd "$CLONEDIR"
-
 # do it!
+cd "$CLONEDIR"
 for DIR in * ; do
     if [ -d "$DIR" -a -d "$DIR"/.git ] ; then
         (
-            echo "===== $DIR ====="
+            # executed in a subshell
             cd $DIR
+
+            # relativize the absolutized params again if we want to operate
+            # only on the files belonging to this exact repo
+            if [ "$RELATIVIZE" = "1" -a -n "$FILES" ] ; then
+                FILESNUM=0
+                INSERTNUM=0
+                PWD=`pwd`
+                PWDLEN=`pwd | wc -c`
+                for I in "${FILES[@]}" ; do
+                    unset FILES[$FILESNUM]
+                    FILESNUM=$(($FILESNUM+1))
+                    # set only those who belong to this repo
+                    if [ "${I:0:$PWDLEN}" = "$PWD/" ] ; then
+                        FILES[$INSERTNUM]="${I:$PWDLEN}"
+                        INSERTNUM=$(($INSERTNUM+1))
+                    fi
+                done
+                [ "$INSERTNUM" = "0" ] && exit 0
+            fi
+
+            # some extra params
             case "$COMMAND" in
                 apply)
                     for I in * ; do
@@ -69,9 +98,11 @@ for DIR in * ; do
                     done
                     ;;
                 commit)
-                    git status | grep '^nothing to commit' && exit 0
+                    git status | grep -qs '^nothing to commit' && exit 0
                     ;;
             esac
+
+            echo "===== $DIR ====="
             git $PAGER "$COMMAND" $EXTRA "${FILES[@]}" || exit $?
         ) || exit $?
     fi
commit 229d6f05b4892488d07bb4fc7373eb4a62979d95
Author: Thorsten Behrens <thb at openoffice.org>
Date:   Mon Aug 23 15:55:46 2010 +0200

    Some sed's don't eat 's#...#...#'.

diff --git a/bin/g b/bin/g
index 74fa7ba..3e077ed 100755
--- a/bin/g
+++ b/bin/g
@@ -49,7 +49,7 @@ while shift ; do
     fi
 done
 
-CLONEDIR=`readlink -e $0 | sed 's#/bin/g$#/clone#'`
+CLONEDIR=`readlink -e $0 | sed 's/\/bin\/g$/\/clone/'`
 cd "$CLONEDIR"
 
 # do it!
commit 12f049fd4a37c7f52cae577db47152971674d5bd
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Mon Aug 23 14:54:35 2010 +0200

    Check for tabs in patches when doing 'g apply'.

diff --git a/bin/g b/bin/g
index e86f377..74fa7ba 100755
--- a/bin/g
+++ b/bin/g
@@ -35,6 +35,15 @@ while shift ; do
         FILES[$FILESNUM]="$1"
         FILESNUM=$(($FILESNUM+1))
     else
+        if [ "$COMMAND" = "apply" ] ; then
+            grep -qs $'^+ *\t' "$1" && {
+                echo "Patch '$1' introduces tabs in indentation, aborting."
+                echo
+                echo "Please fix the patch (something like s/^\(+ *\)\t/\1    /) and try again."
+                echo
+                exit 1
+            }
+        fi
         FILES[$FILESNUM]=`readlink -n -f "$1"`
         FILESNUM=$(($FILESNUM+1))
     fi
@@ -44,11 +53,11 @@ CLONEDIR=`readlink -e $0 | sed 's#/bin/g$#/clone#'`
 cd "$CLONEDIR"
 
 # do it!
-for dir in * ; do
-    if [ -d "$dir" -a -d "$dir"/.git ] ; then
+for DIR in * ; do
+    if [ -d "$DIR" -a -d "$DIR"/.git ] ; then
         (
-            echo "===== $dir ====="
-            cd $dir
+            echo "===== $DIR ====="
+            cd $DIR
             case "$COMMAND" in
                 apply)
                     for I in * ; do
@@ -68,4 +77,11 @@ for dir in * ; do
     fi
 done
 
+# warn
+if [ "$COMMAND" = "apply" ] ; then
+    echo
+    echo "Don't forget to check the status & commit now ;-)"
+    echo
+fi
+
 # vi:set expandtab:
commit 801ba5fab08ada6747e2b277068a3b31f92846dc
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Mon Aug 23 13:33:32 2010 +0200

    Handle 'apply' and 'commit' in the 'g' wrapper too.
    
    * bin/g:

diff --git a/bin/g b/bin/g
index 3011dd5..e86f377 100755
--- a/bin/g
+++ b/bin/g
@@ -3,9 +3,6 @@
 # Wrapper for git to handle more subdirs at the same time
 #
 
-CLONEDIR=`readlink -e $0 | sed 's#/bin/g$#/clone#'`
-cd "$CLONEDIR"
-
 # no params, no action
 if [ "$#" -eq "0" ] ; then
     git
@@ -16,21 +13,59 @@ fi
 EXTRA=
 PAGER=
 COMMAND="$1"
-shift
 
 case "$COMMAND" in
-    log) EXTRA='-1'
-	 PAGER='--no-pager'
-	 ;;
+    apply)
+        EXTRA="-p0 --stat --apply --index --ignore-space-change --whitespace=error"
+        ;;
+    log)
+        EXTRA='-1'
+        PAGER='--no-pager'
+        ;;
 esac
 
+FILES=
+FILESNUM=0
+while shift ; do
+    PARAM="$1"
+    if [ -z "$PARAM" ] ; then
+        #ignore
+        :
+    elif [ "${PARAM:0:1}" = "-" ] ; then
+        FILES[$FILESNUM]="$1"
+        FILESNUM=$(($FILESNUM+1))
+    else
+        FILES[$FILESNUM]=`readlink -n -f "$1"`
+        FILESNUM=$(($FILESNUM+1))
+    fi
+done
+
+CLONEDIR=`readlink -e $0 | sed 's#/bin/g$#/clone#'`
+cd "$CLONEDIR"
+
 # do it!
 for dir in * ; do
     if [ -d "$dir" -a -d "$dir"/.git ] ; then
-	(
-	    echo "===== $dir ====="
-	    cd $dir
-	    git $PAGER "$COMMAND" $EXTRA "$@" || exit $?
-	) || exit $?
+        (
+            echo "===== $dir ====="
+            cd $dir
+            case "$COMMAND" in
+                apply)
+                    for I in * ; do
+                        if [ -d "$I" ] ; then
+                            EXTRA="$EXTRA --include=$I/*"
+                        else
+                            EXTRA="$EXTRA --include=$I"
+                        fi
+                    done
+                    ;;
+                commit)
+                    git status | grep '^nothing to commit' && exit 0
+                    ;;
+            esac
+            git $PAGER "$COMMAND" $EXTRA "${FILES[@]}" || exit $?
+        ) || exit $?
     fi
 done
+
+# vi:set expandtab:
commit 4fa1adad11ab4736fc2acebc3d79100575d141a8
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Mon Aug 23 07:43:02 2010 +0200

    Allow to specify source for cloning in --with-git.
    
    * configure.in:

diff --git a/configure.in b/configure.in
index bd0e290..4d9878d 100644
--- a/configure.in
+++ b/configure.in
@@ -1580,9 +1580,13 @@ if test \( -z "$with_git" -a -f "$SRCDIR/$CVSTAG-bootstrap.tar.bz2" \) -o "$with
     AC_MSG_RESULT([no])
 else
     OOO_GIT="git://anongit.freedesktop.org/git/ooo-build"
-    guess=`git remote show origin | grep 'Fetch URL: ' | sed -e 's/^.*Fetch URL: //' -e 's#/ooo-build$##'`
-    if test -n "$guess" ; then
-	OOO_GIT="$guess"
+    if test "$with_git" != "yes" ; then
+        OOO_GIT="$with_git"
+    else
+        guess=`git remote show origin | grep 'Fetch URL: ' | sed -e 's/^.*Fetch URL: //' -e 's#/ooo-build$##'`
+        if test -n "$guess" ; then
+            OOO_GIT="$guess"
+        fi
     fi
     RESULT="Clone from $OOO_GIT"
     if test -e "$CLONEDIR" ; then
commit 3ad8575683af45c3a2609948ce118de074828e1a
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Fri Aug 20 17:30:12 2010 +0200

    Make it possible to interrupt cloning.
    
    * download.in:

diff --git a/download.in b/download.in
index 7bfad91..5b6671d 100755
--- a/download.in
+++ b/download.in
@@ -243,8 +243,8 @@ sub source_file_ooo($)
         $op = "updating" if ( -d "@CLONEDIR@/$what" );
         print "* $op from @OOO_GIT@/$what\n";
 
-        system( "cd @CLONEDIR@ ; if [ -d $what ] ; then cd $what ; git fetch -t origin ; else git clone @OOO_GIT@/$what ; fi" );
-	system( "cd @CLONEDIR@/$what ; git status | grep 'Your branch is ahead of'" );
+        system( "cd @CLONEDIR@ ; if [ -d $what ] ; then cd $what ; git fetch -t origin ; else git clone @OOO_GIT@/$what ; fi" ) && exit 1;
+        system( "cd @CLONEDIR@/$what ; git status | grep 'Your branch is ahead of'" );
     }
     elsif ( '@SOURCE_TYPE@' eq "UPSTREAM" ) {
         die "Up-stream doesn't have a package split" if ($SPLIT);
commit 6cef14a3d844ab7685c82b50316661b4bad8f264
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Fri Aug 20 17:29:44 2010 +0200

    Add clone/ and rawbuild/ to .gitignore.
    
    * .gitignore:

diff --git a/.gitignore b/.gitignore
index 0e7c676..a285ac1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,9 +14,11 @@ nohup.out
 # Ignore just in the toplevel dir
 
 /build/
+/clone/
 /download
 /download.list
 /gob.log
+/rawbuild/
 /stamp/
 
 # autotools stuff
commit ff43a0eb73fb53a782503c897d3c2b9533c7aaf6
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Fri Aug 20 15:11:55 2010 +0200

    Actually, execute the 'g' script always in the clone/ subdir.
    
    This makes things easier when in rawbuild/ subdir.
    
    * bin/g:

diff --git a/bin/g b/bin/g
index dd8d267..3011dd5 100755
--- a/bin/g
+++ b/bin/g
@@ -3,6 +3,9 @@
 # Wrapper for git to handle more subdirs at the same time
 #
 
+CLONEDIR=`readlink -e $0 | sed 's#/bin/g$#/clone#'`
+cd "$CLONEDIR"
+
 # no params, no action
 if [ "$#" -eq "0" ] ; then
     git
commit 350726cf6181955f2f31343ca03bf3342e83bccb
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Fri Aug 20 13:13:59 2010 +0200

    Wrapper for git to handle more git repos at the same time.
    
    * bin/g:

diff --git a/bin/g b/bin/g
new file mode 100755
index 0000000..dd8d267
--- /dev/null
+++ b/bin/g
@@ -0,0 +1,33 @@
+#!/bin/bash
+#
+# Wrapper for git to handle more subdirs at the same time
+#
+
+# no params, no action
+if [ "$#" -eq "0" ] ; then
+    git
+    exit $?
+fi
+
+# extra params for some commands, like log
+EXTRA=
+PAGER=
+COMMAND="$1"
+shift
+
+case "$COMMAND" in
+    log) EXTRA='-1'
+	 PAGER='--no-pager'
+	 ;;
+esac
+
+# do it!
+for dir in * ; do
+    if [ -d "$dir" -a -d "$dir"/.git ] ; then
+	(
+	    echo "===== $dir ====="
+	    cd $dir
+	    git $PAGER "$COMMAND" $EXTRA "$@" || exit $?
+	) || exit $?
+    fi
+done
commit 2e4e2ee9b5655e1c70a092beb804ef324c0f67d4
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Fri Aug 20 13:12:21 2010 +0200

    Rework --with-git switch to actually work with masters of the repos.
    
    * bin/setup.in:
    * bin/unpack:
    * configure.in:
    * download.in:

diff --git a/bin/setup.in b/bin/setup.in
index bacd43c..2af1692 100755
--- a/bin/setup.in
+++ b/bin/setup.in
@@ -16,6 +16,8 @@ if test "$OOO_LANGS" = ""; then OOO_LANGS="en-US"; fi
 OOO_POOR_HELP_LOCALIZATIONS='@OOO_POOR_HELP_LOCALIZATIONS@'
 CVSTAG='@CVSTAG@'
 OOO_GIT='@OOO_GIT@'
+CLONEDIR='@CLONEDIR@'
+RAWBUILDDIR='@RAWBUILDDIR@'
 GITTAG="ooo/`echo @CVSTAG@ | tr '[[:lower:]]-' '[[:upper:]]_' | sed 's/_M/_m/'`"
 APPLY_DIR='@APPLY_DIR@'
 BUILD_NCPUS='@BUILD_NCPUS@'
diff --git a/bin/unpack b/bin/unpack
index df22c35..76f5dde 100755
--- a/bin/unpack
+++ b/bin/unpack
@@ -21,9 +21,6 @@ else
     echo_n=echo echo_c='\c'
 fi
 
-# mac does not ship flock binary
-test "z`uname -s`" = "zDarwin" || use_flock=true
-
 #"# don't confuse vim's syntax highlighting ;-)
 
 check_tarball()
@@ -43,20 +40,15 @@ check_tarball()
 
 check_git_repo()
 {
-    tree="$SRCDIR/clone/$1"
-    $echo_n "Looking for $GITTAG in $tree ... $echo_c";
+    tree="$CLONEDIR/$1"
+    $echo_n "Checking for current branch of $tree ... $echo_c";
     if cd "$tree" >/dev/null 2>&1 ; then
-        # ugly hack to always checkout latest tag of given master
-		if echo $GITTAG | grep LATEST; then
-			GITTAG=`echo $GITTAG | sed 's/_LATEST/*/'`
-			GITTAG=`git tag -l $GITTAG | tail -n1`
-			CVSTAG=`echo $GITTAG | tr '[[:upper:]]_' '[[:lower:]]-' | sed 's/ooo\///'`
-		fi
-        if git show $GITTAG >/dev/null 2>&1 ; then
+	IS_MASTER=`git branch | grep '^\* master$'`
+        if test -n "$IS_MASTER" ; then
             echo "ok"
         else
-            echo "missing the tag; run './download'"
-            exit 1;
+            $echo_n "warning, current branch is "
+	    git branch | grep '^\*' | sed 's/^.//'
         fi
     else
         echo "missing the $tree clone; run './download'"
@@ -300,31 +292,30 @@ if test "z$OOO_GIT" = "z" ; then
 	fi
     fi
 else
+    if test -d "$RAWBUILDDIR" ; then
+        echo "* removing old nonsplit dir: $RAWBUILDDIR"
+        rm -rf "$RAWBUILDDIR"
+    fi
+    mkdir "$RAWBUILDDIR"
+    echo "* creating symlinks in $RAWBUILDDIR"
+    for pkg in $CORE_PKGS; do
+	if test "$pkg" != "l10n" ; then
+	    # l10n cannot be easily handled in nonsplit/, we only copy it to
+	    # build dir (the one with the applied patches)
+	    ln -s "$CLONEDIR/$pkg"/* "$RAWBUILDDIR/"
+	fi
+    done
     if test -d $OOBUILDDIR; then
         echo "* removing old build dir: $OOBUILDDIR"
         rm -rf $OOBUILDDIR
     fi
-    mkdir $OOBUILDDIR
-    for pkg in $CORE_PKGS; do
-        export pkg
-        (
-            test -z $use_flock || flock 200
-            test -z $use_flock && echo "Warning: potential race, make sure you have exclusive access to upstream src tree $pkg"
-            tree=$SRCDIR/clone/$pkg
-            echo "* checking out $CVSTAG in $pkg..."
-            (
-                cd $tree
-                if git show $CVSTAG >/dev/null 2>&1 ; then
-                    git checkout $CVSTAG || exit 1
-                else
-                    git checkout -b $CVSTAG $GITTAG || exit 1
-                fi
-            ) || exit 1
-            echo "* copying it into place..."
-            rsync -a --exclude .git $tree/* $OOBUILDDIR/
-        ) 200>$SRCDIR/clone/$pkg-lock
-        unset pkg
-    done
+    echo "* copying $RAWBUILDDIR into $OOBUILDDIR..."
+    #cp -pLR "$RAWBUILDDIR" "$OOBUILDDIR"
+    rsync -prL --exclude .git --exclude 'unxlng??.pro' "$RAWBUILDDIR/" "$OOBUILDDIR/"
+    if test -d "$CLONEDIR/l10n" ; then
+	echo "* copying translations into $OOBUILDDIR..."
+	rsync -a --exclude .git "$CLONEDIR/l10n/*" $OOBUILDDIR/
+    fi
 fi
 
 # original upstream sources
diff --git a/configure.in b/configure.in
index 68c9521..bd0e290 100644
--- a/configure.in
+++ b/configure.in
@@ -1574,18 +1574,19 @@ AC_MSG_RESULT([$build_product])
 
 AC_MSG_CHECKING([whether to use git to get the up-stream sources])
 OOO_GIT=
+CLONEDIR="$BASEDIR/clone"
+RAWBUILDDIR="$BASEDIR/rawbuild"
 if test \( -z "$with_git" -a -f "$SRCDIR/$CVSTAG-bootstrap.tar.bz2" \) -o "$with_git" = "no"; then
     AC_MSG_RESULT([no])
 else
     OOO_GIT="git://anongit.freedesktop.org/git/ooo-build"
+    guess=`git remote show origin | grep 'Fetch URL: ' | sed -e 's/^.*Fetch URL: //' -e 's#/ooo-build$##'`
+    if test -n "$guess" ; then
+	OOO_GIT="$guess"
+    fi
     RESULT="Clone from $OOO_GIT"
-    if test -e "src/clone" ; then
-        RESULT="src/clone already set up"
-    else
-        if test -d "$with_git" ; then
-            RESULT="Reusing trees located here: $with_git"
-            ln -s "$with_git" src/clone || AC_MSG_ERROR([Cannot ln -s $with_git src/clone])
-        fi
+    if test -e "$CLONEDIR" ; then
+        RESULT="$CLONEDIR already set up"
     fi
     AC_MSG_RESULT([$RESULT])
 
@@ -1595,6 +1596,8 @@ else
     fi
 fi
 AC_SUBST(OOO_GIT)
+AC_SUBST(CLONEDIR)
+AC_SUBST(RAWBUILDDIR)
 
 AC_MSG_CHECKING([whether to use git to manage the patches])
 if test -z "$with_git_managed" -o "$with_git_managed" = "no"; then
diff --git a/download.in b/download.in
index 85808e7..7bfad91 100755
--- a/download.in
+++ b/download.in
@@ -240,10 +240,11 @@ sub source_file_ooo($)
     my $tag = '@CVSTAG@';
     if ( '@OOO_GIT@' ne "" ) {
         $op = "cloning";
-        $op = "updating" if ( -d "@SRCDIR@/clone/$what" );
+        $op = "updating" if ( -d "@CLONEDIR@/$what" );
         print "* $op from @OOO_GIT@/$what\n";
 
-        system( "cd @SRCDIR@/clone ; if [ -d $what ] ; then cd $what ; git fetch -t origin ; else git clone -n @OOO_GIT@/$what ; fi" );
+        system( "cd @CLONEDIR@ ; if [ -d $what ] ; then cd $what ; git fetch -t origin ; else git clone @OOO_GIT@/$what ; fi" );
+	system( "cd @CLONEDIR@/$what ; git status | grep 'Your branch is ahead of'" );
     }
     elsif ( '@SOURCE_TYPE@' eq "UPSTREAM" ) {
         die "Up-stream doesn't have a package split" if ($SPLIT);
@@ -321,8 +322,8 @@ sub download_files($$$)
 if (!-d "@SRCDIR@") {
     `mkdir -p @SRCDIR@`;
 }
-if ( '@OOO_GIT@' ne "" && !-d "@SRCDIR@/clone" ) {
-    `mkdir -p @SRCDIR@/clone`;
+if ( '@OOO_GIT@' ne "" && !-d "@CLONEDIR@" ) {
+    `mkdir -p @CLONEDIR@`;
 }
 
 my $download_all = 0;


More information about the ooo-build-commit mailing list