[Crossfire-wiki] [Crossfire DokuWiki] page changed: user:kbulgrien

no-reply_wiki at metalforge.org no-reply_wiki at metalforge.org
Tue May 12 23:12:35 CDT 2009


A page in your DokuWiki was added or changed. Here are the details:

Date        : 2009/05/12 23:12
User        : kbulgrien
Edit Summary: Update svn-co.sh to auto-detect svn client version and switch modes accordingly

@@ -25,12 +25,13 @@
  ====Portable C/C++====
      * [[http://www.gnu.org/software/automake/manual/autoconf/Portable-C-and-C_002b_002b.html#Portable-C-and-C_002b_002b|Automake Manual Chapter]]
  
  =====SVN Scripts=====
+ 
  
  ====svn-co.sh====
  
- This script can do svn 1.5.x sparse checkouts or pre-1.5 checkouts.  The script defaults to using subversion 1.5+ sparse checkouts.  If the older checkout style is desired, the script must be edited to change "if false" to "if true".
+ This script can do svn 1.5.x sparse checkouts or pre-1.5 checkouts.  The script defaults to using subversion 1.5+ sparse checkouts.  If an older client is detected, the script switches to a legacy checkout directory model.
  
  Create the desired development directory first, then run the script to checkout.  For example:
  
    cd /home/devel/crossfire
@@ -43,16 +44,28 @@
  The script:
  
    #!/bin/bash
    #
-   # Determine what to checkout based on the command-line parameters.
+   # A Crossfire RPG project SVN checkout utility.
    #
-   allmodules="arch client jxclient maps metaserver server sounds"
+   # $RCSfile: svn-co.sh,v $ $Revision: 1.6 $ $Date: 2009/05/13 03:06:01 $
+   #
+   # Determine what to checkout based on the command-line parameters and whether
+   # or not we are in an rpmbuild directory or not.  jxclient and metaserver
+   # areas are not applicable to the rpmbuild processes.
+   #
+   if [ "$(pwd)" = "$(pwd | sed -e s/rpmbuild//)" ]
+   then
+     allmodules="arch client jxclient maps metaserver server sounds"
+   else
+     allmodules="arch client maps server sounds"
+   fi
    branchmodules="arch client maps server"
    
    if [ "${1}" = "trunk" ]
    then
      COTYPE="trunk"
+     shift 1
    elif [ "${1}" = "branch" ]
    then
      COTYPE="branches/"
      if [ -z "${2}" ]
@@ -62,8 +75,9 @@
      else
        COTYPE="branches/${2}"
        allmodules="${branchmodules}"
      fi
+     shift 2
    else
      echo -e "\nsvn-co.sh: Error: Usage:\n"
      echo -e "  svn-co.sh trunk"
      echo -e "  svn-co.sh branch 1.xx"
@@ -71,11 +85,11 @@
      exit 1;
    fi
    
    # How shall the checkout be done?  The pre-svn 1.5 way, or via sparse
-   # checkout?  Always use sparse checkouts = false.
+   # checkout?  Auto-detect the svn client version.
    #
-   if false
+   if [ "$(svn --version -q | sed -e 's/[.]//g')" -le 150 ]
    then
      #
      # Pre-SVN 1.5 Checkout (deprecated).
      #
@@ -87,13 +101,14 @@
        DIR="${module}/${COTYPE}"
        if [ ! -d "${DIR}" ]
        then
          echo -e "\n${DIR}\n"
+         mkdir -p "${DIR}"
          CMD="svn co ${*} ${URL}/${DIR} ${DIR}"
          ${CMD}
        fi
      done
-      echo
+     echo
    else
      #
      # Sparse Checkout
      #
@@ -113,9 +128,9 @@
      then
        #
        # Runs only for branch checkouts
        #
-       for module in ${branchmodules}
+       for module in ${allmodules}
        do
          svn update --depth=files ${module}/${path}
        done
        path="${path}/${COTYPE##*/}"
@@ -137,33 +152,8 @@
    # Link the arch directory into the server directory tree.
    #
    unlink $(pwd)/server/${COTYPE}/lib/arch 2>/dev/null
    ln -s $(pwd)/arch/${COTYPE} $(pwd)/server/${COTYPE}/lib/arch
-   echo
- 
- ==svn-up.sh==
- 
- When using SVN 1.5 sparse checkouts built by the above **svn-co.sh**, this script is not needed.  With a sparse checkout, one merely changes to the **crossfire** directory and issues an **//svn update//** command.
- 
- Before sparse checkouts were supported, it was common to checkout the various subdirectories of the project separately so that **//svn update//** did not result in the download of all tags, branches, etc.  In lieu of manually updating the many directories separately, this script performed an update operation for each separate svn workspace checked out:
- 
-   #!/bin/bash
-   #
-   CWD=$(pwd)
-   for co in arch client maps server sounds
-   do
-     for dir in trunk
-     do
-       WORKING=${co}/${dir}
-       if [ -d ${CWD}/${WORKING} ]
-       then
-         echo; echo ${WORKING}; echo
-         cd ${CWD}/${WORKING}
-         svn update
-         cd ${CWD}
-       fi
-     done
-   done
    echo
  
  =====Configure Scripts=====
  


IP-Address  : 68.90.128.197
Old Revision: http://wiki.metalforge.net/doku.php/user:kbulgrien?rev=1242186290
New Revision: http://wiki.metalforge.net/doku.php/user:kbulgrien

-- 
This mail was generated by DokuWiki at
http://wiki.metalforge.net/




More information about the crossfire-wiki mailing list