<project cat='proj'>
    <title>Supporting variants in the Ports framework</title>

    <contact>
        <person>
            <name>
                <given>Brendan</given>
                <common>Molloy</common>
            </name>

            <email>brendan+freebsd@bbqsrc.net</email>
        </person>
    </contact>
    <links>
        <url href="https://github.com/bbqsrc/poudriere/compare/master...feature/variants">Poudriere PoC with variants</url>
        <url href="https://gist.github.com/bbqsrc/e7e3a54d84706485aa3a">Ports makefile PoC with examples</url>
    </links>
    <body>
        <p>I recently became involved with FreeBSD (as in, the last 2-3 weeks),
            and found myself quickly involved with Ports development. What quickly
            struck me was the difficulty in providing a Python package that was
            depended upon by multiple versions of Python. As it turns out, poudriere
            can currently only generate one package per port, meaning that a
            Python version-neutral (compatible with 2.x and 3.x) port cannot
            simultaneously be packaged for each variant at the same time.</p>

        <p>I discussed the issue with koobs@, who suggested I look into implementing
            a 'variants protocol' within the Ports framework and necessary changes
            to poudriere in order to allow a port to generate more than one package.</p>

        <p>Support for variants is strongly needed in Ports and provides significant benefits.</p>

        <ul>
            <li>It would allow Python and other languages to provide packages for
                dependencies for multiple language versions from the same port</li>
            <li>It alleviates the need for so-called 'slave ports', as a single
                port could now have multiple generated packages from a single port</li>
            <li>It would have a very small impact on the greater Ports ecosystem: adding only
                two new variables, <code>VARIANT</code> and <code>VARIANTS</code>.</li>
            <li>It would provide a more consistent approach between different
                packaging teams for handling variations.</li>
        </ul>

        <p>For a simple example, <code>editors/vim-lite</code> could be folded
            into the <code>editors/vim</code> port, while still generating a
            <code>vim</code> and <code>vim-lite</code> package. For Python,
            <code>VARIANTS</code> can be derived from the already used
            <code>USES</code> flags and generate compatible packages.
            <code>py27-foobar</code> and <code>py34-foobar</code> could now
            be consistently generated by poudriere without issue.</p>

        <p>Fortunately, this is not a wishful thinking piece. I dug in my heels
            and have implemented a proof-of-concept implementation of variants
            in the Ports framework, including necessary modifications to
            poudriere in order to support it. It was mildly upsetting to find
            that poudriere is mostly written in Bourne shell scripts, but press
            on I did nonetheless.</p>

        <p>I started with <a href="https://github.com/bapt/ports-wip/compare/variants">the prototype made by bapt@</a>
            as the base, and built from there. The poudriere PoC limits changes
            as much as possible to merely adding support for the new variants flags,
            while also at the request of koobs@ making the logging output more
            package-centric as opposed to port-centric as a result of these changes.</p>

        <p>This is a <strong>work in progress</strong>, and I would love to hea
            your feedback. I've enjoyed my first two weeks working on FreeBSD,
            and I hope to stay here for quite some time.</p>
    </body>
    <help>
        <task>Any constructive feedback on the implementation would be very welcome!</task>
        <task>Hopefully the code will be of sufficient quality to be considered
            for formal review in the coming months</task>
    </help>
</project>
  </project>
<project cat='ports'>
    <title>New tools to enhance the porting experience</title>

    <contact>
      <person>
        <name>
          <given>Brendan</given>
          <common>Molloy</common>
        </name>

        <email>brendan+freebsd@bbqsrc.net</email>
      </person>
    </contact>

    <links>
        <url href="https://github.com/freebsd/pytoport">pytoport: Generate FreeBSD Ports from Python modules on PyPI</url>
        <url href="https://github.com/bbqsrc/bandar">bandar: Create development overlays for the Ports tree</url>
        <url href="https://github.com/bbqsrc/skog-python">skog: Generate visual dependency trees for FreeBSD ports</url>
        <url href="https://github.com/bbqsrc/spdx-lookup-python">spdx-lookup: SPDX license list query tool</url>
    </links>

    <body>
        <p>When I starting working on ports for FreeBSD in the last couple of weeks,
            I found that my workflow wasn't as efficient as it could be with the
            available tools, so I made a few that could be useful to the development
            community at large. All of these have been added to the Ports tree, or otherwise
            will soon have one, so you can play with them today!</p>

        <p><code>pytoport</code> is a command line application that generates
            a skeleton port for a given PyPI package name. It attempts to generate
            the correct dependencies, it makes a good attempt at guessing the
            license using <code>spdx-lookup</code>, and generates a
            <code>pkg-descr</code>. This made generating the fifteen or so ports
            I was working on a complete breeze.</p>

        <p>While doing this however, I noticed that some ports were bringing in
            dependencies that I didn't expect, and I needed some way to visualise this.
            <code>skog</code> builds a dependency tree from the depends lists output by
            the Ports framework, and displays it on the command line (with extra
            shiny output if you are using UTF-8). No more pesky example and documentation
            dependencies being dragged in when you <em>clearly</em> toggled that
            <code>OPTION</code> as far off as it would go.</p>

        <p>While doing all of this, I found it cumbersome to be copying ports
            back and forward between my small development tree living in git
            and the larger upstream SVN tree I was using in poudriere. I built
            a tool called <code>bandar</code> that takes advantage of the FUSE
            version of unionfs to easily overlay my dev tree on the upstream
            tree, run linting, poudriere and generate archives with ease.</p>

        <p>I'm very impressed with how easy it was to build more tooling for
            FreeBSD. I hope some of these tools will be of some use to you, and as
            always, I'd love to hear your feedback!</p>
    </body>

    <help>
        <task>Improve skog to support searching a tree for a certain port</task>
        <task>Get the bandar port completed</task>
        <task>Continue to improve pytoport, adding trove support and better
            depedency handling</task>
        <task>Patches welcome for all of the above!</task>
    </help>
</project>
