diff --git a/.github/workflows/build_test.yaml b/.github/workflows/build_test.yaml index 137edb77..fa24cb84 100644 --- a/.github/workflows/build_test.yaml +++ b/.github/workflows/build_test.yaml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest permissions: read-all container: - image: ghcr.io/aosedge/aos-core-build-base:latest + image: ghcr.io/aosedge/aos-core-build:latest options: "--entrypoint /usr/bin/bash" credentials: username: ${{ github.actor }} @@ -33,10 +33,6 @@ jobs: BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory steps: - # Apply solution to "HOME is overridden for containers" problem: https://github.com/actions/runner/issues/863 - - name: Preserve $HOME set in the container - run: echo HOME=/root >> "$GITHUB_ENV" - - name: Checkout uses: actions/checkout@v4 with: diff --git a/external/aos_core_lib_cpp b/external/aos_core_lib_cpp index 2ddba726..2f48d804 160000 --- a/external/aos_core_lib_cpp +++ b/external/aos_core_lib_cpp @@ -1 +1 @@ -Subproject commit 2ddba726723cf9240611b653f856f534133757a5 +Subproject commit 2f48d804f2c37f0ae521e0ae4ebd7964498d64c8 diff --git a/include/downloader/downloader.hpp b/include/downloader/downloader.hpp index 65698911..a601f49b 100644 --- a/include/downloader/downloader.hpp +++ b/include/downloader/downloader.hpp @@ -33,10 +33,13 @@ class Downloader : public aos::downloader::DownloaderItf { * * @param url URL. * @param path path to file. - * @param contentType content type. + * @param targetType target type. + * @param targetID target ID. + * @param version version. * @return Error. */ - Error Download(const String& url, const String& path, aos::downloader::DownloadContent contentType) override; + Error Download(const String& url, const String& path, cloudprotocol::DownloadTarget targetType, + const String& targetID = "", const String& version = "") override; private: constexpr static std::chrono::milliseconds cDelay {1000}; diff --git a/include/network/interfacemanager.hpp b/include/network/interfacemanager.hpp index 422edec8..0abeab5a 100644 --- a/include/network/interfacemanager.hpp +++ b/include/network/interfacemanager.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include @@ -203,7 +204,7 @@ class InterfaceManager : public sm::networkmanager::InterfaceManagerItf, * @param[out] routes routes. * @return Error. */ - Error GetRouteList(Array& routes) const; + Error GetRouteList(std::vector& routes) const; /** * Adds link. @@ -248,8 +249,6 @@ class InterfaceManager : public sm::networkmanager::InterfaceManagerItf, using LinkDeleter = std::function; using UniqueLink = std::unique_ptr; - static constexpr size_t cMaxRouteCount = 20; - RetWithError GetMasterInterfaceIndex() const; RetWithError CreateNetlinkSocket() const; RetWithError CreateLink() const; diff --git a/src/downloader/downloader.cpp b/src/downloader/downloader.cpp index c9e1428f..7d6b739c 100644 --- a/src/downloader/downloader.cpp +++ b/src/downloader/downloader.cpp @@ -28,9 +28,13 @@ Downloader::~Downloader() mCondVar.notify_all(); } -Error Downloader::Download(const String& url, const String& path, aos::downloader::DownloadContent contentType) +Error Downloader::Download(const String& url, const String& path, cloudprotocol::DownloadTarget targetType, + const String& targetID, const String& version) { - LOG_DBG() << "Start download: url=" << url << ", path=" << path << ", contentType=" << contentType; + (void)targetID; + (void)version; + + LOG_DBG() << "Start download: url=" << url << ", path=" << path << ", contentType=" << targetType; return RetryDownload(url, path); } diff --git a/src/network/interfacemanager.cpp b/src/network/interfacemanager.cpp index 14e41baf..5408555e 100644 --- a/src/network/interfacemanager.cpp +++ b/src/network/interfacemanager.cpp @@ -437,7 +437,7 @@ Error InterfaceManager::SetMasterLink(const String& ifname, const String& master return ErrorEnum::eNone; } -Error InterfaceManager::GetRouteList(Array& routes) const +Error InterfaceManager::GetRouteList(std::vector& routes) const { LOG_DBG() << "List routes"; @@ -475,9 +475,7 @@ Error InterfaceManager::GetRouteList(Array& routes) const } } - if (err = routes.PushBack(info); !err.IsNone()) { - return AOS_ERROR_WRAP(err); - } + routes.push_back(std::move(info)); } return ErrorEnum::eNone; @@ -574,7 +572,7 @@ RetWithError InterfaceManager::GetMasterInterfaceIndex() const { LOG_DBG() << "Get master interface index"; - StaticArray routes; + std::vector routes; if (auto err = GetRouteList(routes); !err.IsNone()) { return {-1, err}; diff --git a/tests/downloader/downloader_test.cpp b/tests/downloader/downloader_test.cpp index 304d79b5..a96bfebc 100644 --- a/tests/downloader/downloader_test.cpp +++ b/tests/downloader/downloader_test.cpp @@ -63,7 +63,7 @@ TEST_F(DownloaderTest, Download) StartServer(); auto err = mDownloader.Download( - "http://localhost:8000/test_file.dat", mFilePath.c_str(), aos::downloader::DownloadContentEnum::eService); + "http://localhost:8000/test_file.dat", mFilePath.c_str(), aos::cloudprotocol::DownloadTargetEnum::eService); EXPECT_EQ(err, aos::ErrorEnum::eNone); EXPECT_TRUE(std::filesystem::exists(mFilePath)); @@ -79,7 +79,7 @@ TEST_F(DownloaderTest, Download) TEST_F(DownloaderTest, DownloadFileScheme) { auto err = mDownloader.Download( - "file://test_file.dat", mFilePath.c_str(), aos::downloader::DownloadContentEnum::eService); + "file://test_file.dat", mFilePath.c_str(), aos::cloudprotocol::DownloadTargetEnum::eService); EXPECT_EQ(err, aos::ErrorEnum::eNone); EXPECT_TRUE(std::filesystem::exists(mFilePath));