我正在尝试为R中的Rserve
包编写第一个公式:https://www.rforge.net/Rserve/。
到目前为止,我有这个:
# Documentation: https://docs.brew.sh/Formula-Cookbook
# https://www.rubydoc.info/github/Homebrew/brew/master/Formula
class Rserve < Formula
desc "Rserve acts as a socket server (TCP/IP or local sockets) which allows binary requests to be sent to R."
homepage "http://www.rforge.net/Rserve/"
url "https://cran.r-project.org/src/contrib/Rserve_1.7-3.tar.gz"
sha256 "f6d636c736c3f16487d9987e54554fe0c55257b9bc0671b43e536d832e513027"
depends_on "r"
depends_on "gettext"
def install
system("whoami")
system("#{HOMEBREW_PREFIX}/bin/R CMD install --configure-args=\"CPPFLAGS=-L#{HOMEBREW_PREFIX}/opt/gettext/lib LDFLAGS=-I#{HOMEBREW_PREFIX}/opt/gettext/include\" .")
end
test do
# `test do` will create, run in and delete a temporary directory.
#
# This test will fail and we won't accept that! For Homebrew/homebrew-core
# this will need to be a test that verifies the functionality of the
# software. Run the test with `brew test Rserve`. Options passed
# to `brew install` such as `--HEAD` also need to be provided to `brew test`.
#
# The installed folder is not in the path, so use the entire path to any
# executables being tested: `system "#{bin}/program", "do", "something"`.
system "false"
end
end
我得到的错误是:
==> Downloading https://cran.r-project.org/src/contrib/Rserve_1.7-3.tar.gz
Already downloaded: /Users/kwilliams/Library/Caches/Homebrew/downloads/690e0934dcba3770ba80b743f7b2c9cee0250434ed17cc7949bc1eee74d5b170--Rserve_1.7-3.tar.gz
==> Verifying 690e0934dcba3770ba80b743f7b2c9cee0250434ed17cc7949bc1eee74d5b170--Rserve_1.7-3.tar.gz checksum
tar xf /Users/kwilliams/Library/Caches/Homebrew/downloads/690e0934dcba3770ba80b743f7b2c9cee0250434ed17cc7949bc1eee74d5b170--Rserve_1.7-3.tar.gz -C /private/tmp/d20190114-99089-11isfza
cp -pR /private/tmp/d20190114-99089-11isfza/Rserve/. /private/tmp/rserve-20190114-99089-b57ji6/Rserve
chmod -Rf +w /private/tmp/d20190114-99089-11isfza
==> whoami
kwilliams
==> /usr/local/bin/R CMD install --configure-args="CPPFLAGS=-L/usr/local/opt/gettext/lib LDFLAGS=-I/usr/local/opt/gettext/include" .
* installing to library ‘/usr/local/lib/R/3.5/site-library’
Error: ERROR: no permission to install to directory ‘/usr/local/lib/R/3.5/site-library’
==> Formula
Path: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/rserve.rb
==> Configuration
HOMEBREW_VERSION: 1.9.2-5-g44f4f36
ORIGIN: https://github.com/Homebrew/brew
HEAD: 44f4f36c0db693000410fe664b250a90325f4e32
Last commit: 4 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: de1ecc1d981de9d5165ea9e96242c32023d14d7c
Core tap last commit: 4 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_ENABLE_AUTO_UPDATE_MIGRATION: 1
HOMEBREW_LOGS: /Users/kwilliams/Library/Logs/Homebrew
CPU: octa-core 64-bit kabylake
Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 10.0 build 1000
Git: 2.17.2 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 11.0.1, 1.8.0_192
macOS: 10.13.6-x86_64
CLT: 10.1.0.0.1.1539992718
Xcode: 10.1
XQuartz: 2.7.11 => /opt/X11
/usr/local/lib/R/3.5/site-library
上的权限应允许我在此处进行安装,
% ls -al /usr/local/lib/R/3.5/site-library
total 0
drwxr-xr-x 2 kwilliams admin 64 Jan 14 13:38 ./
drwxr-xr-x 3 kwilliams admin 96 Jan 14 13:38 ../
如果我将自己放在Rserve
tarball的新目录中,然后手动运行命令/usr/local/bin/R CMD install --configure-args="CPPFLAGS=-L/usr/local/opt/gettext/lib LDFLAGS=-I/usr/local/opt/gettext/include" .
,则不会收到有关“无权安装到目录”的错误信息
与我在shell中运行它相比,Homebrew在运行该命令的环境有什么不同?
我的brew doctor
输出是干净的,除了警告我的docker
桶已断开链接外,我认为这是不相关的。
答案 0 :(得分:0)
弄清楚了-有一个沙箱(我认为是 Class Age City Color Count
0 A 20 Los Angeles Blue 2
1 A 20 Los Angeles Red 1
2 B 25 Phoenix Yellow 1
,它限制了对前缀目录外部文件系统的写入:
https://discourse.brew.sh/t/potential-permission-issues-in-a-formula-im-writing/3707
我需要找出将文件写入sandbox-exec
的正确方法,或者从Cellar目录或其任何文件将它们符号链接到那里。