Okay, there is just another problem I still face, even with the shiny new attach_pack/2: Where do I call attach_pack/2 to test a locally installed pack? Here’s my scenario with library(xsd):
- library(xsd) comes with more than 1000 (!) tests which are executed via library(tap).
- library(xsd) additionally depends on library(regex).
- library(xsd) comes with a CLI to validate an XML Document against a given XML Schema. As part of its installation, we create the saved state qlf file
cli.exefrom library(xsd)'scli.pl, using SWI-Prolog’s-cflag. Thecli.plcalls:- use_module(library(xsd)).at some point.
As part of a CI workflow with GitHub Actions, I want to automatically run the tests defined via library(tap) as well as just call the created cli.exe with some example XML+XSD file to ensure it’s working correctly. These tests are defined in the project’s Makefile. I just uploaded my first try to get this working with GitHub Actions in the branch 16-migrate-to-github-actions. It locally installs SWI-Prolog v8.0 with the help of swivm, installs the dependent packs via pack_install(tap) and pack_install(regex). Our library(xsd), which is subject to be tested, is checked out locally. Now I face the problem that I can’t call ./cli.exe, because it relies on the locally installed library(xsd), so it fails with the error message source_sink library(xsd) does not exist.
My guess was to try to call absolute_file_name(pack('.'),D) (as suggested in this thread) first, then create a symbolic link via ln -s $(pwd) $(swipl -q -g "absolute_file_name(pack('.'),D),writeln(D)" -t 'halt(1)'), and run the test thereafter. However, GitHub’s CI infrastructure apparently comes without a ~/lib directory, so ?- absolute_file_name(pack('.'),D) just returns false 
@jan, any idea how I could solve this? I try to avoid changing the code of :- use_module(library(xsd)) in cli.pl and hope to get SWI-Prolog to just find the correct path to the module.