From 6680ffa7a84397464ae3e10c3790cbd06e8d6d4a Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 17 Jun 2023 20:51:36 -0500 Subject: [PATCH] [keel] Make most of pack build regardless of platform --- src/keel/pack.cpp | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/keel/pack.cpp b/src/keel/pack.cpp index 20e74575..dece9fa8 100644 --- a/src/keel/pack.cpp +++ b/src/keel/pack.cpp @@ -2,12 +2,9 @@ * Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved. */ -#ifndef OX_BARE_METAL - -#include #include -#include #include +#include #include @@ -15,7 +12,8 @@ namespace keel { -static ox::Error pathToInode(keel::Context *ctx, ox::FileSystem *dest, ox::ModelObject *obj) noexcept { +static ox::Error pathToInode( + [[maybe_unused]] keel::Context *ctx, ox::FileSystem *dest, ox::ModelObject *obj) noexcept { auto &o = *obj; auto type = static_cast(o["type"].get()); auto &data = o["data"].get(); @@ -32,8 +30,12 @@ static ox::Error pathToInode(keel::Context *ctx, ox::FileSystem *dest, ox::Model return {}; } if (beginsWith(path, "uuid://")) { +#ifndef OX_BARE_METAL const auto uuid = ox::StringView(path).substr(7); path = ctx->uuidToPath[uuid]; +#else + return OxError(1, "UUID to path conversion not supported on this platform"); +#endif } oxRequire(s, dest->stat(path)); oxReturnError(o["type"].set(static_cast(ox::FileAddressType::Inode))); @@ -76,7 +78,12 @@ static ox::Error transformFileAddressesObj(keel::Context *ctx, ox::FileSystem *d return {}; } -static ox::Error doTransformations(keel::Context *ctx, ox::TypeStore *ts, ox::FileSystem *dest, ox::CRStringView filePath) noexcept { +static ox::Error doTransformations( + [[maybe_unused]] keel::Context *ctx, + [[maybe_unused]] ox::TypeStore *ts, + [[maybe_unused]] ox::FileSystem *dest, + [[maybe_unused]] ox::CRStringView filePath) noexcept { +#ifndef OX_BARE_METAL // load file oxRequire(s, dest->stat(filePath)); // do transformations @@ -91,6 +98,9 @@ static ox::Error doTransformations(keel::Context *ctx, ox::TypeStore *ts, ox::Fi // write file to dest oxReturnError(dest->write(s.inode, buff.data(), buff.size())); return {}; +#else + return OxError(1, "Transformations not supported on this platform"); +#endif } // claw file transformations are broken out from copy because path to inode @@ -122,8 +132,8 @@ struct VerificationPair { ox::String path; ox::Buffer buff; VerificationPair(ox::String &&pPath, ox::Buffer &&pBuff) noexcept: - path(std::forward(pPath)), - buff(std::forward(pBuff)) { + path(ox::forward(pPath)), + buff(ox::forward(pBuff)) { } }; @@ -158,7 +168,7 @@ static ox::Error copyFS(ox::FileSystem *src, ox::FileSystem *dest) noexcept { ox::Vector verificationPairs; oxReturnError(copy(src, dest, "/", &verificationPairs)); // verify all at once in addition to right after the files are written - oxOutf("Verifying completed destination\n"); + oxOut("Verifying completed destination\n"); for (const auto &v : verificationPairs) { oxReturnError(verifyFile(dest, v.path, v.buff)); } @@ -173,5 +183,3 @@ ox::Error pack(keel::Context *ctx, ox::TypeStore *ts, ox::FileSystem *dest) noex } } - -#endif