public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/
Date: Fri, 18 Jul 2014 16:20:03 +0000 (UTC)	[thread overview]
Message-ID: <1405650234.fe530a21c5a873382f15ff9407e8af9e10270252.dywi@gentoo> (raw)
Message-ID: <20140718162003.waOm0UwehTNm_3YQ0-nHT5mZXaJKRaXZq783HX2zWjw@z> (raw)

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


             reply	other threads:[~2014-07-18 16:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-18  2:28 André Erdmann [this message]
2014-07-18 16:20 ` [gentoo-commits] proj/R_overlay:master commit in: roverlay/ André Erdmann
  -- strict thread matches above, loose matches on Subject: below --
2014-07-18  2:50 [gentoo-commits] proj/R_overlay:wip/addition_control " André Erdmann
2014-07-18 16:20 [gentoo-commits] proj/R_overlay:master " André Erdmann
2014-07-18  2:28 ` [gentoo-commits] proj/R_overlay:wip/addition_control " André Erdmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405650234.fe530a21c5a873382f15ff9407e8af9e10270252.dywi@gentoo \
    --to=dywi@mailerd.de \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox