Merge pull request #315094 from NixOS/backport-299269-to-release-24.05

[Backport release-24.05] discourse: 3.1.0 -> 3.2.2
This commit is contained in:
Martin Weinelt 2024-05-27 17:48:50 +02:00 committed by GitHub
commit 0b1b49a45f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 571 additions and 540 deletions

View File

@ -1,13 +0,0 @@
diff --git a/app/assets/javascripts/discourse/package.json b/app/assets/javascripts/discourse/package.json
index 9e4533d2..e57f8a5f 100644
--- a/app/assets/javascripts/discourse/package.json
+++ b/app/assets/javascripts/discourse/package.json
@@ -14,7 +14,7 @@
"build": "ember build",
"start": "ember serve",
"test": "ember test",
- "postinstall": "yarn --silent --cwd .. patch-package"
+ "postinstall": "patch-package"
},
"dependencies": {
"@babel/core": "^7.21.4",

View File

@ -1,13 +1,13 @@
diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake
index 68b5db61ac..d460b5753e 100644 index 9608297789..5487490915 100644
--- a/lib/tasks/assets.rake --- a/lib/tasks/assets.rake
+++ b/lib/tasks/assets.rake +++ b/lib/tasks/assets.rake
@@ -19,7 +19,7 @@ task 'assets:precompile:before' do @@ -36,7 +36,7 @@ task "assets:precompile:build" do
if only_ember_precompile_build_remaining
if only_assets_precompile_remaining exec "#{compile_command}"
# Using exec to free up Rails app memory during ember build elsif only_assets_precompile_remaining
- exec "#{compile_command} && EMBER_CLI_COMPILE_DONE=1 bin/rake assets:precompile" - exec "#{compile_command} && SKIP_EMBER_CLI_COMPILE=1 bin/rake assets:precompile"
+ exec "#{compile_command} && EMBER_CLI_COMPILE_DONE=1 bundle exec rake assets:precompile" + exec "#{compile_command} && SKIP_EMBER_CLI_COMPILE=1 bundle exec rake assets:precompile"
else else
system compile_command system compile_command, exception: true
end EmberCli.clear_cache!

View File

@ -46,13 +46,13 @@
}@args: }@args:
let let
version = "3.1.0"; version = "3.2.2";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "discourse"; owner = "discourse";
repo = "discourse"; repo = "discourse";
rev = "v${version}"; rev = "v${version}";
sha256 = "sha256-Iv7VSnK8nZDpmIwIRPedSWlftABKuMOQ4MXDGpjuWrY="; sha256 = "sha256-JUCFtB5BvBytO3flq9o6iI3HPmvLU358HEmE6wbBsSk=";
}; };
ruby = ruby_3_2; ruby = ruby_3_2;
@ -65,6 +65,7 @@ let
gnutar gnutar
git git
brotli brotli
nodejs_18
# Misc required system utils # Misc required system utils
which which
@ -200,9 +201,14 @@ let
pname = "discourse-assets"; pname = "discourse-assets";
inherit version src; inherit version src;
yarnDevOfflineCache = fetchYarnDeps {
yarnLock = src + "/yarn.lock";
hash = "sha256-0s8c2V8Wl3f5kL1OIn2ps6hL7CUQD5+LJm+9LYHc+W0=";
};
yarnOfflineCache = fetchYarnDeps { yarnOfflineCache = fetchYarnDeps {
yarnLock = src + "/app/assets/javascripts/yarn.lock"; yarnLock = src + "/app/assets/javascripts/yarn-ember5.lock";
sha256 = "0sclrv3303dgg3r08dwhd1yvi3pvlnvnikn300vjsh6c71fnzhnj"; hash = "sha256-ZBXvNdHHV92kSAswe6KA+OqaY5smf7ZKTTOiY8g78D0=";
}; };
nativeBuildInputs = runtimeDeps ++ [ nativeBuildInputs = runtimeDeps ++ [
@ -210,9 +216,7 @@ let
redis redis
nodePackages.uglify-js nodePackages.uglify-js
terser terser
nodePackages.patch-package
yarn yarn
nodejs_18
jq jq
moreutils moreutils
fixup-yarn-lock fixup-yarn-lock
@ -234,13 +238,14 @@ let
# assets precompilation task. # assets precompilation task.
./assets_rake_command.patch ./assets_rake_command.patch
# `app/assets/javascripts/discourse/package.json`'s postinstall # Little does he know, so he decided there is no need to generate the
# hook tries to call `../node_modules/.bin/patch-package`, which # theme-transpiler over and over again. Which at the same time allows the removal
# hasn't been `patchShebangs`-ed yet. So instead we just use # of javascript devDependencies from the runtime environment.
# `patch-package` from `nativeBuildInputs`. ./prebuild-theme-transpiler.patch
./asserts_patch-package_from_path.patch
]; ];
env.RAILS_ENV = "production";
# We have to set up an environment that is close enough to # We have to set up an environment that is close enough to
# production ready or the assets:precompile task refuses to # production ready or the assets:precompile task refuses to
# run. This means that Redis and PostgreSQL has to be running and # run. This means that Redis and PostgreSQL has to be running and
@ -249,27 +254,30 @@ let
# Yarn wants a real home directory to write cache, config, etc to # Yarn wants a real home directory to write cache, config, etc to
export HOME=$NIX_BUILD_TOP/fake_home export HOME=$NIX_BUILD_TOP/fake_home
# Make yarn install packages from our offline cache, not the registry yarn_install() {
yarn config --offline set yarn-offline-mirror $yarnOfflineCache local offlineCache=$1 yarnLock=$2
# Fixup "resolved"-entries in yarn.lock to match our offline cache # Make yarn install packages from our offline cache, not the registry
fixup-yarn-lock app/assets/javascripts/yarn.lock yarn config --offline set yarn-offline-mirror $offlineCache
# Fixup "resolved"-entries in yarn.lock to match our offline cache
fixup-yarn-lock $yarnLock
# Install while ignoring hook scripts
yarn --offline --ignore-scripts --cwd $(dirname $yarnLock) install
}
# Install devDependencies for generating the theme-transpiler executed as
# dependent task assets:precompile:theme_transpiler before db:migrate
yarn_install $yarnDevOfflineCache yarn.lock
# Install the runtime dependencies
yarn_install $yarnOfflineCache app/assets/javascripts/yarn-ember5.lock
# Patch before running postinstall hook script
patchShebangs --build app/assets/javascripts
yarn --offline --cwd app/assets/javascripts run postinstall
export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
find app/assets/javascripts -name package.json -print0 \
| xargs -0 -I {} bash -c "jq 'del(.scripts.postinstall)' -r <{} | sponge {}"
yarn install --offline --cwd app/assets/javascripts/discourse
patchShebangs app/assets/javascripts/node_modules/
# Run `patch-package` AFTER the corresponding shebang inside `.bin/patch-package`
# got patched. Otherwise this will fail with
# /bin/sh: line 1: /build/source/app/assets/javascripts/node_modules/.bin/patch-package: cannot execute: required file not found
pushd app/assets/javascripts &>/dev/null
yarn run patch-package
popd &>/dev/null
redis-server >/dev/null & redis-server >/dev/null &
initdb -A trust $NIX_BUILD_TOP/postgres >/dev/null initdb -A trust $NIX_BUILD_TOP/postgres >/dev/null
@ -286,14 +294,8 @@ let
psql 'discourse' -tAc "CREATE EXTENSION IF NOT EXISTS pg_trgm" psql 'discourse' -tAc "CREATE EXTENSION IF NOT EXISTS pg_trgm"
psql 'discourse' -tAc "CREATE EXTENSION IF NOT EXISTS hstore" psql 'discourse' -tAc "CREATE EXTENSION IF NOT EXISTS hstore"
# Create a temporary home dir to stop bundler from complaining
mkdir $NIX_BUILD_TOP/tmp_home
export HOME=$NIX_BUILD_TOP/tmp_home
${lib.concatMapStringsSep "\n" (p: "ln -sf ${p} plugins/${p.pluginName or ""}") plugins} ${lib.concatMapStringsSep "\n" (p: "ln -sf ${p} plugins/${p.pluginName or ""}") plugins}
export RAILS_ENV=production
bundle exec rake db:migrate >/dev/null bundle exec rake db:migrate >/dev/null
chmod -R +w tmp chmod -R +w tmp
''; '';
@ -352,6 +354,11 @@ let
# Make sure the notification email setting applies # Make sure the notification email setting applies
./notification_email.patch ./notification_email.patch
# Little does he know, so he decided there is no need to generate the
# theme-transpiler over and over again. Which at the same time allows the removal
# of javascript devDependencies from the runtime environment.
./prebuild-theme-transpiler.patch
]; ];
postPatch = '' postPatch = ''

View File

@ -0,0 +1,21 @@
diff --git a/lib/discourse_js_processor.rb b/lib/discourse_js_processor.rb
index 26d142fa4d..6040aba6f4 100644
--- a/lib/discourse_js_processor.rb
+++ b/lib/discourse_js_processor.rb
@@ -68,7 +68,7 @@ class DiscourseJsProcessor
TRANSPILER_PATH =
(
if Rails.env.production?
- "tmp/theme-transpiler.js"
+ "app/assets/javascripts/theme-transpiler.js"
else
"tmp/theme-transpiler/#{Process.pid}.js"
end
@@ -87,6 +87,6 @@ class DiscourseJsProcessor
"node",
"app/assets/javascripts/theme-transpiler/build.js",
TRANSPILER_PATH,
- )
+ ) if !Rails.env.production? or !File.file?(TRANSPILER_PATH)
TRANSPILER_PATH
end

View File

@ -6,28 +6,14 @@ source "https://rubygems.org"
gem "bootsnap", require: false, platform: :mri gem "bootsnap", require: false, platform: :mri
def rails_master? gem "actionmailer", "< 7.1"
ENV["RAILS_MASTER"] == "1" gem "actionpack", "< 7.1"
end gem "actionview", "< 7.1"
gem "activemodel", "< 7.1"
if rails_master? gem "activerecord", "< 7.1"
gem "arel", git: "https://github.com/rails/arel.git" gem "activesupport", "< 7.1"
gem "rails", git: "https://github.com/rails/rails.git" gem "railties", "< 7.1"
else gem "sprockets-rails"
# NOTE: Until rubygems gives us optional dependencies we are stuck with this needing to be explicit
# this allows us to include the bits of rails we use without pieces we do not.
#
# To issue a rails update bump the version number here
rails_version = "7.0.5.1"
gem "actionmailer", rails_version
gem "actionpack", rails_version
gem "actionview", rails_version
gem "activemodel", rails_version
gem "activerecord", rails_version
gem "activesupport", rails_version
gem "railties", rails_version
gem "sprockets-rails"
end
gem "json" gem "json"
@ -141,10 +127,11 @@ group :test do
gem "fakeweb", require: false gem "fakeweb", require: false
gem "minitest", require: false gem "minitest", require: false
gem "simplecov", require: false gem "simplecov", require: false
gem "selenium-webdriver", require: false gem "selenium-webdriver", "~> 4.14", require: false
gem "selenium-devtools", require: false
gem "test-prof" gem "test-prof"
gem "webdrivers", require: false
gem "rails-dom-testing", require: false gem "rails-dom-testing", require: false
gem "minio_runner", require: false
end end
group :test, :development do group :test, :development do
@ -158,7 +145,7 @@ group :test, :development do
gem "rspec-rails" gem "rspec-rails"
gem "shoulda-matchers", require: false, github: "thoughtbot/shoulda-matchers" gem "shoulda-matchers", require: false
gem "rspec-html-matchers" gem "rspec-html-matchers"
gem "byebug", require: ENV["RM_INFO"].nil?, platform: :mri gem "byebug", require: ENV["RM_INFO"].nil?, platform: :mri
gem "rubocop-discourse", require: false gem "rubocop-discourse", require: false
@ -209,7 +196,9 @@ gem "rack-mini-profiler", require: ["enable_rails_patches"]
gem "unicorn", require: false, platform: :ruby gem "unicorn", require: false, platform: :ruby
gem "puma", require: false gem "puma", require: false
gem "rbtrace", require: false, platform: :mri gem "rbtrace", require: false, platform: :mri
gem "gc_tracer", require: false, platform: :mri gem "gc_tracer", require: false, platform: :mri
# required for feed importing and embedding # required for feed importing and embedding
@ -228,9 +217,8 @@ gem "logstash-event", require: false
gem "logstash-logger", require: false gem "logstash-logger", require: false
gem "logster" gem "logster"
# These are forks of sassc and sassc-rails with dart-sass support # A fork of sassc with dart-sass support
gem "dartsass-ruby" gem "sassc-embedded"
gem "dartsass-sprockets"
gem "rotp", require: false gem "rotp", require: false
@ -259,6 +247,11 @@ if ENV["IMPORT"] == "1"
gem "parallel", require: false gem "parallel", require: false
end end
group :generic_import, optional: true do
gem "sqlite3"
gem "redcarpet"
end
gem "web-push" gem "web-push"
gem "colored2", require: false gem "colored2", require: false
gem "maxminddb" gem "maxminddb"

View File

@ -7,63 +7,56 @@ GIT
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
GIT
remote: https://github.com/thoughtbot/shoulda-matchers.git
revision: 783a90554053002017510285bc736099b2749c22
specs:
shoulda-matchers (5.3.0)
activesupport (>= 5.2.0)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actionmailer (7.0.5.1) actionmailer (7.0.8)
actionpack (= 7.0.5.1) actionpack (= 7.0.8)
actionview (= 7.0.5.1) actionview (= 7.0.8)
activejob (= 7.0.5.1) activejob (= 7.0.8)
activesupport (= 7.0.5.1) activesupport (= 7.0.8)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
net-imap net-imap
net-pop net-pop
net-smtp net-smtp
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (7.0.5.1) actionpack (7.0.8)
actionview (= 7.0.5.1) actionview (= 7.0.8)
activesupport (= 7.0.5.1) activesupport (= 7.0.8)
rack (~> 2.0, >= 2.2.4) rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionview (7.0.5.1) actionview (7.0.8)
activesupport (= 7.0.5.1) activesupport (= 7.0.8)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0)
actionview_precompiler (0.2.3) actionview_precompiler (0.3.0)
actionview (>= 6.0.a) actionview (>= 6.0.a)
active_model_serializers (0.8.4) active_model_serializers (0.8.4)
activemodel (>= 3.0) activemodel (>= 3.0)
activejob (7.0.5.1) activejob (7.0.8)
activesupport (= 7.0.5.1) activesupport (= 7.0.8)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (7.0.5.1) activemodel (7.0.8)
activesupport (= 7.0.5.1) activesupport (= 7.0.8)
activerecord (7.0.5.1) activerecord (7.0.8)
activemodel (= 7.0.5.1) activemodel (= 7.0.8)
activesupport (= 7.0.5.1) activesupport (= 7.0.8)
activesupport (7.0.5.1) activesupport (7.0.8)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
minitest (>= 5.1) minitest (>= 5.1)
tzinfo (~> 2.0) tzinfo (~> 2.0)
addressable (2.8.4) addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0) public_suffix (>= 2.0.2, < 6.0)
annotate (3.2.0) annotate (3.2.0)
activerecord (>= 3.2, < 8.0) activerecord (>= 3.2, < 8.0)
rake (>= 10.4, < 14.0) rake (>= 10.4, < 14.0)
ast (2.4.2) ast (2.4.2)
aws-eventstream (1.2.0) aws-eventstream (1.3.0)
aws-partitions (1.583.0) aws-partitions (1.583.0)
aws-sdk-core (3.130.2) aws-sdk-core (3.130.2)
aws-eventstream (~> 1, >= 1.0.2) aws-eventstream (~> 1, >= 1.0.2)
@ -82,55 +75,50 @@ GEM
aws-sigv4 (~> 1.1) aws-sigv4 (~> 1.1)
aws-sigv4 (1.5.0) aws-sigv4 (1.5.0)
aws-eventstream (~> 1, >= 1.0.2) aws-eventstream (~> 1, >= 1.0.2)
base64 (0.2.0)
better_errors (2.10.1) better_errors (2.10.1)
erubi (>= 1.0.0) erubi (>= 1.0.0)
rack (>= 0.9.0) rack (>= 0.9.0)
rouge (>= 1.0.0) rouge (>= 1.0.0)
bigdecimal (3.1.6)
binding_of_caller (1.0.0) binding_of_caller (1.0.0)
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
bootsnap (1.16.0) bootsnap (1.17.1)
msgpack (~> 1.2) msgpack (~> 1.2)
builder (3.2.4) builder (3.2.4)
bullet (7.0.7) bullet (7.1.6)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
uniform_notifier (~> 1.11) uniform_notifier (~> 1.11)
byebug (11.1.3) byebug (11.1.3)
capybara (3.39.2) capybara (3.40.0)
addressable addressable
matrix matrix
mini_mime (>= 0.1.3) mini_mime (>= 0.1.3)
nokogiri (~> 1.8) nokogiri (~> 1.11)
rack (>= 1.6.0) rack (>= 1.6.0)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0) regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2) xpath (~> 3.2)
cbor (0.5.9.6) cbor (0.5.9.8)
certified (1.0.0) certified (1.0.0)
cgi (0.3.6) cgi (0.4.1)
chunky_png (1.4.0) chunky_png (1.4.0)
coderay (1.1.3) coderay (1.1.3)
colored2 (3.1.2) colored2 (4.0.0)
concurrent-ruby (1.2.2) concurrent-ruby (1.2.3)
connection_pool (2.4.1) connection_pool (2.4.1)
cose (1.3.0) cose (1.3.0)
cbor (~> 0.5.9) cbor (~> 0.5.9)
openssl-signature_algorithm (~> 1.0) openssl-signature_algorithm (~> 1.0)
cppjieba_rb (0.4.2) cppjieba_rb (0.4.2)
crack (0.4.5) crack (0.4.6)
bigdecimal
rexml rexml
crass (1.0.6) crass (1.0.6)
css_parser (1.14.0) css_parser (1.16.0)
addressable addressable
dartsass-ruby (3.0.1) date (3.3.4)
sass-embedded (~> 1.54) debug_inspector (1.2.0)
dartsass-sprockets (3.0.0)
dartsass-ruby (~> 3.0)
railties (>= 4.0.0)
sprockets (> 3.0)
sprockets-rails
tilt
date (3.3.3)
debug_inspector (1.1.0)
diff-lcs (1.5.0) diff-lcs (1.5.0)
diffy (3.4.2) diffy (3.4.2)
digest (3.1.1) digest (3.1.1)
@ -144,34 +132,35 @@ GEM
docile (1.4.0) docile (1.4.0)
email_reply_trimmer (0.1.13) email_reply_trimmer (0.1.13)
erubi (1.12.0) erubi (1.12.0)
excon (0.100.0) excon (0.109.0)
execjs (2.8.1) execjs (2.9.1)
exifr (1.4.0) exifr (1.4.0)
fabrication (2.30.0) fabrication (2.31.0)
faker (2.23.0) faker (2.23.0)
i18n (>= 1.8.11, < 2) i18n (>= 1.8.11, < 2)
fakeweb (1.3.0) fakeweb (1.3.0)
faraday (2.7.10) faraday (2.9.0)
faraday-net_http (>= 2.0, < 3.1) faraday-net_http (>= 2.0, < 3.2)
ruby2_keywords (>= 0.0.4) faraday-net_http (3.1.0)
faraday-net_http (3.0.2) net-http
faraday-retry (2.2.0) faraday-retry (2.2.0)
faraday (~> 2.0) faraday (~> 2.0)
fast_blank (1.0.1) fast_blank (1.0.1)
fast_xs (0.8.0) fast_xs (0.8.0)
fastimage (2.2.7) fastimage (2.3.0)
ffi (1.15.5) ffi (1.16.3)
fspath (3.1.2) fspath (3.1.2)
gc_tracer (1.5.1) gc_tracer (1.5.1)
globalid (1.1.0) globalid (1.2.1)
activesupport (>= 5.0) activesupport (>= 6.1)
google-protobuf (3.23.4) google-protobuf (3.25.2)
google-protobuf (3.25.2-arm64-darwin)
google-protobuf (3.25.2-x86_64-darwin)
guess_html_encoding (0.0.11) guess_html_encoding (0.0.11)
hana (1.3.7) hana (1.3.7)
hashdiff (1.0.1) hashdiff (1.1.0)
hashie (5.0.0) hashie (5.0.0)
highline (2.1.0) highline (3.0.1)
hkdf (1.0.0)
htmlentities (4.3.4) htmlentities (4.3.4)
http_accept_language (2.1.1) http_accept_language (2.1.1)
i18n (1.14.1) i18n (1.14.1)
@ -182,13 +171,13 @@ GEM
image_size (>= 1.5, < 4) image_size (>= 1.5, < 4)
in_threads (~> 1.3) in_threads (~> 1.3)
progress (~> 3.0, >= 3.0.1) progress (~> 3.0, >= 3.0.1)
image_size (3.3.0) image_size (3.4.0)
in_threads (1.6.0) in_threads (1.6.0)
jmespath (1.6.2) jmespath (1.6.2)
json (2.6.3) json (2.7.1)
json-schema (3.0.0) json-schema (4.1.1)
addressable (>= 2.8) addressable (>= 2.8)
json_schemer (1.0.3) json_schemer (2.1.1)
hana (~> 1.3) hana (~> 1.3)
regexp_parser (~> 2.0) regexp_parser (~> 2.0)
simpleidn (~> 0.2) simpleidn (~> 0.2)
@ -196,11 +185,13 @@ GEM
kgio (2.11.4) kgio (2.11.4)
language_server-protocol (3.17.0.3) language_server-protocol (3.17.0.3)
libv8-node (18.16.0.0) libv8-node (18.16.0.0)
libv8-node (18.16.0.0-arm64-darwin)
libv8-node (18.16.0.0-x86_64-darwin)
listen (3.8.0) listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10) rb-inotify (~> 0.9, >= 0.9.10)
literate_randomizer (0.4.0) literate_randomizer (0.4.0)
lograge (0.13.0) lograge (0.14.0)
actionpack (>= 4) actionpack (>= 4)
activesupport (>= 4) activesupport (>= 4)
railties (>= 4) railties (>= 4)
@ -208,8 +199,8 @@ GEM
logstash-event (1.2.02) logstash-event (1.2.02)
logstash-logger (0.26.1) logstash-logger (0.26.1)
logstash-event (~> 1.2) logstash-event (~> 1.2)
logster (2.12.2) logster (2.16.0)
loofah (2.21.3) loofah (2.22.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.12.0) nokogiri (>= 1.12.0)
lru_redux (1.1.0) lru_redux (1.1.0)
@ -222,40 +213,45 @@ GEM
matrix (0.4.2) matrix (0.4.2)
maxminddb (0.1.22) maxminddb (0.1.22)
memory_profiler (1.0.1) memory_profiler (1.0.1)
message_bus (4.3.7) message_bus (4.3.8)
rack (>= 1.1.3) rack (>= 1.1.3)
method_source (1.0.0) method_source (1.0.0)
mini_mime (1.1.2) mini_mime (1.1.5)
mini_portile2 (2.8.4) mini_portile2 (2.8.6)
mini_racer (0.8.0) mini_racer (0.8.0)
libv8-node (~> 18.16.0.0) libv8-node (~> 18.16.0.0)
mini_scheduler (0.16.0) mini_scheduler (0.16.0)
sidekiq (>= 4.2.3, < 7.0) sidekiq (>= 4.2.3, < 7.0)
mini_sql (1.4.0) mini_sql (1.5.0)
mini_suffix (0.3.3) mini_suffix (0.3.3)
ffi (~> 1.9) ffi (~> 1.9)
minitest (5.19.0) minio_runner (0.1.2)
minitest (5.21.2)
mocha (2.1.0) mocha (2.1.0)
ruby2_keywords (>= 0.0.5) ruby2_keywords (>= 0.0.5)
msgpack (1.7.2) msgpack (1.7.2)
multi_json (1.15.0) multi_json (1.15.0)
multi_xml (0.6.0) multi_xml (0.6.0)
mustache (1.1.1) mustache (1.1.1)
net-http (0.3.2) net-http (0.4.1)
uri uri
net-imap (0.3.7) net-imap (0.4.9.1)
date date
net-protocol net-protocol
net-pop (0.1.2) net-pop (0.1.2)
net-protocol net-protocol
net-protocol (0.2.1) net-protocol (0.2.2)
timeout timeout
net-smtp (0.3.3) net-smtp (0.4.0.1)
net-protocol net-protocol
nio4r (2.5.9) nio4r (2.7.0)
nokogiri (1.15.3) nokogiri (1.16.0)
mini_portile2 (~> 2.8.2) mini_portile2 (~> 2.8.2)
racc (~> 1.4) racc (~> 1.4)
nokogiri (1.16.0-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.0-x86_64-darwin)
racc (~> 1.4)
oauth (1.1.0) oauth (1.1.0)
oauth-tty (~> 1.0, >= 1.0.1) oauth-tty (~> 1.0, >= 1.0.1)
snaky_hash (~> 2.0) snaky_hash (~> 2.0)
@ -268,7 +264,8 @@ GEM
multi_json (~> 1.3) multi_json (~> 1.3)
multi_xml (~> 0.5) multi_xml (~> 0.5)
rack (>= 1.2, < 4) rack (>= 1.2, < 4)
oj (3.15.1) oj (3.16.3)
bigdecimal (>= 3.0)
omniauth (1.9.2) omniauth (1.9.2)
hashie (>= 3.4.6) hashie (>= 3.4.6)
rack (>= 1.6.2, < 3) rack (>= 1.6.2, < 3)
@ -291,17 +288,17 @@ GEM
omniauth-twitter (1.4.0) omniauth-twitter (1.4.0)
omniauth-oauth (~> 1.1) omniauth-oauth (~> 1.1)
rack rack
openssl (3.1.0) openssl (3.2.0)
openssl-signature_algorithm (1.3.0) openssl-signature_algorithm (1.3.0)
openssl (> 2.0) openssl (> 2.0)
optimist (3.1.0) optimist (3.1.0)
parallel (1.23.0) parallel (1.24.0)
parallel_tests (4.2.1) parallel_tests (4.4.0)
parallel parallel
parser (3.2.2.3) parser (3.3.0.5)
ast (~> 2.4.1) ast (~> 2.4.1)
racc racc
pg (1.4.6) pg (1.5.4)
prettier_print (1.2.1) prettier_print (1.2.1)
progress (3.6.0) progress (3.6.0)
pry (0.14.2) pry (0.14.2)
@ -312,18 +309,19 @@ GEM
pry (>= 0.13, < 0.15) pry (>= 0.13, < 0.15)
pry-rails (0.3.9) pry-rails (0.3.9)
pry (>= 0.10.4) pry (>= 0.10.4)
public_suffix (5.0.3) public_suffix (5.0.4)
puma (6.3.0) puma (6.4.2)
nio4r (~> 2.0) nio4r (~> 2.0)
racc (1.7.1) racc (1.7.3)
rack (2.2.8) rack (2.2.8)
rack-mini-profiler (3.1.0) rack-mini-profiler (3.3.0)
rack (>= 1.2.0) rack (>= 1.2.0)
rack-protection (3.0.6) rack-protection (3.2.0)
rack base64 (>= 0.1.0)
rack (~> 2.2, >= 2.2.4)
rack-test (2.1.0) rack-test (2.1.0)
rack (>= 1.3) rack (>= 1.3)
rails-dom-testing (2.1.1) rails-dom-testing (2.2.0)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
minitest minitest
nokogiri (>= 1.6) nokogiri (>= 1.6)
@ -337,34 +335,35 @@ GEM
rails_multisite (5.0.0) rails_multisite (5.0.0)
activerecord (>= 6.0) activerecord (>= 6.0)
railties (>= 6.0) railties (>= 6.0)
railties (7.0.5.1) railties (7.0.8)
actionpack (= 7.0.5.1) actionpack (= 7.0.8)
activesupport (= 7.0.5.1) activesupport (= 7.0.8)
method_source method_source
rake (>= 12.2) rake (>= 12.2)
thor (~> 1.0) thor (~> 1.0)
zeitwerk (~> 2.5) zeitwerk (~> 2.5)
rainbow (3.1.1) rainbow (3.1.1)
raindrops (0.20.1) raindrops (0.20.1)
rake (13.0.6) rake (13.1.0)
rb-fsevent (0.11.2) rb-fsevent (0.11.2)
rb-inotify (0.10.1) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
rbtrace (0.4.14) rbtrace (0.5.1)
ffi (>= 1.0.6) ffi (>= 1.0.6)
msgpack (>= 0.4.3) msgpack (>= 0.4.3)
optimist (>= 3.0.0) optimist (>= 3.0.0)
rchardet (1.8.0) rchardet (1.8.0)
redcarpet (3.6.0)
redis (4.8.1) redis (4.8.1)
redis-namespace (1.11.0) redis-namespace (1.11.0)
redis (>= 4) redis (>= 4)
regexp_parser (2.8.1) regexp_parser (2.9.0)
request_store (1.5.1) request_store (1.5.1)
rack (>= 1.4) rack (>= 1.4)
rexml (3.2.6) rexml (3.2.6)
rinku (2.0.6) rinku (2.0.6)
rotp (6.2.2) rotp (6.3.0)
rouge (4.1.3) rouge (4.2.0)
rqrcode (2.2.0) rqrcode (2.2.0)
chunky_png (~> 1.0) chunky_png (~> 1.0)
rqrcode_core (~> 1.0) rqrcode_core (~> 1.0)
@ -384,7 +383,7 @@ GEM
rspec-mocks (3.12.6) rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0) rspec-support (~> 3.12.0)
rspec-rails (6.0.3) rspec-rails (6.1.1)
actionpack (>= 6.1) actionpack (>= 6.1)
activesupport (>= 6.1) activesupport (>= 6.1)
railties (>= 6.1) railties (>= 6.1)
@ -393,57 +392,68 @@ GEM
rspec-mocks (~> 3.12) rspec-mocks (~> 3.12)
rspec-support (~> 3.12) rspec-support (~> 3.12)
rspec-support (3.12.1) rspec-support (3.12.1)
rss (0.2.9) rss (0.3.0)
rexml rexml
rswag-specs (2.10.1) rswag-specs (2.13.0)
activesupport (>= 3.1, < 7.1) activesupport (>= 3.1, < 7.2)
json-schema (>= 2.2, < 4.0) json-schema (>= 2.2, < 5.0)
railties (>= 3.1, < 7.1) railties (>= 3.1, < 7.2)
rspec-core (>= 2.14) rspec-core (>= 2.14)
rtlcss (0.2.1) rtlcss (0.2.1)
mini_racer (>= 0.6.3) mini_racer (>= 0.6.3)
rubocop (1.55.1) rubocop (1.60.2)
json (~> 2.3) json (~> 2.3)
language_server-protocol (>= 3.17.0) language_server-protocol (>= 3.17.0)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 3.2.2.3) parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0) regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0) rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.1, < 2.0) rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0) unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0) rubocop-ast (1.30.0)
parser (>= 3.2.1.0) parser (>= 3.2.1.0)
rubocop-capybara (2.18.0) rubocop-capybara (2.20.0)
rubocop (~> 1.41) rubocop (~> 1.41)
rubocop-discourse (3.3.0) rubocop-discourse (3.6.0)
rubocop (>= 1.1.0) rubocop (>= 1.59.0)
rubocop-rspec (>= 2.0.0) rubocop-rspec (>= 2.25.0)
rubocop-factory_bot (2.23.1) rubocop-factory_bot (2.25.1)
rubocop (~> 1.33) rubocop (~> 1.41)
rubocop-rspec (2.23.0) rubocop-rspec (2.26.1)
rubocop (~> 1.33) rubocop (~> 1.40)
rubocop-capybara (~> 2.17) rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22) rubocop-factory_bot (~> 2.22)
ruby-prof (1.6.3) ruby-prof (1.7.0)
ruby-progressbar (1.13.0) ruby-progressbar (1.13.0)
ruby-readability (0.7.0) ruby-readability (0.7.0)
guess_html_encoding (>= 0.0.4) guess_html_encoding (>= 0.0.4)
nokogiri (>= 1.6.0) nokogiri (>= 1.6.0)
ruby2_keywords (0.0.5) ruby2_keywords (0.0.5)
rubyzip (2.3.2) rubyzip (2.3.2)
sanitize (6.0.2) sanitize (6.1.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.12.0) nokogiri (>= 1.12.0)
sass-embedded (1.64.1) sass-embedded (1.70.0)
google-protobuf (~> 3.23) google-protobuf (~> 3.25)
rake (>= 13.0.0) rake (>= 13.0.0)
selenium-webdriver (4.10.0) sass-embedded (1.70.0-arm64-darwin)
google-protobuf (~> 3.25)
sass-embedded (1.70.0-x86_64-darwin)
google-protobuf (~> 3.25)
sassc-embedded (1.70.0)
sass-embedded (~> 1.70)
selenium-devtools (0.121.0)
selenium-webdriver (~> 4.2)
selenium-webdriver (4.17.0)
base64 (~> 0.2)
rexml (~> 3.2, >= 3.2.5) rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0) rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0) websocket (~> 1.0)
sidekiq (6.5.9) shoulda-matchers (6.1.0)
activesupport (>= 5.2.0)
sidekiq (6.5.12)
connection_pool (>= 2.2.5, < 3) connection_pool (>= 2.2.5, < 3)
rack (~> 2.0) rack (~> 2.0)
redis (>= 4.5.0, < 5) redis (>= 4.5.0, < 5)
@ -462,62 +472,63 @@ GEM
actionpack (>= 5.2) actionpack (>= 5.2)
activesupport (>= 5.2) activesupport (>= 5.2)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sshkey (2.0.0) sqlite3 (1.7.1)
stackprof (0.2.25) mini_portile2 (~> 2.8.0)
syntax_tree (6.1.1) sqlite3 (1.7.1-arm64-darwin)
sqlite3 (1.7.1-x86_64-darwin)
sshkey (3.0.0)
stackprof (0.2.26)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0) prettier_print (>= 1.2.0)
syntax_tree-disable_ternary (1.0.0) syntax_tree-disable_ternary (1.0.0)
test-prof (1.2.2) test-prof (1.3.1)
thor (1.2.2) thor (1.3.0)
tilt (2.2.0) timeout (0.4.1)
timeout (0.4.0)
tzinfo (2.0.6) tzinfo (2.0.6)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
tzinfo-data (1.2023.3) tzinfo-data (1.2023.4)
tzinfo (>= 1.0.0) tzinfo (>= 1.0.0)
uglifier (4.2.0) uglifier (4.2.0)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.8.2) unf_ext (0.0.9.1)
unicode-display_width (2.4.2) unicode-display_width (2.5.0)
unicorn (6.1.0) unicorn (6.1.0)
kgio (~> 2.6) kgio (~> 2.6)
raindrops (~> 0.7) raindrops (~> 0.7)
uniform_notifier (1.16.0) uniform_notifier (1.16.0)
uri (0.12.2) uri (0.13.0)
version_gem (1.1.3) version_gem (1.1.3)
web-push (3.0.0) web-push (3.0.1)
hkdf (~> 1.0)
jwt (~> 2.0) jwt (~> 2.0)
openssl (~> 3.0) openssl (~> 3.0)
webdrivers (5.3.1) webmock (3.19.1)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (~> 4.0, < 4.11)
webmock (3.18.1)
addressable (>= 2.8.0) addressable (>= 2.8.0)
crack (>= 0.3.2) crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0) hashdiff (>= 0.4.0, < 2.0.0)
websocket (1.2.9) websocket (1.2.10)
xpath (3.2.0) xpath (3.2.0)
nokogiri (~> 1.8) nokogiri (~> 1.8)
yaml-lint (0.1.2) yaml-lint (0.1.2)
yard (0.9.34) yard (0.9.34)
zeitwerk (2.6.10) zeitwerk (2.6.12)
PLATFORMS PLATFORMS
arm64-darwin-21
arm64-darwin-22
ruby ruby
x86_64-darwin-22
DEPENDENCIES DEPENDENCIES
actionmailer (= 7.0.5.1) actionmailer (< 7.1)
actionpack (= 7.0.5.1) actionpack (< 7.1)
actionview (= 7.0.5.1) actionview (< 7.1)
actionview_precompiler actionview_precompiler
active_model_serializers (~> 0.8.3) active_model_serializers (~> 0.8.3)
activemodel (= 7.0.5.1) activemodel (< 7.1)
activerecord (= 7.0.5.1) activerecord (< 7.1)
activesupport (= 7.0.5.1) activesupport (< 7.1)
addressable addressable
annotate annotate
aws-sdk-s3 aws-sdk-s3
@ -535,8 +546,6 @@ DEPENDENCIES
cose cose
cppjieba_rb cppjieba_rb
css_parser css_parser
dartsass-ruby
dartsass-sprockets
diffy diffy
digest digest
discourse-fonts discourse-fonts
@ -577,6 +586,7 @@ DEPENDENCIES
mini_scheduler mini_scheduler
mini_sql mini_sql
mini_suffix mini_suffix
minio_runner
minitest minitest
mocha mocha
multi_json multi_json
@ -604,11 +614,12 @@ DEPENDENCIES
rails-dom-testing rails-dom-testing
rails_failover rails_failover
rails_multisite rails_multisite
railties (= 7.0.5.1) railties (< 7.1)
rake rake
rb-fsevent rb-fsevent
rbtrace rbtrace
rchardet rchardet
redcarpet
redis redis
redis-namespace redis-namespace
rinku rinku
@ -625,12 +636,15 @@ DEPENDENCIES
ruby-readability ruby-readability
rubyzip rubyzip
sanitize sanitize
selenium-webdriver sassc-embedded
shoulda-matchers! selenium-devtools
selenium-webdriver (~> 4.14)
shoulda-matchers
sidekiq sidekiq
simplecov simplecov
sprockets! sprockets!
sprockets-rails sprockets-rails
sqlite3
sshkey sshkey
stackprof stackprof
syntax_tree syntax_tree
@ -642,10 +656,9 @@ DEPENDENCIES
unf unf
unicorn unicorn
web-push web-push
webdrivers
webmock webmock
yaml-lint yaml-lint
yard yard
BUNDLED WITH BUNDLED WITH
2.4.13 2.5.9

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,13 @@
diff --git a/config/unicorn.conf.rb b/config/unicorn.conf.rb diff --git a/config/unicorn.conf.rb b/config/unicorn.conf.rb
index e69979adfe..68cb04a036 100644 index 9fd348b074..40eb73b96e 100644
--- a/config/unicorn.conf.rb --- a/config/unicorn.conf.rb
+++ b/config/unicorn.conf.rb +++ b/config/unicorn.conf.rb
@@ -27,18 +27,10 @@ pid (ENV["UNICORN_PID_PATH"] || "#{discourse_path}/tmp/pids/unicorn.pid") @@ -27,17 +27,9 @@ pid(ENV["UNICORN_PID_PATH"] || "#{discourse_path}/tmp/pids/unicorn.pid")
if ENV["RAILS_ENV"] != "production" if ENV["RAILS_ENV"] != "production"
logger Logger.new(STDOUT) logger Logger.new(STDOUT)
- # we want a longer timeout in dev cause first request can be really slow - # we want a longer timeout in dev cause first request can be really slow
- timeout (ENV["UNICORN_TIMEOUT"] && ENV["UNICORN_TIMEOUT"].to_i || 60) - timeout(ENV["UNICORN_TIMEOUT"] && ENV["UNICORN_TIMEOUT"].to_i || 60)
-else -else
- # By default, the Unicorn logger will write to stderr. - # By default, the Unicorn logger will write to stderr.
- # Additionally, some applications/frameworks log to stderr or stdout, - # Additionally, some applications/frameworks log to stderr or stdout,
@ -18,8 +18,7 @@ index e69979adfe..68cb04a036 100644
- timeout 30 - timeout 30
end end
+timeout (ENV["UNICORN_TIMEOUT"] && ENV["UNICORN_TIMEOUT"].to_i || 60) +timeout(ENV["UNICORN_TIMEOUT"] && ENV["UNICORN_TIMEOUT"].to_i || 60)
+ +
# important for Ruby 2.0 # important for Ruby 2.0
preload_app true preload_app true

View File

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell #!/usr/bin/env nix-shell
#! nix-shell -i python3 -p bundix bundler nix-update nix-universal-prefetch python3 python3Packages.requests python3Packages.click python3Packages.click-log prefetch-yarn-deps #! nix-shell -i python3 -p bundix bundler nix-update nix-universal-prefetch "python3.withPackages (ps: with ps; [ requests click click-log packaging ])" prefetch-yarn-deps
from __future__ import annotations from __future__ import annotations
import click import click
@ -15,8 +15,7 @@ import json
import requests import requests
import textwrap import textwrap
from functools import total_ordering from functools import total_ordering
from distutils.version import LooseVersion from packaging.version import Version
from itertools import zip_longest
from pathlib import Path from pathlib import Path
from typing import Union, Iterable from typing import Union, Iterable
@ -47,33 +46,16 @@ class DiscourseVersion:
else: else:
self.tag = 'v' + version self.tag = 'v' + version
self.version = version self.version = version
self.split_version = LooseVersion(self.version).version
self._version = Version(self.version)
def __eq__(self, other: DiscourseVersion): def __eq__(self, other: DiscourseVersion):
"""Versions are equal when their individual parts are.""" """Versions are equal when their individual parts are."""
return self.split_version == other.split_version return self._version == other._version
def __gt__(self, other: DiscourseVersion): def __gt__(self, other: DiscourseVersion):
"""Check if this version is greater than the other. """Check if this version is greater than the other."""
return self._version > other._version
Goes through the parts of the version numbers from most to
least significant, only continuing on to the next if the
numbers are equal and no decision can be made. If one version
ends in 'betaX' and the other doesn't, all else being equal,
the one without 'betaX' is considered greater, since it's the
release version.
"""
for (this_ver, other_ver) in zip_longest(self.split_version, other.split_version):
if this_ver == other_ver:
continue
if type(this_ver) is int and type(other_ver) is int:
return this_ver > other_ver
elif 'beta' in [this_ver, other_ver]:
# release version (None) is greater than beta
return this_ver is None
else:
return False
class DiscourseRepo: class DiscourseRepo:
@ -104,11 +86,12 @@ class DiscourseRepo:
return self._latest_commit_sha return self._latest_commit_sha
def get_yarn_lock_hash(self, rev: str): def get_yarn_lock_hash(self, rev: str, path: str):
yarnLockText = self.get_file('app/assets/javascripts/yarn.lock', rev) yarnLockText = self.get_file(path, rev)
with tempfile.NamedTemporaryFile(mode='w') as lockFile: with tempfile.NamedTemporaryFile(mode='w') as lockFile:
lockFile.write(yarnLockText) lockFile.write(yarnLockText)
return subprocess.check_output(['prefetch-yarn-deps', lockFile.name]).decode('utf-8').strip() hash = subprocess.check_output(['prefetch-yarn-deps', lockFile.name]).decode().strip()
return subprocess.check_output(["nix", "hash", "to-sri", "--type", "sha256", hash]).decode().strip()
def get_file(self, filepath, rev): def get_file(self, filepath, rev):
"""Return file contents at a given rev. """Return file contents at a given rev.
@ -242,6 +225,8 @@ def update(rev):
with open(rubyenv_dir / fn, 'w') as f: with open(rubyenv_dir / fn, 'w') as f:
f.write(repo.get_file(fn, version.tag)) f.write(repo.get_file(fn, version.tag))
# work around https://github.com/nix-community/bundix/issues/8
os.environ["BUNDLE_FORCE_RUBY_PLATFORM"] = "true"
subprocess.check_output(['bundle', 'lock'], cwd=rubyenv_dir) subprocess.check_output(['bundle', 'lock'], cwd=rubyenv_dir)
_remove_platforms(rubyenv_dir) _remove_platforms(rubyenv_dir)
subprocess.check_output(['bundix'], cwd=rubyenv_dir) subprocess.check_output(['bundix'], cwd=rubyenv_dir)
@ -249,11 +234,17 @@ def update(rev):
_call_nix_update('discourse', version.version) _call_nix_update('discourse', version.version)
old_yarn_hash = _nix_eval('discourse.assets.yarnOfflineCache.outputHash') old_yarn_hash = _nix_eval('discourse.assets.yarnOfflineCache.outputHash')
new_yarn_hash = repo.get_yarn_lock_hash(version.tag) new_yarn_hash = repo.get_yarn_lock_hash(version.tag, "app/assets/javascripts/yarn-ember5.lock")
click.echo(f"Updating yarn lock hash, {old_yarn_hash} -> {new_yarn_hash}") click.echo(f"Updating yarn lock hash: {old_yarn_hash} -> {new_yarn_hash}")
old_yarn_dev_hash = _nix_eval('discourse.assets.yarnDevOfflineCache.outputHash')
new_yarn_dev_hash = repo.get_yarn_lock_hash(version.tag, "yarn.lock")
click.echo(f"Updating yarn dev lock hash: {old_yarn_dev_hash} -> {new_yarn_dev_hash}")
with open(Path(__file__).parent / "default.nix", 'r+') as f: with open(Path(__file__).parent / "default.nix", 'r+') as f:
content = f.read() content = f.read()
content = content.replace(old_yarn_hash, new_yarn_hash) content = content.replace(old_yarn_hash, new_yarn_hash)
content = content.replace(old_yarn_dev_hash, new_yarn_dev_hash)
f.seek(0) f.seek(0)
f.write(content) f.write(content)
f.truncate() f.truncate()
@ -320,7 +311,7 @@ def update_plugins():
compatibility_spec = repo.get_file('.discourse-compatibility', repo.latest_commit_sha) compatibility_spec = repo.get_file('.discourse-compatibility', repo.latest_commit_sha)
versions = [(DiscourseVersion(discourse_version), plugin_rev.strip(' ')) versions = [(DiscourseVersion(discourse_version), plugin_rev.strip(' '))
for [discourse_version, plugin_rev] for [discourse_version, plugin_rev]
in [line.split(':') in [line.lstrip("< ").split(':')
for line for line
in compatibility_spec.splitlines() if line != '']] in compatibility_spec.splitlines() if line != '']]
discourse_version = DiscourseVersion(_get_current_package_version('discourse')) discourse_version = DiscourseVersion(_get_current_package_version('discourse'))