-
Notifications
You must be signed in to change notification settings - Fork 0
/
mon-systems-make-tarball.sh
executable file
·274 lines (236 loc) · 6.07 KB
/
mon-systems-make-tarball.sh
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
#!/bin/sh
#
#
### ==============================
### :FILE-CREATED <Timestamp: #{2011-04-20T19:24:08-04:00Z}#{11163} - by MON KEY>
### :FILE mon-systems/mon-systems-move-to-git.sh
### ==============================
### :NOTE This script won't work unless $DEVHOME is in your environment
### elisp> (getenv "DEVHOME")
### shell> $DEVHOME
###
### tree --noreport -if -I "*[~#]" /home/sp/HG-Repos/CL-repo-HG/CL-MON-CODE/mon-systems
###
### $DEVHOME
### No doubt there are better ways of doing this with a shell script, but...
### I F*CKING HATE SHELL SCRIPTING!!!
### ==============================
### CL_MON_CODE=$DEVHOME/some/path/to/mon
## "$MON_SYSTEM_SRC $MON_SYSTEM_SRC/tests $MON_SYSTEM_TAR"
DEVHOME=$DEVHOME
CL_MON_CODE=$DEVHOME/CL-MON-CODE
MON_SYSTEM_NM="mon-systems"
MON_SYSTEM_SRC=$CL_MON_CODE/mon-systems
MON_SYSTEM_TAR_TOP=$CL_MON_CODE/SYSTEMS-tmp/MS-tmp
MON_SYSTEM_TAR_DIR=$MON_SYSTEM_TAR_TOP/mon-systems
TAR_DATE=$(date '+%Y-%m-%d')
TAR_TARGET_NAME=$MON_SYSTEM_NM
# echo $DEVHOME
# echo $CL_MON_CODE
# echo $MON_SYSTEM_NM
# echo $MON_SYSTEM_SRC
# echo $MON_SYSTEM_TAR_TOP
# echo $MON_SYSTEM_TAR_DIR
# TESTING
#NOT_GIT_DIR=$MON_SYSTEM_TAR/non-existent-dir
# mon-systems/mon-systems-move-to-git.sh
MON_SYSTEM_FILES="
DEPENDENCIES
LICENSE.txt
README.md
alist.lisp
arrays.lisp
bit-twiddle.lisp
buffer.lisp
char-numeric.lisp
chars.lisp
chronos.lisp
class-doc.lisp
class-utils.lisp
completion.lisp
compose.lisp
conditions.lisp
deprecated.lisp
docs.lisp
emacs-compat.lisp
environ.lisp
file-dir.lisp
file-io.lisp
format.lisp
hash.lisp
introspect.lisp
io.lisp
loadtime-bind.lisp
macros.lisp
make-mon-systems-etags.sh
mon-systems-make-tarball.sh
mon-systems-move-to-git.sh
mon-test.asd
mon.asd
numbers.lisp
package.lisp
plist.lisp
regexp.lisp
seqs.lisp
sldb-specials-deprecated.lisp
specials.lisp
strings.lisp
types.lisp"
# $MON_SYSTEM_SRC/tests
MON_SYSTEM_TEST_FILES="package.lisp
test.lisp
testing.lisp
timing.lisp
timings.lisp
usec-tests.lisp"
#/docs
MON_SYSTEM_DOC_FILE="ifnottex.texinfo
mon-top-level.texinfo
mon.info
mon-systems.texinfo"
ensure_abort_dirs ()
{
for j in `echo "$MON_SYSTEM_SRC $MON_SYSTEM_SRC/tests $MON_SYSTEM_TAR_DIR"`;do
if [ ! -d "$j" ]
then
echo "A required directory was non-existent: $j";
printf "\tdeclining to proceed further\n";
exit 1;
fi
done;
}
ensure_tests_dir ()
{
if [ ! -d "$MON_SYSTEM_TAR_DIR/tests" ]
then
mkdir -p "$MON_SYSTEM_TAR_DIR/tests";
echo "Created previously non-existent directory: $MON_SYSTEM_TAR_DIR/tests"
echo
fi
}
ensure_readme ()
{
if [ ! -e $MON_SYSTEM_TAR_DIR/README.md ]
then
echo "Creaating empty README file: $MON_SYSTEM_TAR_DIR/README.md"
echo
touch $MON_SYSTEM_TAR_DIR/README.md
fi
}
ensure_loadtime_bind ()
{
if [ ! -e $MON_SYSTEM_TAR_DIR/loadtime-bind ]
then
echo "Creaating template file: $MON_SYSTEM_TAR_DIR/loadtime-bind"
printf "\n(\"<USERNAME>\" . \"<MONIKER>\")\n\n" > $MON_SYSTEM_TAR_DIR/loadtime-bind
fi
}
copy_mon_files ()
{
for f in $MON_SYSTEM_FILES; do
if [ ! -e "$MON_SYSTEM_SRC/$f" ] # Check if file exists.
then
echo ":FILE $MON_SYSTEM_SRC/$f does not exist";
echo
else # On to next.
cp "$MON_SYSTEM_SRC/$f" "$MON_SYSTEM_TAR_DIR/$f";
echo "Copied :FILE $f";
echo "From :SOURCE $MON_SYSTEM_SRC/ to :DEST $MON_SYSTEM_TAR_DIR/";
echo
fi
done;
}
#
copy_mon_test_files ()
{
for f in $MON_SYSTEM_TEST_FILES; do
if [ ! -e "$MON_SYSTEM_SRC/tests/$f" ] # Check if file exists.
then
echo ":FILE $MON_SYSTEM_SRC/tests/$f does not exist";
echo
else # On to next.
# cp `echo $MON_SYSTEM_SRC/tests/$f $MON_SYSTEM_TAR_DIR/tests/$f`;
cp $MON_SYSTEM_SRC/tests/$f $MON_SYSTEM_TAR_DIR/tests/$f;
echo "Copied :FILE $f";
echo "From :SOURCE $MON_SYSTEM_SRC/tests to :DEST $MON_SYSTEM_TAR_DIR/tests";
echo
fi
done;
}
copy_mon_doc_files ()
{
for f in $MON_SYSTEM_DOC_FILES; do
if [ ! -e "$MON_SYSTEM_SRC/docs/$f" ] # Check if file exists.
then
echo ":FILE $MON_SYSTEM_SRC/docs/$f does not exist";
echo
else # On to next.
# cp `echo $MON_SYSTEM_SRC/tests/$f $MON_SYSTEM_GIT/docs/$f`;
cp $MON_SYSTEM_SRC/docs/$f $MON_SYSTEM_GIT/docs/$f;
echo "Copied :FILE $f";
echo "From :SOURCE $MON_SYSTEM_SRC/docs to :DEST $MON_SYSTEM_GIT/docs";
echo
fi
done;
}
etags_src ()
{
cd $MON_SYSTEM_SRC
if [ -e "$MON_SYSTEM_SRC/make-mon-systems-etags.sh" ]
then
./make-mon-systems-etags.sh
echo "executing make-mon-systems-etags.sh"
fi
}
etags_after_copy ()
{
cd $MON_SYSTEM_TAR_DIR
z find . -name '*.lisp' -print | xargs etags -o ./TAGS --language=lisp
echo "etags created :FILE $MON_SYSTEM_TAR_DIR/TAGS"
echo
}
tar_it_up ()
{
cd $MON_SYSTEM_TAR_TOP
tar -czvf mon-systems-$TAR_DATE.tgz ./mon-systems
echo "creating tar file mon-systems-$TAR_DATE.tgz in directory: $MON_SYSTEM_TAR_TOP"
}
clean_it_up ()
{
for f in $MON_SYSTEM_FILES; do
if [ ! -e "$MON_SYSTEM_TAR_DIR/$f" ] # Check if file exists.
then
echo ":FILE $MON_SYSTEM_TAR_DIR/$f does not exist";
echo
else # On to next.
rm -f "$MON_SYSTEM_TAR_DIR/$f";
echo "Removed :FILE $MON_SYSTEM_TAR_DIR/$f";
echo
fi
done;
for f in $MON_SYSTEM_TEST_FILES; do
if [ ! -e "$MON_SYSTEM_TAR_DIR/tests/$f" ] # Check if file exists.
then
echo ":FILE $MON_SYSTEM_TAR_DIR/$f does not exist";
echo
else
rm -f "$MON_SYSTEM_TAR_DIR/tests/$f";
echo "Removed :FILE $MON_SYSTEM_TAR_DIR/tests/$f";
fi
done;
}
echo $MON_SYSTEM_SRC
ensure_abort_dirs
ensure_tests_dir
copy_mon_files
copy_mon_test_files
copy_mon_doc_files
# ensure_readme
ensure_loadtime_bind
etags_src
etags_after_copy
tar_it_up
clean_it_up
exit 0
### ==============================
### EOF