-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
package_managers: rpm: Generate the .repo file through ConfigParser
Repo files follow the INI syntax for which we can use ConfigParser. The motivation behind using a library abstraction to generate the INI repo files stems from the fact that we already have some options rendered conditionally with a fair chance of extending this in the future with more custom user-supplied DNF repo options which means even more conditionals which would stretch the capabilities of a plain triple string (or a template for that matter) a bit too far. Therefore, this patch proposes using ConfigParser instance for creating and dumping the repo files in the inject_files post action. Note that to make things a tiny bit more ergonomic, we subclass the ConfigParser class to define a couple utility methods that can tell us whether the ConfigParser instance is effectively empty (because an empty instance of ConfigParser still evaluates to True) and thus can be dumped to a file as well as some extra handling of default options, e.g. defaulting to 'gpgcheck=1' explicitly in the generated .repo file. Signed-off-by: Erik Skultety <[email protected]>
- Loading branch information
Showing
2 changed files
with
142 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters