RexOps / Rex

Rex, the friendly automation framework
https://www.rexify.org
717 stars 223 forks source link

"signed-by" option in for Debian Repositories #1556

Open djzort opened 2 years ago

djzort commented 2 years ago

As

Me

I would like to

"signed-by" option in for Debian Repositories

so I can

indicate to dpkg what key should be signing packages

Additional context

No response

Describe the solution you would like

Just needs to have the "signed-by" keyword added here https://metacpan.org/release/FERKI/Rex-1.13.4/source/lib/Rex/Pkg/Debian.pm#L134

Example output https://code.visualstudio.com/docs/setup/linux#_debian-and-ubuntu-based-distributions

Describe alternatives you have considered

No response

ferki commented 1 year ago

Thanks for raising this, @djzort!

The sources.list manual has specifications for both single-line and DEB822-style formats for APT data sources.

There are 13 options listed as supported, but rex seems to handle only one so far (arch). It is even special-cased as an if-else decision, which structure does not make it easy to extend support for arbitrary combinations of all the accepted options.

Suggested approach

Based on the above, my first idea about how to address the situation is the following:

  1. Introduce a new parameter for the repository command, which accepts a hash reference with the desired options for the given APT repository:

    repository add => 'myrepo',
        url    => ...,
        distro => ...,
        options => {
            arch        => ...,
            'signed-by' => ...,
        };

    options or apt_options sounds like good candidates for this new parameter at this point.

  2. Generate the desired file contents by using an embedded template at the end of Rex::Pkg::Debian under __DATA__, passing the repository() command's parameters to it for substitution. Then write the results to the target file.

  3. Find a way to make this approach testable. For example add an internal private function to get the generated content from the template, so tests can call it and compare it against expectations.

This approach is:


edit: indent for list numbering

djzort commented 1 year ago

I dont have a preference. But it would be great to support all the options.