From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/, roverlay/
Date: Wed, 11 Sep 2013 11:14:52 +0000 (UTC) [thread overview]
Message-ID: <1378896088.cb1c966c0505d4b005f0469a3a3e3aba61d3ad33.dywi@gentoo> (raw)
commit: cb1c966c0505d4b005f0469a3a3e3aba61d3ad33
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Sep 11 10:41:28 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> 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="<key=\"value\">", 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 ---
next reply other threads:[~2013-09-11 11:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-11 11:14 André Erdmann [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-09-06 17:27 [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/, roverlay/ André Erdmann
2013-07-12 12:36 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-12 13:57 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-06-22 15:24 André Erdmann
2013-06-22 15:14 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-06-22 15:24 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
2012-07-30 8:52 [gentoo-commits] proj/R_overlay:overlay_wip " André Erdmann
2012-07-30 8:52 ` [gentoo-commits] proj/R_overlay:master " 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=1378896088.cb1c966c0505d4b005f0469a3a3e3aba61d3ad33.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