From 4bbf92912b9c578dae181d19b4b6083e1512bf38 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Tue, 24 Nov 2020 10:52:11 -0800 Subject: [PATCH 1/3] Enable HOMEBREW_PATCHELF_RB_WRITE by default Enable HOMEBREW_PATCHELF_RB_WRITE by default for everyone except CI. It may be disabled using HOMEBREW_NO_PATCHELF_RB_WRITE. It may be enabled on CI using HOMEBREW_PATCHELF_RB_WRITE. --- Library/Homebrew/os/linux/global.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Library/Homebrew/os/linux/global.rb b/Library/Homebrew/os/linux/global.rb index 370fa38ed2..2e53fb551a 100644 --- a/Library/Homebrew/os/linux/global.rb +++ b/Library/Homebrew/os/linux/global.rb @@ -4,8 +4,7 @@ # Enables experimental `patchelf.rb` write support. HOMEBREW_PATCHELF_RB_WRITE = ( ENV["HOMEBREW_NO_PATCHELF_RB_WRITE"].blank? && - (ENV["HOMEBREW_PATCHELF_RB_WRITE"].present? || - (ENV["CI"].blank? && ENV["HOMEBREW_DEVELOPER"].present?)) + (ENV["HOMEBREW_PATCHELF_RB_WRITE"].present? || ENV["CI"].blank?) ).freeze module Homebrew From 8a4299d02885640fa0b1a44dcfe5e60be14276e9 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Thu, 26 Nov 2020 11:20:55 -0800 Subject: [PATCH 2/3] Enable HOMEBREW_PATCHELF_RB_WRITE for CI and HOMEBREW_DEV_CMD_RUN Enable HOMEBREW_PATCHELF_RB_WRITE by default for HOMEBREW_DEV_CMD_RUN and CI, but not when building bottles. --- Library/Homebrew/dev-cmd/bottle.rb | 2 ++ Library/Homebrew/os/linux/elf.rb | 2 +- Library/Homebrew/os/linux/global.rb | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 45fba5500e..07525589c6 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -84,6 +84,8 @@ module Homebrew end def bottle + ENV["HOMEBREW_NO_PATCHELF_RB_WRITE"] = "1" unless ENV["HOMEBREW_PATCHELF_RB_WRITE"].present? + args = bottle_args.parse return merge(args: args) if args.merge? diff --git a/Library/Homebrew/os/linux/elf.rb b/Library/Homebrew/os/linux/elf.rb index e8009af519..eafd25b41e 100644 --- a/Library/Homebrew/os/linux/elf.rb +++ b/Library/Homebrew/os/linux/elf.rb @@ -101,7 +101,7 @@ module ELFShim def patch!(interpreter: nil, rpath: nil) return if interpreter.blank? && rpath.blank? - if HOMEBREW_PATCHELF_RB_WRITE + if HOMEBREW_PATCHELF_RB_WRITE && ENV["HOMEBREW_NO_PATCHELF_RB_WRITE"].blank? save_using_patchelf_rb interpreter, rpath else save_using_patchelf interpreter, rpath diff --git a/Library/Homebrew/os/linux/global.rb b/Library/Homebrew/os/linux/global.rb index 2e53fb551a..14e115b246 100644 --- a/Library/Homebrew/os/linux/global.rb +++ b/Library/Homebrew/os/linux/global.rb @@ -4,7 +4,7 @@ # Enables experimental `patchelf.rb` write support. HOMEBREW_PATCHELF_RB_WRITE = ( ENV["HOMEBREW_NO_PATCHELF_RB_WRITE"].blank? && - (ENV["HOMEBREW_PATCHELF_RB_WRITE"].present? || ENV["CI"].blank?) + (ENV["HOMEBREW_PATCHELF_RB_WRITE"].present? || ENV["CI"].present? || ENV["HOMEBREW_DEV_CMD_RUN"].present?) ).freeze module Homebrew From 65bc39f952d5542e620d1711dd2337913c890f7a Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Thu, 26 Nov 2020 11:53:31 -0800 Subject: [PATCH 3/3] HOMEBREW_PATCHELF_RB_WRITE: Move logic to test-bot --- Library/Homebrew/dev-cmd/bottle.rb | 2 -- Library/Homebrew/os/linux/elf.rb | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 07525589c6..45fba5500e 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -84,8 +84,6 @@ module Homebrew end def bottle - ENV["HOMEBREW_NO_PATCHELF_RB_WRITE"] = "1" unless ENV["HOMEBREW_PATCHELF_RB_WRITE"].present? - args = bottle_args.parse return merge(args: args) if args.merge? diff --git a/Library/Homebrew/os/linux/elf.rb b/Library/Homebrew/os/linux/elf.rb index eafd25b41e..e8009af519 100644 --- a/Library/Homebrew/os/linux/elf.rb +++ b/Library/Homebrew/os/linux/elf.rb @@ -101,7 +101,7 @@ module ELFShim def patch!(interpreter: nil, rpath: nil) return if interpreter.blank? && rpath.blank? - if HOMEBREW_PATCHELF_RB_WRITE && ENV["HOMEBREW_NO_PATCHELF_RB_WRITE"].blank? + if HOMEBREW_PATCHELF_RB_WRITE save_using_patchelf_rb interpreter, rpath else save_using_patchelf interpreter, rpath