r22167 - gnucash/trunk - Further tweaks to enable git on the windows build

Geert Janssens gjanssens at code.gnucash.org
Sat Apr 28 12:18:29 EDT 2012


Author: gjanssens
Date: 2012-04-28 12:18:29 -0400 (Sat, 28 Apr 2012)
New Revision: 22167
Trac: http://svn.gnucash.org/trac/changeset/22167

Modified:
   gnucash/trunk/packaging/win32/defaults.sh
   gnucash/trunk/packaging/win32/install-impl.sh
   gnucash/trunk/packaging/win32/install.sh
   gnucash/trunk/util/gnc-svnversion
Log:
Further tweaks to enable git on the windows build

Modified: gnucash/trunk/packaging/win32/defaults.sh
===================================================================
--- gnucash/trunk/packaging/win32/defaults.sh	2012-04-28 13:37:17 UTC (rev 22166)
+++ gnucash/trunk/packaging/win32/defaults.sh	2012-04-28 16:18:29 UTC (rev 22167)
@@ -35,21 +35,26 @@
     set_default REPOS_DIR $GNUCASH_DIR
     # keep this pointing from BUILD_DIR to REPOS_DIR
     set_default REL_REPOS_DIR ..
-    set_default BUILD_DIR $GNUCASH_DIR\\build
-    set_default INSTALL_DIR $GNUCASH_DIR\\inst
 else
     # change this to "no" if you are using install.sh from the same repository checkout
     set_default UPDATE_SOURCES yes
-    # latest revision that should compile, use HEAD or vwxyz
-    set_default SVN_REV "HEAD"
     set_default GNUCASH_DIR $GLOBAL_DIR\\gnucash
-    set_default REPOS_URL "http://svn.gnucash.org/repo/gnucash/trunk"
     set_default REPOS_DIR $GNUCASH_DIR\\repos
     # keep this pointing from BUILD_DIR to REPOS_DIR
     set_default REL_REPOS_DIR ..\\repos
-    set_default BUILD_DIR $GNUCASH_DIR\\build
-    set_default INSTALL_DIR $GNUCASH_DIR\\inst
+
+    set_default REPOS_TYPE svn
+    if [ "$REPOS_TYPE" = "git" ]; then
+      set_default GIT_REV "trunk"
+      set_default REPOS_URL "git://github.com/Gnucash/gnucash.git"
+    elif [ "$REPOS_TYPE" = "svn" ]; then
+      # latest revision that should compile, use HEAD or vwxyz
+      set_default SVN_REV "HEAD"
+      set_default REPOS_URL "http://svn.gnucash.org/repo/gnucash/trunk"
+    fi
 fi
+set_default BUILD_DIR $GNUCASH_DIR\\build
+set_default INSTALL_DIR $GNUCASH_DIR\\inst
 
 set_default WITH_CUTECASH no
 set_default CUTECASH_BUILD_DIR $GNUCASH_DIR\\build-cutecash
@@ -351,8 +356,8 @@
 set_default SVN_URL "http://subversion.tigris.org/files/documents/15/47914/svn-win32-1.6.6.zip"
 set_default SVN_DIR $GLOBAL_DIR\\svn
 
-set_default GIT_URL "http://msysgit.googlecode.com/files/Git-1.7.8-preview20111206.exe"
-set_default GIT_DIR $GLOBAL_DIR\\git-1.7.8
+set_default GIT_URL "http://msysgit.googlecode.com/files/Git-1.7.10-preview20120409.exe"
+set_default GIT_DIR $GLOBAL_DIR\\git-1.7.10
 
 # OFX import in gnucash and ofx directconnect support for aqbanking
 set_default OPENSP_URL "$SF_MIRROR/openjade/OpenSP-1.5.2.tar.gz"

Modified: gnucash/trunk/packaging/win32/install-impl.sh
===================================================================
--- gnucash/trunk/packaging/win32/install-impl.sh	2012-04-28 13:37:17 UTC (rev 22166)
+++ gnucash/trunk/packaging/win32/install-impl.sh	2012-04-28 16:18:29 UTC (rev 22167)
@@ -254,15 +254,24 @@
 function inst_git() {
     setup Git
     _GIT_UDIR=`unix_path $GIT_DIR`
-    add_to_env $_GIT_UDIR/bin PATH
-    if quiet $_GIT_UDIR/bin/git --help || quiet git --help
+    # Don't add git's directory to the PATH, its installed DLLs conflict
+    # with the ones in our mingw environment
+    # add_to_env $_GIT_UDIR/bin PATH
+    if quiet git --help
     then
+        echo "git already installed in the system path.  skipping."
+        set_env git GIT_CMD
+    elif quiet "$_GIT_UDIR/bin/git" --help
+    then
         echo "git already installed in $_GIT_UDIR.  skipping."
+        set_env "$_GIT_UDIR/bin/git" GIT_CMD
     else
         smart_wget $GIT_URL $DOWNLOAD_DIR
         $LAST_FILE //SP- //SILENT //DIR="$GIT_DIR"
-        quiet git --help || die "git unavailable"
+        quiet "$_GIT_UDIR/bin/git" --help || die "git unavailable"
     fi
+    # Make sure GIT_CMD is available to subshells if it is set
+    [ -n "$GIT_CMD" ] && export GIT_CMD
 }
 
 # Functions before this point are basic build infrastructure functions or else they get pieces needed to build
@@ -1443,6 +1452,27 @@
     fi
 }
 
+function git_up() {
+    mkdir -p $_REPOS_UDIR
+    qpushd $_REPOS_UDIR
+    if [ -x .git ]; then
+        setup "git update in ${REPOS_DIR}"
+# FIXME I'm not sure what update sources should do for git.
+#       git update ? That would pull from upstream branches
+#                    but does nothing useful if the user checked out a local branches
+#                    Additionally this script is not available by default
+#       git pull ? I'm not sure if this doesn't have unwanted side effects
+#       So for now an update does nothing other than cloning the repository the
+#       first time it's called
+#        $GIT_CMD pull origin
+    else
+        setup git clone
+        $GIT_CMD clone $REPOS_URL .
+        $GIT_CMD checkout $GIT_REV .
+    fi
+    qpopd
+}
+
 function svn_up() {
     mkdir -p $_REPOS_UDIR
     qpushd $_REPOS_UDIR

Modified: gnucash/trunk/packaging/win32/install.sh
===================================================================
--- gnucash/trunk/packaging/win32/install.sh	2012-04-28 13:37:17 UTC (rev 22166)
+++ gnucash/trunk/packaging/win32/install.sh	2012-04-28 16:18:29 UTC (rev 22167)
@@ -83,7 +83,7 @@
 add_step inst_guile
 if [ "$CROSS_COMPILE" != "yes" ]; then
  add_step inst_svn
-# add_step inst_git
+add_step inst_git
 fi
 add_step inst_gnutls
 add_step inst_libxslt
@@ -112,7 +112,13 @@
 
 ##
 if [ "$UPDATE_SOURCES" = "yes" ]; then
- add_step svn_up
+  if [ "$REPOS_TYPE" = "git" ]; then
+    add_step git_up
+  elif [ "$REPOS_TYPE" = "svn" ]; then
+    add_step svn_up
+  else
+    die "Unkown repos type $REPOS_TYPE. Sources can only be updated for git or svn type repos"
+  fi
 fi
 if [ "$WITH_CUTECASH" = "yes" ]; then
  add_step inst_cmake

Modified: gnucash/trunk/util/gnc-svnversion
===================================================================
--- gnucash/trunk/util/gnc-svnversion	2012-04-28 13:37:17 UTC (rev 22166)
+++ gnucash/trunk/util/gnc-svnversion	2012-04-28 16:18:29 UTC (rev 22167)
@@ -67,14 +67,18 @@
 real_gitdir="${real_srcdir}"/.git
 if test -d "${real_gitdir}"
 then
-  githead=`git --git-dir "${real_gitdir}" log -1 --pretty=format:"%h" HEAD 2>/dev/null`  # short hash only
+  # The windows build uses environment variable $GIT_CMD to invoke git (adding git
+  # to the PATH in Windows results in a build failure).
+  # So for platform independence, use GIT_CMD for all
+  [ -n "$GIT_CMD" ] || GIT_CMD=git
+  githead=`"$GIT_CMD" --git-dir "${real_gitdir}" log -1 --pretty=format:"%h" HEAD 2>/dev/null`  # short hash only
   if test $? = 0 ; then
     /bin/echo -n $githead
     # Add a "+" to the hash if there deleted or modified files (not excluded by .gitignore and friends)
     # "Ignores" untracked files
-    # [ $(git --git-dir "${real_gitdir}" ls-files -dkm 2>/dev/null | wc -l) -gt 0 ] && /bin/echo -n "+"
+    # [ $("$GIT_CMD" --git-dir "${real_gitdir}" ls-files -dkm 2>/dev/null | wc -l) -gt 0 ] && /bin/echo -n "+"
     # Includes untracked files
-    [ $(git --git-dir "${real_gitdir}" ls-files -dkmo --exclude-standard 2>/dev/null | wc -l) -gt 0 ] && /bin/echo -n "+"
+    [ $("$GIT_CMD" --git-dir "${real_gitdir}" ls-files -dkmo --exclude-standard 2>/dev/null | wc -l) -gt 0 ] && /bin/echo -n "+"
     echo
     exit 0
   else



More information about the gnucash-changes mailing list