From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 7AF2313877A for ; Fri, 18 Jul 2014 02:28:11 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1FC4BE0ABB; Fri, 18 Jul 2014 02:28:09 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5F985E0AB3 for ; Fri, 18 Jul 2014 02:28:08 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 59AF23401D3 for ; Fri, 18 Jul 2014 02:28:07 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id B7D48193E6 for ; Fri, 18 Jul 2014 02:28:04 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1405650234.fe530a21c5a873382f15ff9407e8af9e10270252.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:wip/addition_control commit in: roverlay/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/argparser.py X-VCS-Directories: roverlay/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: fe530a21c5a873382f15ff9407e8af9e10270252 X-VCS-Branch: wip/addition_control Date: Fri, 18 Jul 2014 02:28:04 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 25427b3d-2ee6-452e-890e-45ac7627a26b X-Archives-Hash: 2885c86bc98f7a9fe65cc9632e6ff5e5 commit: fe530a21c5a873382f15ff9407e8af9e10270252 Author: André Erdmann mailerd de> AuthorDate: Fri Jul 18 02:23:54 2014 +0000 Commit: André Erdmann mailerd 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" ) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id C399D1393DD for ; Fri, 18 Jul 2014 16:20:11 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1BB0BE09B0; Fri, 18 Jul 2014 16:20:09 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 07EFCE098A for ; Fri, 18 Jul 2014 16:20:07 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B63AD3403D3 for ; Fri, 18 Jul 2014 16:20:06 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id D9F1B193FD for ; Fri, 18 Jul 2014 16:20:03 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1405650234.fe530a21c5a873382f15ff9407e8af9e10270252.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/argparser.py X-VCS-Directories: roverlay/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: fe530a21c5a873382f15ff9407e8af9e10270252 X-VCS-Branch: master Date: Fri, 18 Jul 2014 16:20:03 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 8918a7d7-3f44-45ee-9eb0-7b95ac0d339a X-Archives-Hash: 4fb94e55b5640adbe784412d0311adc0 Message-ID: <20140718162003.waOm0UwehTNm_3YQ0-nHT5mZXaJKRaXZq783HX2zWjw@z> commit: fe530a21c5a873382f15ff9407e8af9e10270252 Author: André Erdmann mailerd de> AuthorDate: Fri Jul 18 02:23:54 2014 +0000 Commit: André Erdmann mailerd 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" )