Revert "Add ability to check /etc/lsb-release for HWID"
This reverts commit d1da5101a191aa90fd671c9b9ab36573849a08e2.
Investigating a parrot in this state (from the bug) I discovered that if I specified HWID_OVERRIDE=tacos, hardware_class=tacos got sent in the omaha request. This must be an issue with either us passing define incorrectly or parsing it incorrectly. Reverting for now to be safe.
BUG=chromium:344727
TEST=tested manually that the reason the bug is happening is because update_engine is respecting HWID_OVERRIDE
Change-Id: I18665abc93a8d88b1d73f56c1784971ff0d29b87
Reviewed-on: https://chromium-review.googlesource.com/187029
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
diff --git a/SConstruct b/SConstruct
index 489f956..341622b 100644
--- a/SConstruct
+++ b/SConstruct
@@ -222,7 +222,6 @@
hardware.cc
http_common.cc
http_fetcher.cc
- hwid_override.cc
install_plan.cc
libcurl_http_fetcher.cc
metadata.cc
@@ -273,7 +272,6 @@
gpio_mock_udev_interface.cc
graph_utils_unittest.cc
http_fetcher_unittest.cc
- hwid_override_unittest.cc
metadata_unittest.cc
mock_http_fetcher.cc
mock_system_state.cc
diff --git a/extent_writer_unittest.cc b/extent_writer_unittest.cc
index 55cbff6..f0f5f7a 100644
--- a/extent_writer_unittest.cc
+++ b/extent_writer_unittest.cc
@@ -40,7 +40,7 @@
}
int fd() { return fd_; }
const char* path() { return path_; }
-
+
// Writes data to an extent writer in 'chunk_size' chunks with
// the first chunk of size first_chunk_size. It calculates what the
// resultant file should look like and ensure that the extent writer
diff --git a/hardware.cc b/hardware.cc
index 26435cf..6213739 100644
--- a/hardware.cc
+++ b/hardware.cc
@@ -20,7 +20,6 @@
const char* command = "";
void (*uuid_generator)(uint8_t* buffer) = NULL;
-#include "update_engine/hwid_override.h"
#include "update_engine/subprocess.h"
#include "update_engine/utils.h"
@@ -29,10 +28,6 @@
namespace chromeos_update_engine {
-Hardware::Hardware() {}
-
-Hardware::~Hardware() {}
-
const string Hardware::BootKernelDevice() {
return utils::KernelDeviceOfBootDevice(Hardware::BootDevice());
}
@@ -133,9 +128,6 @@
}
string Hardware::GetHardwareClass() {
- if (USE_HWID_OVERRIDE) {
- return HwidOverride::Read(base::FilePath("/"));
- }
return ReadValueFromCrosSystem("hwid");
}
diff --git a/hardware.h b/hardware.h
index 8168d9c..2693e3b 100644
--- a/hardware.h
+++ b/hardware.h
@@ -14,8 +14,7 @@
// Implements the real interface with the hardware.
class Hardware : public HardwareInterface {
public:
- Hardware();
- virtual ~Hardware();
+ Hardware() {}
// HardwareInterface methods.
virtual const std::string BootKernelDevice();
diff --git a/hwid_override.cc b/hwid_override.cc
deleted file mode 100644
index 90e413b..0000000
--- a/hwid_override.cc
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "update_engine/hwid_override.h"
-
-#include <map>
-#include <string>
-
-#include <base/basictypes.h>
-#include <base/file_path.h>
-#include <base/file_util.h>
-
-#include "update_engine/simple_key_value_store.h"
-
-using std::map;
-using std::string;
-
-namespace chromeos_update_engine {
-
-const char HwidOverride::kHwidOverrideKey[] = "HWID_OVERRIDE";
-
-HwidOverride::HwidOverride() {}
-
-HwidOverride::~HwidOverride() {}
-
-std::string HwidOverride::Read(const base::FilePath& root) {
- base::FilePath kFile(root.value() + "/etc/lsb-release");
- string file_data;
- map<string, string> data;
- if (file_util::ReadFileToString(kFile, &file_data)) {
- data = simple_key_value_store::ParseString(file_data);
- }
- return data[kHwidOverrideKey];
-}
-
-} // namespace chromeos_update_engine
diff --git a/hwid_override.h b/hwid_override.h
deleted file mode 100644
index 8f8dbc6..0000000
--- a/hwid_override.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_HWID_OVERRIDE_H__
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_HWID_OVERRIDE_H__
-
-#include <map>
-#include <string>
-
-#include <base/basictypes.h>
-#include <base/file_path.h>
-
-namespace chromeos_update_engine {
-
-// Class that allows HWID to be read from <root>/etc/lsb-release.
-class HwidOverride {
- public:
- HwidOverride();
- ~HwidOverride();
-
- // Read HWID from an /etc/lsb-release file under given root.
- // An empty string is returned if there is any error.
- static std::string Read(const base::FilePath& root);
-
- static const char kHwidOverrideKey[];
- private:
- DISALLOW_COPY_AND_ASSIGN(HwidOverride);
-};
-
-} // namespace chromeos_update_engine
-
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_HWID_OVERRIDE_H__
diff --git a/hwid_override_unittest.cc b/hwid_override_unittest.cc
deleted file mode 100644
index 01c9fa0..0000000
--- a/hwid_override_unittest.cc
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "update_engine/hwid_override.h"
-
-#include <string>
-
-#include <base/file_path.h>
-#include <base/file_util.h>
-#include <base/files/scoped_temp_dir.h>
-#include <gtest/gtest.h>
-
-namespace chromeos_update_engine {
-
-class HwidOverrideTest : public ::testing::Test {
- public:
- HwidOverrideTest() {}
- virtual ~HwidOverrideTest() {}
-
- virtual void SetUp() {
- ASSERT_TRUE(tempdir_.CreateUniqueTempDir());
- ASSERT_TRUE(file_util::CreateDirectory(tempdir_.path().Append("etc")));
- }
-
- protected:
- base::ScopedTempDir tempdir_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(HwidOverrideTest);
-};
-
-TEST_F(HwidOverrideTest, ReadGood) {
- std::string expected_hwid("expected");
- std::string keyval(HwidOverride::kHwidOverrideKey);
- keyval += ("=" + expected_hwid);
- ASSERT_EQ(file_util::WriteFile(tempdir_.path().Append("etc/lsb-release"),
- keyval.c_str(), keyval.length()),
- keyval.length());
- EXPECT_EQ(expected_hwid, HwidOverride::Read(tempdir_.path()));
-}
-
-TEST_F(HwidOverrideTest, ReadNothing) {
- std::string keyval("SOMETHING_ELSE=UNINTERESTING");
- ASSERT_EQ(file_util::WriteFile(tempdir_.path().Append("etc/lsb-release"),
- keyval.c_str(), keyval.length()),
- keyval.length());
- EXPECT_EQ(std::string(), HwidOverride::Read(tempdir_.path()));
-}
-
-TEST_F(HwidOverrideTest, ReadFailure) {
- EXPECT_EQ(std::string(), HwidOverride::Read(tempdir_.path()));
-}
-
-} // namespace chromeos_update_engine
diff --git a/simple_key_value_store.h b/simple_key_value_store.h
index 24a1d75..6453eee 100644
--- a/simple_key_value_store.h
+++ b/simple_key_value_store.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -14,8 +14,8 @@
namespace chromeos_update_engine {
namespace simple_key_value_store {
-
-// Parses a string.
+
+// Parses a string.
std::map<std::string, std::string> ParseString(const std::string& str);
std::string AssembleString(const std::map<std::string, std::string>& data);