Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mcpp.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
namespace = "mcpplibs"
name = "xpkg"
version = "0.0.61"
version = "0.0.62"
description = "C++23 reference implementation of the xpkg V2 spec (multi-arch)"
license = "Apache-2.0"
repo = "https://github.com/openxlings/libxpkg"
Expand Down
3 changes: 0 additions & 3 deletions src/lua-stdlib/xim/libxpkg/elfpatch.lua
Original file line number Diff line number Diff line change
Expand Up @@ -919,9 +919,6 @@ function M.closure_lib_paths(opt)
end
end

local sysroot = _RUNTIME and _RUNTIME.subos_sysrootdir
if sysroot and sysroot ~= "" then _push(path.join(sysroot, "lib")) end

return values
end

Expand Down
39 changes: 39 additions & 0 deletions tests/test_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,45 @@ TEST(ExecutorTest, HostLinkInterposer_ReportsAnUnservedVendorClosure) {
fs::remove_all(temp_dir);
}

TEST(ExecutorTest, Elfpatch_ClosureRemainsPayloadDirectAcrossScopes) {
const fs::path tempDir = make_temp_dir("libxpkg-elfpatch-scope-");
const fs::path installDir = tempDir / "payload";
const fs::path pkgPath = tempDir / "consumer.lua";
fs::create_directories(installDir);
write_text(pkgPath, R"lua(
package = { spec = "1", name = "consumer",
xpm = { linux = { ["1.0.0"] = {} } } }
local elfpatch = import("xim.libxpkg.elfpatch")
function config()
local paths = elfpatch.closure_lib_paths()
assert(#paths == 3, "unexpected closure: " .. table.concat(paths, ":"))
assert(paths[1] == "/store/consumer/lib")
assert(paths[2] == "/store/declared/lib")
assert(paths[3] == "/store/resolved/lib")
local explicit = elfpatch.closure_lib_paths({ deps_list = {} })
assert(#explicit == 1 and explicit[1] == paths[1],
"empty dependency override included scope libraries")
return true
end
)lua");
for (const auto scope : {"/home/subos/first", "/home/subos/second"}) {
auto exec = create_executor(pkgPath);
ASSERT_TRUE(exec.has_value()) << (exec ? "" : exec.error());
auto ctx = make_context(installDir, "linux");
ctx.subos_sysrootdir = scope;
ctx.self_exports.libdirs = {"/store/consumer/lib"};
ctx.deps_list = {"declared@1", "resolved@1", "build@1"};
ctx.runtime_deps_list = {"declared@1", "resolved@1"};
ctx.build_deps_list = {"build@1"};
ctx.deps_exports["declared@1"].libdirs = {"/store/declared/lib"};
ctx.resolved_deps["resolved@1"].libdirs = {"/store/resolved/lib"};
ctx.resolved_deps["build@1"].libdirs = {"/store/build/lib"};
const auto result = exec->run_hook(HookType::Config, ctx);
EXPECT_TRUE(result.success) << result.error << "\n" << result.output;
}
fs::remove_all(tempDir);
}

TEST(ExecutorTest, PkgInfo_UsesExplicitDependencyStoreRoots) {
const fs::path tempDir = make_temp_dir("libxpkg-pkginfo-roots-");
const fs::path registryRoot = tempDir / "registry" / "data" / "xpkgs";
Expand Down
Loading