versioner.tcl 1.64 KB
Newer Older
1
2
3
4
5
6
7
8
#!/bin/sh
# the next line restarts using tclsh \
    exec tclsh "$0" "$@"

################################################################################
#
# versioner.tcl
#
9
# adds a lib/Slicer3/SlicerVersion.txt file to the current build
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#
# Usage: (no options)
#   versioner 
#
# Initiated - sp - 2009-03-24
#

################################################################################

# for subversion repositories (Sandbox)
if {[info exists ::env(SVN)]} {
    set ::SVN $::env(SVN)
} else {
    set ::SVN svn
}


################################################################################
# build the lib/Slicer3/Slicer3version.txt file
# - determine the location
# - determine the build variables
# - get the svn info
# - write the file
# 

set cwd [pwd]
cd [file dirname [info script]]
cd ..
38
set ::Slicer_HOME [pwd]
39

40
source $::Slicer_HOME/slicer_variables.tcl
41
42
43

set ::Slicer3_BUILDDATE [clock format [clock seconds] -format %Y-%m-%d]

44
set ::ENV(LANG) "C"
45
46
47
48
49
50
51
52
53
54
55
56
57
58
set svninfo [split [exec svn info] "\n"]
array set svn ""
foreach line $svninfo {
  foreach {tag value} $line {
    if { $tag == "URL:" } {
      set svn(URL) $value
    }
    if { $tag == "Revision:" } {
      set svn(revision) $value
    }
  }
}
cd $cwd

59
set versionText ""
60
61
62
63
set versionText "${versionText}build $::env(BUILD)\n"
set versionText "${versionText}buildDate $::Slicer3_BUILDDATE\n"
set versionText "${versionText}svnurl $svn(URL)\n"
set versionText "${versionText}svnrevision $svn(revision)\n"
64

65
set versionFile $::Slicer3_BUILD/lib/Slicer3/SlicerVersion.txt
66
67
68
69
puts "Writing version information to $versionFile"
puts $versionText
set fp [open $versionFile "w"]
puts $fp $versionText
70
close $fp