RDTK / generator

A tool for creating Jenkins jobs and other things from recipes describing software projects
GNU General Public License v3.0
21 stars 3 forks source link

Centralize definition of platform requirements #16

Closed scymtym closed 5 years ago

scymtym commented 5 years ago

Is your feature request related to a problem? Please describe.

Project versions currently have three ways of requiring things:

  1. The generator's automatic analysis yields required feature triples nature:name[:version]

  2. The recipe (or a template) can contain extra-requires definitions also specifying feature triples

  3. The recipe (or a template) can contain platform-requires definitions specifying lists of systems packages in a ancestry-based tree of platforms:

    platform-requires:
     ubuntu:
       packages:
         - package1
       xenial:
         packages:
           - package2
           - package3

Requirements of kinds 1. and 2. are resolved between project versions in the distribution under consideration to produce concrete (ordering) dependencies. Requirements of kind 3. are used to compute a list of required system packages for a given target platform.

See this presentation for more details.

There are two problems with this approach:

  1. Requirements of kinds 1. and 2. cannot be resolved using system packages. Imagine the automatic analysis somehow yields the required feature pkg-config:libsomething:1.2.3. Even if there is a platform-requires entry for say the libsomething-dev package, the required feature will still be considered unsatisfied.

  2. A requirement can be satisfied by system packages in different ways. For example, depending on a fictional "Library for something" in a C++ program could correspond to the following requirements on the system package level:

    platform-requires:
     ubuntu:
       xenial:
         packages:
           - libsomething2-extra
           - libsomething2-dev
       bionic:
         packages:
           - libsomething3-dev
     redhat:
       packages:
         - libsomething-devel

    This is not a problem when specified in a single recipe, but imagine multiple projects depending on this library. Each library would have to include this fragment. Obviously not good.

Describe the solution you'd like

Introduce a new platform-provides variable that can be used to describe the provided features of system packages. The syntax is as follows:

platform-provides:
- name: Protocol Buffers C++ Library
  variables:
    extra-provides:
    - nature: cmake
      target: ProtocolBuffers
    platform-requires:
      ubuntu:
        xenial:
          packages:
          - libprotobuf1-dev
        bionic:
          packages:
          - libprotobuf2-dev
⋮

A list of these descriptions would be collected and maintained in a template (solving problem 2.). A recipe currently containing

platform-requires:
 ubuntu:
   xenial:
     packages:
     - libprotobuf1-dev
   bionic:
     packages:
     - libprotobuf2-dev

could then be simplified to

extra-requires:
- nature: cmake
  target: ProtocolBuffers

or even nothing if the feature requirement can be identified by the automatic analysis (solving problem 1.).