-
Notifications
You must be signed in to change notification settings - Fork 0
/
makedist
executable file
·103 lines (84 loc) · 2.45 KB
/
makedist
1
2
3
4
5
6
7
8
9
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/sh
#============================================================
# create a source tar ball from the tcl/websh project
# $Id: makedist 383181 2006-03-04 19:19:44Z ronnie $
#============================================================
# \
exec tclsh "$0" "$@"
set repository "http://svn.apache.org/repos/asf/tcl/websh"
proc usage {} {
global argv0
fatal "usage: $argv0 <build>\n where <build> is the name of a tagged build (e.g. 3.5.0)\n or trunk for the latest repository version\n or builds for a list of available tagged builds"
}
proc fatal {msg} {
puts stderr $msg
exit 1
}
if {$argc != 1} {
usage
}
# get build from command line
set build [lindex $argv 0]
if {"$build" == "trunk"} {
set trunk 1
append build "-[clock format [clock seconds] -format "%Y%m%d"]"
} elseif {"$build" == "builds"} {
set builds ""
regsub -all "/" [exec svn list $repository/tags] "" builds
puts $builds
puts "trunk"
exit
} else {
set trunk 0
}
if {!$trunk} {
# check whether build is valid
puts "checking for build $build"
if {[catch {
set svnlist [exec svn list $repository/tags]
if {![regexp "$build/" $svnlist]} {
fatal "build $build is not tagged"
}
} msg]} {fatal $msg}
}
# checkout build in a temporary directory
set tmpdir [pid].tmp
file mkdir $tmpdir
cd $tmpdir
if {$trunk} {
puts "checking out trunk in temporary directory"
catch {exec svn co $repository/trunk websh-$build}
} else {
puts "checking out build $build in temporary directory"
catch {exec svn co $repository/tags/$build websh-$build}
}
if {![file exists websh-$build/README]} {
cd ..
fatal "checkout in directory $tmpdir failed"
}
cd websh-$build
## -------------------------------------------------------------
## do some cleanup in the build (just add more fixes or stuff
# remove the examples
file delete -force examples
# make the docs (quickref in html format)
cd doc
file mkdir html
catch {exec make}
cd ..
## end of cleanup
## -------------------------------------------------------------
# creating tar ball for quickref
puts "creating tar ball quickref-$build.tar.gz"
cd doc
file rename html quickref-$build
exec tar czf ../../../quickref-$build.tar.gz --exclude .svn quickref-$build
file rename quickref-$build html
cd ../..
# creating tar ball
puts "creating tar ball websh-$build-src.tar.gz"
exec tar czf ../websh-$build-src.tar.gz --exclude .svn websh-$build
# cleanup
cd ..
file delete -force $tmpdir
puts "done."