diff options
author | Tom Cherry <tomcherry@google.com> | 2018-06-12 14:40:38 -0700 |
---|---|---|
committer | Tom Cherry <tomcherry@google.com> | 2018-06-14 14:08:33 -0700 |
commit | 863d808c2e7badcbcd43eee45ae7bbb49f2a1e2c (patch) | |
tree | bd7e5459be71cc9dcf5407dd75a21115b49e79f6 /init/host_import_parser.cpp | |
parent | ae74e42d2557b93a3da9ef75c51ef1f6aab3cc0a (diff) |
Relax host init parser to work with the build system
It's not going to be possible to safely assume $OUT has the right init
scripts to be parsed at a given point, so instead we fall back to
parsing init scripts individually.
This isn't a full revert of the previous commits. We retain parsing
correctness of the 'import' statements and we retain using the new
host side property functionality.
Also, fix a bug where main was not actually returning -1 on failure
Bug: 36970783
Test: testing individual files still works correctly
Change-Id: I4ae5620f234caa08993deb2c30825904a75f6654
Diffstat (limited to 'init/host_import_parser.cpp')
-rw-r--r-- | init/host_import_parser.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/init/host_import_parser.cpp b/init/host_import_parser.cpp index faf6fc1e3..93e363ff3 100644 --- a/init/host_import_parser.cpp +++ b/init/host_import_parser.cpp @@ -23,22 +23,17 @@ using android::base::StartsWith; namespace android { namespace init { -Result<Success> HostImportParser::ParseSection(std::vector<std::string>&& args, - const std::string& filename, int line) { +Result<Success> HostImportParser::ParseSection(std::vector<std::string>&& args, const std::string&, + int) { if (args.size() != 2) { return Error() << "single argument needed for import\n"; } - auto import_path = args[1]; - - if (StartsWith(import_path, "/system") || StartsWith(import_path, "/product") || - StartsWith(import_path, "/odm") || StartsWith(import_path, "/vendor")) { - import_path = out_dir_ + "/" + import_path; - } else { - import_path = out_dir_ + "/root/" + import_path; - } + return Success(); +} - return ImportParser::ParseSection({"import", import_path}, filename, line); +Result<Success> HostImportParser::ParseLineSection(std::vector<std::string>&&, int) { + return Error() << "Unexpected line found after import statement"; } } // namespace init |