[build2] publishing packages with external tests

Markus Pawellek markuspawellek at gmail.com
Wed Mar 18 12:48:43 UTC 2020

Boris Kolpackov <boris at codesynthesis.com> wrote:

> The recommended way to resolve this is to provide stub packages
> for dependencies that haven't yet been packaged.
> A stub is a package without any source code that can only be
> "obtained" from the system (i.e., as a system-installed package).
> Here is an example of a stub:
> https://cppget.org/libapr1
> As you can see, it has the special version 0.
> The advantage of this approach is that you will be able to
> publish your tests and those wanting to build and run them
> will be able to do so by obtaining the stubbed dependencies
> from the system. Also, if/when the stub is converted to a
> real package, your packages will automatically be able to
> take advantage of them.
> It is, however, a bit of work to create and publish stubs
> for your missing dependencies.

I was not aware of the fact that it is already possible to create stub packages.
To me, this sounds like a valid solution.
If there will be new dependencies, I will try to add the respective
stub packages when there is time.
How is the CI environment of build2 currently dealing with
dependencies which are stub packages?

> Markus Pawellek <markuspawellek at gmail.com> writes:
> > In this case, I would remove the linking of the tests package from the
> > library manifest file to keep on providing a package on cppget.org.
> If you do this, I would recommend that you also provide at least
> some basic tests for your package, probably as part of the package
> itself (there is nothing wrong with having some extra dependency-free
> tests in the package itself and additional tests as a separate *-tests
> package).

Is it possible to use more than one external package for tests?
In this case, I could create another tests package for more
complicated dependencies.

> Normally you would make the *-tests package version constraint
> match the main package version exactly, for example:
> tests: libbuild2-hello-tests == $
> If done this way, you shouldn't have any issues changing your
> mind on whether to publish the *-tests package.

Thank you.
I have put this version constraint into my code.

I have pushed the tests package to cppget.org.
Currently, my tests package lists the main package as an explicit
dependency and is not excluded from the builds.
According to the documentation, will this be a problem?

More information about the users mailing list