expect: fix scripts to use Homebrew `tcl-tk`
`tcl-tk` is keg-only on macOS, so installed scripts would use system `tclsh`, and CI is testing the system `expect` library instead of the Homebrew one. `TCLLIBPATH` also needs to be set, because `tcl-tk`'s built-in package search path doesn't cover `$HOMEBREW_PREFIX/lib`. Also improved test block for some functional verification. Closes #113709. Closes #113812. Signed-off-by: Sean Molenaar <1484494+SMillerDev@users.noreply.github.com> Signed-off-by: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com>master
parent
a14fc301db
commit
92f12a58d0
|
@ -4,7 +4,7 @@ class Expect < Formula
|
|||
url "https://downloads.sourceforge.net/project/expect/Expect/5.45.4/expect5.45.4.tar.gz"
|
||||
sha256 "49a7da83b0bdd9f46d04a04deec19c7767bb9a323e40c4781f89caf760b92c34"
|
||||
license :public_domain
|
||||
revision 1
|
||||
revision 2
|
||||
|
||||
livecheck do
|
||||
url :stable
|
||||
|
@ -33,13 +33,14 @@ class Expect < Formula
|
|||
conflicts_with "ircd-hybrid", because: "both install an `mkpasswd` binary"
|
||||
|
||||
def install
|
||||
tcltk = Formula["tcl-tk"]
|
||||
args = %W[
|
||||
--prefix=#{prefix}
|
||||
--exec-prefix=#{prefix}
|
||||
--mandir=#{man}
|
||||
--enable-shared
|
||||
--enable-64bit
|
||||
--with-tcl=#{Formula["tcl-tk"].opt_lib}
|
||||
--with-tcl=#{tcltk.opt_lib}
|
||||
]
|
||||
|
||||
# Temporarily workaround build issues with building 5.45.4 using Xcode 12.
|
||||
|
@ -62,9 +63,17 @@ class Expect < Formula
|
|||
system "make"
|
||||
system "make", "install"
|
||||
lib.install_symlink Dir[lib/"expect*/libexpect*"]
|
||||
if OS.mac?
|
||||
bin.env_script_all_files libexec/"bin",
|
||||
PATH: "#{tcltk.opt_bin}:$PATH",
|
||||
TCLLIBPATH: lib.to_s
|
||||
# "expect" is already linked to "tcl-tk", no shim required
|
||||
bin.install libexec/"bin/expect"
|
||||
end
|
||||
end
|
||||
|
||||
test do
|
||||
system "#{bin}/mkpasswd"
|
||||
assert_match "works", shell_output("echo works | #{bin}/timed-read 1")
|
||||
assert_equal "", shell_output("{ sleep 3; echo fails; } | #{bin}/timed-read 1 2>&1")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue