Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Make custom channels work with pear (#207)

- add --pear-channel-update flag to force 'pear channel-update' prior to
  installation.
  • Loading branch information...
commit f9ed3dd83ffb94a95cfe79777c89820285c52c17 1 parent 3d10f65
Jordan Sissel authored
Showing with 13 additions and 3 deletions.
  1. +13 −3 lib/fpm/package/pear.rb
16 lib/fpm/package/pear.rb
View
@@ -13,6 +13,9 @@ class FPM::Package::PEAR < FPM::Package
option "--channel", "CHANNEL_URL",
"The pear channel url to use instead of the default."
+ option "--channel-update", :flag,
+ "call 'pear channel-update' prior to installation"
+
# Input a PEAR package.
#
# The parameter is a PHP PEAR package name.
@@ -32,13 +35,21 @@ def input(input_package)
safesystem("pear", "config-create", staging_path(installroot), config)
# try channel-discover
- if attributes.include?(:pear_channel)
+ if !attributes[:pear_channel].nil?
@logger.info("Custom channel specified", :channel => attributes[:pear_channel])
+ p ["pear", "-c", config, "channel-discover", attributes[:pear_channel]]
safesystem("pear", "-c", config, "channel-discover", attributes[:pear_channel])
input_package = "#{attributes[:pear_channel]}/#{input_package}"
@logger.info("Prefixing package name with channel", :package => input_package)
end
+ # do channel-update if requested
+ if attributes[:pear_channel_update?]
+ channel = attributes[:pear_channel] || "pear"
+ @logger.info("Updating the channel", :channel => channel)
+ safesystem("pear", "-c", config, "channel-update", channel)
+ end
+
pear_cmd = "pear -c #{config} remote-info #{input_package}"
@logger.info("Fetching package information", :package => input_package, :command => pear_cmd)
name = %x{#{pear_cmd} | sed -ne '/^Package\s*/s/^Package\s*//p'}.chomp
@@ -51,8 +62,7 @@ def input(input_package)
@logger.info("Installing pear package", :package => input_package,
:directory => staging_path)
::Dir.chdir(staging_path) do
- safesystem("pear", "-c", config, "install", "-n", "-f", "-P", ".",
- input_package)
+ safesystem("pear", "-c", config, "install", "-n", "-f", input_package)
end
# Remove the stuff we don't want
Please sign in to comment.
Something went wrong with that request. Please try again.