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
7 changes: 7 additions & 0 deletions pkgs/x/xpkg.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ package = {

xpm = {
linux = {
["0.0.69"] = {
url = {
GLOBAL = "https://github.com/openxlings/libxpkg/archive/refs/tags/0.0.69.tar.gz",
CN = "https://gitcode.com/mcpp-res/xpkg/releases/download/0.0.69/xpkg-0.0.69.tar.gz",
},
sha256 = "40c07239d494e463ed8babdc6a94434715e83831ea66845437d848a8e26cc0ee",
},
["0.0.68"] = {
url = {
GLOBAL = "https://github.com/openxlings/libxpkg/archive/refs/tags/0.0.68.tar.gz",
Expand Down
2 changes: 1 addition & 1 deletion tests/examples/xpkg/mcpp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ name = "xpkg-tests"
version = "0.1.0"

[dependencies]
mcpplibs.xpkg = "0.0.68"
mcpplibs.xpkg = "0.0.69"
17 changes: 15 additions & 2 deletions tests/examples/xpkg/tests/consume.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Consuming `mcpplibs.xpkg` through the published index: a recipe is read
// and what it declares comes back, a recipe that is not there is refused, and
// the format's specification the library embeds is there to read.
// and what it declares comes back, a recipe that is not there is refused, a
// recipe outside an index reads the libs of the index the host names, and the
// format's specification the library embeds is there to read.
import std;
import mcpplibs.xpkg;
import mcpplibs.xpkg.loader;
Expand Down Expand Up @@ -36,6 +37,18 @@ int main() {
check(!xpkg::load_package(dir / "absent.lua").has_value(), "a recipe that is not there is refused");
check(xpkg::conformance::specification().contains("xpkg"), "the specification is embedded");

// 0.0.69: a recipe in no index reads the libs of the index the host names.
fs::create_directories(dir / "host" / "libs");
std::ofstream(dir / "host" / "libs" / "probelib.lua") << "return { word = function() return 'host' end }\n";
const auto loose = dir / "loose.lua";
std::ofstream(loose) << R"(package = { spec = "3", name = "loose", xpm = { linux = { ["1.0.0"] = {} } } }
import("xim.pkgindex.probelib")
local word = probelib.word()
)";
check(xpkg::load_package(loose, {.platform = "linux", .arch = "x86_64",
.pkgindex_dir = (dir / "host").string()}).has_value(),
"a recipe outside an index reads the host's index libs");

fs::remove_all(dir);
if (failures == 0) std::println("xpkg: ok");
return failures == 0 ? 0 : 1;
Expand Down
Loading