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 254831381F3 for ; Wed, 11 Sep 2013 11:14:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4F1C7E0CA3; Wed, 11 Sep 2013 11:14:55 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 985B0E0CA3 for ; Wed, 11 Sep 2013 11:14:54 +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 7C1B333EC07 for ; Wed, 11 Sep 2013 11:14:53 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 2DF5CE5463 for ; Wed, 11 Sep 2013 11:14:52 +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: <1378896088.cb1c966c0505d4b005f0469a3a3e3aba61d3ad33.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/, roverlay/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/config/defconfig.py roverlay/setupscript.py X-VCS-Directories: roverlay/config/ roverlay/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: cb1c966c0505d4b005f0469a3a3e3aba61d3ad33 X-VCS-Branch: master Date: Wed, 11 Sep 2013 11:14:52 +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: de6230be-024f-40dc-b16d-7a3273cd2952 X-Archives-Hash: 0bfed7ba174c002dc0d2a12effbd9dd0 commit: cb1c966c0505d4b005f0469a3a3e3aba61d3ad33 Author: André Erdmann mailerd de> AuthorDate: Wed Sep 11 10:41:28 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Wed Sep 11 10:41:28 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=cb1c966c setupscript: --additions-dir,-A Also, pass "is_installed" to the config file creation (for future usage). --- roverlay/config/defconfig.py | 6 ++++-- roverlay/setupscript.py | 44 +++++++++++++++++++++++++++++++++++++++----- 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/roverlay/config/defconfig.py b/roverlay/config/defconfig.py index 2e926e8..3654fb8 100644 --- a/roverlay/config/defconfig.py +++ b/roverlay/config/defconfig.py @@ -148,6 +148,7 @@ def CommentedConfigOption ( class RoverlayConfigCreation ( object ): def __init__ ( self, + is_installed, work_root = '~/roverlay', data_root = '/usr/share/roverlay', conf_root = '/etc/roverlay', @@ -160,7 +161,8 @@ class RoverlayConfigCreation ( object ): self._cloader = self._ctree.get_loader() self._verify_value = self._cloader._make_and_verify_value - self.reset() + self.reset ( is_installed=is_installed ) + # --- end of __init__ (...) --- def get_workdir ( self, p ): return os.path.join ( self.work_root, p ).rstrip ( os.path.sep ) @@ -216,7 +218,7 @@ class RoverlayConfigCreation ( object ): else: raise ConfigOptionMissing ( key ) - def reset ( self ): + def reset ( self, is_installed ): workdir = self.get_workdir datadir = self.get_datadir confdir = self.get_confdir diff --git a/roverlay/setupscript.py b/roverlay/setupscript.py index 2a23103..0e59015 100644 --- a/roverlay/setupscript.py +++ b/roverlay/setupscript.py @@ -57,7 +57,7 @@ class SetupArgParser ( roverlay.argparser.RoverlayArgumentParser ): COMMANDS_WITH_PRETEND = frozenset ({ 'init', }) SETUP_TARGETS = ( 'version', 'actions', 'setup', 'config', 'init', ) - PARSE_TARGETS = ( 'actions', 'setup', 'init', ) + PARSE_TARGETS = ( 'actions', 'setup', 'config', 'init', ) def setup_setup ( self ): @@ -108,6 +108,16 @@ class SetupArgParser ( roverlay.argparser.RoverlayArgumentParser ): ) arg ( + '--additions-dir', '-A', dest='additions_dir', + flags=self.ARG_WITH_DEFAULT|self.ARG_META_DIR, + type=roverlay.argutil.couldbe_dirstr_existing, + help=( + 'directory for user-provided content ' + '(patches, hand-written ebuilds, hooks)' + ), + ) + + arg ( '--variable', '-v', metavar="", dest='config_vars', default=[], action='append', type=roverlay.argutil.is_config_opt, @@ -117,6 +127,20 @@ class SetupArgParser ( roverlay.argparser.RoverlayArgumentParser ): return arg # --- end of setup_config (...) --- + def parse_config ( self ): + for kv in self.parsed ['config_vars']: + key, eq_sign, val = kv.partition('=') + if key in { 'ADDITIONS_DIR', 'OVERLAY_ADDITIONS_DIR' }: + self.parser.exit ( + 'use \'--additions-dir {0}\' instead of ' + '\'--variable ADDITIONS_DIR={0}\'.'.format ( val ) + ) + + self.parsed ['config_vars'].append ( + "ADDITIONS_DIR=" + self.parsed ['additions_dir'] + ) + # --- end of parse_config (...) --- + def setup_init ( self ): arg = self.add_argument_group ( 'init', title='options for the \'init\' command' @@ -217,6 +241,14 @@ class SetupEnvironment ( roverlay.runtime.IndependentRuntimeEnvironment ): self.work_root = None self.conf_root = None self.user_conf_root = None + +# not used +# COLUMNS = os.environ.get ( 'COLUMNS', 78 ) +# +# self.text_wrapper = textwrap.TextWrapper ( +# width=COLUMNS, initial_indent='', subsequent_indent='', +# break_long_words=False, break_on_hyphens=False, +# ) # --- end of __init__ (...) --- def create_argparser ( self ): @@ -230,6 +262,7 @@ class SetupEnvironment ( roverlay.runtime.IndependentRuntimeEnvironment ): 'conf_root' : instinfo ['confroot'], 'private_conf_root' : instinfo ['workroot'] + os.sep + 'config', 'import_config' : 'symlink=root', + 'additions_dir' : instinfo ['workroot'] + os.sep + 'files', }, ) # --- end of create_argparser (...) --- @@ -269,13 +302,14 @@ class SetupEnvironment ( roverlay.runtime.IndependentRuntimeEnvironment ): def create_config_file ( self, expand_user=False ): conf_creator = roverlay.config.defconfig.RoverlayConfigCreation ( - work_root = ( + is_installed = self.is_installed(), + work_root = ( self.work_root if expand_user else self.options ['work_root'] ), - data_root = ( + data_root = ( self.data_root if expand_user else self.options ['data_root'] ), - conf_root = ( + conf_root = ( self.user_conf_root if expand_user else self.options ['private_conf_root'] ), @@ -797,7 +831,7 @@ class SetupInitEnvironment ( SetupSubEnvironment ): """Enables the default hooks, e.g. git history creation.""" hook_env = self.setup_env.get_hook_env() if not hook_env.enable_defaults(): - die ( "failed to enable hooks." ) + self.setup_env.die ( "failed to enable hooks." ) # --- end of do_enable_default_hooks (...) --- # --- end of SetupInitEnvironment ---