Skip to content
jsilhan edited this page Aug 26, 2014 · 4 revisions

Plugins are the main part of RPG. Their purpose is to append Spec class with tags and scripts. Whole process of creating spec file from source code in RPG app is following:

  • plugins are triggered in project directory - they set some tags/scripts in Spec instance
  • guessed values from Spec are auto filled in GUI forms and user can modify them
  • next spec command (%prep, %build, %install, %files) is executed and new directory is created
  • repeat steps for new directory

Plugin is a class that is derived from rpg.plugin.Plugin and overrides at least one of following methods: extracted, patched, compiled, installed, package_built. Each of them takes (spec, sack, current_dir) parameters. spec is instance of Spec class, sack is initialized sack from DNF and current_dir is pathlib.Path instance where are project files of future RPM package located. current_dir is different in each phase. The directory of project files in phases are:

  • extracted phase - raw files are extracted from chosen archive or copied files from project working directory
  • patched phase - after application of patches on source files
  • compiled phase - after execution of %build script (e.g. calling make)
  • installed phase - directory containing files after make install
  • package_built - path to final rpm package

Inside plugin can be helper methods that should not be named as any of the phase. It should follow conventions as any private Python method (e.g. _helper_method).

For plugin examples take a look at core plugins folder.

Clone this wiki locally