summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortalyz <kim.lindberger@gmail.com>2021-06-24 19:34:38 +0200
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2021-06-30 22:07:25 +0000
commit0a64a8b87cd293cc941484910f18ba61bca320ed (patch)
tree468e52d4e49d118e18ee3812fd609b52e374ab05
parentdiscourse: Fix plugin support (diff)
downloadnixpkgs-0a64a8b87cd293cc941484910f18ba61bca320ed.tar.gz
discourse: Patch sources instead of using replace-literal
(cherry picked from commit f0ae7fdf7e9518ab1fef4603daa860d5402f5b3b)
-rw-r--r--pkgs/servers/web-apps/discourse/default.nix6
-rw-r--r--pkgs/servers/web-apps/discourse/use_mv_instead_of_rename.patch22
2 files changed, 26 insertions, 2 deletions
diff --git a/pkgs/servers/web-apps/discourse/default.nix b/pkgs/servers/web-apps/discourse/default.nix
index 8258049a4034..698f3d6a6b26 100644
--- a/pkgs/servers/web-apps/discourse/default.nix
+++ b/pkgs/servers/web-apps/discourse/default.nix
@@ -199,6 +199,10 @@ let
# Log Unicorn messages to the journal and make request timeout
# configurable
./unicorn_logging_and_timeout.patch
+
+ # Use mv instead of rename, since rename doesn't work across
+ # device boundaries
+ ./use_mv_instead_of_rename.patch
];
postPatch = ''
@@ -207,8 +211,6 @@ let
# warnings and means we don't have to link back to lib from the
# state directory.
find config -type f -execdir sed -Ei "s,(\.\./)+(lib|app)/,$out/share/discourse/\2/," {} \;
-
- ${replace}/bin/replace-literal -f -r -e 'File.rename(temp_destination, destination)' "FileUtils.mv(temp_destination, destination)" .
'';
buildPhase = ''
diff --git a/pkgs/servers/web-apps/discourse/use_mv_instead_of_rename.patch b/pkgs/servers/web-apps/discourse/use_mv_instead_of_rename.patch
new file mode 100644
index 000000000000..30493b543e38
--- /dev/null
+++ b/pkgs/servers/web-apps/discourse/use_mv_instead_of_rename.patch
@@ -0,0 +1,22 @@
+diff --git a/lib/discourse.rb b/lib/discourse.rb
+index ea2a3cbafd..66454d9157 100644
+--- a/lib/discourse.rb
++++ b/lib/discourse.rb
+@@ -62,7 +62,7 @@ module Discourse
+ fd.fsync()
+ end
+
+- File.rename(temp_destination, destination)
++ FileUtils.mv(temp_destination, destination)
+
+ nil
+ end
+@@ -76,7 +76,7 @@ module Discourse
+ FileUtils.mkdir_p(File.join(Rails.root, 'tmp'))
+ temp_destination = File.join(Rails.root, 'tmp', SecureRandom.hex)
+ execute_command('ln', '-s', source, temp_destination)
+- File.rename(temp_destination, destination)
++ FileUtils.mv(temp_destination, destination)
+
+ nil
+ end