From 62557e6c9f5c45a56a19bbb5d3b0ee03fbb7b566 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Tue, 25 Jun 2019 21:22:10 +0200 Subject: [PATCH] Upgrade to upstream version 2.3.0 --- README.md | 2 +- conf/app.src | 4 +-- manifest.json | 2 +- scripts/_common.sh | 2 +- scripts/upgrade | 12 +++++++- .../patches/app-1-use-latest_uglify-js.patch | 2 +- ...support-for-older-versions-of-brotli.patch | 29 +++++++++++++++++++ .../patches/app-4-Fix-version-detection.patch | 12 ++++++++ ...i_racer-dependencies-for-ARM-compati.patch | 18 ++++++------ 9 files changed, 67 insertions(+), 16 deletions(-) create mode 100644 sources/patches/app-3-Re-add-support-for-older-versions-of-brotli.patch create mode 100644 sources/patches/app-4-Fix-version-detection.patch diff --git a/README.md b/README.md index 7573a32..4d58a84 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Finally, if installing on a low-end ARM device (e.g. Raspberry Pi): To learn more about the philosophy and goals of the project, [visit **discourse.org**](http://www.discourse.org). -**Shipped version:** 2.2.6 +**Shipped version:** 2.3.0 ## Screenshots diff --git a/conf/app.src b/conf/app.src index 76c956b..f0fc559 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,3 +1,3 @@ -SOURCE_URL=https://github.com/discourse/discourse/archive/v2.2.6.tar.gz -SOURCE_SUM=6d64745f50f9fb6d99e3c766d758869a9baa36ad0ccfc254b215fbcba232f52a +SOURCE_URL=https://github.com/discourse/discourse/archive/v2.3.0.tar.gz +SOURCE_SUM=22a8c9dbc6df396f7ee4946f5a2ecdca3e42fad2d1c238dab17f65b316cce754 SOURCE_FORMAT=tar.gz diff --git a/manifest.json b/manifest.json index e602cab..f0d4b8d 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Discussion platform", "fr": "Plateforme de discussion" }, - "version": "2.2.6~ynh1", + "version": "2.3.0~ynh1", "url": "http://Discourse.org", "license": "GPL-2.0", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index d267bab..9131c28 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,7 +3,7 @@ # Common variables # -pkg_dependencies="libjemalloc1 libjemalloc-dev zlib1g-dev libreadline-dev libpq-dev libssl-dev libyaml-dev libcurl4-openssl-dev libapr1-dev libxslt1-dev checkinstall libxml2-dev vim imagemagick postgresql postgresql-server-dev-all postgresql-contrib optipng jhead jpegoptim gifsicle" +pkg_dependencies="libjemalloc1 libjemalloc-dev zlib1g-dev libreadline-dev libpq-dev libssl-dev libyaml-dev libcurl4-openssl-dev libapr1-dev libxslt1-dev checkinstall libxml2-dev vim imagemagick postgresql postgresql-server-dev-all postgresql-contrib optipng jhead jpegoptim gifsicle brotli" RUBY_VERSION="2.6.0" # Execute a command as another user with login diff --git a/scripts/upgrade b/scripts/upgrade index 0c72732..ae463bd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -114,7 +114,17 @@ if ! ynh_is_upstream_up_to_date ; then if [ -d $tmpdir/log ] ; then cp -Rp $tmpdir/log $final_path fi - cp -Rp $tmpdir/plugins/* $final_path/plugins + ( + cd $tmpdir/plugins/ + for discourse_plugin_dir in */ + do + # Only copy plugins not included in Discourse archive + if [ ! -d "$final_path/plugins/$discourse_plugin_dir" ] + then + cp -a "$discourse_plugin_dir" "$final_path/plugins/$discourse_plugin_dir" + fi + done + ) cp -Rp $tmpdir/log $final_path cp -p $tmpdir/discourse.conf $final_path/config diff --git a/sources/patches/app-1-use-latest_uglify-js.patch b/sources/patches/app-1-use-latest_uglify-js.patch index 97d9375..5af4246 100644 --- a/sources/patches/app-1-use-latest_uglify-js.patch +++ b/sources/patches/app-1-use-latest_uglify-js.patch @@ -1,5 +1,5 @@ diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake -index 8575ca11dc..a643316bac 100644 +index 4a02d5f1b1..7b47f21658 100644 --- a/lib/tasks/assets.rake +++ b/lib/tasks/assets.rake @@ -94,6 +94,7 @@ def compress_ruby(from, to) diff --git a/sources/patches/app-3-Re-add-support-for-older-versions-of-brotli.patch b/sources/patches/app-3-Re-add-support-for-older-versions-of-brotli.patch new file mode 100644 index 0000000..728758a --- /dev/null +++ b/sources/patches/app-3-Re-add-support-for-older-versions-of-brotli.patch @@ -0,0 +1,29 @@ +diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake +index 7b47f21658..ea6d0da2c4 100644 +--- a/lib/tasks/assets.rake ++++ b/lib/tasks/assets.rake +@@ -116,9 +116,21 @@ def gzip(path) + end + + # different brotli versions use different parameters +-def brotli_command(path, max_compress) +- compression_quality = max_compress ? "11" : "6" +- "brotli -f --quality=#{compression_quality} #{path} --output=#{path}.br" ++ver_out, _ver_err, ver_status = Open3.capture3('brotli --version') ++if !ver_status.success? ++ # old versions of brotli don't respond to --version ++ def brotli_command(path, max_compress) ++ compression_quality = max_compress ? "11" : "6" ++ "brotli --quality 11 --input #{path} --output #{path}.br" ++ end ++elsif ver_out >= "brotli 1.0.0" ++ def brotli_command(path, max_compress) ++ compression_quality = max_compress ? "11" : "6" ++ "brotli -f --quality=11 #{path} --output=#{path}.br" ++ end ++else ++ # not sure what to do here, not expecting this ++ raise "cannot determine brotli version" + end + + def brotli(path, max_compress) diff --git a/sources/patches/app-4-Fix-version-detection.patch b/sources/patches/app-4-Fix-version-detection.patch new file mode 100644 index 0000000..efe97d0 --- /dev/null +++ b/sources/patches/app-4-Fix-version-detection.patch @@ -0,0 +1,12 @@ +diff --git a/lib/discourse.rb b/lib/discourse.rb +index 2b53a91eb3..eec55647d5 100644 +--- a/lib/discourse.rb ++++ b/lib/discourse.rb +@@ -439,7 +439,7 @@ module Discourse + $full_version ||= + begin + git_cmd = 'git describe --dirty --match "v[0-9]*"' +- self.try_git(git_cmd, 'unknown') ++ self.try_git(git_cmd, Discourse::VERSION::STRING) + end + end diff --git a/sources/patches_arm/app-2-Revert-libv8-mini_racer-dependencies-for-ARM-compati.patch b/sources/patches_arm/app-2-Revert-libv8-mini_racer-dependencies-for-ARM-compati.patch index 3acd77d..ef7a7c8 100644 --- a/sources/patches_arm/app-2-Revert-libv8-mini_racer-dependencies-for-ARM-compati.patch +++ b/sources/patches_arm/app-2-Revert-libv8-mini_racer-dependencies-for-ARM-compati.patch @@ -1,24 +1,24 @@ diff --git a/Gemfile.lock b/Gemfile.lock -index df7187902b..04c80a956c 100644 +index 0fa35801f0..2b7c4a3fc8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock -@@ -172,7 +172,7 @@ GEM - jwt (2.1.0) +@@ -154,7 +154,7 @@ GEM + json (2.2.0) + jwt (2.2.1) kgio (2.11.2) - kramdown (1.17.0) - libv8 (7.3.492.27.1) + libv8 (6.3.292.48.1) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) -@@ -200,8 +200,8 @@ GEM - method_source (0.8.2) +@@ -182,8 +182,8 @@ GEM + method_source (0.9.2) mini_mime (1.0.1) mini_portile2 (2.4.0) -- mini_racer (0.2.5) +- mini_racer (0.2.6) - libv8 (>= 6.9.411) + mini_racer (0.1.15) + libv8 (~> 6.3) - mini_scheduler (0.9.1) + mini_scheduler (0.9.2) sidekiq - mini_sql (0.1.10) + mini_sql (0.2.2)