Perl Toolchain Summit 2018 - META6 dependency hello

I recently returned from the 2018 Perl Toolchain Summit that was held in Oslo, Norway. This event is important because it gathers many key people and tons of experience into a face-to-face forum where technical ideas can be delivered and received with an appropriate amount of empathy. Being in the same room as so many peers is motivating. As one point of interest: I've been friends with tony-o since grade school, but he lives on the other side of the US -- PTS is still when we get the most work done despite easily having the means to do virtual standups.

I worked on Perl6 stuff ( although I enjoy coming just from working in Perl my entire professional career ), mostly collaborating nine and tony-o. They actually did most of the initial work and testing, so I'm glad they were able to attend. And while they were busy adding features, I was busy regressing CPAN::Uploader::Tiny -- luckily the author skaji was one of the attendees so the issue was quickly resolved.

I can assure you we ate and drank well. The venue was great, the weather was warmer than I was used to, and of course lots of friendly people. But without further ado, ( some ) of the Perl6 results of PTS 2018:

Allow structured dependency format

Previously depends only took a string-only value akin to "Foo:ver<1>:auth<a@b.c>", but was improved to take a hash form as well: { "name" : "Foo", "ver", "1", "auth", "a@b.c" }. This is intended to allow more meta data in situations where a nested data structure is needed to express something.

Add declarative syntax for depends leaf nodes

The previous task ultimately led into this one, which adds some basic declarative conditional logic based on the syntax described in https://design.perl6.org/S22.html#Dependency_hints -- Ideally this allows more complex dependency trees that can still be graphed before downloading or building any modules.

"depends": [
    {
        "from": "native",
        "name": {
            "by-kernel.name": {
                "darwin": "libssl",
                "linux" : "libssl",
                "win32" : "ssleay32"
            }
        }
    }
] 

Add basic :from<bin> and :from<native> support

Support based on https://design.perl6.org/S22.html#%3Afrom<bin> and https://design.perl6.org/S22.html#%3Afrom<native>

{
	"description" : "grep PATH for a matching 'curl' script",
	"depends" : [ "curl:from<bin>"]
}
{
	"description" : "load library by name $*VM.platform-library-name("curl".IO)",
	"depends" : [ "curl:from<native>"]
}

The implementation behind these is still quite naive, but for now hopefully serves useful for:

  • Giving authors a way to not use Build.pm to do these checks at build time via shell.
  • Allowing windows/osx to fail at resolve phase instead of during test phase for a linux only dependency.
  • Giving a common way of delivering a message about when these are missing.

Maybe one day we will figure out a way to resolve versions for native/bin dependencies, possibly via backends/plugins that access e.g. apt-get ( although this related more to the previously mentioned dependency hints ).

Add support for builder key in META6.json

If you wanted to do some pre-install logic ( such as running make ) you would put a file called Build.pm in the root of your distribution, and do class Build { method build($cwd) { ... } }. The interface is not bad, but there are a couple of warts:

  1. .pm file extension instead of .pm6
  2. location in project root directory
  3. being a module thats importable under -I. ( not listed in META6.json ) or -Ilib.

Now zef supports a "builder" field to delegate the previous logic to a custom namespace. See: https://github.com/niner/Inline-Python/blob/ab53d6b12cd8eb6e6531edc9f66e17eaef0c2dfd/META6.json#L26

Sponsors for the Perl Toolchain Summit 2018

Thanks to the sponsors for enabling this important open source work!

NUUG Foundation, Teknologihuset, Booking.com, cPanel, FastMail, Elastic, ZipRecruiter, MaxMind, MongoDB, SureVoIP, Campus Explorer, Bytemark, Infinity Interactive, OpusVL, Eligo, Perl Services, Oetiker+Partner.

Also thanks to anyone who encouraged people to bring Stroopwafels back home.