-
Notifications
You must be signed in to change notification settings - Fork 0
/
distro.sh
executable file
·69 lines (60 loc) · 2.23 KB
/
distro.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
#!/bin/sh -e
# Copyright 2009 Wincent Colaiuta.
. "buildtools/Common.sh"
# print warning if current HEAD is not a signed/annotated tag
TAGGED=""
# for signed tags $HEAD will be "2.0" or similar
# for unsigned tags or untagged commits will be "2.0-5-g08867ea" or similar
HEAD=$(git describe)
for TAG in $(git tag)
do
if [ $TAG = $HEAD ]; then
TAGGED=$TAG
fi
done
if [ -z "$TAGGED" ]; then
warn "current HEAD is not tagged/annotated, but it should be for official releases"
TAGGED=$HEAD
fi
# give installer package unique name prior to uploading
mv "$BUILT_PRODUCTS_DIR/WincentStringsUtility.pkg" \
"$BUILT_PRODUCTS_DIR/$PROJECT-$TAGGED.pkg"
# prep source archive
git archive $TAGGED > "$BUILT_PRODUCTS_DIR/$PROJECT-$TAGGED-src.tar"
# add submodules to archive
git ls-tree $TAGGED | grep '^160000 ' | \
while read mode type sha1 path
do
rm -rf "$PROJECT_TEMP_DIR/$PROJECT-$TAGGED-$path-src/$path"
mkdir -p "$PROJECT_TEMP_DIR/$PROJECT-$TAGGED-$path-src/$path"
(cd $path && git archive $sha1 | tar -xf - -C "$PROJECT_TEMP_DIR/$PROJECT-$TAGGED-$path-src/$path")
tar -rf "$BUILT_PRODUCTS_DIR/$PROJECT-$TAGGED-src.tar" \
-C "$PROJECT_TEMP_DIR/$PROJECT-$TAGGED-$path-src" $path
done
bzip2 -f "$BUILT_PRODUCTS_DIR/$PROJECT-$TAGGED-src.tar"
# prep release notes
NOTES="$BUILT_PRODUCTS_DIR/$PROJECT-$TAGGED-release-notes.txt"
"$BUILDTOOLS_DIR/ReleaseNotes.sh" > $NOTES
git ls-tree $TAGGED | grep '^160000 ' | \
while read mode type sha1 path
do
SUBMODULE_NOTES=$(cd $path && "$BUILDTOOLS_DIR/ReleaseNotes.sh" --tag-prefix="wincent-strings-util-")
if [ $(echo "$SUBMODULE_NOTES" | wc -l) -ne 1 ]; then
echo -n "$path: " >> $NOTES
echo "$SUBMODULE_NOTES" >> $NOTES
fi
done
NOTES="$BUILT_PRODUCTS_DIR/$PROJECT-$TAGGED-detailed-release-notes.txt"
"$BUILDTOOLS_DIR/ReleaseNotes.sh" --long > $NOTES
git ls-tree $TAGGED | grep '^160000 ' | \
while read mode type sha1 path
do
SUBMODULE_NOTES=$(cd $path && "$BUILDTOOLS_DIR/ReleaseNotes.sh" --long --tag-prefix="wincent-strings-util-")
if [ $(echo "$SUBMODULE_NOTES" | wc -l) -ne 1 ]; then
echo -n "$path: " >> $NOTES
echo "$SUBMODULE_NOTES" >> $NOTES
fi
done
# prep plaintext version of manpage
MANPAGE="wincent-strings-util.1"
man ./$MANPAGE | col -b > "$BUILT_PRODUCTS_DIR/$MANPAGE.txt"