1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

Changeset 2170

Show
Ignore:
Timestamp:
11/15/11 08:05:58 (18 months ago)
Author:
jkoshy
Message:

Fix a bug in the make-toolchain-version script.

  • Deal with exported source trees in a sensible way.
  • Improve a few comments.

Ticket: #358

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/libelftc/make-toolchain-version

    r2065 r2170  
    5656[ -n "${top}" ] || usage 
    5757 
    58 # Try to determine the tree version. 
     58# Try to determine the in-tree revision number. 
    5959# 
    60 # - If using SVN, use the `svninfo' tool. 
    61 # - If using CVS, use the string `unknown'. 
    62 # - Otherwise use `git --describe'. 
     60# This script attempts to handle the case where our sources have been 
     61# incorporated into an operating system's base sources. 
     62# 
     63# - If SVN is detected, we use the `svninfo' tool to determine the 
     64#   in-tree revision number. 
     65# - If CVS is detected, we use the string `unknown'. 
     66# - Otherwise, we use `git --describe'. 
    6367 
    6468curdir=`pwd` 
    6569cd ${top} || usage "ERROR: Cannot change directory to \"${top}\"." 
    6670 
    67 versionstring="" 
    68 if [ -d .svn ]; then 
    69     versionstring="svn:"$(svnversion) 
    70 elif [ -d CVS ]; then 
    71     versionstring="cvs:unknown" 
    72 else # Try Git 
    73     versionstring="git:"$(git describe --all --dirty --long) 
     71if [ -d .svn ]; then            # FreeBSD and SF.Net sources. 
     72    versionstring=" svn:"$(svnversion) 
     73elif [ -d CVS ]; then           # NetBSD. 
     74    versionstring=" cvs:unknown" 
     75else                            # DragonFlyBSD. 
     76    versionstring=" git:"$(git describe --all --dirty --long 2> /dev/null) 
    7477 
    75     if [ ${?} -ne 0 ]; then 
    76         usage "Cannot determine tree version." 
     78    # Cannot determine an in-tree version number. 
     79    if [ $? -ne 0 ]; then 
     80        versionstring="" 
    7781    fi 
    7882fi 
     
    9599elftc_version(void) 
    96100{ 
    97         return "${elftcname} ${branch} ${buildhost} ${versionstring}"; 
     101        return "${elftcname} ${branch} ${buildhost}${versionstring}"; 
    98102} 
    99103EOF