Commit be22fa30 authored by Kevin Marshall's avatar Kevin Marshall Committed by Commit Bot

Fuchsia: Delete package-probing conditionals from codebase.

All executables are run within packages now, so there is no more need
to support both packaged and non-packaged execution modes.
The transitional codepaths to handle both cases are no longer needed.

This CL removes the bootfs mode from the local SDK builder script.


Bug: 805057
Change-Id: I01bf0223a70f440de675d4ec2434248f973f3eb6
Reviewed-on: https://chromium-review.googlesource.com/1033475Reviewed-by: default avatarDavid Benjamin <davidben@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarScott Graham <scottmg@chromium.org>
Reviewed-by: default avatarNasko Oskov <nasko@chromium.org>
Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554711}
parent 1ab3884b
...@@ -43,18 +43,12 @@ bool PathProviderFuchsia(int key, FilePath* result) { ...@@ -43,18 +43,12 @@ bool PathProviderFuchsia(int key, FilePath* result) {
} }
case DIR_SOURCE_ROOT: case DIR_SOURCE_ROOT:
*result = GetPackageRoot(); *result = GetPackageRoot();
if (result->empty()) {
*result = FilePath("/system");
}
return true; return true;
case DIR_CACHE: case DIR_CACHE:
*result = FilePath("/data"); *result = FilePath("/data");
return true; return true;
case DIR_ASSETS: case DIR_ASSETS:
*result = GetPackageRoot(); *result = GetPackageRoot();
if (result->empty()) {
return PathService::Get(DIR_EXE, result);
}
return true; return true;
} }
return false; return false;
......
...@@ -40,15 +40,7 @@ NativeLibrary LoadNativeLibraryWithOptions(const FilePath& library_path, ...@@ -40,15 +40,7 @@ NativeLibrary LoadNativeLibraryWithOptions(const FilePath& library_path,
return nullptr; return nullptr;
} }
// Fuchsia libraries must live under the "lib" directory, which may be located
// in /system/lib or /pkg/lib depending on whether the executable is running
// inside a package.
// TODO(https://crbug.com/805057): Remove the non-package codepath when bootfs
// is deprecated.
FilePath computed_path = base::GetPackageRoot(); FilePath computed_path = base::GetPackageRoot();
if (computed_path.empty()) {
CHECK(PathService::Get(DIR_EXE, &computed_path));
}
computed_path = computed_path.AppendASCII("lib").Append(components[0]); computed_path = computed_path.AppendASCII("lib").Append(components[0]);
base::File library(computed_path, base::File library(computed_path,
base::File::FLAG_OPEN | base::File::FLAG_READ); base::File::FLAG_OPEN | base::File::FLAG_READ);
......
...@@ -242,11 +242,6 @@ MULTIPROCESS_TEST_MAIN(CheckTmpFileExists) { ...@@ -242,11 +242,6 @@ MULTIPROCESS_TEST_MAIN(CheckTmpFileExists) {
} }
TEST_F(ProcessUtilTest, SelectivelyClonedDir) { TEST_F(ProcessUtilTest, SelectivelyClonedDir) {
// Selective cloning only works if the test executable is deployed as a
// package.
if (GetPackageRoot().empty())
return;
const std::string signal_file = const std::string signal_file =
ProcessUtilTest::GetSignalFilePath(kSignalFileClone); ProcessUtilTest::GetSignalFilePath(kSignalFileClone);
remove(signal_file.c_str()); remove(signal_file.c_str());
...@@ -269,11 +264,6 @@ TEST_F(ProcessUtilTest, SelectivelyClonedDir) { ...@@ -269,11 +264,6 @@ TEST_F(ProcessUtilTest, SelectivelyClonedDir) {
// error code if it detects a directory other than "/tmp", so we can use that as // error code if it detects a directory other than "/tmp", so we can use that as
// a signal that it successfully detected another entry in the root namespace. // a signal that it successfully detected another entry in the root namespace.
TEST_F(ProcessUtilTest, CloneAlternateDir) { TEST_F(ProcessUtilTest, CloneAlternateDir) {
// Selective cloning only works if the test executable is deployed as a
// package.
if (GetPackageRoot().empty())
return;
const std::string signal_file = const std::string signal_file =
ProcessUtilTest::GetSignalFilePath(kSignalFileClone); ProcessUtilTest::GetSignalFilePath(kSignalFileClone);
remove(signal_file.c_str()); remove(signal_file.c_str());
......
...@@ -25,31 +25,20 @@ void UpdateLaunchOptionsForSandbox(service_manager::SandboxType type, ...@@ -25,31 +25,20 @@ void UpdateLaunchOptionsForSandbox(service_manager::SandboxType type,
} }
if (type != service_manager::SANDBOX_TYPE_NO_SANDBOX) { if (type != service_manager::SANDBOX_TYPE_NO_SANDBOX) {
auto package_root = base::GetPackageRoot(); // Map /pkg (read-only files deployed from the package) and /tmp into the
if (!package_root.empty()) { // child's namespace.
// TODO(kmarshall): Build path mappings for each sandbox type. options->paths_to_map.push_back(base::GetPackageRoot().AsUTF8Unsafe());
base::FilePath temp_dir;
// Map /pkg (read-only files deployed from the package) and /tmp into the base::GetTempDir(&temp_dir);
// child's namespace. options->paths_to_map.push_back(temp_dir.AsUTF8Unsafe());
options->paths_to_map.push_back(package_root.AsUTF8Unsafe());
base::FilePath temp_dir; // Clear environmental variables to better isolate the child from
base::GetTempDir(&temp_dir); // this process.
options->paths_to_map.push_back(temp_dir.AsUTF8Unsafe()); options->clear_environ = true;
// Clear environmental variables to better isolate the child from // Propagate stdout/stderr/stdin to the child.
// this process. options->clone_flags = LP_CLONE_FDIO_STDIO;
options->clear_environ = true; return;
// Propagate stdout/stderr/stdin to the child.
options->clone_flags = LP_CLONE_FDIO_STDIO;
return;
}
// TODO(crbug.com/750938): Remove this once package deployments become
// mandatory.
LOG(ERROR) << "Sandboxing was requested but is not available because"
<< "the parent process is not hosted within a package.";
type = service_manager::SANDBOX_TYPE_NO_SANDBOX;
} }
DCHECK_EQ(type, service_manager::SANDBOX_TYPE_NO_SANDBOX); DCHECK_EQ(type, service_manager::SANDBOX_TYPE_NO_SANDBOX);
......
...@@ -29,14 +29,7 @@ base::FilePath GetTestServerConfigFilePath() { ...@@ -29,14 +29,7 @@ base::FilePath GetTestServerConfigFilePath() {
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
PathService::Get(base::DIR_ANDROID_EXTERNAL_STORAGE, &dir); PathService::Get(base::DIR_ANDROID_EXTERNAL_STORAGE, &dir);
#elif defined(OS_FUCHSIA) #elif defined(OS_FUCHSIA)
// TODO(https://crbug.com/805057): Remove conditional after bootfs turndown. dir = base::FilePath("/data");
if (base::GetPackageRoot().empty()) {
// Bootfs runs.
dir = base::FilePath("/system");
} else {
// Packaged runs.
dir = base::FilePath("/data");
}
#else #else
PathService::Get(base::DIR_TEMP, &dir); PathService::Get(base::DIR_TEMP, &dir);
#endif #endif
......
...@@ -26,11 +26,6 @@ ...@@ -26,11 +26,6 @@
-SysInfoTest.AmountOfMem -SysInfoTest.AmountOfMem
-SysInfoTest.AmountOfTotalDiskSpace -SysInfoTest.AmountOfTotalDiskSpace
# Remove this filter once the migration to packages is complete.
# See crbug.com/805057.
-NativeLibraryTest.LoadLibrary
-NativeLibraryTest.LoadLibraryPreferOwnSymbols
# These tests are affected by an issue with cloning namespace entries from # These tests are affected by an issue with cloning namespace entries from
# inside a package. See https://crbug.com/826018 # inside a package. See https://crbug.com/826018
-ProcessUtilTest.CloneAlternateDir -ProcessUtilTest.CloneAlternateDir
......
...@@ -38,14 +38,6 @@ def BuildForArch(arch): ...@@ -38,14 +38,6 @@ def BuildForArch(arch):
'--args=is_debug=false', build_dir) '--args=is_debug=false', build_dir)
Run('scripts/fx', 'full-build') Run('scripts/fx', 'full-build')
# Also build the deprecated bootfs-based image.
# TODO(crbug.com/805057): Remove this once bootfs is turned down.
build_dir_bootfs = 'out/release-' + arch + '-bootfs'
Run('scripts/fx', 'set', arch,
'--packages=garnet/packages/sdk/bootfs', '--args=is_debug=false',
'--args=bootfs_packages=true', build_dir_bootfs)
Run('scripts/fx', 'full-build')
def main(args): def main(args):
if len(args) != 1 or not os.path.isdir(args[0]): if len(args) != 1 or not os.path.isdir(args[0]):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment