Skip to content

Commit 4e3530b

Browse files
Merge pull request #208 from snappizz/topic/package-naming-tweaks
Tweak names produced by package script, merge #186 into 3.10
2 parents 9326e12 + 6f62865 commit 4e3530b

File tree

2 files changed

+111
-0
lines changed

2 files changed

+111
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.DS_Store
22
build*
3+
package/*.tar.bz2
4+
package/*.asc
35
source/local/*.cpp
46
source/local/*.scd
57
source/local/*.sc

package/create_package.sh

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#!/usr/bin/env bash
2+
# Creates assets for sc3-plugins in the form of
3+
# 'sc3-plugins-x.x.x-Source.tar.bz2' and moves the file to the repository's
4+
# package folder.
5+
# Requires a writable /tmp folder.
6+
7+
set -euo pipefail
8+
9+
get_absolute_path() {
10+
echo "$(cd "$(dirname "$0")" && pwd -P)"
11+
}
12+
13+
remove_source_dir() {
14+
echo "Removing potential previous sources."
15+
rm -rf "${source_dir}/sc3-plugins"*
16+
}
17+
18+
checkout_project() {
19+
remove_source_dir
20+
echo "Cloning project..."
21+
cd "$source_dir"
22+
git clone $upstream --branch "Version-$version" --single-branch --recursive
23+
}
24+
25+
clean_sources() {
26+
cd "${source_dir}/${package_name}"
27+
echo "Removing unneeded files and folders..."
28+
rm -rfv .gitignore \
29+
.gitmodules \
30+
.travis.yml \
31+
.git/ \
32+
website \
33+
package
34+
}
35+
36+
rename_sources() {
37+
cd "${source_dir}"
38+
mv -v "${package_name}" "${package_name}-${version}-Source"
39+
}
40+
41+
compress_sources() {
42+
cd "${source_dir}"
43+
tar cvfz "${package_name}-${version}-Source.tar.bz2" \
44+
"${package_name}-${version}-Source"
45+
}
46+
47+
move_sources() {
48+
cd "${source_dir}"
49+
mv -v "${package_name}-${version}-Source.tar.bz2" "${output_dir}/"
50+
}
51+
52+
sign_sources() {
53+
cd "${output_dir}"
54+
gpg2 --default-key "${signer}" \
55+
--output "${package_name}-${version}-Source.tar.bz2.asc" \
56+
--detach-sign "${package_name}-${version}-Source.tar.bz2"
57+
}
58+
59+
cleanup_source_dir() {
60+
cd "${source_dir}"
61+
rm -rf "${package_name}-${version}"
62+
}
63+
64+
print_help() {
65+
echo "Usage: $0 -v <version tag> -s <signature email>"
66+
exit 1
67+
}
68+
69+
upstream="https://github.com/supercollider/sc3-plugins"
70+
package_name="sc3-plugins"
71+
source_dir="/tmp"
72+
version=`date "+%Y-%m-%d"`
73+
signer=""
74+
signature=0
75+
output_dir=$(get_absolute_path $0)
76+
77+
if [ ${#@} -gt 0 ]; then
78+
while getopts 'hv:s:' flag; do
79+
case "${flag}" in
80+
h) print_help
81+
;;
82+
s) signer=$OPTARG
83+
signature=1
84+
;;
85+
v) version=$OPTARG
86+
;;
87+
*)
88+
echo "Error! Try '${0} -h'."
89+
exit 1
90+
;;
91+
esac
92+
done
93+
else
94+
print_help
95+
fi
96+
97+
checkout_project
98+
clean_sources
99+
rename_sources
100+
compress_sources
101+
move_sources
102+
if [ $signature -eq 1 ]; then
103+
sign_sources
104+
fi
105+
cleanup_source_dir
106+
107+
exit 0
108+
109+
# vim:set ts=2 sw=2 et:

0 commit comments

Comments
 (0)