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 3C09B13800E for ; Thu, 9 Aug 2012 09:26:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1F3C4E0656; Thu, 9 Aug 2012 09:26:20 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id D5835E0656 for ; Thu, 9 Aug 2012 09:26:19 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 14AFB1B4035 for ; Thu, 9 Aug 2012 09:26:19 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id CBEC8E5440 for ; Thu, 9 Aug 2012 09:26:17 +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: <1344501158.5f9961f0b8039807353dc6ec01317213360c5bdc.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/argutil.py X-VCS-Directories: roverlay/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 5f9961f0b8039807353dc6ec01317213360c5bdc X-VCS-Branch: master Date: Thu, 9 Aug 2012 09:26:17 +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: 15d06019-c760-4d80-84d4-06e0061bbe63 X-Archives-Hash: fbf025195f05863d7c56632f4d107c82 commit: 5f9961f0b8039807353dc6ec01317213360c5bdc Author: André Erdmann mailerd de> AuthorDate: Thu Aug 9 08:32:38 2012 +0000 Commit: André Erdmann mailerd de> CommitDate: Thu Aug 9 08:32:38 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=5f9961f0 argutil: --no-write, --no-incremental * --write-overlay/--write is now enabled by default * --no-incremental disables scanning of an existing overlay (thus allows to overwrite existing ebuilds) * --deprule-file/-D accepts a directory value now * --overlay/-O no longer implies --write --- roverlay/argutil.py | 59 +++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 50 insertions(+), 9 deletions(-) diff --git a/roverlay/argutil.py b/roverlay/argutil.py index db41204..e4afe4a 100644 --- a/roverlay/argutil.py +++ b/roverlay/argutil.py @@ -37,6 +37,15 @@ def get_parser ( command_map, default_config_file, default_command='create' ): ) return d + def is_fs_file_or_dir ( value ): + f = os.path.abspath ( value ) + if os.path.isdir ( f ) or os.path.isfile ( f ): + return f + else: + raise argparse.ArgumentTypeError ( + "{!r} is neither a file nor a directory.".format ( value ) + ) + def couldbe_fs_dir ( value ): d = os.path.abspath ( value ) if os.path.exists ( d ) and not os.path.isdir ( d ): @@ -113,7 +122,8 @@ def get_parser ( command_map, default_config_file, default_command='create' ): '-D', '--deprule-file', default=argparse.SUPPRESS, action='append', help="simple rule file. can be specified more than once.", - **fs_file + type=is_fs_file_or_dir, + metavar='', ) arg ( @@ -156,28 +166,46 @@ def get_parser ( command_map, default_config_file, default_command='create' ): arg ( '--show-overlay', '--show', help="print ebuilds and metadata to console", - **opt_in + dest="show_overlay", + default=False, + action="store_true", + ) + + arg ( + '--no-show-overlay', '--no-show', + help="don't print ebuilds and metadata to console (default)", + dest="show_overlay", + action="store_false", ) arg ( '--write-overlay', '--write', - help="write overlay to filesystem", - # !! change to opt_out in future (FIXME) - **opt_in + help="write the overlay to filesystem", + dest="write_overlay", + default=True, + action="store_true", + ) + + arg ( + '--no-write-overlay', '--no-write', + help="don't write the overlay", + dest="write_overlay", + action="store_false", ) - # FIXME: swap --stats with --no-stats? (=> print stats by default) arg ( '--stats', help="print some stats", - **opt_in + dest="stats", + default=True, + action="store_true", ) arg ( '--no-stats', help="don't print stats", dest="stats", - **opt_out + action="store_false", ) arg ( @@ -213,6 +241,18 @@ def get_parser ( command_map, default_config_file, default_command='create' ): **opt_in ) + # FIXME: description of --no-incremental is not correct, + # --no-incremental currently means that an existing overlay won't be + # scanned for ebuilds (which means that ebuilds will be recreated), + # but old ebuilds won't be explicitly removed + arg ( + '--no-incremental', + help="start overlay creation from scratch (ignore an existing overlay)", + dest='incremental', + default=True, + action='store_false', + ) + # TODO arg ( '--debug', @@ -266,11 +306,12 @@ def parse_argv ( command_map, **kw ): list_config = p.list_config_entries, force_distroot = p.force_distroot, skip_manifest = p.no_manifest, + incremental = p.incremental, ) if given ( 'overlay' ): doconf ( p.overlay, 'OVERLAY.dir' ) - extra ['write_overlay'] = True + #extra ['write_overlay'] = True if given ( 'overlay_name' ): doconf ( p.overlay_name, 'OVERLAY.name' )