Rex icon indicating copy to clipboard operation
Rex copied to clipboard

"signed-by" option in for Debian Repositories

Open djzort opened this issue 3 years ago • 2 comments
trafficstars

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

djzort avatar Nov 18 '22 01:11 djzort

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:

  • flexible enough to support other options than just arch and signed-by
  • extensible with validation against list of supported options later if desired
  • extensible with support for DEB822-style file formats later via a second embedded template

edit: indent for list numbering

ferki avatar Dec 07 '22 23:12 ferki

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

djzort avatar Dec 09 '22 06:12 djzort