summaryrefslogtreecommitdiff
path: root/utils.cc
diff options
context:
space:
mode:
authorAlex Deymo <deymo@chromium.org>2014-07-11 12:12:32 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-07-17 06:51:01 +0000
commit719bfff28b2bc76e2617b6e3907ceb967eaac1ef (patch)
tree8c64333568e1f9ff0bec3f51d7bbfac3743639ae /utils.cc
parent8ad6da98cdf5670ac999482d6579fbd49997809a (diff)
update_engine: Migrate build system to gyp.
This change migrates the SConstruct file to the platform2 gyp infrastructure without changing the way UE is compiled. The code is still compiled as a single static library shared between delta_generator, update_engine and update_engine_client. This patch adds two generic .gypi rules to generate bindings for DBus glib and public keys using openssl. update_engine_unittests requires to run the openssl version from the board and not the one on the host. This changes does that by using SYSROOT when possible. delta_generator is built without -pie to avoid a bug on how it is run from au-generator.zip. BUG=chromium:393293,chromium:394241 TEST=emerge-link update_engine; sudo emerge update_engine TEST=cros_workon_make --reconf --test update_engine TEST=cbuildbot link-release amd64-generic-full x86-generic-full CQ-DEPEND=CL:Id81c7dca798ac8003252259eed03a12a60054437 Change-Id: Icc5e24ac202e552275cd197ee0b9a4a3d9b4a47c Reviewed-on: https://chromium-review.googlesource.com/208487 Tested-by: Alex Deymo <deymo@chromium.org> Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org>
Diffstat (limited to 'utils.cc')
-rw-r--r--utils.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/utils.cc b/utils.cc
index f78861ae..1235a6b4 100644
--- a/utils.cc
+++ b/utils.cc
@@ -669,6 +669,27 @@ bool GetFilesystemSizeFromFD(int fd,
return true;
}
+string GetPathOnBoard(const string& command) {
+ int return_code = 0;
+ string command_path;
+ // TODO(deymo): prepend SYSROOT to each PATH instead of the result.
+ if (!Subprocess::SynchronousExec(
+ {"which", command}, &return_code, &command_path)) {
+ return command;
+ }
+ if (return_code != 0)
+ return command;
+
+ base::TrimWhitespaceASCII(command_path, base::TRIM_ALL, &command_path);
+ const char* env_sysroot = getenv("SYSROOT");
+ if (env_sysroot) {
+ string sysroot_command_path = env_sysroot + command_path;
+ if (utils::FileExists(sysroot_command_path.c_str()))
+ return sysroot_command_path;
+ }
+ return command_path;
+}
+
// Tries to parse the header of an ELF file to obtain a human-readable
// description of it on the |output| string.
static bool GetFileFormatELF(const char* buffer, size_t size, string* output) {