-
Notifications
You must be signed in to change notification settings - Fork 28
/
pack
executable file
·292 lines (245 loc) · 8.12 KB
/
pack
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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
#!/bin/bash
#
#******************************************************************************
# pack (Sequencer64)
#------------------------------------------------------------------------------
##
# \file pack
# \library Sequencer64
# \author Chris Ahlstrom
# \date 2015-09-10
# \update 2018-09-25
# \version $Revision$
# \license $XPC_SUITE_GPL_LICENSE$
#
# Packs up the current project directory, ignoring some of the derived
# junk and the version-control infrastructure.
#
# Run "./pack --help" for more information.
#
# Now updated to allow some artifacts generated by bootstrap to be included,
# so that a conventional "GNU configure" tarfile can be generated. If you do
# not want that, do a "./bootstrap --full-clean" first.
#
# Please note that making a build from the resulting tarball will not include
# git version information, which is a good thing for release tarballs, which
# just need the date and version number.
#
#-----------------------------------------------------------------------------
CURRENTDATE=$(date +%Y-%m-%d)
CURRENTDIR=$(pwd)
WORKINGDIR=${CURRENTDIR##/*/} # strip all but last part of path
PACKAGENAME="bogus"
TAGSTRING="pack"
DODRYRUN="no"
DOCLEAN="no"
DORELEASE="no"
DODIFFS="no"
BRANCH=`git symbolic-ref -q HEAD 2> /dev/null`
if [ $? == 0 ] ; then
ISGITBRANCH="yes"
GITBRANCH=${BRANCH##*/}
else
ISGITBRANCH="no"
GITBRANCH=""
fi
if [ "$1" == "--help" ] || [ "$1" == "help" ] ; then
cat << E_O_F
seq64 pack 0.5 2018-09-25
Usage: ./pack [--dry-run] [--clean] [--release package] [--diffs] [tag]
where tag is alternate information you want to include in the
name of the tarball; it replaces the current date.
This script packs the contents of the current directory into a
tarball that has the name of the directory and other information
as part of the filename. This tarball should be suitable for unpacking,
then running ./configure, and building the default (currently rtmidi)
build of Sequencer64 (currently the seq64 executable). To create such a
tarball, bootstrap the project for release and rtmidi (or some other setup),
and run "./pack".
This script packs the entire current directory ('$WORKINGDIR') into
a file named like the following (using no tag as an example):
$WORKINGDIR-master-$TAGSTRING-my-code.tar.xz
$WORKINGDIR-$TAGSTRING-my-code.tar.xz
If the --diffs option is specified, "seqpack" is used in lieu of the
current working directory. Obviously, this option will work only in a
git repository.
For source-code releases, one first checks out the desired git branch,
then bootstraps the desired package (e.g. 'rtmidi'), then builds the code
(optional, but recommended), and then runs a command like the following:
./pack --release rtmidi 0.94.6
The resulting tarball can be distributed to users who just want to do
the "./configure ; make ; make install" mantra.
Excluded from the tarball are derived products such as the 'Debug',
'Release', 'html', and 'latex' directories, as well as object
modules and the database/symbol files generated by Visual Studio
or Borland. Version-control-system directories are also ignored.
This script also detects the presence of a git branch, and incorporates
the branch name into the name of the tarball.
Finally, it will pack up configure, the Makefile.in files, and other
necessary files if they are present. Do './bootstrap --full-clean'
first, or './pack --clean', if you don't want these files and want to
start from scratch and build something difference from the default
build.
E_O_F
else
while [ "$1" != "" ] ; do
case "$1" in
# Although this option is no longer needed, keep it around as an
# undocumented feature just in case the user wants to override the
# git discovery.
--branch | --git)
shift
ISGITBRANCH="yes"
GITBRANCH="$1"
;;
--dry-run)
DODRYRUN="yes"
;;
--clean)
DOCLEAN="yes"
;;
--no-clean)
DOCLEAN="no"
;;
--release)
shift
DORELEASE="yes"
PACKAGENAME="$1"
;;
--diffs)
DODIFFS="yes"
;;
*)
TAGSTRING="$1"
;;
esac
shift
done
if [ "$ISGITBRANCH" == "yes" ] ; then
if [ "$DORELEASE" == "yes" ] ; then
TARBALLNAME="$WORKINGDIR-$GITBRANCH-$PACKAGENAME-$TAGSTRING.tar.xz"
elif [ "$DODIFFS" == "yes" ] ; then
TARBALLNAME="seqpack-$GITBRANCH-$CURRENTDATE-$TAGSTRING.tar.xz"
else
TARBALLNAME="$WORKINGDIR-$GITBRANCH-$CURRENTDATE-$TAGSTRING.tar.xz"
fi
else
if [ "$DODIFFS" == "yes" ] ; then
echo "The --diffs option requires a git repository, aborting!"
exit 1
fi
if [ "$DORELEASE" == "yes" ] ; then
TARBALLNAME="$WORKINGDIR-$PACKAGENAME-$TAGSTRING.tar.xz"
else
TARBALLNAME="$WORKINGDIR-$CURRENTDATE-$TAGSTRING.tar.xz"
fi
fi
echo "The tar-ball to be generated is '../$TARBALLNAME'"
if [ "$DODRYRUN" == "yes" ] ; then
if [ "$DOCLEAN" == "yes" ] ; then
echo "Sequencer64 will be cleaned by 'bootstrap --full-clean'."
fi
if [ "$DODIFFS" == "yes" ] ; then
echo "Will do 'tar cJf $TARBALLNAME \$(git diff --name-only)'"
else
echo "Will do 'tar cJf $TARBALLNAME $WORKINGDIR'"
fi
exit 1
fi
if [ "$DOCLEAN" == "yes" ] ; then
echo "Cleaning the project..."
./bootstrap --full-clean
fi
if [ "$DODIFFS" == "yes" ] ; then
tar cJf $TARBALLNAME $(git diff --name-only)
else
# Others that mostly, but not always, are not needed, and so aren't excluded
# at this time:
#
# Makefile
# Makefile.in
# Linux executable files
# --exclude="aux-files"
#
# Removed the slash after WORKINGDIR, and moved it to the end, which
# now allows tar to not include .git in the archive, saving a lot of time
# and space.
pushd ..
if [ -d $WORKINGDIR ] ; then
tar cJf $TARBALLNAME \
--exclude-vcs \
--exclude=".git" \
--exclude="Midiclocker64/midiclocker64" \
--exclude="Sequencer64/sequencer64" \
--exclude="Seq64rtmidi/seq64" \
--exclude="Seq64qt5/qseq64" \
--exclude="Seq64cli/seq64cli" \
--exclude="config.h" \
--exclude="config.status" \
--exclude="libtool" \
--exclude="Makefile" \
--exclude="Debug" \
--exclude="Release" \
--exclude="debug" \
--exclude="release" \
--exclude="autom4te.cache" \
--exclude="core" \
--exclude="moc" \
--exclude="obj" \
--exclude="html" \
--exclude="ipch" \
--exclude="latex" \
--exclude="*stamp*" \
--exclude="tests" \
--exclude="out.*" \
--exclude=".deps" \
--exclude=".exes" \
--exclude=".libs" \
--exclude="*obsolete*" \
--exclude="*.a" \
--exclude="*.BAK" \
--exclude="*.bak" \
--exclude="*.bpi" \
--exclude="*.bz" \
--exclude="*.bz2" \
--exclude="*.deps" \
--exclude="*.gz" \
--exclude="*.idb" \
--exclude="*.ilc" \
--exclude="*.ild" \
--exclude="*.ilf" \
--exclude="*.o" \
--exclude="*.lo" \
--exclude="*.la" \
--exclude="*.lib" \
--exclude="*.log" \
--exclude="*.obj" \
--exclude="*.pch" \
--exclude="*.pdb" \
--exclude="*.Po" \
--exclude="*.sdf" \
--exclude="*.so" \
--exclude="*.stash" \
--exclude="*.swp" \
--exclude=".*.swp" \
--exclude="*.t" \
--exclude="*.tds" \
--exclude="*.tmp" \
--exclude="*.user" \
--exclude="*.xz" \
--exclude="*.testsettings" \
$WORKINGDIR
echo
else
echo "? Working directory $WORKINGDIR does not exist above this directory."
echo " Are you running pack.sh from the proper directory?"
echo " That is what you must do. See './pack --help'."
fi
popd
fi
fi
#******************************************************************************
# pack (Sequencer64)
#------------------------------------------------------------------------------
# vim: ts=3 sw=3 et ft=sh
#------------------------------------------------------------------------------