Merge changes from topics "darwin_awk", "rename_path_prebuilts"
* changes: Use prebuilt awk on Darwin too Stop calling our host $PATH prebuilts toybox
This commit is contained in:
@@ -147,11 +147,10 @@ func SetupPath(ctx Context, config Config) {
|
|||||||
|
|
||||||
myPath, _ = filepath.Abs(myPath)
|
myPath, _ = filepath.Abs(myPath)
|
||||||
|
|
||||||
// Use the toybox prebuilts on linux
|
// We put some prebuilts in $PATH, since it's infeasible to add dependencies for all of
|
||||||
if runtime.GOOS == "linux" {
|
// them.
|
||||||
toyboxPath, _ := filepath.Abs("prebuilts/build-tools/toybox/linux-x86")
|
prebuiltsPath, _ := filepath.Abs("prebuilts/build-tools/path/" + runtime.GOOS + "-x86")
|
||||||
myPath = toyboxPath + string(os.PathListSeparator) + myPath
|
myPath = prebuiltsPath + string(os.PathListSeparator) + myPath
|
||||||
}
|
|
||||||
|
|
||||||
config.Environment().Set("PATH", myPath)
|
config.Environment().Set("PATH", myPath)
|
||||||
config.pathReplaced = true
|
config.pathReplaced = true
|
||||||
|
@@ -26,9 +26,9 @@ type PathConfig struct {
|
|||||||
// Whether to exit with an error instead of invoking the underlying tool.
|
// Whether to exit with an error instead of invoking the underlying tool.
|
||||||
Error bool
|
Error bool
|
||||||
|
|
||||||
// Whether we use a toybox prebuilt for this tool. Since we don't have
|
// Whether we use a linux-specific prebuilt for this tool. On Darwin,
|
||||||
// toybox for Darwin, we'll use the host version instead.
|
// we'll allow the host executable instead.
|
||||||
Toybox bool
|
LinuxOnlyPrebuilt bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var Allowed = PathConfig{
|
var Allowed = PathConfig{
|
||||||
@@ -59,11 +59,11 @@ var Missing = PathConfig{
|
|||||||
Error: true,
|
Error: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
var Toybox = PathConfig{
|
var LinuxOnlyPrebuilt = PathConfig{
|
||||||
Symlink: false,
|
Symlink: false,
|
||||||
Log: true,
|
Log: true,
|
||||||
Error: true,
|
Error: true,
|
||||||
Toybox: true,
|
LinuxOnlyPrebuilt: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetConfig(name string) PathConfig {
|
func GetConfig(name string) PathConfig {
|
||||||
@@ -126,57 +126,56 @@ var Configuration = map[string]PathConfig{
|
|||||||
"pkg-config": Forbidden,
|
"pkg-config": Forbidden,
|
||||||
|
|
||||||
// On Linux we'll use the toybox versions of these instead.
|
// On Linux we'll use the toybox versions of these instead.
|
||||||
"awk": Toybox, // Strictly one-true-awk, but...
|
"basename": LinuxOnlyPrebuilt,
|
||||||
"basename": Toybox,
|
"cat": LinuxOnlyPrebuilt,
|
||||||
"cat": Toybox,
|
"chmod": LinuxOnlyPrebuilt,
|
||||||
"chmod": Toybox,
|
"cmp": LinuxOnlyPrebuilt,
|
||||||
"cmp": Toybox,
|
"cp": LinuxOnlyPrebuilt,
|
||||||
"cp": Toybox,
|
"comm": LinuxOnlyPrebuilt,
|
||||||
"comm": Toybox,
|
"cut": LinuxOnlyPrebuilt,
|
||||||
"cut": Toybox,
|
"dirname": LinuxOnlyPrebuilt,
|
||||||
"dirname": Toybox,
|
"du": LinuxOnlyPrebuilt,
|
||||||
"du": Toybox,
|
"echo": LinuxOnlyPrebuilt,
|
||||||
"echo": Toybox,
|
"env": LinuxOnlyPrebuilt,
|
||||||
"env": Toybox,
|
"expr": LinuxOnlyPrebuilt,
|
||||||
"expr": Toybox,
|
"head": LinuxOnlyPrebuilt,
|
||||||
"head": Toybox,
|
"getconf": LinuxOnlyPrebuilt,
|
||||||
"getconf": Toybox,
|
"hostname": LinuxOnlyPrebuilt,
|
||||||
"hostname": Toybox,
|
"id": LinuxOnlyPrebuilt,
|
||||||
"id": Toybox,
|
"ln": LinuxOnlyPrebuilt,
|
||||||
"ln": Toybox,
|
"ls": LinuxOnlyPrebuilt,
|
||||||
"ls": Toybox,
|
"md5sum": LinuxOnlyPrebuilt,
|
||||||
"md5sum": Toybox,
|
"mkdir": LinuxOnlyPrebuilt,
|
||||||
"mkdir": Toybox,
|
"mktemp": LinuxOnlyPrebuilt,
|
||||||
"mktemp": Toybox,
|
"mv": LinuxOnlyPrebuilt,
|
||||||
"mv": Toybox,
|
"od": LinuxOnlyPrebuilt,
|
||||||
"od": Toybox,
|
"paste": LinuxOnlyPrebuilt,
|
||||||
"paste": Toybox,
|
"pgrep": LinuxOnlyPrebuilt,
|
||||||
"pgrep": Toybox,
|
"pkill": LinuxOnlyPrebuilt,
|
||||||
"pkill": Toybox,
|
"ps": LinuxOnlyPrebuilt,
|
||||||
"ps": Toybox,
|
"pwd": LinuxOnlyPrebuilt,
|
||||||
"pwd": Toybox,
|
"readlink": LinuxOnlyPrebuilt,
|
||||||
"readlink": Toybox,
|
"rm": LinuxOnlyPrebuilt,
|
||||||
"rm": Toybox,
|
"rmdir": LinuxOnlyPrebuilt,
|
||||||
"rmdir": Toybox,
|
"setsid": LinuxOnlyPrebuilt,
|
||||||
"setsid": Toybox,
|
"sha1sum": LinuxOnlyPrebuilt,
|
||||||
"sha1sum": Toybox,
|
"sha256sum": LinuxOnlyPrebuilt,
|
||||||
"sha256sum": Toybox,
|
"sha512sum": LinuxOnlyPrebuilt,
|
||||||
"sha512sum": Toybox,
|
"sleep": LinuxOnlyPrebuilt,
|
||||||
"sleep": Toybox,
|
"sort": LinuxOnlyPrebuilt,
|
||||||
"sort": Toybox,
|
"stat": LinuxOnlyPrebuilt,
|
||||||
"stat": Toybox,
|
"tail": LinuxOnlyPrebuilt,
|
||||||
"tail": Toybox,
|
"tee": LinuxOnlyPrebuilt,
|
||||||
"tee": Toybox,
|
"touch": LinuxOnlyPrebuilt,
|
||||||
"touch": Toybox,
|
"true": LinuxOnlyPrebuilt,
|
||||||
"true": Toybox,
|
"uname": LinuxOnlyPrebuilt,
|
||||||
"uname": Toybox,
|
"uniq": LinuxOnlyPrebuilt,
|
||||||
"uniq": Toybox,
|
"unix2dos": LinuxOnlyPrebuilt,
|
||||||
"unix2dos": Toybox,
|
"wc": LinuxOnlyPrebuilt,
|
||||||
"wc": Toybox,
|
"whoami": LinuxOnlyPrebuilt,
|
||||||
"whoami": Toybox,
|
"which": LinuxOnlyPrebuilt,
|
||||||
"which": Toybox,
|
"xargs": LinuxOnlyPrebuilt,
|
||||||
"xargs": Toybox,
|
"xxd": LinuxOnlyPrebuilt,
|
||||||
"xxd": Toybox,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -185,10 +184,10 @@ func init() {
|
|||||||
Configuration["sw_vers"] = Allowed
|
Configuration["sw_vers"] = Allowed
|
||||||
Configuration["xcrun"] = Allowed
|
Configuration["xcrun"] = Allowed
|
||||||
|
|
||||||
// We don't have toybox prebuilts for darwin, so allow the
|
// We don't have darwin prebuilts for some tools (like toybox),
|
||||||
// host versions.
|
// so allow the host versions.
|
||||||
for name, config := range Configuration {
|
for name, config := range Configuration {
|
||||||
if config.Toybox {
|
if config.LinuxOnlyPrebuilt {
|
||||||
Configuration[name] = Allowed
|
Configuration[name] = Allowed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user