From f1d085ba5d52b54fe527f75d2058f11e54c71f67 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 25 Feb 2018 02:47:40 +0100 Subject: [PATCH 1/8] .gitignore: Adding created assets to ignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 8319354fca..adc2c6fd8f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .DS_Store build* +package/*.tar.tgz source/local/*.cpp source/local/*.scd source/local/*.sc From 246ec2981fbd5a4d84b9f37757b76cdf25c768ef Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 25 Feb 2018 02:49:17 +0100 Subject: [PATCH 2/8] package/create_package.sh: First attempt at creating assets (using /tmp) and a valid version tag. Might not work on macOS properly, because there's no readlink (install with brew/macports). --- package/create_package.sh | 89 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100755 package/create_package.sh diff --git a/package/create_package.sh b/package/create_package.sh new file mode 100755 index 0000000000..14280d52f0 --- /dev/null +++ b/package/create_package.sh @@ -0,0 +1,89 @@ +#!/usr/bin/env bash +# Creates assets for sc3-plugins +# Requires: readlink (in coreutils package), git, access to /tmp + +set -euo pipefail + +get_absolute_path() { + echo $(dirname $(readlink -f "$0")) +} + +create_source_dir(){ + local abs_path="$1" + mkdir -pv "${abs_path}/source" + echo "${abs_path}/source" +} + +remove_source_dir(){ + echo "Removing potential previous sources." + rm -rf "${source_dir}/sc3-plugins"* +} + +checkout_project() { + remove_source_dir + echo "Cloning project..." + cd "$source_dir" + git clone $upstream + echo "Checking out version: Version-$version" + cd "$package_name" + git checkout "Version-$version" +} + +checkout_external_libraries() { + echo "Checking out external libraries..." + cd "${source_dir}/${package_name}" + git submodule update --init --recursive +} + +clean_sources() { + cd "${source_dir}/${package_name}" + rm -rfv .gitigonre \ + .git/ \ + .travis.yml \ + website +} + +rename_sources() { + cd "${source_dir}" + mv -v "${package_name}" "${package_name}-Version-${version}" +} + +compress_sources() { + cd "${source_dir}" + tar cvfz "${package_name}-Version-${version}.tar.tgz" \ + "${package_name}-Version-${version}" +} + +move_sources() { + cd "${source_dir}" + mv -v "${package_name}-Version-${version}.tar.tgz" "${abs_path}/" +} + +upstream="https://github.com/supercollider/sc3-plugins" +package_name="sc3-plugins" +source_dir="/tmp" +os=`uname` +version=`date "+%Y-%m-%d"` +abs_path=$(get_absolute_path $0) + +while getopts ":v:s" Option +do + case $Option in + v ) version=$OPTARG + ;; + s ) package_type="source" + ;; + esac +done +shift $(($OPTIND - 1)) + +checkout_project +checkout_external_libraries +clean_sources +rename_sources +compress_sources +move_sources + +exit 0 + +# vim:set ts=2 sw=2 et: From 620817ca65eda208f1669184e537d39b2398cfa2 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 25 Feb 2018 12:34:44 +0100 Subject: [PATCH 3/8] package/create_package.sh: Adding top comment. Fixing typo in clean_sources() and adding more folders. Unifying the moving of tarball by using output_dir (which is currently HOME for macOS and package dir for Linux. Adding cleanup_source_dir() to remove versioned package directory. Removing unused function. --- package/create_package.sh | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/package/create_package.sh b/package/create_package.sh index 14280d52f0..72da0766c0 100755 --- a/package/create_package.sh +++ b/package/create_package.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash -# Creates assets for sc3-plugins -# Requires: readlink (in coreutils package), git, access to /tmp +# Creates assets for sc3-plugins in the form of +# 'sc3-plugins-Version-x.x.x.tar.gz' and moves the file to $HOME (macOS) the +# repository's package folder (Linux). +# Requires a writable /tmp folder. set -euo pipefail @@ -8,12 +10,6 @@ get_absolute_path() { echo $(dirname $(readlink -f "$0")) } -create_source_dir(){ - local abs_path="$1" - mkdir -pv "${abs_path}/source" - echo "${abs_path}/source" -} - remove_source_dir(){ echo "Removing potential previous sources." rm -rf "${source_dir}/sc3-plugins"* @@ -37,10 +33,13 @@ checkout_external_libraries() { clean_sources() { cd "${source_dir}/${package_name}" - rm -rfv .gitigonre \ - .git/ \ + echo "Removing unneeded files and folders..." + rm -rfv .gitignore \ + .gitmodules \ .travis.yml \ - website + .git/ \ + website \ + package } rename_sources() { @@ -56,15 +55,23 @@ compress_sources() { move_sources() { cd "${source_dir}" - mv -v "${package_name}-Version-${version}.tar.tgz" "${abs_path}/" + mv -v "${package_name}-Version-${version}.tar.tgz" "${output_dir}/" +} + +cleanup_source_dir() { + cd "${source_dir}" + rm -rf "${package_name}-Version-${version}" } upstream="https://github.com/supercollider/sc3-plugins" package_name="sc3-plugins" source_dir="/tmp" +output_dir="$HOME" os=`uname` version=`date "+%Y-%m-%d"` -abs_path=$(get_absolute_path $0) +if [ $os = "Linux" ]; then + output_dir=$(get_absolute_path $0) +fi while getopts ":v:s" Option do @@ -83,6 +90,7 @@ clean_sources rename_sources compress_sources move_sources +cleanup_source_dir exit 0 From 114e7a682ada940c3aeafdcba278b50419d9bf0d Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 18 Mar 2018 20:41:28 +0100 Subject: [PATCH 4/8] package/create_package.sh: Using workaround to output to the same directory as the script is in on macOS and Linux alike. --- package/create_package.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/package/create_package.sh b/package/create_package.sh index 72da0766c0..23d8dc984a 100755 --- a/package/create_package.sh +++ b/package/create_package.sh @@ -7,7 +7,7 @@ set -euo pipefail get_absolute_path() { - echo $(dirname $(readlink -f "$0")) + echo "$(cd "$(dirname "$0")" && pwd -P)" } remove_source_dir(){ @@ -66,12 +66,8 @@ cleanup_source_dir() { upstream="https://github.com/supercollider/sc3-plugins" package_name="sc3-plugins" source_dir="/tmp" -output_dir="$HOME" -os=`uname` version=`date "+%Y-%m-%d"` -if [ $os = "Linux" ]; then - output_dir=$(get_absolute_path $0) -fi +output_dir=$(get_absolute_path $0) while getopts ":v:s" Option do From 0d5161c5e514b1f3e8af87e93be1c8418fa2dbc6 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 18 Mar 2018 21:41:56 +0100 Subject: [PATCH 5/8] package/create_package.sh: Updating initial comment. Adding print_help() function. Revising getopts usage and defaulting to print_help in case of no input. --- package/create_package.sh | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/package/create_package.sh b/package/create_package.sh index 23d8dc984a..d2eb620425 100755 --- a/package/create_package.sh +++ b/package/create_package.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Creates assets for sc3-plugins in the form of -# 'sc3-plugins-Version-x.x.x.tar.gz' and moves the file to $HOME (macOS) the -# repository's package folder (Linux). +# 'sc3-plugins-Version-x.x.x.tar.gz' and moves the file to the repository's +# package folder. # Requires a writable /tmp folder. set -euo pipefail @@ -63,22 +63,33 @@ cleanup_source_dir() { rm -rf "${package_name}-Version-${version}" } +print_help() { + echo "Usage: $0 -v " + exit 1 +} + upstream="https://github.com/supercollider/sc3-plugins" package_name="sc3-plugins" source_dir="/tmp" version=`date "+%Y-%m-%d"` output_dir=$(get_absolute_path $0) -while getopts ":v:s" Option -do - case $Option in - v ) version=$OPTARG - ;; - s ) package_type="source" +if [ ${#@} -gt 0 ]; then + while getopts 'hv:' flag; do + case "${flag}" in + h) print_help + ;; + v) version=$OPTARG + ;; + *) + echo "Error! Try '${0} -h'." + exit 1 ;; - esac -done -shift $(($OPTIND - 1)) + esac + done +else + print_help +fi checkout_project checkout_external_libraries From 18483a32b0e50c4877032fcb974944a950b58a8c Mon Sep 17 00:00:00 2001 From: David Runge Date: Wed, 21 Mar 2018 15:45:24 +0100 Subject: [PATCH 6/8] package/create_package.sh: Adding function to automatically sign source tarball with a given ID/e-mail, when -s flag is provided. --- package/create_package.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/package/create_package.sh b/package/create_package.sh index d2eb620425..c4cf8c2318 100755 --- a/package/create_package.sh +++ b/package/create_package.sh @@ -58,13 +58,20 @@ move_sources() { mv -v "${package_name}-Version-${version}.tar.tgz" "${output_dir}/" } +sign_sources() { + cd "${output_dir}" + gpg2 --default-key "${signer}" \ + --output "${package_name}-Version-${version}.tar.tgz.asc" \ + --detach-sign "${package_name}-Version-${version}.tar.tgz" +} + cleanup_source_dir() { cd "${source_dir}" rm -rf "${package_name}-Version-${version}" } print_help() { - echo "Usage: $0 -v " + echo "Usage: $0 -v -s " exit 1 } @@ -72,13 +79,18 @@ upstream="https://github.com/supercollider/sc3-plugins" package_name="sc3-plugins" source_dir="/tmp" version=`date "+%Y-%m-%d"` +signer="" +signature=0 output_dir=$(get_absolute_path $0) if [ ${#@} -gt 0 ]; then - while getopts 'hv:' flag; do + while getopts 'hv:s:' flag; do case "${flag}" in h) print_help ;; + s) signer=$OPTARG + signature=1 + ;; v) version=$OPTARG ;; *) @@ -97,6 +109,9 @@ clean_sources rename_sources compress_sources move_sources +if [ $signature -eq 1 ]; then + sign_sources +fi cleanup_source_dir exit 0 From 4484d212ca19e6177785a8946ade1be8a727e42b Mon Sep 17 00:00:00 2001 From: David Runge Date: Fri, 3 Aug 2018 23:37:57 +0200 Subject: [PATCH 7/8] .gitignore: Also ignoring signatures. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index adc2c6fd8f..476dd55de8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .DS_Store build* package/*.tar.tgz +package/*.asc source/local/*.cpp source/local/*.scd source/local/*.sc From 9beee8a1b6571165f15e6ef56c0e9380dae7c58b Mon Sep 17 00:00:00 2001 From: David Runge Date: Fri, 3 Aug 2018 23:38:32 +0200 Subject: [PATCH 8/8] package/create_package.sh: Simplifying the cloning process. --- package/create_package.sh | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/package/create_package.sh b/package/create_package.sh index c4cf8c2318..2a61a0bc22 100755 --- a/package/create_package.sh +++ b/package/create_package.sh @@ -10,7 +10,7 @@ get_absolute_path() { echo "$(cd "$(dirname "$0")" && pwd -P)" } -remove_source_dir(){ +remove_source_dir() { echo "Removing potential previous sources." rm -rf "${source_dir}/sc3-plugins"* } @@ -19,16 +19,7 @@ checkout_project() { remove_source_dir echo "Cloning project..." cd "$source_dir" - git clone $upstream - echo "Checking out version: Version-$version" - cd "$package_name" - git checkout "Version-$version" -} - -checkout_external_libraries() { - echo "Checking out external libraries..." - cd "${source_dir}/${package_name}" - git submodule update --init --recursive + git clone $upstream --branch "Version-$version" --single-branch --recursive } clean_sources() { @@ -104,7 +95,6 @@ else fi checkout_project -checkout_external_libraries clean_sources rename_sources compress_sources