public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/R_overlay:wip/addition_control commit in: roverlay/
@ 2014-07-18  2:50 André Erdmann
  2014-07-18 16:20 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
  0 siblings, 1 reply; 4+ messages in thread
From: André Erdmann @ 2014-07-18  2:50 UTC (permalink / raw
  To: gentoo-commits

commit:     c86aaac5aca70211bc346b13e8d2b1d8afd00eb6
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul 18 02:49:22 2014 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul 18 02:49:22 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=c86aaac5

roverlay/runtime: fix add_addition_control_rules()

---
 roverlay/runtime.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/roverlay/runtime.py b/roverlay/runtime.py
index 4d0e9c2..521eb0e 100644
--- a/roverlay/runtime.py
+++ b/roverlay/runtime.py
@@ -233,7 +233,12 @@ class RuntimeEnvironment ( RuntimeEnvironmentBase ):
       add_control_rule = self.create_addition_control_rules (
          default_category = default_category
       )
-      package_rules.append_rule ( add_control_rule )
+
+      if add_control_rule:
+         package_rules.append_rule ( add_control_rule )
+         return True
+      else:
+         return False
    # --- end of add_addition_control_rules (...) ---
 
    def add_addition_control_to_overlay_creator ( self ):
@@ -243,7 +248,7 @@ class RuntimeEnvironment ( RuntimeEnvironmentBase ):
          raise AssertionError ( "overlay creator has no package rules." )
       # --
 
-      self.add_addition_control_rules (
+      return self.add_addition_control_rules (
          self._overlay_creator.package_rules,
          self._overlay_creator.overlay.default_category,
       )


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/
@ 2014-07-18 16:20 André Erdmann
  2014-07-18  2:28 ` [gentoo-commits] proj/R_overlay:wip/addition_control " André Erdmann
  0 siblings, 1 reply; 4+ messages in thread
From: André Erdmann @ 2014-07-18 16:20 UTC (permalink / raw
  To: gentoo-commits

commit:     cdac4e5844a929ccf999a0e1b023c8076e8d3d9e
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul 18 02:26:56 2014 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul 18 02:26:56 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=cdac4e58

add addition control to roverlay main script

add package rules to --print-package-rules, apply_rules, create

---
 roverlay/defaultscript.py |  4 ++++
 roverlay/runtime.py       | 51 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)

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()


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [gentoo-commits] proj/R_overlay:wip/addition_control commit in: roverlay/
@ 2014-07-18  2:28 André Erdmann
  0 siblings, 0 replies; 4+ messages in thread
From: André Erdmann @ 2014-07-18  2:28 UTC (permalink / raw
  To: gentoo-commits

commit:     fe530a21c5a873382f15ff9407e8af9e10270252
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul 18 02:23:54 2014 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul 18 02:23:54 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=fe530a21

roverlay/argparser: add add-policy args to main script

not adding all PKG_* actions, just revbump-on-collision, force-replace and
replace-only, plus {package,ebuild}-list (read extended statements from files).

A typical usage scenario would be:
   roverlay --replace "pkg0" --revbump "cat/p2" --replace-only "*"
or
   roverlay --ebuild-list /tmp/my_list --replace-only "*"

---
 roverlay/argparser.py | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/roverlay/argparser.py b/roverlay/argparser.py
index 706cf5f..c323ce3 100644
--- a/roverlay/argparser.py
+++ b/roverlay/argparser.py
@@ -12,6 +12,9 @@ import roverlay.core
 import roverlay.argutil
 import roverlay.util.objects
 
+import roverlay.overlay.abccontrol
+from roverlay.overlay.abccontrol import AdditionControlResult
+
 # lazy import
 from roverlay.argutil import \
    LOG_LEVELS, \
@@ -449,8 +452,65 @@ class RoverlayArgumentParserBase ( roverlay.argutil.ArgumentParserProxy ):
          default=argparse.SUPPRESS, flags=self.ARG_WITH_DEFAULT,
          help="choose how Manifest files are created (ebuild(1) or internal)",
       )
+
+      self._setup_addition_control ( arg )
    # --- end of setup_overlay_creation (...) ---
 
+   def _setup_addition_control ( self, add_arg ):
+##      # all:
+##      for name in AdditionControlResult.PKG_DESCRIPTION_REVMAP, ~X~:
+
+      for variant in [ "package", ]:
+         for name, long_name in [
+            ( "revbump",         "revbump-on-collision"  ),
+            ( "replace",         "force-replace"         ),
+            ( "replace-only",    "replace-only"          ),
+         ]:
+            arg_opt = (
+               "--{variant}-{name}".format ( variant=variant, name=name )
+            )
+
+            dest_name = "{variant}_{aname}".format (
+               variant = variant,
+               aname   = long_name.replace ( "-", "_" )
+            )
+
+
+            add_arg (
+               arg_opt,
+               dest = "cmdline_" + dest_name,
+               metavar = "<{variant}>".format ( variant=variant ),
+               default = [],
+               action  = 'append',
+               help    = (
+                  'set add-policy for <{variant}> to {lname!r}'.format (
+                     variant = variant,
+                     lname   = long_name,
+                  )
+               )
+            )
+      # -- end for
+
+      for variant in [ "package", "ebuild" ]:
+         arg_opt   = "--{variant}-list".format ( variant=variant )
+         dest_name = "file_{variant}_extended".format ( variant=variant )
+
+         add_arg (
+            arg_opt,
+            dest     = dest_name,
+            default  = None,
+            flags    = self.ARG_WITH_DEFAULT|self.ARG_META_FILE,
+            type     = is_fs_file_or_void,
+            help     = (
+               "file that lists {variant} add-policy statements".format (
+                  variant=variant
+               )
+            )
+         )
+      # -- end for
+
+   # --- end of _setup_addition_control (...) ---
+
    def setup_remote_minimal ( self ):
       arg = self.add_argument_group ( "remote", title="sync options" )
 


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-07-18 16:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-18  2:50 [gentoo-commits] proj/R_overlay:wip/addition_control commit in: roverlay/ André Erdmann
2014-07-18 16:20 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
  -- strict thread matches above, loose matches on Subject: below --
2014-07-18 16:20 André Erdmann
2014-07-18  2:28 ` [gentoo-commits] proj/R_overlay:wip/addition_control " André Erdmann
2014-07-18  2:28 André Erdmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox