@@ -19,46 +19,58 @@ set -e
1919# set -x
2020
2121print_usage () {
22- echo " Synopsis:" >&2
23- echo " $0 " >&2
22+ echo " Synopsis:" >&2
23+ echo " $0 " >&2
2424}
2525
2626if [[ $# -gt 0 ]]; then
27- print_usage
28- exit 1
27+ print_usage
28+ exit 1
2929fi
3030
3131cur_dir=" $( cd " $( dirname " ${0} " ) " && pwd) "
3232cd " ${cur_dir} "
3333
34- archive_name=" jvm-common.tar.xz "
34+ archive_name=" jvm"
3535
36- echo " ---> Creating the archive ${archive_name} "
36+ echo " ---> Creating archives "
3737
3838jvm_common_dir=" $( mktemp --tmpdir=/tmp --directory jvm-common-XXXX) "
3939ignore_files=" $( ./tools/stoml ./buildpack.toml publish.Ignore.files) "
4040exclude_opts=" --exclude=tools"
4141
4242for f in ${ignore_files} ; do
43- exclude_opts=" ${exclude_opts} --exclude=${f} "
43+ exclude_opts=" ${exclude_opts} --exclude=${f} "
4444done
4545
4646# We use rsync instead of cp to copy files excluding some other files
47- rsync --recursive --perms --times --group --owner " ${exclude_opts} " ./* " ${jvm_common_dir} "
47+ rsync --recursive --perms --times --group --owner " ${exclude_opts} " ./* \
48+ " ${jvm_common_dir} "
4849
4950if [[ $? -ne 0 ]]; then
50- echo " Fail to copy the files to the temporary directory (${jvm_common_dir} )" >&2
51- exit 1
51+ echo " Fail to copy the files to the temporary directory (${jvm_common_dir} )" >&2
52+ exit 1
5253fi
5354
54- tar --create --xz --file " ${archive_name} " --directory " ${jvm_common_dir} " .
55+ # Create legacy .tar.xz archive:
56+ tar --create --xz --file " ${archive_name} -common.tar.xz" \
57+ --directory " ${jvm_common_dir} " .
5558
5659if [[ $? -ne 0 ]]; then
57- echo " Error when creating the archive" >&2
58- exit 1
60+ echo " Error when creating the .tar.xz archive" >&2
61+ exit 1
5962fi
63+ echo " .tar.xz: OK."
6064
61- echo " ---> Archive created"
65+ # Create .tgz archive:
66+ tar --create --gzip --file " ${archive_name} .tgz" \
67+ --directory " ${jvm_common_dir} " .
68+
69+ if [[ $? -ne 0 ]]; then
70+ echo " Error when creating the .tgz archive" >&2
71+ exit 1
72+ fi
73+ echo " .tgz: OK."
6274
6375which s3cmd > /dev/null ||
6476 echo " s3cmd is not available in your PATH" >&2 ||
@@ -67,20 +79,36 @@ which s3cmd >/dev/null ||
6779
6880s3_bucket=" buildpacks-repository"
6981
70- echo " ---> Uploading ${archive_name} to S3 (${s3_bucket} )"
82+ echo " ---> Uploading archives to S3 (${s3_bucket} )"
7183
7284s3cmd \
7385 --access_key=" ${AWS_ACCESS_KEY_ID} " \
7486 --secret_key=" ${AWS_SECRET_ACCESS_KEY} " \
7587 --access_token=" ${AWS_SESSION_TOKEN} " \
7688 --acl-public --quiet \
77- put " ${archive_name} " \
89+ put " ${archive_name} -common.tar.xz " \
7890 " s3://${s3_bucket} /"
7991
8092if [[ $? -ne 0 ]]; then
81- echo " Error uploading the archive to S3" >&2
82- exit 1
93+ echo " Error uploading the .tar.xz archive to S3" >&2
94+ exit 1
95+ fi
96+ echo " .tar.xz: OK."
97+
98+ s3cmd \
99+ --access_key=" ${AWS_ACCESS_KEY_ID} " \
100+ --secret_key=" ${AWS_SECRET_ACCESS_KEY} " \
101+ --access_token=" ${AWS_SESSION_TOKEN} " \
102+ --acl-public --quiet \
103+ put " ${archive_name} .tgz" \
104+ " s3://${s3_bucket} /"
105+
106+ if [[ $? -ne 0 ]]; then
107+ echo " Error uploading the .tgz archive to S3" >&2
108+ exit 1
83109fi
110+ echo " .tgz: OK."
111+
84112
85113echo " ---> Deleting the temporary files"
86- rm -r " ${jvm_common_dir} " " ${archive_name} "
114+ rm -r " ${jvm_common_dir} " " ${archive_name} -common.tar.xz " " ${archive_name} .tgz "
0 commit comments