Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php: Fully version the pear repository #26137

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Formula/php.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
class Php < Formula
desc "General-purpose scripting language"
homepage "https://php.net/"
homepage "https://secure.php.net/"
url "https://php.net/get/php-7.2.4.tar.xz/from/this/mirror"
sha256 "7916b1bd148ddfd46d7f8f9a517d4b09cd8a8ad9248734e7c8dd91ef17057a88"
revision 1

bottle do
sha256 "465136132568d7b316e8cec31569aa67af7ce8b6d4e472a55d78c0fbdf22401b" => :high_sierra
Expand Down Expand Up @@ -71,6 +72,9 @@ def install
ENV.append "CPPFLAGS", "-DU_USING_ICU_NAMESPACE=1"

config_path = etc/"php/#{php_version}"
# Prevent system pear config from inhibiting pear install
(config_path/"pear.conf").delete if (config_path/"pear.conf").exist?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be wary of deleting user files here. Additionally, bear in mind this won't work for bottled installs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit wary, but pear has a two-tier configuration system that provides a "system" config and a "user" config. Users should not be modifying the system config and the post_install will rebuild it. The guard is there specifically for source builds, as anyone that has this config file with configuration pointed at a pear repository where the pear files are already installed will skip the pear installation of binaries in the cellar. The would mean build from source upgrades would be missing the pear and pecl binaries.


# Prevent homebrew from harcoding path to sed shim in phpize script
ENV["lt_cv_path_SED"] = "sed"

Expand All @@ -80,6 +84,7 @@ def install
--sysconfdir=#{config_path}
--with-config-file-path=#{config_path}
--with-config-file-scan-dir=#{config_path}/conf.d
--with-pear=#{pkgshare}/pear
--enable-bcmath
--enable-calendar
--enable-dba
Expand Down Expand Up @@ -193,7 +198,7 @@ def caveats
end

def post_install
pear_prefix = share/"pear"
pear_prefix = pkgshare/"pear"
pear_files = %W[
#{pear_prefix}/.depdblock
#{pear_prefix}/.filemap
Expand All @@ -220,6 +225,7 @@ def post_install

# fix pear config to install outside cellar
pear_path = HOMEBREW_PREFIX/"share/pear"
cp_r pkgshare/"pear/.", pear_path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this re-runnable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is. I've run it quite a few times in testing just to make sure that it didn't override manually installed things and keeps the upstream installed files in sync. Of course more robust testing from other users would be greatly appreciated (we all know what works4me gets).

{
"php_ini" => etc/"php/#{php_version}/php.ini",
"php_dir" => pear_path,
Expand All @@ -237,6 +243,8 @@ def post_install
system bin/"pear", "config-set", key, value, "system"
end

system bin/"pear", "update-channels"

%w[
opcache
].each do |e|
Expand Down
11 changes: 8 additions & 3 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class PhpAT56 < Formula
homepage "https://secure.php.net/"
url "https://php.net/get/php-5.6.35.tar.xz/from/this/mirror"
sha256 "9985cb64cb8224c289effff5b34f670d14f838175f76daea0507d643eec650d2"
revision 1

bottle do
sha256 "df5e8f314eed3b68f47cf4ba34e0dc5c8fa8250868bb8f6e1a87e920aff19087" => :high_sierra
Expand Down Expand Up @@ -75,7 +76,7 @@ def install
ENV.append "CPPFLAGS", "-DU_USING_ICU_NAMESPACE=1"

config_path = etc/"php/#{php_version}"
# Prevent system pear config from inhibitting pear install
# Prevent system pear config from inhibiting pear install
(config_path/"pear.conf").delete if (config_path/"pear.conf").exist?

# Prevent homebrew from harcoding path to sed shim in phpize script
Expand All @@ -87,6 +88,7 @@ def install
--sysconfdir=#{config_path}
--with-config-file-path=#{config_path}
--with-config-file-scan-dir=#{config_path}/conf.d
--with-pear=#{pkgshare}/pear
--enable-bcmath
--enable-calendar
--enable-dba
Expand Down Expand Up @@ -198,7 +200,7 @@ def caveats
end

def post_install
pear_prefix = share/"pear"
pear_prefix = pkgshare/"pear"
pear_files = %W[
#{pear_prefix}/.depdblock
#{pear_prefix}/.filemap
Expand All @@ -224,7 +226,8 @@ def post_install
php_ext_dir = opt_prefix/"lib/php"/php_basename

# fix pear config to install outside cellar
pear_path = HOMEBREW_PREFIX/"share/pear"
pear_path = HOMEBREW_PREFIX/"share/pear@#{php_version}"
cp_r pkgshare/"pear/.", pear_path
{
"php_ini" => etc/"php/#{php_version}/php.ini",
"php_dir" => pear_path,
Expand All @@ -242,6 +245,8 @@ def post_install
system bin/"pear", "config-set", key, value, "system"
end

system bin/"pear", "update-channels"

%w[
opcache
].each do |e|
Expand Down
11 changes: 8 additions & 3 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class PhpAT70 < Formula
homepage "https://secure.php.net/"
url "https://php.net/get/php-7.0.29.tar.xz/from/this/mirror"
sha256 "ca79d3ecc123bff4b623d4a1bbf5ad53ad39f5f2f5912fecc0ea97e95eba21cc"
revision 1

bottle do
sha256 "a69d7632ed603a87d4b9140258287ae60366dde630bc3ec35e4425371bbd669b" => :high_sierra
Expand Down Expand Up @@ -76,7 +77,7 @@ def install
ENV.append "CPPFLAGS", "-DU_USING_ICU_NAMESPACE=1"

config_path = etc/"php/#{php_version}"
# Prevent system pear config from inhibitting pear install
# Prevent system pear config from inhibiting pear install
(config_path/"pear.conf").delete if (config_path/"pear.conf").exist?

# Prevent homebrew from harcoding path to sed shim in phpize script
Expand All @@ -88,6 +89,7 @@ def install
--sysconfdir=#{config_path}
--with-config-file-path=#{config_path}
--with-config-file-scan-dir=#{config_path}/conf.d
--with-pear=#{pkgshare}/pear
--enable-bcmath
--enable-calendar
--enable-dba
Expand Down Expand Up @@ -197,7 +199,7 @@ def caveats
end

def post_install
pear_prefix = share/"pear"
pear_prefix = pkgshare/"pear"
pear_files = %W[
#{pear_prefix}/.depdblock
#{pear_prefix}/.filemap
Expand All @@ -223,7 +225,8 @@ def post_install
php_ext_dir = opt_prefix/"lib/php"/php_basename

# fix pear config to install outside cellar
pear_path = HOMEBREW_PREFIX/"share/pear"
pear_path = HOMEBREW_PREFIX/"share/pear@#{php_version}"
cp_r pkgshare/"pear/.", pear_path
{
"php_ini" => etc/"php/#{php_version}/php.ini",
"php_dir" => pear_path,
Expand All @@ -241,6 +244,8 @@ def post_install
system bin/"pear", "config-set", key, value, "system"
end

system bin/"pear", "update-channels"

%w[
opcache
].each do |e|
Expand Down
11 changes: 8 additions & 3 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class PhpAT71 < Formula
homepage "https://secure.php.net/"
url "https://php.net/get/php-7.1.16.tar.xz/from/this/mirror"
sha256 "a5d67e477248a3911af7ef85c8400c1ba8cd632184186fd31070b96714e669f1"
revision 1

bottle do
sha256 "cd22b9c7cd6986c7e80acaac6eb971acbf01ba9b3a4401df15d6d193b0f699a8" => :high_sierra
Expand Down Expand Up @@ -76,7 +77,7 @@ def install
ENV.append "CPPFLAGS", "-DU_USING_ICU_NAMESPACE=1"

config_path = etc/"php/#{php_version}"
# Prevent system pear config from inhibitting pear install
# Prevent system pear config from inhibiting pear install
(config_path/"pear.conf").delete if (config_path/"pear.conf").exist?

# Prevent homebrew from harcoding path to sed shim in phpize script
Expand All @@ -88,6 +89,7 @@ def install
--sysconfdir=#{config_path}
--with-config-file-path=#{config_path}
--with-config-file-scan-dir=#{config_path}/conf.d
--with-pear=#{pkgshare}/pear
--enable-bcmath
--enable-calendar
--enable-dba
Expand Down Expand Up @@ -200,7 +202,7 @@ def caveats
end

def post_install
pear_prefix = share/"pear"
pear_prefix = pkgshare/"pear"
pear_files = %W[
#{pear_prefix}/.depdblock
#{pear_prefix}/.filemap
Expand All @@ -226,7 +228,8 @@ def post_install
php_ext_dir = opt_prefix/"lib/php"/php_basename

# fix pear config to install outside cellar
pear_path = HOMEBREW_PREFIX/"share/pear"
pear_path = HOMEBREW_PREFIX/"share/pear@#{php_version}"
cp_r pkgshare/"pear/.", pear_path
{
"php_ini" => etc/"php/#{php_version}/php.ini",
"php_dir" => pear_path,
Expand All @@ -244,6 +247,8 @@ def post_install
system bin/"pear", "config-set", key, value, "system"
end

system bin/"pear", "update-channels"

%w[
opcache
].each do |e|
Expand Down