tools: remove phosphor-ipmi-blobs dependency
The host tool depended on the BMC header: firmware_handler.hpp because
it defined the flags. This header depends on phosphor-ipmi-blobs,
therefore the host-tool depends on this. Move the flags into a separate
common header file and snip this dependency.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Id2ad33a1611c02605a1ed5c695429d0451eb98d4
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 96f8a7e..e54b301 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -4,14 +4,12 @@
burn_my_bmc_LDADD = libupdater.la $(CODE_COVERAGE_LIBS)
burn_my_bmc_CXXFLAGS = \
-I$(top_srcdir) \
- -I$(top_srcdir)/bmc/ \
$(CODE_COVERAGE_CXXFLAGS)
noinst_LTLIBRARIES = libupdater.la
libupdater_la_LDFLAGS = -static $(CODE_COVERAGE_LIBS) $(IPMIBLOB_LIBS) $(PCILIB_LIBS)
libupdater_la_CXXFLAGS = \
-I$(top_srcdir) \
- -I$(top_srcdir)/bmc/ \
$(CODE_COVERAGE_CXXFLAGS) \
$(IPMIBLOB_CFLAGS) \
$(PCILIB_CFLAGS)
diff --git a/tools/bt.hpp b/tools/bt.hpp
index 9caac5d..729f74d 100644
--- a/tools/bt.hpp
+++ b/tools/bt.hpp
@@ -17,9 +17,9 @@
sys(sys){};
bool sendContents(const std::string& input, std::uint16_t session) override;
- ipmi_flash::FirmwareBlobHandler::UpdateFlags supportedType() const override
+ ipmi_flash::FirmwareFlags::UpdateFlags supportedType() const override
{
- return ipmi_flash::FirmwareBlobHandler::UpdateFlags::ipmi;
+ return ipmi_flash::FirmwareFlags::UpdateFlags::ipmi;
}
private:
diff --git a/tools/handler.cpp b/tools/handler.cpp
index 147a457..65596f5 100644
--- a/tools/handler.cpp
+++ b/tools/handler.cpp
@@ -16,13 +16,13 @@
#include "handler.hpp"
+#include "flags.hpp"
#include "helper.hpp"
#include "status.hpp"
#include "tool_errors.hpp"
#include "util.hpp"
#include <algorithm>
-#include <blobs-ipmid/blobs.hpp>
#include <cstdint>
#include <cstring>
#include <ipmiblob/blob_errors.hpp>
@@ -85,7 +85,8 @@
{
session = blob->openBlob(
target, static_cast<std::uint16_t>(supported) |
- static_cast<std::uint16_t>(blobs::OpenFlags::write));
+ static_cast<std::uint16_t>(
+ ipmi_flash::FirmwareFlags::UpdateFlags::openWrite));
}
catch (const ipmiblob::BlobException& b)
{
@@ -113,7 +114,8 @@
try
{
session = blob->openBlob(
- target, static_cast<std::uint16_t>(blobs::OpenFlags::write));
+ target, static_cast<std::uint16_t>(
+ ipmi_flash::FirmwareFlags::UpdateFlags::openWrite));
}
catch (const ipmiblob::BlobException& b)
{
@@ -162,9 +164,10 @@
try
{
std::fprintf(stderr, "Opening the cleanup blob\n");
- session =
- blob->openBlob(ipmi_flash::cleanupBlobId,
- static_cast<std::uint16_t>(blobs::OpenFlags::write));
+ session = blob->openBlob(
+ ipmi_flash::cleanupBlobId,
+ static_cast<std::uint16_t>(
+ ipmi_flash::FirmwareFlags::UpdateFlags::openWrite));
}
catch (...)
{
diff --git a/tools/interface.hpp b/tools/interface.hpp
index ae341ec..2c993bf 100644
--- a/tools/interface.hpp
+++ b/tools/interface.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "firmware_handler.hpp"
+#include "flags.hpp"
#include <cstdint>
#include <string>
@@ -30,8 +30,7 @@
*
* @return the enum value corresponding to the supported type.
*/
- virtual ipmi_flash::FirmwareBlobHandler::UpdateFlags
- supportedType() const = 0;
+ virtual ipmi_flash::FirmwareFlags::UpdateFlags supportedType() const = 0;
};
} // namespace host_tool
diff --git a/tools/lpc.cpp b/tools/lpc.cpp
index 9359b92..7dbfaf3 100644
--- a/tools/lpc.cpp
+++ b/tools/lpc.cpp
@@ -16,9 +16,14 @@
#include "lpc.hpp"
+#include "data.hpp"
+
#include <cerrno>
+#include <cstdint>
#include <cstring>
#include <ipmiblob/blob_errors.hpp>
+#include <memory>
+#include <string>
namespace host_tool
{
diff --git a/tools/lpc.hpp b/tools/lpc.hpp
index 32e1d8c..2c3a723 100644
--- a/tools/lpc.hpp
+++ b/tools/lpc.hpp
@@ -28,9 +28,9 @@
io(io), address(address), length(length), sys(sys){};
bool sendContents(const std::string& input, std::uint16_t session) override;
- ipmi_flash::FirmwareBlobHandler::UpdateFlags supportedType() const override
+ ipmi_flash::FirmwareFlags::UpdateFlags supportedType() const override
{
- return ipmi_flash::FirmwareBlobHandler::UpdateFlags::lpc;
+ return ipmi_flash::FirmwareFlags::UpdateFlags::lpc;
}
private:
diff --git a/tools/p2a.cpp b/tools/p2a.cpp
index 9e246ae..66fc62e 100644
--- a/tools/p2a.cpp
+++ b/tools/p2a.cpp
@@ -16,12 +16,15 @@
#include "p2a.hpp"
-#include "firmware_handler.hpp"
+#include "data.hpp"
+#include "flags.hpp"
#include "pci.hpp"
-#include "pci_handler.hpp"
+#include <cstdint>
#include <cstring>
#include <ipmiblob/blob_errors.hpp>
+#include <memory>
+#include <string>
namespace host_tool
{
diff --git a/tools/p2a.hpp b/tools/p2a.hpp
index 920422f..c84f12d 100644
--- a/tools/p2a.hpp
+++ b/tools/p2a.hpp
@@ -30,9 +30,9 @@
}
bool sendContents(const std::string& input, std::uint16_t session) override;
- ipmi_flash::FirmwareBlobHandler::UpdateFlags supportedType() const override
+ ipmi_flash::FirmwareFlags::UpdateFlags supportedType() const override
{
- return ipmi_flash::FirmwareBlobHandler::UpdateFlags::p2a;
+ return ipmi_flash::FirmwareFlags::UpdateFlags::p2a;
}
private:
diff --git a/tools/test/Makefile.am b/tools/test/Makefile.am
index a0e2912..c05654b 100644
--- a/tools/test/Makefile.am
+++ b/tools/test/Makefile.am
@@ -3,7 +3,6 @@
AM_CPPFLAGS = \
-I$(top_srcdir)/ \
-I$(top_srcdir)/tools/ \
- -I$(top_srcdir)/bmc \
$(GTEST_CFLAGS) \
$(GMOCK_CFLAGS) \
$(CODE_COVERAGE_CPPFLAGS)
diff --git a/tools/test/data_interface_mock.hpp b/tools/test/data_interface_mock.hpp
index 3189e5b..0ee799b 100644
--- a/tools/test/data_interface_mock.hpp
+++ b/tools/test/data_interface_mock.hpp
@@ -14,8 +14,7 @@
virtual ~DataInterfaceMock() = default;
MOCK_METHOD2(sendContents, bool(const std::string&, std::uint16_t));
- MOCK_CONST_METHOD0(supportedType,
- ipmi_flash::FirmwareBlobHandler::UpdateFlags());
+ MOCK_CONST_METHOD0(supportedType, ipmi_flash::FirmwareFlags::UpdateFlags());
};
} // namespace host_tool
diff --git a/tools/test/tools_updater_unittest.cpp b/tools/test/tools_updater_unittest.cpp
index 85f86bc..0c9e6b5 100644
--- a/tools/test/tools_updater_unittest.cpp
+++ b/tools/test/tools_updater_unittest.cpp
@@ -1,11 +1,11 @@
#include "data_interface_mock.hpp"
+#include "flags.hpp"
#include "status.hpp"
#include "tool_errors.hpp"
#include "updater.hpp"
#include "updater_mock.hpp"
#include "util.hpp"
-#include <blobs-ipmid/blobs.hpp>
#include <ipmiblob/test/blob_interface_mock.hpp>
#include <string>
@@ -32,8 +32,8 @@
TEST_F(UpdateHandlerTest, CheckAvailableSuccess)
{
ipmiblob::StatResponse statObj = {};
- statObj.blob_state = ipmi_flash::FirmwareBlobHandler::UpdateFlags::ipmi |
- ipmi_flash::FirmwareBlobHandler::UpdateFlags::lpc;
+ statObj.blob_state = ipmi_flash::FirmwareFlags::UpdateFlags::ipmi |
+ ipmi_flash::FirmwareFlags::UpdateFlags::lpc;
EXPECT_CALL(blobMock, getBlobList())
.WillOnce(
@@ -43,7 +43,7 @@
.WillOnce(Return(statObj));
EXPECT_CALL(handlerMock, supportedType())
- .WillOnce(Return(ipmi_flash::FirmwareBlobHandler::UpdateFlags::lpc));
+ .WillOnce(Return(ipmi_flash::FirmwareFlags::UpdateFlags::lpc));
EXPECT_TRUE(updater.checkAvailable(ipmi_flash::staticLayoutBlobId));
}
@@ -55,11 +55,12 @@
std::uint16_t supported =
static_cast<std::uint16_t>(
- ipmi_flash::FirmwareBlobHandler::UpdateFlags::lpc) |
- static_cast<std::uint16_t>(blobs::OpenFlags::write);
+ ipmi_flash::FirmwareFlags::UpdateFlags::lpc) |
+ static_cast<std::uint16_t>(
+ ipmi_flash::FirmwareFlags::UpdateFlags::openWrite);
EXPECT_CALL(handlerMock, supportedType())
- .WillOnce(Return(ipmi_flash::FirmwareBlobHandler::UpdateFlags::lpc));
+ .WillOnce(Return(ipmi_flash::FirmwareFlags::UpdateFlags::lpc));
EXPECT_CALL(blobMock, openBlob(ipmi_flash::staticLayoutBlobId, supported))
.WillOnce(Return(session));
diff --git a/tools/updater.cpp b/tools/updater.cpp
index 438fc4a..4d150db 100644
--- a/tools/updater.cpp
+++ b/tools/updater.cpp
@@ -16,14 +16,13 @@
#include "updater.hpp"
-#include "firmware_handler.hpp"
+#include "flags.hpp"
#include "handler.hpp"
#include "status.hpp"
#include "tool_errors.hpp"
#include "util.hpp"
#include <algorithm>
-#include <blobs-ipmid/blobs.hpp>
#include <cstring>
#include <ipmiblob/blob_errors.hpp>
#include <memory>