aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Erdmann <dywi@mailerd.de>2014-07-18 04:26:56 +0200
committerAndré Erdmann <dywi@mailerd.de>2014-07-18 04:26:56 +0200
commitcdac4e5844a929ccf999a0e1b023c8076e8d3d9e (patch)
tree99b60c445889d5ccb8ff15d08f4ff4df86965733 /roverlay
parentroverlay/argparser: add add-policy args to main script (diff)
downloadR_overlay-cdac4e5844a929ccf999a0e1b023c8076e8d3d9e.tar.gz
R_overlay-cdac4e5844a929ccf999a0e1b023c8076e8d3d9e.tar.bz2
R_overlay-cdac4e5844a929ccf999a0e1b023c8076e8d3d9e.zip
add addition control to roverlay main script
add package rules to --print-package-rules, apply_rules, create
Diffstat (limited to 'roverlay')
-rw-r--r--roverlay/defaultscript.py4
-rw-r--r--roverlay/runtime.py51
2 files changed, 55 insertions, 0 deletions
diff --git a/roverlay/defaultscript.py b/roverlay/defaultscript.py
index 2c0d1f2..cd8d1ae 100644
--- a/roverlay/defaultscript.py
+++ b/roverlay/defaultscript.py
@@ -133,6 +133,8 @@ def run_early_commands ( env ):
package_rules = (
roverlay.packagerules.rules.PackageRules.get_configured()
)
+ env.add_addition_control_rules ( package_rules )
+
print ( env.HLINE )
print ( str ( package_rules ) )
print ( env.HLINE )
@@ -206,6 +208,7 @@ def run_overlay_create ( env ):
try:
repo_list = env.get_repo_list()
overlay_creator = env.get_overlay_creator()
+ env.add_addition_control_to_overlay_creator()
ebuild_import_nosync = env.option ( 'sync_imported' )
if ebuild_import_nosync is None:
@@ -282,6 +285,7 @@ def run_apply_package_rules ( env ):
FH = None
prules = roverlay.packagerules.rules.PackageRules.get_configured()
+ env.add_addition_control_rules ( prules )
# track package rules
prules.add_trace_actions()
diff --git a/roverlay/runtime.py b/roverlay/runtime.py
index 829940e..4d0e9c2 100644
--- a/roverlay/runtime.py
+++ b/roverlay/runtime.py
@@ -20,6 +20,10 @@ import roverlay.stats.collector
import roverlay.util.objects
import roverlay.recipe.easylogger
+import roverlay.packagerules.generators.addition_control
+from roverlay.packagerules.generators.addition_control import \
+ create_addition_control_package_rule
+
import roverlay.config.tree
import roverlay.config.const
@@ -202,6 +206,53 @@ class RuntimeEnvironment ( RuntimeEnvironmentBase ):
return self._overlay_creator
# --- end of get_overlay_creator (...) ---
+ def create_addition_control_rules ( self, default_category=None ):
+ kwargs = {}
+ def add_key ( k, _kwargs=kwargs, _options=self.options ):
+ _kwargs [k] = _options [k]
+
+ add_key ( "cmdline_package_revbump_on_collision" )
+ add_key ( "cmdline_package_force_replace" )
+ add_key ( "cmdline_package_replace_only" )
+
+ add_key ( "file_package_extended" )
+ add_key ( "file_ebuild_extended" )
+
+ return create_addition_control_package_rule (
+ (
+ default_category
+ or self.config.get_or_fail ( 'OVERLAY.category' )
+ ),
+ **kwargs
+ )
+ # --- end of create_addition_control_rules (...) ---
+
+ def add_addition_control_rules (
+ self, package_rules, default_category=None
+ ):
+ add_control_rule = self.create_addition_control_rules (
+ default_category = default_category
+ )
+ package_rules.append_rule ( add_control_rule )
+ # --- end of add_addition_control_rules (...) ---
+
+ def add_addition_control_to_overlay_creator ( self ):
+ if not self._overlay_creator:
+ raise AssertionError ( "overlay creator not initialized." )
+ elif not getattr ( self._overlay_creator, 'package_rules', None ):
+ raise AssertionError ( "overlay creator has no package rules." )
+ # --
+
+ self.add_addition_control_rules (
+ self._overlay_creator.package_rules,
+ self._overlay_creator.overlay.default_category,
+ )
+
+ # + add addition_control object [FUTURE]
+
+ # --- end of add_addition_control_to_overlay_creator (...) ---
+
+
def do_setup ( self ):
self.do_setup_parser()
self.do_setup_config()