* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2012-06-25 18:19 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2012-06-25 18:19 UTC (permalink / raw
To: gentoo-commits
commit: 3608ce9e8abe2412f2cf032b1e22c1a3be8aee2a
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Jun 25 18:05:17 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Jun 25 18:05:17 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=3608ce9e
fix _tree_to_str() in ConfigTree
modified: roverlay/config/tree.py
---
roverlay/config/tree.py | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/roverlay/config/tree.py b/roverlay/config/tree.py
index 707aa8a..adcdcde 100644
--- a/roverlay/config/tree.py
+++ b/roverlay/config/tree.py
@@ -189,13 +189,17 @@ class ConfigTree ( object ):
var_indent = indent + '* '
if root is None:
return "%s%s is unset\n" % ( var_indent, name )
- elif len ( root ) == 0:
- return "%s%s is empty\n" % ( var_indent, name )
elif isinstance ( root, dict ):
- extra = ''.join ( [
- self._tree_to_str ( n, r, level+1 ) for r, n in root.items()
- ] )
- return "%s%s {\n%s%s}\n" % ( indent, name, extra, indent )
+ if len ( root ) == 0:
+ return "%s%s is empty\n" % ( var_indent, name )
+ else:
+ extra = ''.join ( [
+ self._tree_to_str ( n, r, level+1 ) for r, n in root.items()
+ ] )
+ return "%s%s {\n%s%s}\n" % ( indent, name, extra, indent )
+ elif level == 1:
+ # non-nested config entry
+ return "\n%s%s = '%s'\n\n" % ( var_indent, name, root )
else:
return "%s%s = '%s'\n" % ( var_indent, name, root )
# --- end of _tree_to_str (...) ---
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2012-06-25 18:19 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2012-06-25 18:19 UTC (permalink / raw
To: gentoo-commits
commit: 01de85fad92fc06bf39421aff47a54e70346c6d9
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Jun 25 18:06:19 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Jun 25 18:06:19 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=01de85fa
add repo-specific options to the config entry map
modified: roverlay/config/entrymap.py
---
roverlay/config/entrymap.py | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index 6e206e5..966ac2d 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -68,6 +68,10 @@ CONFIG_ENTRY_MAP = dict (
distfiles_dir = dict (
value_type = 'fs_dir',
),
+ rsync_bwlimit = dict (
+ path = [ 'rsync_bwlimit' ],
+ value_type = 'int',
+ ),
ebuild_prog = dict (
path = [ 'TOOLS', 'ebuild_prog' ],
value_type = 'fs_path',
@@ -77,6 +81,10 @@ CONFIG_ENTRY_MAP = dict (
value_type = 'list:fs_abs',
),
simple_rules_file = 'simple_rules_files',
- remote = 'repo',
- repo = '',
+ repo_config = 'repo_config_files',
+ repo_config_file = 'repo_config_files',
+ repo_config_files = dict (
+ path = [ 'REPO', 'config_files' ],
+ value_type = 'slist:fs_abs',
+ ),
)
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2012-06-26 15:42 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2012-06-26 15:42 UTC (permalink / raw
To: gentoo-commits
commit: 9ee8e2b549ccbcd321ce4344bcc5a20a14f01025
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Jun 26 15:42:03 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Jun 26 15:42:03 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=9ee8e2b5
config entry map update
---
roverlay/config/entrymap.py | 117 +++++++++++++++++++++++++++++--------------
1 files changed, 79 insertions(+), 38 deletions(-)
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index 966ac2d..2cb7077 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -32,59 +32,100 @@
# with a colon 'list:yesno', which is parsed in a left-to-right order.
# Nested subtypes such as list:slist:int:fs_file:list may lead to errors.
#
+
+fs_file = 'fs_file'
+fs_abslist = 'slist:fs_abs'
+
+# often (>1) used entry dicts (it's ok to share a ref to those dicts
+# 'cause CONFIG_ENTRY_MAP won't be modified)
+is_fs_file = { 'value_type' : fs_file }
+is_str = { 'value_type' : 'str' }
+
+only_vtype = lambda x : { 'value_type': x }
+
CONFIG_ENTRY_MAP = dict (
- log_level = '',
- log_console = dict (
- value_type = 'yesno',
- ),
+
+ # == logging ==
+
+ log_level = '',
+ log_console = only_vtype ( 'yesno' ),
log_file = dict (
# setting path to LOG.FILE.main to avoid collision with LOG.FILE.*
- path = [ 'LOG', 'FILE', 'Main' ],
- value_type = 'fs_file',
- ),
- log_file_resolved = dict (
- value_type = 'fs_file',
- ),
- log_file_unresolvable = dict (
- value_type = 'fs_file',
- ),
- ebuild_header = dict (
- value_type = 'fs_file',
- ),
- overlay_category = dict (
- value_type = 'str',
+ path = [ 'LOG', 'FILE', 'main' ],
+ value_type = fs_file,
),
+ log_file_resolved = is_fs_file,
+ log_file_unresolvable = is_fs_file,
+
+ # --- logging
+
+
+ # == overlay ==
+
+ # FIXME key is not in use
+ ebuild_header = is_fs_file,
+
+ overlay_category = is_str, # e.g. 'sci-R'
+ overlay_dir = only_vtype ( 'fs_abs:fs_dir' ),
+
overlay_eclass = dict (
path = [ 'OVERLAY', 'eclass_files' ],
- value_type = 'list:fs_abs:fs_file',
+ value_type = fs_abslist,
),
- eclass = 'overlay_eclass',
- overlay_dir = dict (
- value_type = 'fs_abs:fs_dir',
- ),
- overlay_name = dict (
- value_type = 'str',
+
+ overlay_name = is_str,
+
+ # ebuild is used to create Manifest files
+ ebuild_prog = dict (
+ path = [ 'TOOLS', 'ebuild_prog' ],
+ value_type = 'fs_path',
),
- distfiles_dir = dict (
- value_type = 'fs_dir',
+
+ # * alias
+ eclass = 'overlay_eclass',
+
+ # --- overlay
+
+
+ # == remote ==
+
+ # the distfiles root directory
+ # this is where repos create their own DISTDIR as sub directory unless
+ # they specify another location
+ distfiles_root = only_vtype ( 'fs_dir' ),
+
+ # the repo config file(s)
+ repo_config_files = dict (
+ path = [ 'REPO', 'config_files' ],
+ value_type = fs_abslist,
),
+
+ # this option is used to limit bandwidth usage while running rsync
rsync_bwlimit = dict (
path = [ 'rsync_bwlimit' ],
value_type = 'int',
),
- ebuild_prog = dict (
- path = [ 'TOOLS', 'ebuild_prog' ],
- value_type = 'fs_path',
- ),
+
+ # * alias
+ distfiles = 'distfiles_root',
+ distdir = 'distfiles_root',
+ repo_config = 'repo_config_files',
+ repo_config_file = 'repo_config_files',
+
+ # --- remote
+
+
+ # == dependency resolution ==
+
+ # the list of simple dep rule files
simple_rules_files = dict (
path = [ 'DEPRES', 'SIMPLE_RULES', 'files' ],
- value_type = 'list:fs_abs',
+ value_type = fs_abslist,
),
+
+ # * alias
simple_rules_file = 'simple_rules_files',
- repo_config = 'repo_config_files',
- repo_config_file = 'repo_config_files',
- repo_config_files = dict (
- path = [ 'REPO', 'config_files' ],
- value_type = 'slist:fs_abs',
- ),
+
+ # --- dependency resolution
+
)
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2012-06-29 22:48 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2012-06-29 22:48 UTC (permalink / raw
To: gentoo-commits
commit: 9ba820af2f340179df7a29052b9564561ccd8a5e
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jun 29 22:19:15 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jun 29 22:19:15 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=9ba820af
remove useless whitespace from config values
modified: roverlay/config/loader.py
---
roverlay/config/loader.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/roverlay/config/loader.py b/roverlay/config/loader.py
index 5983b72..9b855e5 100644
--- a/roverlay/config/loader.py
+++ b/roverlay/config/loader.py
@@ -374,7 +374,7 @@ class ConfigLoader ( object ):
dofunc = lambda f, v : [ f(x) for x in v ] \
if isinstance ( v, list ) else f(v)
- retval = value
+ retval = value.strip()
for vtype in vtypes:
if vtype in funcmap:
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2012-07-03 17:48 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2012-07-03 17:48 UTC (permalink / raw
To: gentoo-commits
commit: 7a6de49dd07aea5d7a5e4eb34a4735b354e838ff
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Jul 3 17:37:42 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Jul 3 17:37:42 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=7a6de49d
config module, ConfigTree
ConfigTree:
* can now be merged with dicts
* added get_or_fail()
* uses logging now instead of InitialLogger
added field_definition_file to the config entry map
modified: roverlay/config/__init__.py
modified: roverlay/config/const.py
modified: roverlay/config/entrymap.py
modified: roverlay/config/tree.py
---
roverlay/config/__init__.py | 2 +-
roverlay/config/const.py | 13 ++++++----
roverlay/config/entrymap.py | 6 +++++
roverlay/config/tree.py | 51 ++++++++++++++++++++++++++----------------
4 files changed, 46 insertions(+), 26 deletions(-)
diff --git a/roverlay/config/__init__.py b/roverlay/config/__init__.py
index 9640c9f..50f5eba 100644
--- a/roverlay/config/__init__.py
+++ b/roverlay/config/__init__.py
@@ -35,5 +35,5 @@ def get ( key, fallback_value=None, fail_if_unset=False ):
# --- end of get (...) ---
def get_or_fail ( key ):
- return access().get ( key, fail_if_unset=True )
+ return access().get_or_fail ( key )
# --- end of get_or_fail (...) ---
diff --git a/roverlay/config/const.py b/roverlay/config/const.py
index 18e4614..80763ce 100644
--- a/roverlay/config/const.py
+++ b/roverlay/config/const.py
@@ -7,17 +7,18 @@ import time
_CONSTANTS = dict (
DESCRIPTION = dict (
- field_separator = ':',
- comment_chars = '#;',
- list_split_regex = '\s*[,;]{1}\s*',
- file_name = 'DESCRIPTION',
+ field_separator = ':',
+ comment_chars = '#;',
+ list_split_regex = '\s*[,;]{1}\s*',
+ file_name = 'DESCRIPTION',
),
R_PACKAGE = dict (
suffix_regex = '[.](tgz|tbz2|tar|(tar[.](gz|bz2)))',
name_ver_separator = '_',
),
EBUILD = dict (
- indent = '\t',
+ # indent is currently not in use, FIXME
+ #indent = '\t',
default_header = '\n'.join ( (
'# Copyright 1999-%i Gentoo Foundation' % ( time.gmtime() [0] ),
'# Distributed under the terms of the GNU General Public License v2',
@@ -25,6 +26,8 @@ _CONSTANTS = dict (
'',
'EAPI=4',
'',
+ # FIXME: don't include eclasses here, calculate their names
+ # using OVERLAY.eclass_files
'inherit R-packages'
) ),
),
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index 4179c4f..d1e8eca 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -130,6 +130,11 @@ CONFIG_ENTRY_MAP = dict (
# == description reader ==
+ field_definition_file = dict (
+ path = [ 'DESCRIPTION', 'field_definition_file' ],
+ value_type = fs_file,
+ ),
+
# * for debugging
# if set: write _all_ description files to dir/<package_filename>
description_descfiles_dir = dict (
@@ -139,5 +144,6 @@ CONFIG_ENTRY_MAP = dict (
# * alias
description_dir = 'description_descfiles_dir',
+ field_definition = 'field_definition_file',
)
diff --git a/roverlay/config/tree.py b/roverlay/config/tree.py
index adcdcde..426343e 100644
--- a/roverlay/config/tree.py
+++ b/roverlay/config/tree.py
@@ -2,6 +2,7 @@
# Copyright 2006-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+import logging
import sys
from roverlay.config import const
@@ -10,24 +11,6 @@ from roverlay.config.util import get_config_path
CONFIG_INJECTION_IS_BAD = True
-class InitialLogger:
-
- def __init__ ( self ):
- """Initializes an InitialLogger.
- It implements the debug/info/warning/error/critical/exception methods
- known from the logging module and its output goes directly to sys.stderr.
- This can be used until the real logging has been configured.
- """
- # @return None
- self.debug = lambda x : sys.stdout.write ( "DBG %s\n" % x )
- self.info = lambda x : sys.stdout.write ( "INFO %s\n" % x )
- self.warning = lambda x : sys.stderr.write ( "WARN %s\n" % x )
- self.error = lambda x : sys.stderr.write ( "ERR %s\n" % x )
- self.critical = lambda x : sys.stderr.write ( "CRIT %s\n" % x )
- self.exception = lambda x : sys.stderr.write ( "EXC! %s\n" % x )
-
- # --- end of __init__ (...) ---
-
class ConfigTree ( object ):
# static access to the first created ConfigTree
instance = None
@@ -45,8 +28,10 @@ class ConfigTree ( object ):
"""
if ConfigTree.instance is None:
ConfigTree.instance = self
-
- self.logger = InitialLogger()
+ self.logger = logging.getLogger ( self.__class__.__name__ )
+ else:
+ self.logger = logging.getLogger (
+ self.__class__.__name__ + "(%i)" % id ( self ) )
self._config = const.clone() if import_const else dict ()
self._const_imported = import_const
@@ -59,6 +44,28 @@ class ConfigTree ( object ):
return ConfigLoader ( self )
# --- end of get_loader (...) ---
+ def merge_with ( self, _dict, allow_empty_value=False ):
+ # strategy = theirs
+ # unsafe operation (empty values,...)
+ if not _dict:
+ pass
+
+ elif not isinstance ( _dict, dict ):
+ raise Exception ( "bad usage" )
+
+ elif allow_empty_value:
+ self._config.update ( _dict )
+
+ elif sys.version_info >= ( 2, 7 ):
+ u = { k : v for ( k, v ) in _dict.items() if v or v == 0 }
+ self._config.update ( u )
+ else:
+ # FIXME remove < 2.7 statement, roverlay (probably) doesn't work
+ # with python version prior to 2.7
+ u = dict ( x for x in _dict.items() if x [1] or x [1] == 0 )
+
+ # --- end of merge_with (...) ---
+
def _findpath (
self, path,
root=None, create=False, value=None, forcepath=False, forceval=False
@@ -164,6 +171,10 @@ class ConfigTree ( object ):
# --- end of get (...) ---
+ def get_or_fail ( self, key ):
+ return self.get ( key, fail_if_unset=True )
+ # --- end of get_or_fail ---
+
def get_field_definition ( self, force_update=False ):
"""Gets the field definition stored in this ConfigTree.
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2012-07-05 16:00 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2012-07-05 16:00 UTC (permalink / raw
To: gentoo-commits
commit: 1bca2ba4460766fb4025a97fd249fb727db69918
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jul 5 15:51:40 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jul 5 15:51:40 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=1bca2ba4
config: entries for logging
modified: roverlay/config/const.py
modified: roverlay/config/entrymap.py
modified: roverlay/config/loader.py
---
roverlay/config/const.py | 14 ++++---
roverlay/config/entrymap.py | 86 ++++++++++++++++++++++++++++++++++++++-----
roverlay/config/loader.py | 15 +++++++-
3 files changed, 98 insertions(+), 17 deletions(-)
diff --git a/roverlay/config/const.py b/roverlay/config/const.py
index 80763ce..fed4a65 100644
--- a/roverlay/config/const.py
+++ b/roverlay/config/const.py
@@ -6,31 +6,33 @@ import copy
import time
_CONSTANTS = dict (
+ DEBUG = False,
+
+ # logging defaults are in recipe/easylogger
+
DESCRIPTION = dict (
field_separator = ':',
comment_chars = '#;',
list_split_regex = '\s*[,;]{1}\s*',
file_name = 'DESCRIPTION',
),
+
R_PACKAGE = dict (
suffix_regex = '[.](tgz|tbz2|tar|(tar[.](gz|bz2)))',
name_ver_separator = '_',
),
+
EBUILD = dict (
- # indent is currently not in use, FIXME
- #indent = '\t',
default_header = '\n'.join ( (
'# Copyright 1999-%i Gentoo Foundation' % ( time.gmtime() [0] ),
'# Distributed under the terms of the GNU General Public License v2',
'# $Header: $',
'',
'EAPI=4',
- '',
- # FIXME: don't include eclasses here, calculate their names
- # using OVERLAY.eclass_files
- 'inherit R-packages'
+ # inherit <eclasses> is no longer part of the default header
) ),
),
+
OVERLAY = dict (
category = 'sci-R',
),
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index d1e8eca..f8987cf 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -39,7 +39,16 @@ fs_abslist = 'slist:fs_abs'
# often (>1) used entry dicts (it's ok to share a ref to those dicts
# 'cause CONFIG_ENTRY_MAP won't be modified)
is_fs_file = { 'value_type' : fs_file }
-is_str = { 'value_type' : 'str' }
+#is_str = { 'value_type' : 'str' }
+is_yesno = { 'value_type' : 'yesno' }
+
+CAPSLOCK = ( 'CAPSLOCK', )
+LOG_LEVEL = frozenset ((
+ "DEBUG", "INFO", "WARN",
+ "WARNING", "ERROR", "CRITICAL"
+))
+
+is_log_level = { 'choices' : LOG_LEVEL, 'flags' : CAPSLOCK }
only_vtype = lambda x : { 'value_type': x }
@@ -47,16 +56,66 @@ CONFIG_ENTRY_MAP = dict (
# == logging ==
- log_level = '',
- log_console = only_vtype ( 'yesno' ),
- log_file = dict (
- # setting path to LOG.FILE.main to avoid collision with LOG.FILE.*
- path = [ 'LOG', 'FILE', 'main' ],
- value_type = fs_file,
- ),
+ log_enabled = is_yesno,
+ log_level = is_log_level,
+ #log_format = None, # there's no global log format
+ log_date_format = '',
+
+ # used in depres listener modules
log_file_resolved = is_fs_file,
log_file_unresolvable = is_fs_file,
+ # === logging to console ===
+
+ log_console_enabled = is_yesno,
+ log_console = 'log_console_enabled',
+
+ log_console_level = is_log_level,
+ log_level_console = 'log_console_level',
+
+ log_console_stream = None, # option not configurable
+
+ log_console_format = '',
+ log_format_console = 'log_console_format',
+
+ # === logging to file ===
+
+ log_file_enabled = is_yesno,
+
+ log_file = dict (
+ # setting path to LOG.FILE.file to avoid collision with LOG.FILE.*
+ path = [ 'LOG', 'FILE', 'file' ],
+ value_type = fs_file,
+ ),
+
+ log_file_level = is_log_level,
+ log_level_file = 'log_file_level',
+
+ log_file_rotate = is_yesno,
+ log_file_rotate_count = dict (
+ path = [ 'LOG', 'FILE', 'rotate_count' ],
+ value_type = 'int',
+ ),
+
+ log_file_format = '',
+ log_format_file = 'log_file_format',
+
+ log_file_buffered = is_yesno,
+ log_file_buffer_count = 'log_file_buffer_capacity',
+ log_file_buffer_capacity = dict (
+ path = [ 'LOG', 'FILE', 'buffer_capacity' ],
+ value_type = 'int',
+ ),
+
+
+# # === syslog ===
+#
+# log_syslog_enabled = is_yesno,
+# log_syslog = 'log_syslog_enabled',
+#
+# log_syslog_level = is_log_level,
+# log_level_syslog = 'log_syslog_level',
+#
# --- logging
@@ -65,7 +124,7 @@ CONFIG_ENTRY_MAP = dict (
# FIXME key is not in use
ebuild_header = is_fs_file,
- overlay_category = is_str, # e.g. 'sci-R'
+ overlay_category = '', # e.g. 'sci-R'
overlay_dir = only_vtype ( 'fs_abs:fs_dir' ),
overlay_eclass = dict (
@@ -73,7 +132,7 @@ CONFIG_ENTRY_MAP = dict (
value_type = fs_abslist,
),
- overlay_name = is_str,
+ overlay_name = '',
# ebuild is used to create Manifest files
ebuild_prog = dict (
@@ -128,6 +187,7 @@ CONFIG_ENTRY_MAP = dict (
# --- dependency resolution
+
# == description reader ==
field_definition_file = dict (
@@ -146,4 +206,10 @@ CONFIG_ENTRY_MAP = dict (
description_dir = 'description_descfiles_dir',
field_definition = 'field_definition_file',
+ # --- description reader
+
)
+
+del fs_file, fs_abslist, is_fs_file, is_yesno, is_log_level, \
+ CAPSLOCK, LOG_LEVEL, only_vtype
+
diff --git a/roverlay/config/loader.py b/roverlay/config/loader.py
index 9b855e5..b703403 100644
--- a/roverlay/config/loader.py
+++ b/roverlay/config/loader.py
@@ -74,11 +74,24 @@ class ConfigLoader ( object ):
if path:
# verify and convert value if value_type is set
- if 'value_type' in cref:
+ if 'value_type' in cref and cref ['value_type']:
value = self._make_and_verify_value (
cref ['value_type'], value
)
+ if 'choices' in cref and value not in cref ['choices']:
+ if 'flags' in cref and 'CAPSLOCK' in cref ['flags']:
+ v_up = value.upper()
+ value = v_up if v_up in cref ['choices'] else None
+ else:
+ value = None
+
+ elif 'flags' in cref and 'CAPSLOCK' in cref ['flags']:
+ value = value.upper()
+
+
+
+
# need a valid value
if value:
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2012-07-06 22:19 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2012-07-06 22:19 UTC (permalink / raw
To: gentoo-commits
commit: 415683e88e8dedcc7b84c3691213dfca2033b93f
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul 6 22:10:24 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul 6 22:10:24 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=415683e8
ConfigTree: fix merge_with (<dict>)
the config tree will now be merged recursively with the given dict
modified: roverlay/config/tree.py
---
roverlay/config/tree.py | 31 +++++++++++++++++++++----------
1 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/roverlay/config/tree.py b/roverlay/config/tree.py
index 426343e..dd14fb7 100644
--- a/roverlay/config/tree.py
+++ b/roverlay/config/tree.py
@@ -44,7 +44,19 @@ class ConfigTree ( object ):
return ConfigLoader ( self )
# --- end of get_loader (...) ---
- def merge_with ( self, _dict, allow_empty_value=False ):
+ def merge_with ( self, _dict ):
+ def merge_dict ( pos, dict_to_merge ):
+ # this uses references where possible (no copy.[deep]copy,..)
+ for key, val in dict_to_merge.items():
+ if not key in pos:
+ pos [key] = val
+ elif isinstance ( pos [key], dict ):
+ merge_dict ( pos [key], val )
+ else:
+ pos [key] = val
+ # --- end of merge_dict (...) ---
+
+
# strategy = theirs
# unsafe operation (empty values,...)
if not _dict:
@@ -53,16 +65,15 @@ class ConfigTree ( object ):
elif not isinstance ( _dict, dict ):
raise Exception ( "bad usage" )
- elif allow_empty_value:
- self._config.update ( _dict )
-
- elif sys.version_info >= ( 2, 7 ):
- u = { k : v for ( k, v ) in _dict.items() if v or v == 0 }
- self._config.update ( u )
else:
- # FIXME remove < 2.7 statement, roverlay (probably) doesn't work
- # with python version prior to 2.7
- u = dict ( x for x in _dict.items() if x [1] or x [1] == 0 )
+ if sys.version_info >= ( 2, 7 ):
+ u = { k : v for ( k, v ) in _dict.items() if v or v == 0 }
+ else:
+ # FIXME remove < 2.7 statement, roverlay (probably) doesn't work
+ # with python version prior to 2.7
+ u = dict ( kv for kv in _dict.items() if kv [1] or kv [1] == 0 )
+
+ merge_dict ( self._config, u )
# --- end of merge_with (...) ---
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2012-07-06 22:19 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2012-07-06 22:19 UTC (permalink / raw
To: gentoo-commits
commit: 68b95b0e8adfd900ed53330d1e2d5c90f8260efb
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul 6 22:13:51 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul 6 22:13:51 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=68b95b0e
config: add descriptions to the entry map
modified: roverlay/config/entrymap.py
new file: roverlay/config/entryutil.py
---
roverlay/config/entrymap.py | 170 ++++++++++++++++++++++++++++++++----------
roverlay/config/entryutil.py | 44 +++++++++++
2 files changed, 175 insertions(+), 39 deletions(-)
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index f8987cf..60e1766 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -35,6 +35,7 @@
fs_file = 'fs_file'
fs_abslist = 'slist:fs_abs'
+yesno = 'yesno'
# often (>1) used entry dicts (it's ok to share a ref to those dicts
# 'cause CONFIG_ENTRY_MAP won't be modified)
@@ -50,61 +51,112 @@ LOG_LEVEL = frozenset ((
is_log_level = { 'choices' : LOG_LEVEL, 'flags' : CAPSLOCK }
+
only_vtype = lambda x : { 'value_type': x }
CONFIG_ENTRY_MAP = dict (
# == logging ==
- log_enabled = is_yesno,
- log_level = is_log_level,
+ log_enabled = dict (
+ value_type = yesno,
+ description = "enable/disable logging",
+ ),
+ log_level = dict (
+ desc = "global log level, choices are {}.".format (
+ ', '.join ( LOG_LEVEL )
+ ),
+ **is_log_level
+ ),
#log_format = None, # there's no global log format
- log_date_format = '',
+ log_date_format = dict (
+ desc = "date format, example: '%F %H:%M:%S'.",
+ ),
# used in depres listener modules
- log_file_resolved = is_fs_file,
- log_file_unresolvable = is_fs_file,
+ log_file_resolved = dict (
+ value_type = fs_file,
+ description = '''NOT IN USE.
+ file where resolved dep strings will be written to.
+ ''',
+ ),
+ log_file_unresolvable = dict (
+ value_type = fs_file,
+ description = '''file where unresolved dependency strings
+ will be written to
+ '''
+ ),
# === logging to console ===
- log_console_enabled = is_yesno,
+ log_console_enabled = dict (
+ value_type = yesno,
+ description = "enable/disable logging to stdout/stderr",
+ ),
log_console = 'log_console_enabled',
- log_console_level = is_log_level,
+ log_console_level = dict (
+ desc = "log level for console logging.",
+ **is_log_level
+ ),
log_level_console = 'log_console_level',
log_console_stream = None, # option not configurable
- log_console_format = '',
+ log_console_format = dict (
+ desc = '''console logging format,
+ example: '%(levelname)-7s [%(name)s] %(message)s'
+ ''',
+ ),
log_format_console = 'log_console_format',
# === logging to file ===
- log_file_enabled = is_yesno,
+ log_file_enabled = dict (
+ value_type = yesno,
+ description = "enable/disable logging to file",
+ ),
- log_file = dict (
+ log_file = dict (
# setting path to LOG.FILE.file to avoid collision with LOG.FILE.*
- path = [ 'LOG', 'FILE', 'file' ],
- value_type = fs_file,
+ path = [ 'LOG', 'FILE', 'file' ],
+ value_type = fs_file,
+ description = "log file to write",
),
- log_file_level = is_log_level,
+ log_file_level = dict (
+ desc = "log level for file logging",
+ **is_log_level
+ ),
log_level_file = 'log_file_level',
- log_file_rotate = is_yesno,
+ log_file_rotate = dict (
+ value_type = yesno,
+ description = "enable/disable log file rotating (per script run)",
+ ),
log_file_rotate_count = dict (
- path = [ 'LOG', 'FILE', 'rotate_count' ],
- value_type = 'int',
+ path = [ 'LOG', 'FILE', 'rotate_count' ],
+ value_type = 'int',
+ description = "number of rotated log files to keep",
),
- log_file_format = '',
+ log_file_format = dict (
+ desc = '''file logging format,
+ example: '%(asctime)s %(levelname)-8s %(name)-10s: %(message)s'
+ '''
+ ),
log_format_file = 'log_file_format',
- log_file_buffered = is_yesno,
+ log_file_buffered = dict (
+ value_type = yesno,
+ description = "buffer log entries before writing them to file",
+ ),
+
log_file_buffer_count = 'log_file_buffer_capacity',
log_file_buffer_capacity = dict (
- path = [ 'LOG', 'FILE', 'buffer_capacity' ],
- value_type = 'int',
+ path = [ 'LOG', 'FILE', 'buffer_capacity' ],
+ value_type = 'int',
+ description = "max number of log entries to buffer",
),
@@ -122,22 +174,40 @@ CONFIG_ENTRY_MAP = dict (
# == overlay ==
# FIXME key is not in use
- ebuild_header = is_fs_file,
+ ebuild_header = dict (
+ value_type = fs_file,
+ description = '''NOT IN USE.
+ ebuild header file that will be included in every created ebuild.
+ ''',
+ ),
- overlay_category = '', # e.g. 'sci-R'
- overlay_dir = only_vtype ( 'fs_abs:fs_dir' ),
+ overlay_category = dict (
+ desc = "overlay category to use for created ebuilds, e.g. 'sci-R'.",
+ ),
+ overlay_dir = dict (
+ value_type = 'fs_abs:fs_dir',
+ description = '''overlay root directory where the
+ ebuilds, profiles/ dir, etc. will be written to.
+ '''
+ ),
overlay_eclass = dict (
- path = [ 'OVERLAY', 'eclass_files' ],
- value_type = fs_abslist,
+ path = [ 'OVERLAY', 'eclass_files' ],
+ value_type = fs_abslist,
+ description = '''eclass files to import into the overlay.
+ Automatically inherited in ebuilds.
+ ''',
),
- overlay_name = '',
+ overlay_name = dict (
+ desc = "overlay name, e.g. 'R-Overlay'.",
+ ),
# ebuild is used to create Manifest files
ebuild_prog = dict (
- path = [ 'TOOLS', 'ebuild_prog' ],
- value_type = 'fs_path',
+ path = [ 'TOOLS', 'ebuild_prog' ],
+ value_type = 'fs_path',
+ description = "name of/path to the ebuild executable",
),
# * alias
@@ -151,18 +221,25 @@ CONFIG_ENTRY_MAP = dict (
# the distfiles root directory
# this is where repos create their own DISTDIR as sub directory unless
# they specify another location
- distfiles_root = only_vtype ( 'fs_dir' ),
+ distfiles_root = dict (
+ value_type = 'fs_dir',
+ description = '''distfiles root,
+ repos will create their distdirs in this directory.
+ ''',
+ ),
# the repo config file(s)
repo_config_files = dict (
- path = [ 'REPO', 'config_files' ],
- value_type = fs_abslist,
+ path = [ 'REPO', 'config_files' ],
+ value_type = fs_abslist,
+ description = 'list of repo config files',
),
# this option is used to limit bandwidth usage while running rsync
rsync_bwlimit = dict (
- path = [ 'rsync_bwlimit' ],
- value_type = 'int',
+ path = [ 'rsync_bwlimit' ],
+ value_type = 'int',
+ description = "max average rsync bandwidth usage (in kilobytes/second)"
),
# * alias
@@ -178,8 +255,9 @@ CONFIG_ENTRY_MAP = dict (
# the list of simple dep rule files
simple_rules_files = dict (
- path = [ 'DEPRES', 'SIMPLE_RULES', 'files' ],
- value_type = fs_abslist,
+ path = [ 'DEPRES', 'SIMPLE_RULES', 'files' ],
+ value_type = fs_abslist,
+ description = "list of dependency rule files",
),
# * alias
@@ -191,15 +269,19 @@ CONFIG_ENTRY_MAP = dict (
# == description reader ==
field_definition_file = dict (
- path = [ 'DESCRIPTION', 'field_definition_file' ],
- value_type = fs_file,
+ path = [ 'DESCRIPTION', 'field_definition_file' ],
+ value_type = fs_file,
+ description = "config file that controls DESCRIPTION file reading",
),
# * for debugging
# if set: write _all_ description files to dir/<package_filename>
description_descfiles_dir = dict (
- path = [ 'DESCRIPTION', 'descfiles_dir' ],
- value_type = 'fs_abs:fs_dir',
+ path = [ 'DESCRIPTION', 'descfiles_dir' ],
+ value_type = 'fs_abs:fs_dir',
+ description = '''if set: write description files (read from tarballs)
+ into this directory. Leave blank / comment out to disable.
+ '''
),
# * alias
@@ -213,3 +295,13 @@ CONFIG_ENTRY_MAP = dict (
del fs_file, fs_abslist, is_fs_file, is_yesno, is_log_level, \
CAPSLOCK, LOG_LEVEL, only_vtype
+def prune_description():
+ for entry in CONFIG_ENTRY_MAP.values():
+ if isinstance ( entry, dict ):
+
+ if 'description' in entry:
+ del entry ['description']
+ elif 'desc' in entry:
+ del entry ['desc']
+
+
diff --git a/roverlay/config/entryutil.py b/roverlay/config/entryutil.py
new file mode 100644
index 0000000..dfa7647
--- /dev/null
+++ b/roverlay/config/entryutil.py
@@ -0,0 +1,44 @@
+import re
+import textwrap
+
+from roverlay.config.entrymap import CONFIG_ENTRY_MAP
+
+def _iter_entries():
+ for entry_key, entry in CONFIG_ENTRY_MAP.items():
+ name = entry_key.upper()
+ if entry is None:
+ # entry is disabled
+ pass
+ elif isinstance ( entry, dict ):
+ if 'description' in entry:
+ yield ( name, entry ['description'] )
+ elif 'desc' in entry:
+ yield ( name, entry ['desc'] )
+ else:
+ yield ( name, )
+ elif isinstance ( entry, str ) and entry:
+ yield ( name, "alias to " + entry.upper() )
+ else:
+ yield ( name, )
+
+
+def list_entries ( newline_after_entry=True ):
+ wrapper = textwrap.TextWrapper (
+ initial_indent = 2 * ' ',
+ subsequent_indent = 3 * ' ',
+ #width = 75,
+ )
+ remove_ws = re.compile ( "\s+" )
+ wrap = wrapper.wrap
+
+ lines = list()
+ for entry in sorted ( _iter_entries(), key = lambda x : x[0] ):
+ lines.append ( entry [0] )
+ if len ( entry ) > 1:
+ lines.extend ( wrap ( remove_ws.sub ( ' ', entry [1] ) ) )
+
+ if newline_after_entry:
+ lines.append ( '' )
+
+ return '\n'.join ( lines )
+
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2012-07-11 18:43 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2012-07-11 18:43 UTC (permalink / raw
To: gentoo-commits
commit: 1361fd841aa90e78dd9b02b03e8427a1337c7639
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jul 11 18:40:38 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jul 11 18:40:38 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=1361fd84
removed unused code
* also replaced list config entry type by slist,
removing slist soon
modified: roverlay/config/entrymap.py
modified: roverlay/config/loader.py
---
roverlay/config/entrymap.py | 6 +++---
roverlay/config/loader.py | 40 ++++++++--------------------------------
2 files changed, 11 insertions(+), 35 deletions(-)
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index 60e1766..9c6d755 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -13,8 +13,8 @@
# * path = str | list of str -- path of this entry in the config tree
#
# * value_type, you can specify:
-# ** slist -- value is a whitespace-separated list
-# ** list -- value is a list, see DEFAULT_LIST_REGEX below
+# ** slist -- value is a whitespace-separated list (replaced by list)
+# ** list -- value is a whitespace-separated list
# ** int -- integer
# ** str -- [explicit string conversion]
# ** yesno -- value must evaluate to 'yes' or 'no' (on,off,y,n,1,0...)
@@ -34,7 +34,7 @@
#
fs_file = 'fs_file'
-fs_abslist = 'slist:fs_abs'
+fs_abslist = 'list:fs_abs'
yesno = 'yesno'
# often (>1) used entry dicts (it's ok to share a ref to those dicts
diff --git a/roverlay/config/loader.py b/roverlay/config/loader.py
index b703403..57027ec 100644
--- a/roverlay/config/loader.py
+++ b/roverlay/config/loader.py
@@ -13,7 +13,7 @@ from roverlay.config.entrymap import CONFIG_ENTRY_MAP
class ConfigLoader ( object ):
# often used regexes
- DEFAULT_LIST_REGEX = re.compile ( '\s*[,;]{1}\s*' )
+ #DEFAULT_LIST_REGEX = re.compile ( '\s*[,;]{1}\s*' )
WHITESPACE = re.compile ( '\s+' )
@@ -89,11 +89,8 @@ class ConfigLoader ( object ):
elif 'flags' in cref and 'CAPSLOCK' in cref ['flags']:
value = value.upper()
-
-
-
# need a valid value
- if value:
+ if value is not None:
self.logger.debug (
"New config entry %s with path %s and value %s." %
@@ -107,7 +104,7 @@ class ConfigLoader ( object ):
else:
self.logger.error (
"Option '%s' has an unusable value '%s'." %
- ( real_option, value )
+ ( option, value )
)
return False
# ---
@@ -323,28 +320,6 @@ class ConfigLoader ( object ):
return None
# --- end of fs_dir (...) ---
- def repo ( val ):
- """To be removed. (FIXME)"""
- if not val: return None
-
- name, sepa, remainder = val.partition ( ':' )
-
- if sepa != ':' or not name or not remainder: return None
-
- if remainder [0] == ':':
- # name::url
- return ( name, None, remainder [1:] )
-
- elif remainder [0] == '/':
- # name:dir:url
- _dir, sepa, url = remainder.partition ( ':' )
- if sepa != ':' or not url: return None
- if not _dir: _dir = None
- return ( name, _dir, url )
- else:
- return ( name, None, remainder )
- # --- end of repo (...) ---
-
def _regex ( val ):
"""val is a regex -- compile it if possible
@@ -370,8 +345,6 @@ class ConfigLoader ( object ):
# value_type -> function where function accepts one parameter
funcmap = {
- 'list' : ConfigLoader.DEFAULT_LIST_REGEX.split,
- 'slist' : ConfigLoader.WHITESPACE.split,
'yesno' : yesno,
'int' : to_int,
'fs_dir' : fs_dir,
@@ -380,7 +353,6 @@ class ConfigLoader ( object ):
'fs_abs' : fs_abs,
'regex' : _regex,
'str' : str,
- 'repo' : repo,
}
# dofunc ( function f, <list or str> v) calls f(x) for every str in v
@@ -390,7 +362,11 @@ class ConfigLoader ( object ):
retval = value.strip()
for vtype in vtypes:
- if vtype in funcmap:
+ if vtype == "slist" or vtype == "list":
+ retval = list ( filter (
+ None, self.__class__.WHITESPACE.split ( retval )
+ ) )
+ elif vtype in funcmap:
retval = dofunc ( funcmap [vtype], retval )
else:
self.logger.warning ( "unknown value type '" + vtype + "'." )
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2012-08-01 21:10 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2012-08-01 21:10 UTC (permalink / raw
To: gentoo-commits
commit: c7eeb838de320923a4e2e3d7715ca0e0dcc0889d
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Aug 1 21:09:27 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Aug 1 21:09:27 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=c7eeb838
config entry: overlay_keep_nth_latest
---
roverlay/config/entrymap.py | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index 9c6d755..078ddfe 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -210,8 +210,17 @@ CONFIG_ENTRY_MAP = dict (
description = "name of/path to the ebuild executable",
),
+
+ overlay_keep_nth_latest = dict (
+ path = [ 'OVERLAY', 'keep_nth_latest' ],
+ value_type = 'int',
+ description = 'number of ebuilds per R package to keep (if > 0)',
+ ),
+
+
# * alias
- eclass = 'overlay_eclass',
+ eclass = 'overlay_eclass',
+ keep_nth_latest = 'overlay_keep_nth_latest',
# --- overlay
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2012-08-02 15:14 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2012-08-02 15:14 UTC (permalink / raw
To: gentoo-commits
commit: 37545b5c22386e42805c644bab9c2ea7952ccf17
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Aug 2 14:57:04 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Aug 2 14:57:04 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=37545b5c
config: update entry map comment
---
roverlay/config/entrymap.py | 15 +++++----------
roverlay/config/tree.py | 19 +++++++------------
2 files changed, 12 insertions(+), 22 deletions(-)
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index 078ddfe..0119983 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -1,6 +1,4 @@
-# <header!!>
-
-# TODO/FIXME comments
+# R Overlay -- config entry map
# the map of config entries (keep keys in lowercase)
# format is config_entry = None|''|str|dict(...), where
@@ -10,10 +8,10 @@
# dict() means that config_entry has options / diverts from defaults.
#
# known dict keys are:
-# * path = str | list of str -- path of this entry in the config tree
+# * path = str | list of str -- path of this entry in the config tree
+# * description = str -- description
#
# * value_type, you can specify:
-# ** slist -- value is a whitespace-separated list (replaced by list)
# ** list -- value is a whitespace-separated list
# ** int -- integer
# ** str -- [explicit string conversion]
@@ -23,14 +21,13 @@
# (pwd + path)
# ** fs_dir -- fs_abs and value must be a dir if it exists
# ** fs_file -- fs_abs and value must be a file if it exists
-# TODO** fs_prog -- fs_file (and fs_path) and value must be executable (TODO)
# ** regex -- value is a regex and will be compiled (re.compile(..))
#
# multiple types are generally not supported ('this is an int or a str'),
# but subtypes are ('list of yesno'), which can be specified by either
# using a list of types ['list', 'yesno'] or by separating the types
# with a colon 'list:yesno', which is parsed in a left-to-right order.
-# Nested subtypes such as list:slist:int:fs_file:list may lead to errors.
+# Nested subtypes such as list:int:fs_file:list may lead to errors.
#
fs_file = 'fs_file'
@@ -173,7 +170,7 @@ CONFIG_ENTRY_MAP = dict (
# == overlay ==
- # FIXME key is not in use
+ # COULDFIX key is not in use
ebuild_header = dict (
value_type = fs_file,
description = '''NOT IN USE.
@@ -312,5 +309,3 @@ def prune_description():
del entry ['description']
elif 'desc' in entry:
del entry ['desc']
-
-
diff --git a/roverlay/config/tree.py b/roverlay/config/tree.py
index dd14fb7..dfc6289 100644
--- a/roverlay/config/tree.py
+++ b/roverlay/config/tree.py
@@ -59,21 +59,16 @@ class ConfigTree ( object ):
# strategy = theirs
# unsafe operation (empty values,...)
- if not _dict:
- pass
+ if _dict and isinstance ( _dict, dict ):
- elif not isinstance ( _dict, dict ):
- raise Exception ( "bad usage" )
+ u = { k : v for ( k, v ) in _dict.items() if v or v == 0 }
+ merge_dict ( self._config, u )
- else:
- if sys.version_info >= ( 2, 7 ):
- u = { k : v for ( k, v ) in _dict.items() if v or v == 0 }
- else:
- # FIXME remove < 2.7 statement, roverlay (probably) doesn't work
- # with python version prior to 2.7
- u = dict ( kv for kv in _dict.items() if kv [1] or kv [1] == 0 )
+ elif not _dict:
+ pass
- merge_dict ( self._config, u )
+ else:
+ raise Exception ( "bad usage" )
# --- end of merge_with (...) ---
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2012-08-08 23:46 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2012-08-08 23:46 UTC (permalink / raw
To: gentoo-commits
commit: 80a5a2b8c124effc613ef5051eeb73e419f9e413
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Aug 8 23:44:08 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Aug 8 23:44:08 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=80a5a2b8
const: console logging and overlay name
---
roverlay/config/const.py | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/roverlay/config/const.py b/roverlay/config/const.py
index 9c52633..a3e9706 100644
--- a/roverlay/config/const.py
+++ b/roverlay/config/const.py
@@ -39,7 +39,14 @@ _CONSTANTS = dict (
) ),
),
+ LOG = dict (
+ CONSOLE = dict (
+ enabled = True,
+ ),
+ )
+
OVERLAY = dict (
+ name = 'R_Overlay',
category = 'sci-R',
),
)
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2012-08-09 9:26 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2012-08-09 9:26 UTC (permalink / raw
To: gentoo-commits
commit: 69dc9688838fb9dd5855a5890b76d7e5a7f2f0f6
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Aug 9 08:32:07 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Aug 9 08:32:07 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=69dc9688
typo
---
roverlay/config/const.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/roverlay/config/const.py b/roverlay/config/const.py
index a3e9706..132125a 100644
--- a/roverlay/config/const.py
+++ b/roverlay/config/const.py
@@ -43,7 +43,7 @@ _CONSTANTS = dict (
CONSOLE = dict (
enabled = True,
),
- )
+ ),
OVERLAY = dict (
name = 'R_Overlay',
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-01-28 23:54 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-01-28 23:54 UTC (permalink / raw
To: gentoo-commits
commit: bad2e17dfe93ffebc5467b187e2ded668be47632
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Jan 28 22:27:42 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Jan 28 23:37:04 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=bad2e17d
roverlay/config: new config entries
* new entry [OVERLAY_]SYMLINK_DISTROOT
* new entry [OVERLAY_]SYMLINK_DISTROOT_TMP with default value True
* value choices changed for [OVERLAY_]MANIFEST_IMPLEMENTATION
---
roverlay/config/const.py | 4 ++++
roverlay/config/entrymap.py | 27 ++++++++++++++++++++++-----
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/roverlay/config/const.py b/roverlay/config/const.py
index 6eb30e6..9005c42 100644
--- a/roverlay/config/const.py
+++ b/roverlay/config/const.py
@@ -49,6 +49,10 @@ _CONSTANTS = dict (
name = 'R_Overlay',
category = 'sci-R',
manifest_implementation = 'default',
+ SYMLINK_DISTROOT = dict (
+ root = "",
+ tmp = True,
+ ),
),
)
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index 0d679c2..ed1dad8 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -215,15 +215,16 @@ CONFIG_ENTRY_MAP = dict (
overlay_manifest_implementation = dict (
desc = "manifest implementation to be used",
+ path = [ 'OVERLAY', 'manifest_implementation' ],
choices = frozenset ((
'none',
- 'default'
- 'external:ebuild',
-# 'external:portage',
-# 'internal',
+ 'default',
+ 'ebuild',
+ 'portage',
+# 'e',
+# 'p',
)),
),
-
# ebuild is used to create Manifest files
ebuild_prog = dict (
path = [ 'TOOLS', 'ebuild_prog' ],
@@ -238,11 +239,27 @@ CONFIG_ENTRY_MAP = dict (
description = 'number of ebuilds per R package to keep (if > 0)',
),
+ # overlay_symlink_distroot_
+ # used to create "virtual" DISTDIRs for Manifest file creation
+ # This has nothing to do with DISTFILES_ROOT.
+ overlay_symlink_distroot_root = dict (
+ path = [ 'OVERLAY', 'SYMLINK_DISTROOT', 'root' ],
+ value_type = 'fs_dir',
+ description = "symlink distroot directory",
+ ),
+
+ overlay_symlink_distroot_tmp = dict (
+ path = [ 'OVERLAY', 'SYMLINK_DISTROOT', 'tmp' ],
+ value_type = yesno,
+ description = "whether the symlink distroot is a tmpdir or not",
+ ),
# * alias
eclass = 'overlay_eclass',
keep_nth_latest = 'overlay_keep_nth_latest',
manifest_implementation = 'overlay_manifest_implementation',
+ symlink_distroot = 'overlay_symlink_distroot_root',
+ symlink_distroot_tmp = 'overlay_symlink_distroot_tmp',
# --- overlay
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-01-28 23:54 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-01-28 23:54 UTC (permalink / raw
To: gentoo-commits
commit: ec985d3e4d71380e8d24fbece8f521d0b3053813
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Jan 28 21:25:51 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Jan 28 23:37:04 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=ec985d3e
roverlay/config: added ConfigError exception
---
roverlay/config/__init__.py | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/roverlay/config/__init__.py b/roverlay/config/__init__.py
index b6aeb19..5d8f558 100644
--- a/roverlay/config/__init__.py
+++ b/roverlay/config/__init__.py
@@ -8,4 +8,7 @@
from roverlay.config.static import *
-__all__ = [ 'access', 'get_loader', 'get', 'get_or_fail', ]
+__all__ = [ 'access', 'get_loader', 'get', 'get_or_fail', 'ConfigError', ]
+
+class ConfigError ( ValueError ):
+ pass
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-02-09 20:45 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-02-09 20:45 UTC (permalink / raw
To: gentoo-commits
commit: a534bed4c28c722add240643eb0aa93923054d5c
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Sat Feb 9 19:26:16 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Sat Feb 9 20:08:15 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=a534bed4
config/const: remove SYMLINK_DISTROOT_*
---
roverlay/config/const.py | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/roverlay/config/const.py b/roverlay/config/const.py
index 9005c42..6eb30e6 100644
--- a/roverlay/config/const.py
+++ b/roverlay/config/const.py
@@ -49,10 +49,6 @@ _CONSTANTS = dict (
name = 'R_Overlay',
category = 'sci-R',
manifest_implementation = 'default',
- SYMLINK_DISTROOT = dict (
- root = "",
- tmp = True,
- ),
),
)
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-02-09 20:45 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-02-09 20:45 UTC (permalink / raw
To: gentoo-commits
commit: 73a23ab7ced4890b5930ff27cc2a4759f3956594
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Sat Feb 9 19:20:16 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Sat Feb 9 20:08:15 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=73a23ab7
config/loader: list of choices, value functions
* added the ability to load a "list of choices"
example config_entry_map entry <<
config_option = dict (
value_type = "list",
choices = frozenset (( "first", "second", )),
)
>>
* added the ability to convert values after validating their value_type via
'f_convert' and 'f_convert_item' in the config entry dict
* added the ability to verify the (final) value of a config option via
'f_verify' in the config entry dict
---
roverlay/config/loader.py | 144 +++++++++++++++++++++++++++++++++++----------
1 files changed, 113 insertions(+), 31 deletions(-)
diff --git a/roverlay/config/loader.py b/roverlay/config/loader.py
index e71770b..71f4074 100644
--- a/roverlay/config/loader.py
+++ b/roverlay/config/loader.py
@@ -22,6 +22,10 @@ from roverlay.config import fielddef
from roverlay.config.util import get_config_path
from roverlay.config.entrymap import CONFIG_ENTRY_MAP
+def listlike ( var ):
+ return hasattr ( var, '__iter__' ) and not isinstance ( var, str )
+# --- end of listlike (...) ---
+
class ConfigLoader ( object ):
"""Loads config data from files."""
@@ -73,41 +77,122 @@ class ConfigLoader ( object ):
* value -- value read from a config file (will be verified here)
* config_root -- ignored;
"""
- # determine the config path
- path = None
- if 'path' in cref:
- path = cref ['path']
- else:
- path = option.split ( '_' )
+ def uppercase_if_in_iterable ( s, iterable ):
+ """Returns s.upper() if s.upper() in iterable else None.
- path = get_config_path ( path )
+ arguments:
+ * s -- string
+ * iterable -- items
+ """
+ s_up = s.upper()
+ return s_up if s_up in iterable else None
+ # --- end of uppercase_if_in_iterable (...) ---
+
+ # determine the config path
+ path = get_config_path (
+ cref.get ( "path", None ) or option.split ( '_' )
+ )
# need a valid path
if path:
# verify and convert value if value_type is set
- if 'value_type' in cref and cref ['value_type']:
+ if cref.get ( "value_type", None ):
value = self._make_and_verify_value (
cref ['value_type'], value
)
-
- if 'choices' in cref and value not in cref ['choices']:
- if 'flags' in cref and 'CAPSLOCK' in cref ['flags']:
- v_up = value.upper()
- value = v_up if v_up in cref ['choices'] else None
- else:
+ # --- end prepare value;
+
+ value_choices = cref.get ( "choices", None )
+
+ if value_choices:
+ if listlike ( value ):
+
+ # create value_invalid for logging
+ # * also used as condition whether value is valid or not
+ value_invalid = None
+
+ if 'flags' in cref and 'CAPSLOCK' in cref ['flags']:
+ value_valid = list (
+ filter (
+ None,
+ (
+ uppercase_if_in_iterable ( v, value_choices )
+ for v in value
+ )
+ )
+ )
+
+ if len ( value_valid ) != len ( value ):
+
+ value_invalid = [
+ v for v in value if v.upper() not in value_choices
+ ]
+ else:
+ value_valid = [ v for v in value if v in value_choices ]
+
+ if len ( value_valid ) != len ( value ):
+ value_invalid = [
+ v for v in value if v not in value_choices
+ ]
+
+
+ if not value_invalid:
+ value = value_valid
+ else:
+ # mark value as invalid
+ self.logger.error (
+ "Option {o!r} has unusable value(s): {v!r}.".format (
+ o=option,
+ v=', '.join ( value_invalid )
+ )
+ )
+ #value = None
+ # return immediately, no need to log about that twice
+ return False
+
+
+ elif 'flags' in cref and 'CAPSLOCK' in cref ['flags']:
+ value = uppercase_if_in_iterable ( value, value_choices )
+
+ elif value not in value_choices:
value = None
+ # else value is valid
+
elif 'flags' in cref and 'CAPSLOCK' in cref ['flags']:
- value = value.upper()
+ if listlike ( value ):
+ value = [ s.upper() for s in value ]
+ # is a list
+ pass
+ else:
+ value = value.upper()
+ # --- end verify choices / apply flags;
# need a valid value
if value is not None:
- self.logger.debug (
- "New config entry %s with path %s and value %s." %
- ( option, path, value )
+ if listlike ( value ) and 'f_convert_item' in cref:
+ # or use map()
+ value = [ cref ['f_convert_item'] ( v ) for v in value ]
+
+ # not elif (use both functions for iterables if specified)
+ if 'f_convert' in cref:
+ # func should expect an iterable if value_type has/is "list"
+ value = cref ['f_convert'] ( value )
+
+ if value is not None and (
+ 'f_verify' not in cref
+ or cref ['f_verify'] (
+ value,
+ logger=self.logger.getChild ( option )
)
+ ):
+
+ self.logger.debug (
+ "New config entry {o} with path {p} and value {v}.".format (
+ o=option, p=path, v=value
+ ) )
# add option/value to the config
self._setval ( path, value )
@@ -115,9 +200,9 @@ class ConfigLoader ( object ):
return True
else:
self.logger.error (
- "Option '%s' has an unusable value '%s'." %
- ( option, value )
- )
+ "Option {o!r} has an unusable value {v!r}.".format (
+ o=option, v=value
+ ) )
return False
# ---
# --- end of _config_enty (...) ---
@@ -161,15 +246,11 @@ class ConfigLoader ( object ):
raise Exception ( "CONFIG_ENTRY_MAP is invalid!" )
# check if config entry is disabled
- if cref is None:
+ if cref is not None:
+ return self._config_entry ( cref, option, value, config_root )
+ else:
# deftly ignored
return True
-
- elif self._config_entry ( cref, option, value, config_root ):
- return True
- else:
- self.logger.error ( "Option '%s' is unusable..." % real_option )
- return False
# ---
self.logger.warning ( "Option '%s' is unknown." % real_option )
@@ -210,12 +291,13 @@ class ConfigLoader ( object ):
option, equal, value = nextline ()
- if fh:
- fh.close ()
-
except IOError as ioerr:
raise
+ finally:
+ if 'fh' in locals() and fh:
+ fh.close()
+
# --- end of load_config (...) ---
def load_field_definition ( self, def_file, lenient=False ):
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-02-09 20:45 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-02-09 20:45 UTC (permalink / raw
To: gentoo-commits
commit: 513351ca1dfd0f328ac00750a32690e3ee01441f
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Sat Feb 9 19:27:06 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Sat Feb 9 20:08:15 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=513351ca
config/entrymap: OVERLAY_DISTDIR[_STRATEGY,_FLAT]
Important: This commit changes the meaning of the DISTDIR config option.
added three new config keys, OVERLAY_DISTDIR (alias DISTDIR),
OVERLAY_DISTDIR_STRATEGY (DISTDIR_STRATEGY) and
OVERLAY_DISTDIR_FLAT (DISTDIR_FLAT), which will be used for creating
the "overlay distdir" that is able to serve as package mirror directory.
---
roverlay/config/entrymap.py | 73 +++++++++++++++++++++++++++++++-----------
1 files changed, 54 insertions(+), 19 deletions(-)
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index 2122eb8..26da456 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -44,9 +44,10 @@ known dict keys are 'path', 'description'/'desc' and 'value_type':
__all__ = [ 'CONFIG_ENTRY_MAP', 'prune_description', ]
-fs_file = 'fs_file'
-fs_abslist = 'list:fs_abs'
-yesno = 'yesno'
+fs_file = 'fs_file'
+fs_abslist = 'list:fs_abs'
+yesno = 'yesno'
+list_of_choices = "list:str"
# often (>1) used entry dicts (it's ok to share a ref to those dicts
# 'cause CONFIG_ENTRY_MAP won't be modified)
@@ -62,10 +63,31 @@ LOG_LEVEL = frozenset ((
is_log_level = { 'choices' : LOG_LEVEL, 'flags' : CAPSLOCK }
-
only_vtype = lambda x : { 'value_type': x }
+def _verify_distdir_strategy ( strategy, logger ):
+ methods = set ( strategy )
+ if not strategy:
+ logger.error (
+ 'strategy must not be empty.'
+ )
+ return False
+ elif len ( methods ) != len ( strategy ):
+ logger.error (
+ 'specifying a method more than once makes no sense.'
+ )
+ return False
+ elif 'tmpdir' in methods and len ( strategy ) > 1:
+ logger.error (
+ "the 'tmpdir' strategy does not accept any fallback methods!"
+ )
+ return False
+ else:
+ return True
+# --- end of _verify_distdir_strategy (...) ---
+
CONFIG_ENTRY_MAP = dict (
+
# == logging ==
log_enabled = dict (
@@ -239,27 +261,41 @@ CONFIG_ENTRY_MAP = dict (
description = 'number of ebuilds per R package to keep (if > 0)',
),
- # overlay_symlink_distroot_
- # used to create "virtual" DISTDIRs for Manifest file creation
- # This has nothing to do with DISTFILES_ROOT.
- overlay_symlink_distroot_root = dict (
- path = [ 'OVERLAY', 'SYMLINK_DISTROOT', 'root' ],
+ overlay_distdir_root = dict (
value_type = 'fs_dir',
- description = "symlink distroot directory",
+ description = (
+ 'DISTDIR which is used for Manifest creation and can, '
+ 'depending on the DISTDIR strategy, '
+ 'serve as package mirror directory',
+ ),
),
- overlay_symlink_distroot_tmp = dict (
- path = [ 'OVERLAY', 'SYMLINK_DISTROOT', 'tmp' ],
+ overlay_distdir_strategy = dict (
+ description = "list of DISTDIR creation methods",
+ value_type = list_of_choices,
+ choices = frozenset ((
+ "symlink",
+ "hardlink",
+ "copy",
+ "tmpdir",
+ )),
+ f_verify = _verify_distdir_strategy,
+ ),
+
+ overlay_distdir_flat = dict (
+ description = (
+ "whether to use per-package distdirs (False) or not (True)"
+ ),
value_type = yesno,
- description = "whether the symlink distroot is a tmpdir or not",
),
# * alias
- eclass = 'overlay_eclass',
- keep_nth_latest = 'overlay_keep_nth_latest',
- manifest_implementation = 'overlay_manifest_implementation',
- symlink_distroot = 'overlay_symlink_distroot_root',
- symlink_distroot_tmp = 'overlay_symlink_distroot_tmp',
+ eclass = 'overlay_eclass',
+ keep_nth_latest = 'overlay_keep_nth_latest',
+ manifest_implementation = 'overlay_manifest_implementation',
+ distdir = 'overlay_distdir_root',
+ distdir_strategy = 'overlay_distdir_strategy',
+ distdir_flat = 'overlay_distdir_flat',
# --- overlay
@@ -292,7 +328,6 @@ CONFIG_ENTRY_MAP = dict (
# * alias
distfiles = 'distfiles_root',
- distdir = 'distfiles_root',
repo_config = 'repo_config_files',
repo_config_file = 'repo_config_files',
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-06-04 21:06 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-06-04 21:06 UTC (permalink / raw
To: gentoo-commits
commit: d509f0df9020cb2a963fa638bce5a199db9f52fa
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon May 13 18:50:00 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon May 13 18:50:00 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=d509f0df
add jobcount to roverlay/config/const
---
roverlay/config/const.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/roverlay/config/const.py b/roverlay/config/const.py
index 6eb30e6..3f3148e 100644
--- a/roverlay/config/const.py
+++ b/roverlay/config/const.py
@@ -37,6 +37,24 @@ _CONSTANTS = dict (
'EAPI=4',
# inherit <eclasses> is no longer part of the default header
) ),
+
+ # number of workers used by OverlayCreator
+ # when 0 => dont use threads
+ # otherwise => use N threads
+ jobcount = 0,
+ ),
+
+ DEPRES = dict (
+ # number of dependency resolution workers
+ # when 0 => dont use threads
+ # otherwise => use K threads resulting in a depres speedup of < K
+ #
+ # Note: an ebuild creation job usually needs to resolve more than one
+ # dependency, so setting K > N may be advantageous.
+ # OTOH, a depres job takes considerably less time than
+ # ebuild creation.
+ #
+ jobcount = 0,
),
LOG = dict (
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
2013-06-13 16:34 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
@ 2013-06-18 14:12 ` André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-06-18 14:12 UTC (permalink / raw
To: gentoo-commits
commit: c5c9eb0fe096b62e305f4e4ed0b6768a637dd9f3
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jun 13 16:28:00 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jun 13 16:28:00 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=c5c9eb0f
roverlay/config/loader: support real types
---
roverlay/config/loader.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/roverlay/config/loader.py b/roverlay/config/loader.py
index c96598b..182915a 100644
--- a/roverlay/config/loader.py
+++ b/roverlay/config/loader.py
@@ -433,8 +433,15 @@ class ConfigLoader ( object ):
vtypes = value_type
elif isinstance ( value_type, str ):
vtypes = value_type.split ( ':' )
+ elif type ( value_type ) is type:
+ try:
+ return value_type ( value )
+ except ValueError:
+ return None
else:
- self.logger.error ( "Unknown data type for value type." )
+ self.logger.error (
+ "Unknown value type {!r}.".format ( value_type )
+ )
return value
# value_type -> function where function accepts one parameter
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-06-19 18:59 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-06-19 18:59 UTC (permalink / raw
To: gentoo-commits
commit: 8dab755d9d1d5f0955fc602b10421085525794d8
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jun 19 18:43:14 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jun 19 18:43:14 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=8dab755d
roverlay config: add CACHEDIR, TMPDIR
---
roverlay/config/entrymap.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index 4dbce44..65f2df5 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -432,6 +432,24 @@ CONFIG_ENTRY_MAP = dict (
# * alias
package_rules = 'package_rule_files',
+ # --- package rules
+
+ # == other ==
+
+ cachedir = dict (
+ path = [ 'CACHEDIR', 'root', ],
+ value_type = 'fs_dir',
+ description = 'directory for cache data',
+ ),
+
+ tmpdir = dict (
+ path = [ 'TMPDIR', 'root', ],
+ value_type = 'fs_dir',
+ description = 'directory for temporary data',
+ ),
+
+ # --- other
+
)
del fs_file, fs_abslist, is_fs_file, is_yesno, is_log_level, \
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-06-30 15:58 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-06-30 15:58 UTC (permalink / raw
To: gentoo-commits
commit: 84f3fafe99ee9e291ef09cd4b9ea0c8ec933a45b
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jun 26 17:22:27 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jun 26 17:22:27 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=84f3fafe
roverlay/config/tree, visualize(): sort entries
---
roverlay/config/tree.py | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/roverlay/config/tree.py b/roverlay/config/tree.py
index 3466889..4be20c1 100644
--- a/roverlay/config/tree.py
+++ b/roverlay/config/tree.py
@@ -252,12 +252,15 @@ class ConfigTree ( object ):
return "{}{} is empty\n".format ( var_indent, name )
else:
extra = ''.join ( [
- self._tree_to_str ( n, r, level+1 ) for r, n in root.items()
+ self._tree_to_str ( n, r, level+1 ) for r, n in sorted (
+ root.items(),
+ key=lambda e: ( isinstance ( e[1], dict ), e[0] )
+ )
] )
- return "{i}{} {{\n{}{i}}}\n".format ( name, extra, i=indent )
- elif level == 1:
- # non-nested config entry
- return "\n{}{} = {!r}\n\n".format ( var_indent, name, root )
+ return "{i}{n} {{\n{e}{i}}}\n".format ( n=name, e=extra, i=indent )
+# elif level == 1:
+# # non-nested config entry
+# return "\n{}{} = {!r}\n".format ( var_indent, name, root )
else:
return "{}{} = {!r}\n".format ( var_indent, name, root )
# --- end of _tree_to_str (...) ---
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
2013-07-10 15:10 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
@ 2013-07-10 16:16 ` André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-07-10 16:16 UTC (permalink / raw
To: gentoo-commits
commit: caba066014710bd69e7978933a6f73cbe7a30f3f
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jul 10 15:03:47 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jul 10 15:03:47 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=caba0660
roverlay/config/const: "fix" INSTALLINFO.libexec
---
roverlay/config/const.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/roverlay/config/const.py b/roverlay/config/const.py
index e7ad4c1..b0a0b6e 100644
--- a/roverlay/config/const.py
+++ b/roverlay/config/const.py
@@ -19,7 +19,8 @@ _CONSTANTS = dict (
portdir = '/usr/portage',
INSTALLINFO = dict (
- libexec = '/usr/libexec/roverlay', # ::LIBEXEC::
+ # FIXME: rename key
+ libexec = '/usr/share/roverlay', # ::LIBEXEC::
),
# logging defaults are in recipe/easylogger
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-07-11 16:29 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-07-11 16:29 UTC (permalink / raw
To: gentoo-commits
commit: 384456170719b57f0dbdcefa5344eb74213bd09a
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jul 11 16:26:11 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jul 11 16:26:11 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=38445617
roverlay/config: update description
---
roverlay/config/entrymap.py | 27 +++++++++++++-------------
roverlay/config/entryutil.py | 45 ++++++++++++++++++++++++++++++++++++++++----
2 files changed, 55 insertions(+), 17 deletions(-)
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index 35f1e66..de29ca7 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -224,9 +224,9 @@ CONFIG_ENTRY_MAP = dict (
),
overlay_dir = dict (
value_type = 'fs_abs:fs_dir',
- description = '''overlay root directory where the
- ebuilds, profiles/ dir, etc. will be written to.
- '''
+ description = (
+ 'this is the directory of the overlay to be created/maintained'
+ ),
),
overlay_additions_dir = dict (
@@ -274,11 +274,11 @@ CONFIG_ENTRY_MAP = dict (
overlay_distdir_root = dict (
value_type = 'fs_dir',
- description = '''
- DISTDIR which is used for Manifest creation and can,
- depending on the DISTDIR strategy,
- serve as package mirror directory.
- '''
+ description = (
+ 'this is the directory where hard/symbolic links '
+ 'to all package files will be created '
+ '(during Manifest file creation)'
+ ),
),
overlay_distdir_strategy = dict (
@@ -376,9 +376,10 @@ CONFIG_ENTRY_MAP = dict (
# they specify another location
distfiles_root = dict (
value_type = 'fs_dir',
- description = '''distfiles root,
- repos will create their distdirs in this directory.
- ''',
+ description = (
+ 'this is the directory where per-repo package directories '
+ 'will be created'
+ ),
),
# the repo config file(s)
@@ -447,7 +448,7 @@ CONFIG_ENTRY_MAP = dict (
package_rule_files = dict (
path = [ 'PACKAGE_RULES', 'files' ],
value_type = fs_abslist,
- description = 'list of package rule files',
+ description = 'list of package rule files/dirs',
),
# * alias
@@ -502,7 +503,7 @@ CONFIG_ENTRY_MAP = dict (
license_map = dict (
path = [ 'LICENSEMAP', 'file', ],
value_type = 'fs_file',
- description = None,
+ description = 'dictionary file for translating license strings',
)
# --- other
diff --git a/roverlay/config/entryutil.py b/roverlay/config/entryutil.py
index 1c6b7ea..cd5f230 100644
--- a/roverlay/config/entryutil.py
+++ b/roverlay/config/entryutil.py
@@ -13,6 +13,41 @@ import textwrap
from roverlay.config.entrymap import CONFIG_ENTRY_MAP
+def deref_entry ( name ):
+ entry_name = name.lower()
+ entry_next = CONFIG_ENTRY_MAP [entry_name]
+ while isinstance ( entry_next, str ):
+ entry_name = entry_next
+ entry_next = CONFIG_ENTRY_MAP [entry_name]
+ return ( entry_name, entry_next )
+# --- end of deref_entry (...) ---
+
+def deref_entry_safe ( name ):
+ visited = set()
+ entry_name = name.lower()
+ entry_next = CONFIG_ENTRY_MAP [entry_name]
+
+ while isinstance ( entry_next, str ):
+ visited.add ( entry_name )
+ entry_name = entry_next
+ entry_next = CONFIG_ENTRY_MAP [entry_name]
+
+ if entry_name in visited:
+ raise Exception (
+ "cyclic config entry detected for {!r}!".format ( name )
+ )
+
+ return ( entry_name, entry_next )
+# --- end of deref_entry_safe (...) ---
+
+def find_config_path ( name ):
+ entry_name, entry = deref_entry_safe ( name )
+ try:
+ return entry ['path']
+ except KeyError:
+ return entry_name.split ( '_' )
+# --- end of find_config_path (...) ---
+
def _iter_entries():
"""Iterates through all entries in CONFIG_ENTRY_MAP and yields config
entry information (entry name, description).
@@ -23,10 +58,12 @@ def _iter_entries():
# entry is disabled
pass
elif isinstance ( entry, dict ):
- if 'description' in entry:
- yield ( name, entry ['description'] )
- elif 'desc' in entry:
- yield ( name, entry ['desc'] )
+ description = entry.get ( 'description' ) or entry.get ( 'desc' )
+ if description:
+ if isinstance ( description, str ):
+ yield ( name, description )
+ else:
+ yield ( name, '\n'.join ( map ( str, description ) ) )
else:
yield ( name, )
elif isinstance ( entry, str ) and entry:
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-07-12 13:57 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-07-12 13:57 UTC (permalink / raw
To: gentoo-commits
commit: 5ba978bbb4230068c6f43626f235a342b7c4cd05
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul 12 13:46:05 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul 12 13:46:05 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=5ba978bb
config: fix want_dir_create for distfiles_root
---
roverlay/config/entrymap.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index 86c17da..e87a289 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -401,7 +401,7 @@ CONFIG_ENTRY_MAP = dict (
'this is the directory where per-repo package directories '
'will be created'
),
- want_dir_create = WANT_PRIVATE_FILEDIR | WANT_USERDIR,
+ want_dir_create = WANT_PRIVATE_DIR | WANT_USERDIR,
),
# the repo config file(s)
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
2013-07-12 13:57 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
@ 2013-07-12 13:57 ` André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-07-12 13:57 UTC (permalink / raw
To: gentoo-commits
commit: 50aa4030f1150b7408added17ad3c076b9bcfe3f
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul 12 13:43:42 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul 12 13:43:42 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=50aa4030
roverlay/config/defconfig: set DISTDIR=/.../mirror
Avoid distdir/distfiles confusion by setting DISTDIR to mirror.
---
roverlay/config/defconfig.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/roverlay/config/defconfig.py b/roverlay/config/defconfig.py
index 733a108..7ae0d5b 100644
--- a/roverlay/config/defconfig.py
+++ b/roverlay/config/defconfig.py
@@ -221,7 +221,7 @@ class RoverlayConfigCreation ( object ):
'',
ConfigOption ( 'DISTFILES', workdir ( 'distfiles' ) ),
ConfigOption ( 'OVERLAY_DIR', workdir ( 'overlay' ) ),
- ConfigOption ( 'DISTDIR', workdir ( 'distdir' ) ),
+ ConfigOption ( 'DISTDIR', workdir ( 'mirror' ) ),
ConfigOption (
'LOG_FILE', workdir ( 'log/roverlay.log' ), recommended=True,
use_default_desc=False
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-07-16 16:36 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-07-16 16:36 UTC (permalink / raw
To: gentoo-commits
commit: 39d0fc71190b45813be08386c638bb49e1827454
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Jul 15 22:28:30 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Jul 15 22:28:30 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=39d0fc71
roverlay/config/defconfig: set EVENT_HOOK_RESTRICT
---
roverlay/config/defconfig.py | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/roverlay/config/defconfig.py b/roverlay/config/defconfig.py
index 7ae0d5b..9e0f336 100644
--- a/roverlay/config/defconfig.py
+++ b/roverlay/config/defconfig.py
@@ -69,16 +69,22 @@ class ConfigOption ( object ):
self.append_newline = append_newline
self.value = None
self.defaults_to = defaults_to
+
+ #self.is_set = False
# --- end of __init__ (...) ---
+ def set_value ( self, value ):
+ self.value = value
+ #self.is_set = True
+
def gen_str ( self ):
entry = self.map_entry[1]
if self.value is None:
using_default = True
self.value = self.default
- elif self.value == self.default:
- using_default = True
+# elif self.value == self.default:
+# using_default = True
else:
using_default = False
@@ -198,8 +204,8 @@ class RoverlayConfigCreation ( object ):
except ( TypeError, ValueError ):
raise ConfigValueError ( key, value )
- if converted_value:
- option.value = svalue
+ if converted_value is not None:
+ option.set_value ( svalue )
else:
raise ConfigValueError ( key, value )
pass
@@ -279,8 +285,12 @@ class RoverlayConfigCreation ( object ):
'EVENT_HOOK', datadir ( 'hooks/mux.sh' ),
),
ConfigOption (
- 'EVENT_HOOK_RESTRICT', '-* overlay_success',
- comment_default=True, required=False,
+ 'EVENT_HOOK_RESTRICT', '-* overlay_success user',
+ description=(
+ 'Note:',
+ ' setting -user is highly recommended when running roverlay as root',
+ ),
+ comment_default=False, required=False,
defaults_to=( "*", "allow all" ),
),
ConfigOption (
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-07-24 17:45 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-07-24 17:45 UTC (permalink / raw
To: gentoo-commits
commit: 1dafffc5c417cba0ba4eafc1d5830ba63be149f1
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jul 24 17:40:10 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jul 24 17:43:54 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=1dafffc5
roverlay/config: set value_type to str if unset
This removes (unwanted) quote chars in config values. Config options that want to
keep the old behavior can do so by setting value_type=False.
---
roverlay/config/loader.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/roverlay/config/loader.py b/roverlay/config/loader.py
index 8bb3826..8c6a630 100644
--- a/roverlay/config/loader.py
+++ b/roverlay/config/loader.py
@@ -99,10 +99,9 @@ class ConfigLoader ( object ):
if path:
# verify and convert value if value_type is set
- if cref.get ( "value_type", None ):
- value = self._make_and_verify_value (
- cref ['value_type'], value
- )
+ value = self._make_and_verify_value (
+ cref.get ( 'value_type', str ), value
+ )
# --- end prepare value;
value_choices = cref.get ( "choices", None )
@@ -443,7 +442,10 @@ class ConfigLoader ( object ):
# --- end of _regex (...) ---
# replace whitespace with a single ' '
- value = unquote ( ConfigLoader.WHITESPACE.sub ( ' ', value ) )
+ if value_type is False:
+ return ConfigLoader.WHITESPACE.sub ( ' ', value )
+ else:
+ value = unquote ( ConfigLoader.WHITESPACE.sub ( ' ', value ) )
# convert value_type into a list of value types
if not value_type:
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-07-29 14:56 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-07-29 14:56 UTC (permalink / raw
To: gentoo-commits
commit: c9c9d8c3a29eb49b6b22eb0fa7db4577e6c1addc
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Jul 29 14:52:12 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Jul 29 14:52:12 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=c9c9d8c3
config entry map: add STATS_DB
---
roverlay/config/entrymap.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index 5800000..b6be4ab 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -537,7 +537,13 @@ CONFIG_ENTRY_MAP = dict (
path = [ 'LICENSEMAP', 'file', ],
value_type = 'fs_file',
description = 'dictionary file for translating license strings',
- )
+ ),
+
+ stats_db = dict (
+ path = [ 'RRD_DB', 'file', ],
+ value_type = 'fs_file',
+ description = 'stats database file',
+ ),
# --- other
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-07-30 18:40 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-07-30 18:40 UTC (permalink / raw
To: gentoo-commits
commit: 0ae9b1ffad16a71b325c29862d139e0ebf20dcbc
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Jul 30 16:05:00 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Jul 30 16:05:00 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=0ae9b1ff
roverlay/config: STATS_INTERVAL
Controls the time interval of the RRD.
---
roverlay/config/const.py | 4 ++++
roverlay/config/defconfig.py | 1 -
roverlay/config/entrymap.py | 8 ++++++++
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/roverlay/config/const.py b/roverlay/config/const.py
index b0a0b6e..2dc79c5 100644
--- a/roverlay/config/const.py
+++ b/roverlay/config/const.py
@@ -99,6 +99,10 @@ _CONSTANTS = dict (
)
),
),
+
+ RRD_DB = dict (
+ step = 7200,
+ ),
)
def lookup ( key, fallback_value=None ):
diff --git a/roverlay/config/defconfig.py b/roverlay/config/defconfig.py
index 9e0f336..47d67d0 100644
--- a/roverlay/config/defconfig.py
+++ b/roverlay/config/defconfig.py
@@ -208,7 +208,6 @@ class RoverlayConfigCreation ( object ):
option.set_value ( svalue )
else:
raise ConfigValueError ( key, value )
- pass
else:
raise ConfigOptionMissing ( key )
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index b6be4ab..af1d338 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -545,6 +545,14 @@ CONFIG_ENTRY_MAP = dict (
description = 'stats database file',
),
+ stats_interval = dict (
+ path = [ 'RRD_DB', 'step', ],
+ value_type = 'int',
+ description = (
+ 'database update interval (only used for creating new database files)'
+ ),
+ ),
+
# --- other
)
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-08-02 13:39 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-08-02 13:39 UTC (permalink / raw
To: gentoo-commits
commit: 8a4b1a7e8da001176d53f9ee9d735c4b2dd16ba2
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Aug 2 13:38:14 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Aug 2 13:38:14 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=8a4b1a7e
new config map entry: OVERLAY_MASTERS
sets the value for the 'masters = ...' attribute in metadata/layout.conf
---
roverlay/config/entrymap.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index af1d338..3551078 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -337,6 +337,12 @@ CONFIG_ENTRY_MAP = dict (
want_dir_create = WANT_PRIVATE_FILEDIR | WANT_USERDIR,
),
+ overlay_masters = dict (
+ path = [ 'OVERLAY', 'masters', ],
+ value_type = 'list:str',
+ description = 'masters attribute for metadata/layout.conf',
+ ),
+
# * alias
backup_desc = 'overlay_backup_desc',
eclass = 'overlay_eclass',
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-08-05 11:44 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-08-05 11:44 UTC (permalink / raw
To: gentoo-commits
commit: 323c7478ba5acd8055865de82c10135adcca789c
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Aug 5 11:06:36 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Aug 5 11:06:36 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=323c7478
config, license map: read licenses from file
maintain a file ("licenses" in CACHEDIR) containing licenses found in PORTDIR.
This allows to operate if PORTDIR is not available (once the file has been
created). Compression is supported (via roverlay.util.fileio).
---
roverlay/config/const.py | 4 ++
roverlay/config/defconfig.py | 8 +++
roverlay/config/entrymap.py | 48 ++++++++++++++---
roverlay/config/fielddef.py | 123 ++++++++++++++++++++++++++++++++++++++-----
roverlay/config/loader.py | 1 +
5 files changed, 166 insertions(+), 18 deletions(-)
diff --git a/roverlay/config/const.py b/roverlay/config/const.py
index 64ee0ad..f6492d7 100644
--- a/roverlay/config/const.py
+++ b/roverlay/config/const.py
@@ -82,6 +82,10 @@ _CONSTANTS = dict (
masters = [ 'gentoo', ],
),
+ LICENSEMAP = dict (
+ use_portdir = True,
+ ),
+
EVENT_HOOK = dict (
default_exe_relpath = [ 'hooks', 'mux.sh' ],
),
diff --git a/roverlay/config/defconfig.py b/roverlay/config/defconfig.py
index 47d67d0..8bf0701 100644
--- a/roverlay/config/defconfig.py
+++ b/roverlay/config/defconfig.py
@@ -341,6 +341,14 @@ class RoverlayConfigCreation ( object ):
defaults_to="<CACHEDIR>/distmap.db"
),
ConfigOption (
+ 'USE_PORTAGE_LICENSES', 'no', required=False,
+ comment_default=True, defaults_to="yes"
+ ),
+ ConfigOption (
+ 'CREATE_LICENSES_FILE', 'no', required=False,
+ comment_default=True, defaults_to="yes"
+ ),
+ ConfigOption (
'NOSYNC', 'yes', required=False, comment_default=True,
defaults_to="no",
),
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index 3551078..5cf5103 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -520,6 +520,48 @@ CONFIG_ENTRY_MAP = dict (
hook_restrict = 'event_hook_restrict',
+ # == license map ==
+
+ license_map = dict (
+ path = [ 'LICENSEMAP', 'file', ],
+ value_type = 'fs_file',
+ description = 'dictionary file for translating license strings',
+ ),
+
+ use_portage_licenses = dict (
+ path = [ 'LICENSEMAP', 'use_portdir', ],
+ value_type = 'yesno',
+ description = 'try to read licenses from PORTDIR/licenses',
+ ),
+
+ # hidden option (using CACHEDIR.root + "/licenses" as licenses file)
+ licenses_file = None,
+# licenses_file = dict (
+# path = [ 'LICENSEMAP', 'licenses_file', ],
+# value_type = 'fs_file',
+# description = (
+# 'licenses file (used as fallback if PORTDIR not available)'
+# ),
+# ),
+
+ create_licenses_file = dict (
+ path = [ 'LICENSEMAP', 'create_licenses_file', ],
+ value_type = 'yesno',
+ description = 'create a licenses file after reading portage licenses',
+ ),
+
+ # hidden option (always using bzip2)
+ licenses_file_compression = None,
+
+
+ # * alias
+ license_file = 'licenses_file',
+ create_license_file = 'create_licenses_file',
+ license_file_compression = 'licenses_file_compression',
+
+ # --- license map
+
+
# == other ==
cachedir = dict (
@@ -539,12 +581,6 @@ CONFIG_ENTRY_MAP = dict (
description = 'path to the portage directory (usually /usr/portage)',
),
- license_map = dict (
- path = [ 'LICENSEMAP', 'file', ],
- value_type = 'fs_file',
- description = 'dictionary file for translating license strings',
- ),
-
stats_db = dict (
path = [ 'RRD_DB', 'file', ],
value_type = 'fs_file',
diff --git a/roverlay/config/fielddef.py b/roverlay/config/fielddef.py
index 338995b..dd1449c 100644
--- a/roverlay/config/fielddef.py
+++ b/roverlay/config/fielddef.py
@@ -13,18 +13,25 @@ This module defines the following classes:
__all__ = [ 'DescriptionFieldDefinition', ]
import os
+import errno
+import itertools
try:
import configparser
except ImportError as running_python2:
# configparser is named ConfigParser in python2
import ConfigParser as configparser
+# -- end try
+
+
+import roverlay.rpackage.descriptionfields
+import roverlay.rpackage.licensemap
+import roverlay.util.fileio
-from roverlay.rpackage import descriptionfields, licensemap
class DescriptionFieldDefinition ( object ):
- """Loads field definition data."""
+ """Loads field definition data and the license map."""
def __init__ ( self, logger, config ):
@@ -34,6 +41,7 @@ class DescriptionFieldDefinition ( object ):
* logger -- logger to use
* config --
"""
+ super ( DescriptionFieldDefinition, self ).__init__()
self.logger = logger
self.config = config
self._parser = configparser.SafeConfigParser ( allow_no_value=True )
@@ -68,6 +76,102 @@ class DescriptionFieldDefinition ( object ):
# --- end of load_file (...) ---
+ def _create_license_map ( self ):
+ # get $PORTDIR/licenses/* or read license file ($PORTDIR is preferred)
+
+ LICENSE_FILE = self.config.get ( 'LICENSEMAP.licenses_file' )
+ if not LICENSE_FILE and self.config.get ( 'CACHEDIR.root' ):
+ LICENSE_FILE = (
+ self.config.get ( 'CACHEDIR.root' ) + os.sep + 'licenses'
+ )
+
+ # for writing the licenses file
+ LICENSE_FILE_COMPRESSION = self.config.get (
+ 'LICENSEMAP.licenses_file_compression', 'bzip2'
+ )
+
+ # tri-state CREATE_LICENSE_FILE (True,False,None):
+ #
+ # (True) create licenses file (fail if license file not set)
+ # (None) create licenses file if set
+ # (False) do not create licenses file
+ #
+ # Note:
+ # license_file is written if LICENSEMAP.licenses_file and/or
+ # CACHEDIR.root is set
+ #
+ ## Alternatively,
+ ## self.config.get ( 'LICENSEMAP.licenses_file', False )
+ ## instead of bool ( LICENSE_FILE )
+ CREATE_LICENSE_FILE = self.config.get (
+ 'LICENSEMAP.create_licenses_file', bool ( LICENSE_FILE )
+ )
+
+ TRY_PORTDIR_LICENSES = self.config.get_or_fail (
+ 'LICENSEMAP.use_portdir'
+ )
+ PORTDIR = self.config.get ( 'portdir' )
+
+ # -- end "constants"
+
+
+ licenses_list = None
+ using_portdir = False
+
+ if TRY_PORTDIR_LICENSES and PORTDIR:
+ portage_license_dir = PORTDIR + os.sep + 'licenses'
+
+ try:
+ portage_licenses = os.listdir ( portage_license_dir )
+ except OSError as oserr:
+ if oserr.errno != errno.ENOENT:
+ raise
+ else:
+ self.logger.info (
+ "Using {n:d} licenses from dir: {!r}".format (
+ portage_license_dir, n=len ( portage_licenses )
+ )
+ )
+ licenses_list = portage_licenses
+ using_portdir = True
+
+ # -- end if <try to read from portdir>
+
+ if licenses_list is None:
+ using_portdir = False
+ if not LICENSE_FILE:
+ raise Exception (
+ "config: LICENSEMAP.licenses_file is not set."
+ )
+
+ licenses_list = list (
+ itertools.chain.from_iterable (
+ line.strip().split ( None ) for line in
+ roverlay.util.fileio.read_text_file ( LICENSE_FILE )
+ )
+ )
+
+ self.logger.info (
+ "Using {n:d} licenses from file: {!r}".format (
+ LICENSE_FILE, n=len ( licenses_list )
+ )
+ )
+
+ elif CREATE_LICENSE_FILE:
+ roverlay.util.fileio.write_text_file (
+ LICENSE_FILE, sorted ( licenses_list ), LICENSE_FILE_COMPRESSION
+ )
+
+ self.logger.info (
+ "Wrote licenses file: {!r}".format ( LICENSE_FILE )
+ )
+ # -- end if <read from file> / <create licenses file>
+
+ return roverlay.rpackage.licensemap.LicenseMap (
+ licenses_list, self.config.get ( 'LICENSEMAP.file', None ),
+ )
+ # --- end of _create_license_map (...) ---
+
def get ( self ):
"""Creates and returns field definition data. Please see the example
field definition config file for details.
@@ -81,12 +185,14 @@ class DescriptionFieldDefinition ( object ):
return [ e for e in l if e.strip() ]
- fdef = descriptionfields.DescriptionFields()
+ fdef = roverlay.rpackage.descriptionfields.DescriptionFields()
parser = self._parser
for field_name in parser.sections():
- field = descriptionfields.DescriptionField ( field_name )
+ field = (
+ roverlay.rpackage.descriptionfields.DescriptionField ( field_name )
+ )
for option, value in parser.items ( field_name, 1 ):
if option == 'alias' or option == 'alias_withcase':
@@ -121,14 +227,7 @@ class DescriptionFieldDefinition ( object ):
fdef.update()
if fdef.get_fields_with_flag ( 'isLicense' ):
- # get $PORTDIR/licenses/*
- portdir_licenses = os.listdir (
- self.config.get_or_fail ( 'portdir' ) + os.sep + 'licenses'
- )
- fdef.license_map = licensemap.LicenseMap (
- portdir_licenses,
- self.config.get ( 'LICENSEMAP.file', None )
- )
+ fdef.license_map = self._create_license_map()
return fdef
# --- end of get (...) ---
diff --git a/roverlay/config/loader.py b/roverlay/config/loader.py
index 8c6a630..e05e72f 100644
--- a/roverlay/config/loader.py
+++ b/roverlay/config/loader.py
@@ -329,6 +329,7 @@ class ConfigLoader ( object ):
defaults to False
"""
if self.fielddef is None:
+ # field def loads the license map
self.fielddef = fielddef.DescriptionFieldDefinition (
self.logger, self.ctree
)
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-08-06 10:58 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-08-06 10:58 UTC (permalink / raw
To: gentoo-commits
commit: 2ebd2b46ac8b7c0f11f8328aeb335d38bad318c2
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Aug 6 10:23:04 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Aug 6 10:23:04 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=2ebd2b46
roverlay/config/fielddef: reduce log level
---
roverlay/config/fielddef.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/roverlay/config/fielddef.py b/roverlay/config/fielddef.py
index dd1449c..974da99 100644
--- a/roverlay/config/fielddef.py
+++ b/roverlay/config/fielddef.py
@@ -127,7 +127,7 @@ class DescriptionFieldDefinition ( object ):
if oserr.errno != errno.ENOENT:
raise
else:
- self.logger.info (
+ self.logger.debug (
"Using {n:d} licenses from dir: {!r}".format (
portage_license_dir, n=len ( portage_licenses )
)
@@ -151,7 +151,7 @@ class DescriptionFieldDefinition ( object ):
)
)
- self.logger.info (
+ self.logger.debug (
"Using {n:d} licenses from file: {!r}".format (
LICENSE_FILE, n=len ( licenses_list )
)
@@ -162,7 +162,7 @@ class DescriptionFieldDefinition ( object ):
LICENSE_FILE, sorted ( licenses_list ), LICENSE_FILE_COMPRESSION
)
- self.logger.info (
+ self.logger.debug (
"Wrote licenses file: {!r}".format ( LICENSE_FILE )
)
# -- end if <read from file> / <create licenses file>
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-08-09 15:27 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-08-09 15:27 UTC (permalink / raw
To: gentoo-commits
commit: 34ca4caa6798e901e50e317f4c59110e40258d5c
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Aug 9 12:00:49 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Aug 9 12:00:49 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=34ca4caa
config entry map: sort LOG_LEVEL
Use a tuple, not a [frozen]set. Results in predictable order when generating
config files (roverlay-mkconfig).
---
roverlay/config/entrymap.py | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index 5cf5103..976a267 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -56,10 +56,7 @@ is_fs_file = { 'value_type' : fs_file }
is_yesno = { 'value_type' : 'yesno' }
CAPSLOCK = ( 'CAPSLOCK', )
-LOG_LEVEL = frozenset ((
- "DEBUG", "INFO", "WARN",
- "WARNING", "ERROR", "CRITICAL"
-))
+LOG_LEVEL = ( "DEBUG", "INFO", "WARN", "WARNING", "ERROR", "CRITICAL" )
is_log_level = { 'choices' : LOG_LEVEL, 'flags' : CAPSLOCK }
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-08-09 15:27 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-08-09 15:27 UTC (permalink / raw
To: gentoo-commits
commit: 30776c9dacbbc3955a470c9f11761a2a0c153862
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Aug 9 12:03:49 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Aug 9 12:03:49 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=30776c9d
defconfig: add STATS_DB, STATS_INTERVAL
+ add db_written to EVENT_HOOK_RESTRICT
---
roverlay/config/defconfig.py | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/roverlay/config/defconfig.py b/roverlay/config/defconfig.py
index 8bf0701..62d58d2 100644
--- a/roverlay/config/defconfig.py
+++ b/roverlay/config/defconfig.py
@@ -216,6 +216,10 @@ class RoverlayConfigCreation ( object ):
datadir = self.get_datadir
confdir = self.get_confdir
+ cachedir = lambda p=None: (
+ workdir ( ( 'cache' + os.sep + p ) if p else 'cache' )
+ )
+
self.config = [
'# R-overlay.conf',
@@ -231,7 +235,7 @@ class RoverlayConfigCreation ( object ):
'LOG_FILE', workdir ( 'log/roverlay.log' ), recommended=True,
use_default_desc=False
),
- ConfigOption ( 'CACHEDIR', workdir ( 'cache' ) ),
+ ConfigOption ( 'CACHEDIR', cachedir() ),
ConfigOption (
'PORTDIR', '/usr/portage', use_default_desc=False,
description=(
@@ -281,10 +285,21 @@ class RoverlayConfigCreation ( object ):
'PACKAGE_RULES', confdir ( 'package-rules.d' ),
),
ConfigOption (
+ 'STATS_DB', cachedir ( 'stats.rrd' ),
+ defaults_to=( "", "disable persistent stats" ),
+ ),
+ ConfigOption (
+ 'STATS_INTERVAL', comment_default=True, required=False,
+ default="14400", defaults_to=( "7200", "2 hours" ),
+ description=(
+ 'expected time span between overlay creation runs, in seconds'
+ ),
+ ),
+ ConfigOption (
'EVENT_HOOK', datadir ( 'hooks/mux.sh' ),
),
ConfigOption (
- 'EVENT_HOOK_RESTRICT', '-* overlay_success user',
+ 'EVENT_HOOK_RESTRICT', '-* db_written overlay_success user',
description=(
'Note:',
' setting -user is highly recommended when running roverlay as root',
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-08-12 8:18 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-08-12 8:18 UTC (permalink / raw
To: gentoo-commits
commit: c2169e9246205275652a9bc7ffd886a6fd7b8ff4
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Aug 12 08:14:36 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Aug 12 08:14:36 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=c2169e92
roverla, defconfig: comment option if value empty
---
roverlay/config/defconfig.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/roverlay/config/defconfig.py b/roverlay/config/defconfig.py
index 62d58d2..c98ab8a 100644
--- a/roverlay/config/defconfig.py
+++ b/roverlay/config/defconfig.py
@@ -69,6 +69,7 @@ class ConfigOption ( object ):
self.append_newline = append_newline
self.value = None
self.defaults_to = defaults_to
+ self.comment_value = False
#self.is_set = False
# --- end of __init__ (...) ---
@@ -115,7 +116,7 @@ class ConfigOption ( object ):
yield '# Defaults to \"{}\".'.format ( self.defaults_to )
- if self.comment_default and using_default:
+ if self.comment_value or ( self.comment_default and using_default ):
yield "#{k}=\"{v}\"".format ( k=self.name, v=self.value )
else:
yield "{k}=\"{v}\"".format ( k=self.name, v=self.value )
@@ -206,6 +207,8 @@ class RoverlayConfigCreation ( object ):
if converted_value is not None:
option.set_value ( svalue )
+ elif isinstance ( value, str ) and not value:
+ option.comment_value = True
else:
raise ConfigValueError ( key, value )
else:
@@ -217,7 +220,7 @@ class RoverlayConfigCreation ( object ):
confdir = self.get_confdir
cachedir = lambda p=None: (
- workdir ( ( 'cache' + os.sep + p ) if p else 'cache' )
+ workdir ( os.path.join ( 'cache', p ) if p else 'cache' )
)
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-08-14 14:56 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-08-14 14:56 UTC (permalink / raw
To: gentoo-commits
commit: ed7d8045c34b1b545721166857d86d04b2d691cc
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Aug 13 12:06:01 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Aug 13 12:06:01 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=ed7d8045
config entry map: TEMPLATE_ROOT, TEMPLATE_MODULE_DIR
---
roverlay/config/entrymap.py | 43 +++++++++++++++++++++++++++++--------------
1 file changed, 29 insertions(+), 14 deletions(-)
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index 976a267..88974ba 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -558,24 +558,18 @@ CONFIG_ENTRY_MAP = dict (
# --- license map
+ # == stats / status report generation ==
- # == other ==
-
- cachedir = dict (
- path = [ 'CACHEDIR', 'root', ],
- value_type = 'fs_dir',
- description = 'directory for cache data',
- want_dir_create = WANT_PRIVATE_DIR | WANT_USERDIR,
+ template_root = dict (
+ path = [ 'STATS', 'TEMPLATE', 'root', ],
+ value_type = 'list:fs_dir',
+ description = 'directories with templates for status reports',
),
- nosync = dict (
- value_type = yesno,
- description = 'forbid/allow syncing with remotes',
- ),
-
- portdir = dict (
+ template_module_dir = dict (
+ path = [ 'STATS', 'TEMPLATE', 'module_dir', ],
value_type = 'fs_dir',
- description = 'path to the portage directory (usually /usr/portage)',
+ description = 'directory for caching templates',
),
stats_db = dict (
@@ -592,6 +586,27 @@ CONFIG_ENTRY_MAP = dict (
),
),
+ # --- stats / status report generation
+
+ # == other ==
+
+ cachedir = dict (
+ path = [ 'CACHEDIR', 'root', ],
+ value_type = 'fs_dir',
+ description = 'directory for cache data',
+ want_dir_create = WANT_PRIVATE_DIR | WANT_USERDIR,
+ ),
+
+ nosync = dict (
+ value_type = yesno,
+ description = 'forbid/allow syncing with remotes',
+ ),
+
+ portdir = dict (
+ value_type = 'fs_dir',
+ description = 'path to the portage directory (usually /usr/portage)',
+ ),
+
# --- other
)
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-09-04 10:16 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-09-04 10:16 UTC (permalink / raw
To: gentoo-commits
commit: e438767ef4e262de19a600680c9732d555ed8a8c
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Sep 4 10:12:59 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Sep 4 10:12:59 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=e438767e
config: comments, EVENT_HOOK_RC
EVENT_HOOK_RC is a shell file that should be loaded by the mux.sh script before
running the hooks.
Not defining hook-related variables in the main config file allows to use
$variables etc.
---
roverlay/config/entrymap.py | 12 +++++++++++-
roverlay/config/loader.py | 3 +--
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index 88974ba..c7b1493 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -22,7 +22,7 @@ known dict keys are 'path', 'description'/'desc' and 'value_type':
* path (string or list of strings) -- path of this entry in the config tree
* description (string) -- describes the entry
-* value_type (string), you can specify:
+* value_type can be any of:
-> list -- value is a whitespace-separated list
-> int -- integer
-> str -- [explicit string conversion]
@@ -33,6 +33,9 @@ known dict keys are 'path', 'description'/'desc' and 'value_type':
-> fs_dir -- fs_abs and value must be a dir if it exists
-> fs_file -- fs_abs and value must be a file if it exists
-> regex -- value is a regex and will be compiled (re.compile(..))
+-> a type (str,int,...)
+-> a callable that accepts one arg and returns the converted value or None,
+ where None means "not valid"
Multiple types are generally not supported ('this is an int or a str'),
but subtypes are ('list of yesno'), which can be specified by either
@@ -505,6 +508,12 @@ CONFIG_ENTRY_MAP = dict (
description = 'script that is run on certain events, e.g. overlay_success',
),
+ event_hook_rc = dict (
+ path = [ 'EVENT_HOOK', 'config_file', ],
+ value_type = 'fs_abs',
+ description = 'hook (shell) config file',
+ ),
+
event_hook_restrict = dict (
path = [ 'EVENT_HOOK', 'restrict', ],
value_type = 'list:str',
@@ -514,6 +523,7 @@ CONFIG_ENTRY_MAP = dict (
# * alias
hook = 'event_hook',
+ hook_rc = 'event_hook_rc',
hook_restrict = 'event_hook_restrict',
diff --git a/roverlay/config/loader.py b/roverlay/config/loader.py
index e05e72f..19d377b 100644
--- a/roverlay/config/loader.py
+++ b/roverlay/config/loader.py
@@ -402,7 +402,6 @@ class ConfigLoader ( object ):
else:
return None
-
def fs_file ( val ):
""""val is a file - returns expanded path if it is
an existent file or it does not exist.
@@ -455,7 +454,7 @@ class ConfigLoader ( object ):
vtypes = value_type
elif isinstance ( value_type, str ):
vtypes = value_type.split ( ':' )
- elif type ( value_type ) is type:
+ elif hasattr ( value_type, '__call__' ) or type ( value_type ) is type:
try:
return value_type ( value )
except ValueError:
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-09-06 17:27 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-09-06 17:27 UTC (permalink / raw
To: gentoo-commits
commit: 62c81650a1ce027d376dd04c70861a8be9faa934
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Sep 6 17:22:46 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Sep 6 17:22:46 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=62c81650
config tree: register_static, reset()
Optionally do not register a created ConfigTree instance as static instance.
Support for re-setting the config tree (which removes all config options from
it).
---
roverlay/config/tree.py | 33 +++++++++++++++++++++++++--------
1 file changed, 25 insertions(+), 8 deletions(-)
diff --git a/roverlay/config/tree.py b/roverlay/config/tree.py
index 4be20c1..c87df55 100644
--- a/roverlay/config/tree.py
+++ b/roverlay/config/tree.py
@@ -31,7 +31,7 @@ class ConfigTree ( object ):
# static access to the first created ConfigTree
instance = None
- def __init__ ( self, import_const=True ):
+ def __init__ ( self, import_const=True, register_static=None ):
"""Initializes an ConfigTree, which is a container for options/values.
Values can be stored directly (such as the field_definitions) or
in a tree-like { section -> subsection[s] -> option = value } structure.
@@ -41,21 +41,38 @@ class ConfigTree ( object ):
arguments:
* import_const -- whether to deepcopy constants into the config tree or
not. Copying allows faster lookups.
+ * register_static -- if True: register new instance as static
+ if None: same as for True unless a static instance
+ is already registered
+ else: do nothing
"""
- if ConfigTree.instance is None:
- ConfigTree.instance = self
+ if register_static is True or (
+ self.__class__.instance is None and register_static is None
+ ):
+ self.__class__.instance = self
self.logger = logging.getLogger ( self.__class__.__name__ )
else:
self.logger = logging.getLogger (
- self.__class__.__name__ + "(%i)" % id ( self ) )
+ "{}({:d}".format ( self.__class__.__name__, id ( self ) )
+ )
- self._config = const.clone() if import_const else dict ()
- self._const_imported = import_const
- self._field_definition = None
- self._use_extend_map = None
+ self._config = None
+ self._const_imported = False
+ self._field_definition = None
+ self._use_extend_map = None
+ self.reset ( import_const=import_const )
# --- end of __init__ (...) ---
+ def reset ( self, import_const=None ):
+ if import_const is not None:
+ self._const_imported = bool ( import_const )
+
+ self._config = const.clone() if self._const_imported else dict()
+ self._field_definition = None
+ self._use_extend_map = None
+ # --- end of reset (...) ---
+
def get_loader ( self ):
"""Returns a ConfigLoader for this ConfigTree."""
return ConfigLoader ( self )
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-09-10 14:40 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-09-10 14:40 UTC (permalink / raw
To: gentoo-commits
commit: 7875a144c06bad609a852a394c63fc92b0e158fa
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Sep 10 14:25:46 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Sep 10 14:25:46 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=7875a144
roverlay/config: load config from string
In addition to reading roverlay's config from a file, allow to load it from a
str.
---
roverlay/config/defconfig.py | 18 +++++++++++++-
roverlay/config/loader.py | 58 +++++++++++++++++++-------------------------
2 files changed, 42 insertions(+), 34 deletions(-)
diff --git a/roverlay/config/defconfig.py b/roverlay/config/defconfig.py
index c98ab8a..64f99d6 100644
--- a/roverlay/config/defconfig.py
+++ b/roverlay/config/defconfig.py
@@ -386,6 +386,22 @@ class RoverlayConfigCreation ( object ):
}
# --- end of reset (...) ---
+ def gen_lines ( self ):
+ for item in self.config:
+ yield str ( item )
+ # --- end of gen_lines (...) ---
+
+ def get_lines ( self ):
+ return list ( self.gen_lines() )
+ # --- end of get_lines (...) ---
+
+ def get_str ( self, append_newline=True ):
+ ret = '\n'.join ( self.gen_lines() ).rstrip()
+ return ( ret + '\n' ) if append_newline else ret
+ # --- end of get_str (...) ---
def __str__ ( self ):
- return '\n'.join ( map ( str, self.config ) )
+ return self.get_str ( False )
+ # --- end of __str__ (...) ---
+
+# --- end of RoverlayConfigCreation ---
diff --git a/roverlay/config/loader.py b/roverlay/config/loader.py
index 19d377b..2ec153a 100644
--- a/roverlay/config/loader.py
+++ b/roverlay/config/loader.py
@@ -24,6 +24,7 @@ from roverlay.config.entrymap import CONFIG_ENTRY_MAP
import roverlay.ebuild.useflagmap
+
def listlike ( var ):
return hasattr ( var, '__iter__' ) and not isinstance ( var, str )
# --- end of listlike (...) ---
@@ -259,46 +260,37 @@ class ConfigLoader ( object ):
# --- end of _add_entry (...) ---
- def load_config ( self, config_file ):
- """Loads a config file and integrates its content into the config tree.
- Older config entries may be overwritten.
-
- arguments:
- config_file -- path to the file that should be read
- """
-
- # load file
-
- try:
- fh = open ( config_file, 'r' )
- reader = shlex.shlex ( fh )
- reader.wordchars += ' ,./$()[]:+-@*~'
- reader.whitespace_split = False
-
+ def parse_config ( self, fh_or_str, config_file='input' ):
+ reader = shlex.shlex ( fh_or_str, config_file )
+ reader.wordchars += ' ,./$()[]:+-@*~'
+ reader.whitespace_split = False
- nextline = lambda : ( reader.get_token() for n in range (3) )
+ nextline = lambda: [ reader.get_token() for n in range(3) ]
- option, equal, value = nextline ()
+ option, equal, value = nextline()
- while equal == '=' or not ( option == value == reader.eof ):
- if equal == '=':
- self._add_entry ( option, value )
- else:
-
- self.logger.warning (
- "In '%s', cannot parse this line: '%s%s%s'." %
- ( config_file, option, equal, value )
+ while equal == '=' or not ( option == value == reader.eof ):
+ if equal == '=':
+ self._add_entry ( option, value )
+ else:
+ self.logger.warning (
+ "In {!r}, cannot parse this line: '{}{}{}'.".format (
+ config_file, option, equal, value
)
+ )
- option, equal, value = nextline ()
-
- except IOError as ioerr:
- raise
+ option, equal, value = nextline()
+ # --- end of parse_config (...) ---
- finally:
- if 'fh' in locals() and fh:
- fh.close()
+ def load_config ( self, config_file ):
+ """Loads a config file and integrates its content into the config tree.
+ Older config entries may be overwritten.
+ arguments:
+ config_file -- path to the file that should be read
+ """
+ with open ( config_file, 'rt' ) as FH:
+ self.parse_config ( FH, config_file )
# --- end of load_config (...) ---
def load_use_expand_map ( self, map_file ):
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-09-10 14:40 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-09-10 14:40 UTC (permalink / raw
To: gentoo-commits
commit: e3b01296ac26adc5eec4552afc14a59ed9963214
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Sep 10 14:25:11 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Sep 10 14:25:11 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=e3b01296
add file/dir paths to roverlay.config.const
---
roverlay/config/const.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/roverlay/config/const.py b/roverlay/config/const.py
index 20e5aad..411153a 100644
--- a/roverlay/config/const.py
+++ b/roverlay/config/const.py
@@ -21,9 +21,13 @@ _CONSTANTS = dict (
INSTALLINFO = dict (
# FIXME: rename key
- libexec = '/usr/share/roverlay', # ::LIBEXEC::
+ libexec = '/usr/share/roverlay', # ::DATA_ROOT::
+ confroot = '/etc/roverlay', # ::CONF_ROOT::
+ workroot = '~/roverlay', # ::WORK_ROOT::
),
+ config_file_name = "R-overlay.conf",
+
# logging defaults are in recipe/easylogger
DESCRIPTION = dict (
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-09-11 10:27 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-09-11 10:27 UTC (permalink / raw
To: gentoo-commits
commit: c04a83d5771b889fc2b906abfffc54eda405224f
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Sep 11 10:26:29 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Sep 11 10:26:29 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=c04a83d5
defconfig: add EVENT_HOOK_RC
---
roverlay/config/defconfig.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/roverlay/config/defconfig.py b/roverlay/config/defconfig.py
index 64f99d6..a137fd1 100644
--- a/roverlay/config/defconfig.py
+++ b/roverlay/config/defconfig.py
@@ -4,6 +4,8 @@
# Distributed under the terms of the GNU General Public License;
# either version 2 of the License, or (at your option) any later version.
+# TODO: generate config file for not-installed versions
+
import os.path
import re
import textwrap
@@ -302,6 +304,9 @@ class RoverlayConfigCreation ( object ):
'EVENT_HOOK', datadir ( 'hooks/mux.sh' ),
),
ConfigOption (
+ 'EVENT_HOOK_RC', confdir ( 'hookrc' ),
+ ),
+ ConfigOption (
'EVENT_HOOK_RESTRICT', '-* db_written overlay_success user',
description=(
'Note:',
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-09-11 10:27 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-09-11 10:27 UTC (permalink / raw
To: gentoo-commits
commit: dd6a1463bdfe9ceb7eba71b0b60a1cd0c28cee81
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Sep 11 10:26:55 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Sep 11 10:26:55 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=dd6a1463
defconfig: move STATS_DB file stats.rrd->stats.db
---
roverlay/config/defconfig.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/roverlay/config/defconfig.py b/roverlay/config/defconfig.py
index a137fd1..0a408db 100644
--- a/roverlay/config/defconfig.py
+++ b/roverlay/config/defconfig.py
@@ -290,7 +290,7 @@ class RoverlayConfigCreation ( object ):
'PACKAGE_RULES', confdir ( 'package-rules.d' ),
),
ConfigOption (
- 'STATS_DB', cachedir ( 'stats.rrd' ),
+ 'STATS_DB', cachedir ( 'stats.db' ),
defaults_to=( "", "disable persistent stats" ),
),
ConfigOption (
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-09-11 10:30 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-09-11 10:30 UTC (permalink / raw
To: gentoo-commits
commit: 37b00a4a92e9c35a4b9271a89314c5d035d2000e
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Sep 11 10:29:16 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Sep 11 10:29:16 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=37b00a4a
defconfig: set PACKAGE_RULES=$confdir/package_rules
roverlay currently installs a single package rules file. Let the default config
reflect this.
---
roverlay/config/defconfig.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/roverlay/config/defconfig.py b/roverlay/config/defconfig.py
index 0a408db..24c8f1f 100644
--- a/roverlay/config/defconfig.py
+++ b/roverlay/config/defconfig.py
@@ -287,7 +287,7 @@ class RoverlayConfigCreation ( object ):
),
),
ConfigOption (
- 'PACKAGE_RULES', confdir ( 'package-rules.d' ),
+ 'PACKAGE_RULES', confdir ( 'package_rules' ),
),
ConfigOption (
'STATS_DB', cachedir ( 'stats.db' ),
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-09-11 11:14 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-09-11 11:14 UTC (permalink / raw
To: gentoo-commits
commit: e635e845a5c590c811d8c2025d01c147b44e7893
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Sep 11 10:36:46 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Sep 11 10:36:59 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=e635e845
defconfig: remove STATS_INTERVAL
roverlay writes its stats to a flat file now, which makes this option useless.
---
roverlay/config/defconfig.py | 7 -------
1 file changed, 7 deletions(-)
diff --git a/roverlay/config/defconfig.py b/roverlay/config/defconfig.py
index 24c8f1f..2e926e8 100644
--- a/roverlay/config/defconfig.py
+++ b/roverlay/config/defconfig.py
@@ -294,13 +294,6 @@ class RoverlayConfigCreation ( object ):
defaults_to=( "", "disable persistent stats" ),
),
ConfigOption (
- 'STATS_INTERVAL', comment_default=True, required=False,
- default="14400", defaults_to=( "7200", "2 hours" ),
- description=(
- 'expected time span between overlay creation runs, in seconds'
- ),
- ),
- ConfigOption (
'EVENT_HOOK', datadir ( 'hooks/mux.sh' ),
),
ConfigOption (
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2013-09-13 15:10 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2013-09-13 15:10 UTC (permalink / raw
To: gentoo-commits
commit: 0138be482b63df9c34df6e0495fdeb39fef0b7f9
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Sep 13 14:57:40 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Sep 13 14:57:40 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=0138be48
defconfig: generate config files for standalone roverlay
---
roverlay/config/defconfig.py | 152 ++++++++++++++++++++++++++-----------------
1 file changed, 92 insertions(+), 60 deletions(-)
diff --git a/roverlay/config/defconfig.py b/roverlay/config/defconfig.py
index 3654fb8..40d6830 100644
--- a/roverlay/config/defconfig.py
+++ b/roverlay/config/defconfig.py
@@ -40,6 +40,19 @@ wrap_comment_lines = lambda e: '\n'.join (
map ( wrap_comment, do_iterate ( e ) )
)
+def _fspath_prefix_func ( *prefix ):
+ _PREFIX = os.path.join ( *prefix )
+ def wrapped ( *p ):
+ if p:
+ return os.path.join ( _PREFIX, *p ).rstrip ( os.path.sep )
+ else:
+ return _PREFIX
+ # --- end of wrapped (...) ---
+
+ return wrapped
+# --- end of _fspath_prefix_func (...) ---
+
+
class ConfigOptionMissing ( KeyError ):
def __init__ ( self, key ):
super ( ConfigOptionMissing, self ).__init__ (
@@ -129,50 +142,36 @@ class ConfigOption ( object ):
def __str__ ( self ):
return '\n'.join ( self.gen_str() )
+ # --- end of __str__ (...) ---
-
-
-
-def CommentedConfigOption (
- name, default=None, required=False,
- use_default_desc=False, append_newline=False, **kw
-):
- return ConfigOption (
- name, default=default, comment_default=True, required=required,
- use_default_desc=use_default_desc, append_newline=append_newline, **kw
- )
-
-
+# --- end of ConfigOption ---
class RoverlayConfigCreation ( object ):
def __init__ ( self,
is_installed,
- work_root = '~/roverlay',
- data_root = '/usr/share/roverlay',
- conf_root = '/etc/roverlay',
+ work_root = '~/roverlay',
+ data_root = '/usr/share/roverlay',
+ conf_root = '/etc/roverlay',
+ additions_dir = '/etc/roverlay/files',
):
- self.work_root = work_root
- self.data_root = data_root
- self.conf_root = conf_root
-
- self._ctree = tree.ConfigTree()
- self._cloader = self._ctree.get_loader()
- self._verify_value = self._cloader._make_and_verify_value
-
+ self.work_root = work_root
+ self.data_root = data_root
+ self.conf_root = conf_root
+ self.additions_dir = additions_dir
+
+ self.get_workdir = _fspath_prefix_func ( self.work_root )
+ self.get_datadir = _fspath_prefix_func ( self.data_root )
+ self.get_confdir = _fspath_prefix_func ( self.conf_root )
+ self.get_additions_dir = _fspath_prefix_func ( self.additions_dir )
+
+ self._ctree = tree.ConfigTree()
+ self._cloader = self._ctree.get_loader()
+ self._verify_value = self._cloader._make_and_verify_value
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 )
-
- def get_datadir ( self, p ):
- return os.path.join ( self.data_root, p ).rstrip ( os.path.sep )
-
- def get_confdir ( self, p ):
- return os.path.join ( self.conf_root, p ).rstrip ( os.path.sep )
-
def iter_options ( self ):
for item in self.config:
if isinstance ( item, ConfigOption ):
@@ -219,12 +218,22 @@ class RoverlayConfigCreation ( object ):
raise ConfigOptionMissing ( key )
def reset ( self, is_installed ):
- workdir = self.get_workdir
- datadir = self.get_datadir
- confdir = self.get_confdir
+ workdir = self.get_workdir
+ datadir = self.get_datadir
+ confdir = self.get_confdir
+ additions_dir = self.get_additions_dir
+
+ cachedir = _fspath_prefix_func ( self.work_root, 'cache' )
+
- cachedir = lambda p=None: (
- workdir ( os.path.join ( 'cache', p ) if p else 'cache' )
+ UNLESS_INSTALLED = lambda *a, **b: (
+ None if is_installed else ConfigOption ( *a, **b )
+ )
+ IF_INSTALLED = lambda *a, **b: (
+ ConfigOption ( *a, **b ) if is_installed else None
+ )
+ get_val = lambda v_inst, v_standalone: (
+ v_inst if is_installed else v_standalone
)
@@ -253,31 +262,49 @@ class RoverlayConfigCreation ( object ):
'',
'# --- Logging Configuration (optional) ---',
'',
- CommentedConfigOption ( 'LOG_LEVEL', 'WARNING',
- use_default_desc=True, append_newline=True,
+ ConfigOption (
+ 'LOG_LEVEL', get_val ( 'WARNING', 'INFO' ), required=False,
+ comment_default=is_installed,
+ ),
+ ConfigOption (
+ 'LOG_LEVEL_CONSOLE', get_val ( 'INFO', 'WARNING' ),
+ required=False, comment_default=is_installed,
+ use_default_desc=False, append_newline=False,
+ ),
+ ConfigOption (
+ 'LOG_LEVEL_FILE', get_val ( 'ERROR', 'WARNING' ),
+ required=False, comment_default=is_installed,
+ use_default_desc=False, append_newline=False,
),
- CommentedConfigOption ( 'LOG_LEVEL_CONSOLE', 'INFO' ),
- CommentedConfigOption ( 'LOG_LEVEL_FILE', 'ERROR' ),
'',
- CommentedConfigOption ( 'LOG_FILE_ROTATE', 'yes',
+ ConfigOption (
+ 'LOG_FILE_ROTATE', 'yes', required=False,
+ comment_default=is_installed, use_default_desc=False,
description='this enables per-run log files',
- append_newline=True, # defaults_to="no",
+ # defaults_to="no"
),
- CommentedConfigOption ( 'LOG_FILE_ROTATE_COUNT', '5',
+ ConfigOption (
+ 'LOG_FILE_ROTATE_COUNT', '5', required=False,
+ comment_default=True, use_default_desc=False,
description='number of backup log files to keep',
- append_newline=True,
+ defaults_to="3"
+ ),
+ ConfigOption (
+ 'LOG_FILE_UNRESOLVABLE',
+ workdir ( 'log', 'dep_unresolvable.log' ), required=False,
+ comment_default=is_installed,
),
'',
'# --- Other Configuration Options ---',
'',
# ADDITIONS_DIR: confdir or workdir?
- ConfigOption ( 'ADDITIONS_DIR', confdir ( 'files' ), ),
+ ConfigOption ( 'ADDITIONS_DIR', additions_dir() ),
ConfigOption (
- 'USE_EXPAND_RENAME', confdir ( 'files/use_expand.rename' ),
+ 'USE_EXPAND_RENAME', additions_dir ( 'use_expand.rename' ),
comment_default=True, required=False,
),
ConfigOption (
- 'USE_EXPAND_DESC', confdir ( 'file/use_expand.desc' ),
+ 'USE_EXPAND_DESC', additions_dir ( 'use_expand.desc' ),
comment_default=True, required=False,
),
ConfigOption (
@@ -310,6 +337,7 @@ class RoverlayConfigCreation ( object ):
comment_default=False, required=False,
defaults_to=( "*", "allow all" ),
),
+ UNLESS_INSTALLED ( 'TEMPLATE_ROOT', datadir ( 'mako_templates' ) ),
ConfigOption (
'LICENSE_MAP', confdir ( 'license.map' )
),
@@ -336,7 +364,11 @@ class RoverlayConfigCreation ( object ):
use_default_desc=False,
description='using the default field definition file',
),
-
+ UNLESS_INSTALLED (
+ 'DESCRIPTION_DIR', cachedir ( 'desc-files' ),
+ comment_default=True, required=False,
+ description='Note that this slows overlay creation down.',
+ ),
ConfigOption (
'DISTDIR_STRATEGY', 'hardlink symlink',
use_default_desc=False,
@@ -345,18 +377,17 @@ class RoverlayConfigCreation ( object ):
' try hard links first, then fall back to symbolic ones'
),
),
- CommentedConfigOption (
- 'DISTDIR_VERIFY', 'no', use_default_desc=True,
+ ConfigOption (
+ 'DISTDIR_VERIFY', 'no', required=False, comment_default=True,
description=' usually not needed',
- append_newline=True,
),
- CommentedConfigOption (
- 'DISTMAP_COMPRESSION', 'bzip2', use_default_desc=True,
- append_newline=True, defaults_to=True,
+ ConfigOption (
+ 'DISTMAP_COMPRESSION', 'bzip2', required=False,
+ comment_default=True, defaults_to=True,
),
- CommentedConfigOption (
- 'DISTMAP_FILE', '', use_default_desc=True, append_newline=True,
- defaults_to="<CACHEDIR>/distmap.db"
+ ConfigOption (
+ 'DISTMAP_FILE', '', required=False, comment_default=True,
+ defaults_to="<CACHEDIR>/distmap.db",
),
ConfigOption (
'USE_PORTAGE_LICENSES', 'no', required=False,
@@ -388,7 +419,8 @@ class RoverlayConfigCreation ( object ):
def gen_lines ( self ):
for item in self.config:
- yield str ( item )
+ if item is not None:
+ yield str ( item )
# --- end of gen_lines (...) ---
def get_lines ( self ):
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2014-01-26 19:06 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2014-01-26 19:06 UTC (permalink / raw
To: gentoo-commits
commit: d72284c4978f84bbdcdc54ce0c4b4d66b6d91ad3
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Sun Jan 26 16:37:44 2014 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Sun Jan 26 16:37:44 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=d72284c4
roverlay/config/, ConfigTree: get options by name
Added get_by_name() to the ConfigTree, which is similar to get(), but takes an
option name (used in config files, e.g. OVERLAY_DIR) instead of a config path
(used in the code, e.g. ['OVERLAY','dir']) as key.
query_by_name() can be used to get multiple options and return them as dict.
Might be useful for scripting.
---
roverlay/config/entryutil.py | 43 +++++++++++++++-----
roverlay/config/exceptions.py | 40 +++++++++++++++++++
roverlay/config/tree.py | 92 ++++++++++++++++++++++++++++++++++++++++---
3 files changed, 159 insertions(+), 16 deletions(-)
diff --git a/roverlay/config/entryutil.py b/roverlay/config/entryutil.py
index cd5f230..716c166 100644
--- a/roverlay/config/entryutil.py
+++ b/roverlay/config/entryutil.py
@@ -1,6 +1,6 @@
# R overlay -- config package, entryutil
# -*- coding: utf-8 -*-
-# Copyright (C) 2012 André Erdmann <dywi@mailerd.de>
+# Copyright (C) 2012-2014 André Erdmann <dywi@mailerd.de>
# Distributed under the terms of the GNU General Public License;
# either version 2 of the License, or (at your option) any later version.
@@ -11,9 +11,11 @@ __all__ = [ 'list_entries', ]
import re
import textwrap
+import roverlay.config.exceptions
from roverlay.config.entrymap import CONFIG_ENTRY_MAP
def deref_entry ( name ):
+ # COULDFIX: raise ConfigOptionNotFound
entry_name = name.lower()
entry_next = CONFIG_ENTRY_MAP [entry_name]
while isinstance ( entry_next, str ):
@@ -25,29 +27,50 @@ def deref_entry ( name ):
def deref_entry_safe ( name ):
visited = set()
entry_name = name.lower()
- entry_next = CONFIG_ENTRY_MAP [entry_name]
+ try:
+ entry_next = CONFIG_ENTRY_MAP [entry_name]
+ except KeyError:
+ # entry does not exist
+ raise roverlay.config.exceptions.ConfigOptionNotFound ( name )
while isinstance ( entry_next, str ):
visited.add ( entry_name )
entry_name = entry_next
- entry_next = CONFIG_ENTRY_MAP [entry_name]
+ try:
+ entry_next = CONFIG_ENTRY_MAP [entry_name]
+ except KeyError:
+ raise roverlay.config.exceptions.ConfigEntryMapException (
+ "dangling config map entry {!r} (<- {!r})".format (
+ entry_name, name
+ )
+ )
if entry_name in visited:
- raise Exception (
- "cyclic config entry detected for {!r}!".format ( name )
- )
+ raise roverlay.config.exceptions.ConfigEntryMapException (
+ "cyclic config entry detected for {!r}!".format ( name )
+ )
return ( entry_name, entry_next )
# --- end of deref_entry_safe (...) ---
def find_config_path ( name ):
entry_name, entry = deref_entry_safe ( name )
- try:
- return entry ['path']
- except KeyError:
- return entry_name.split ( '_' )
+ if entry:
+ try:
+ return entry ['path']
+ except KeyError:
+ return entry_name.split ( '_' )
+ else:
+ # hidden entry
+ raise roverlay.config.exceptions.ConfigOptionNotFound ( name )
# --- end of find_config_path (...) ---
+def iter_config_keys():
+ for key, entry in CONFIG_ENTRY_MAP.items():
+ if isinstance ( entry, dict ):
+ yield key
+# --- end of iter_config_keys (...) ---
+
def _iter_entries():
"""Iterates through all entries in CONFIG_ENTRY_MAP and yields config
entry information (entry name, description).
diff --git a/roverlay/config/exceptions.py b/roverlay/config/exceptions.py
new file mode 100644
index 0000000..715d9eb
--- /dev/null
+++ b/roverlay/config/exceptions.py
@@ -0,0 +1,40 @@
+# R overlay -- config package, exceptions
+# -*- coding: utf-8 -*-
+# Copyright (C) 2014 André Erdmann <dywi@mailerd.de>
+# Distributed under the terms of the GNU General Public License;
+# either version 2 of the License, or (at your option) any later version.
+
+__all__ = [
+ 'ConfigException', 'ConfigEntryMapException',
+ 'ConfigKeyError', 'ConfigOptionNotFound',
+ 'ConfigTreeUsageError',
+]
+
+
+class ConfigException ( Exception ):
+ pass
+# --- end of ConfigException ---
+
+class ConfigEntryMapException ( ConfigException ):
+ pass
+# --- end of ConfigEntryMapException ---
+
+
+class ConfigKeyError ( ConfigException ):
+ # or inherit KeyError
+ def __init__ ( self, config_key ):
+ super ( ConfigKeyError, self ).__init__ (
+ "config key {!r} not found but required.".format ( config_key )
+ )
+# --- end of ConfigKeyError ---
+
+class ConfigOptionNotFound ( ConfigException ):
+ pass
+# --- end of ConfigOptionNotFound ---
+
+class ConfigTreeUsageError ( ConfigException ):
+ def __init__ ( self, message=None ):
+ super ( ConfigTreeUsageError, self ).__init__ (
+ "bad usage" if message is None else message
+ )
+# --- end of ConfigTreeUsageError ---
diff --git a/roverlay/config/tree.py b/roverlay/config/tree.py
index d9f1900..0aeb86c 100644
--- a/roverlay/config/tree.py
+++ b/roverlay/config/tree.py
@@ -1,6 +1,6 @@
# R overlay -- config package, tree
# -*- coding: utf-8 -*-
-# Copyright (C) 2012 André Erdmann <dywi@mailerd.de>
+# Copyright (C) 2012-2014 André Erdmann <dywi@mailerd.de>
# Distributed under the terms of the GNU General Public License;
# either version 2 of the License, or (at your option) any later version.
@@ -20,9 +20,11 @@ __all__ = [ 'ConfigTree', ]
import logging
-from roverlay.config import const
-from roverlay.config.loader import ConfigLoader
-from roverlay.config.util import get_config_path
+import roverlay.config.exceptions
+from roverlay.config import const
+from roverlay.config.loader import ConfigLoader
+from roverlay.config.util import get_config_path
+from roverlay.config.entryutil import find_config_path
CONFIG_INJECTION_IS_BAD = True
@@ -115,7 +117,7 @@ class ConfigTree ( object ):
pass
else:
- raise Exception ( "bad usage" )
+ raise roverlay.config.exceptions.ConfigUsageError()
# --- end of merge_with (...) ---
@@ -207,6 +209,9 @@ class ConfigTree ( object ):
* key --
* fallback_value --
* fail_if_unset -- fail if key is neither in config nor const
+
+ raises:
+ * ConfigKeyError -- key does not exist and fail_if_unset is True
"""
config_value = self._findpath ( key )
@@ -219,7 +224,7 @@ class ConfigTree ( object ):
config_value = fallback
if config_value is None and fail_if_unset:
- raise Exception ( "config key '%s' not found but required." % key )
+ raise roverlay.config.exceptions.ConfigKeyError ( key )
return config_value
@@ -230,6 +235,81 @@ class ConfigTree ( object ):
return self.get ( key, fail_if_unset=True )
# --- end of get_or_fail ---
+ def get_by_name ( self, option_name, *args, **kwargs ):
+ """Searches for an option referenced by name (e.g. OVERLAY_DIR)
+ and returns its value. See ConfigTree.get() for details.
+
+ This is an inefficient operation meant for setup/query scripts.
+ Use get() where possible.
+
+ arguments:
+ * option_name
+ * *args, **kwargs -- passed to get()
+
+ raises:
+ * ConfigOptionNotFound -- option_name is unknown or hidden
+ * ConfigEntryMapException -- config entry is broken
+ * ConfigKeyError -- key does not exist and fail_if_unset is True
+ """
+ return self.get ( find_config_path ( option_name ), *args, **kwargs )
+ # --- end of get_by_name (...) ---
+
+ def get_by_name_or_fail ( self, option_name ):
+ """Alias to self.get_by_name ( key, fail_if_unset=True )."""
+ return self.get_by_name ( option_name, fail_if_unset=True )
+ # --- end of get_by_name_or_fail (...) ---
+
+ def query_by_name ( self,
+ request, empty_missing=False, convert_value=None
+ ):
+ """Creates a dict<var_name,value> of config options, referenced by name
+
+ Returns: 2-tuple ( # of missing options, var dict ).
+
+ arguments:
+ * request -- an iterable containing strings
+ or 2-tuples(option_name,var_name)
+ * empty_missing -- whether to create empty entries for missing options
+ or not. Defaults to False.
+ * convert_value -- if set and not None: convert config values using
+ this function before adding them to the resulting
+ dict
+ """
+ num_missing = 0
+ retvars = dict()
+
+ for k in request:
+ if (
+ not isinstance ( k, str ) and hasattr ( k, '__iter__' )
+ and len ( k ) > 1
+ ):
+
+ option_name = k[0]
+ var_name = k[1]
+ else:
+ option_name = str(k)
+ var_name = option_name
+ # -- end if <set option_name/var_name>
+
+ try:
+ value = self.get_by_name_or_fail ( option_name )
+ except (
+ roverlay.config.exceptions.ConfigOptionNotFound,
+ roverlay.config.exceptions.ConfigKeyError
+ ):
+ num_missing += 1
+ if empty_missing:
+ retvars [var_name] = ""
+ else:
+ if convert_value is not None:
+ retvars [var_name] = convert_value ( value )
+ else:
+ retvars [var_name] = value
+ # -- end for <request>
+
+ return ( num_missing, retvars )
+ # --- end of query_by_name (...) ---
+
def get_field_definition ( self, force_update=False ):
"""Gets the field definition stored in this ConfigTree.
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2014-04-01 16:38 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2014-04-01 16:38 UTC (permalink / raw
To: gentoo-commits
commit: 0afe47d7ddff30f1e82f942e865afeb1672a7ca5
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Mar 31 15:41:11 2014 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Mar 31 15:41:11 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=0afe47d7
config entry map: make LICENSES_FILE configurable
---
roverlay/config/entrymap.py | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index fb285a1..46c2f7f 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -553,15 +553,13 @@ CONFIG_ENTRY_MAP = dict (
description = 'try to read licenses from PORTDIR/licenses',
),
- # hidden option (using CACHEDIR.root + "/licenses" as licenses file)
- licenses_file = None,
-# licenses_file = dict (
-# path = [ 'LICENSEMAP', 'licenses_file', ],
-# value_type = 'fs_file',
-# description = (
-# 'licenses file (used as fallback if PORTDIR not available)'
-# ),
-# ),
+ licenses_file = dict (
+ path = [ 'LICENSEMAP', 'licenses_file', ],
+ value_type = 'fs_file',
+ description = (
+ 'licenses file (used as fallback if PORTDIR not available)'
+ ),
+ ),
create_licenses_file = dict (
path = [ 'LICENSEMAP', 'create_licenses_file', ],
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2014-04-01 16:38 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2014-04-01 16:38 UTC (permalink / raw
To: gentoo-commits
commit: 23adf50912a502873b4799ce74c2ef5e5814f508
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Mar 31 15:39:56 2014 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Mar 31 15:39:56 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=23adf509
config/fielddef: log path of the missing licenses file
---
roverlay/config/fielddef.py | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/roverlay/config/fielddef.py b/roverlay/config/fielddef.py
index d5ff53d..ee4e943 100644
--- a/roverlay/config/fielddef.py
+++ b/roverlay/config/fielddef.py
@@ -140,12 +140,20 @@ class DescriptionFieldDefinition ( object ):
"config: LICENSEMAP.licenses_file is not set."
)
- licenses_list = list (
- itertools.chain.from_iterable (
- line.strip().split ( None ) for line in
- roverlay.util.fileio.read_text_file ( LICENSE_FILE )
+ try:
+ licenses_list = list (
+ itertools.chain.from_iterable (
+ line.strip().split ( None ) for line in
+ roverlay.util.fileio.read_text_file ( LICENSE_FILE )
+ )
)
- )
+ except IOError as err:
+ if err.errno == errno.ENOENT:
+ self.logger.critical (
+ "licenses file {!r} does not exist.".format ( LICENSE_FILE )
+ )
+ # -- end if
+ raise
self.logger.debug (
"Using {n:d} licenses from file: {!r}".format (
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2014-04-01 16:38 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2014-04-01 16:38 UTC (permalink / raw
To: gentoo-commits
commit: c8a9eee2bc05ec7c02110318277cc0604c69ad44
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Mar 31 15:39:17 2014 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Mar 31 15:39:17 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=c8a9eee2
config/entryutil: iter_entries_with_value_type()
---
roverlay/config/entryutil.py | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/roverlay/config/entryutil.py b/roverlay/config/entryutil.py
index 716c166..899bd4d 100644
--- a/roverlay/config/entryutil.py
+++ b/roverlay/config/entryutil.py
@@ -65,6 +65,29 @@ def find_config_path ( name ):
raise roverlay.config.exceptions.ConfigOptionNotFound ( name )
# --- end of find_config_path (...) ---
+def iter_visible_entries():
+ for entry_key, entry in CONFIG_ENTRY_MAP.items():
+ if entry is not None:
+ # else entry is disabled
+ yield ( entry_key, entry )
+# --- end of iter_visible_entries (...) ---
+
+def iter_entries_with_value_type ( value_types ):
+ for key, entry in iter_visible_entries():
+ if isinstance ( entry, dict ):
+ if entry.get ( 'value_type' ) in value_types:
+ yield ( key, entry )
+ elif entry and isinstance ( entry, str ):
+ # ^ not really necessary
+ real_key, real_entry = deref_entry_safe ( key )
+ if (
+ isinstance ( real_entry, dict )
+ and real_entry.get ( 'value_type' ) in value_types
+ ):
+ yield ( key, real_entry )
+ # -- end for
+# --- end of iter_entries_with_value_type (...) ---
+
def iter_config_keys():
for key, entry in CONFIG_ENTRY_MAP.items():
if isinstance ( entry, dict ):
@@ -75,12 +98,9 @@ def _iter_entries():
"""Iterates through all entries in CONFIG_ENTRY_MAP and yields config
entry information (entry name, description).
"""
- for entry_key, entry in CONFIG_ENTRY_MAP.items():
+ for entry_key, entry in iter_visible_entries():
name = entry_key.upper()
- if entry is None:
- # entry is disabled
- pass
- elif isinstance ( entry, dict ):
+ if isinstance ( entry, dict ):
description = entry.get ( 'description' ) or entry.get ( 'desc' )
if description:
if isinstance ( description, str ):
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2014-08-23 19:03 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2014-08-23 19:03 UTC (permalink / raw
To: gentoo-commits
commit: 3082162095b944388a5b6942135a8d6326cb89d9
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Sat Aug 23 17:50:46 2014 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Sat Aug 23 17:56:30 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=30821620
set default EAPI=5 and make it configurable
SLOTted dependency rules allow to use EAPI 5 features, so default to 5.
---
roverlay/config/const.py | 2 +-
roverlay/config/defconfig.py | 4 ++++
roverlay/config/entrymap.py | 11 +++++------
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/roverlay/config/const.py b/roverlay/config/const.py
index 0933689..046268b 100644
--- a/roverlay/config/const.py
+++ b/roverlay/config/const.py
@@ -49,7 +49,7 @@ _CONSTANTS = dict (
'# $Header: $\n'
).format ( year=time.gmtime()[0] ),
# EAPI=N and inherit <eclasses> are no longer part of the default header
- eapi = 4,
+ eapi = 5,
# number of workers used by OverlayCreator
# when 0 => dont use threads
diff --git a/roverlay/config/defconfig.py b/roverlay/config/defconfig.py
index 383bb96..145905f 100644
--- a/roverlay/config/defconfig.py
+++ b/roverlay/config/defconfig.py
@@ -426,6 +426,10 @@ class RoverlayConfigCreation ( object ):
defaults_to="no",
),
ConfigOption (
+ 'EBUILD_EAPI', '5', required=False, comment_default=True,
+ defaults_to="5",
+ ),
+ ConfigOption (
'MANIFEST_IMPLEMENTATION', 'ebuild', required=False,
use_default_desc=False, comment_default=True, defaults_to="next",
description=(
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py
index 46c2f7f..3e188b3 100644
--- a/roverlay/config/entrymap.py
+++ b/roverlay/config/entrymap.py
@@ -366,11 +366,10 @@ CONFIG_ENTRY_MAP = dict (
# == ebuild ==
- ebuild_eapi = None,
-# ebuild_eapi = dict (
-# description = "EAPI of the created ebuilds",
-# value_type = str,
-# ),
+ ebuild_eapi = dict (
+ description = "EAPI of the created ebuilds",
+ value_type = str,
+ ),
ebuild_use_expand_desc = dict (
path = [ 'EBUILD', 'USE_EXPAND', 'desc_file', ],
@@ -394,7 +393,7 @@ CONFIG_ENTRY_MAP = dict (
),
# * alias
- #eapi = 'ebuild_eapi',
+ eapi = 'ebuild_eapi',
use_expand_desc = 'ebuild_use_expand_desc',
use_expand_name = 'ebuild_use_expand_name',
use_expand_rename = 'ebuild_use_expand_rename',
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2014-08-23 19:03 André Erdmann
0 siblings, 0 replies; 54+ messages in thread
From: André Erdmann @ 2014-08-23 19:03 UTC (permalink / raw
To: gentoo-commits
commit: 7224fec5b78c8ac4c2c52d5615cc8ea42726c8a2
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Sat Aug 23 17:15:50 2014 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Sat Aug 23 17:15:50 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=7224fec5
config loader, yesno(): use str_to_bool()
---
roverlay/config/loader.py | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/roverlay/config/loader.py b/roverlay/config/loader.py
index f5d28d8..76c73b0 100644
--- a/roverlay/config/loader.py
+++ b/roverlay/config/loader.py
@@ -17,7 +17,7 @@ import re
import shlex
import os.path
-from roverlay.strutil import unquote
+from roverlay.strutil import unquote, str_to_bool
from roverlay.config import fielddef
from roverlay.config.util import get_config_path
from roverlay.config.entrymap import CONFIG_ENTRY_MAP
@@ -365,15 +365,12 @@ class ConfigLoader ( object ):
arguments:
* val --
"""
- if not val is None:
- to_check = str ( val ).lower()
- if to_check in [ 'y', 'yes', '1', 'true', 'enabled', 'on' ]:
- return 1
- elif to_check in [ 'n', 'no', '0', 'false', 'disabled', 'off' ]:
- return 0
-
- self.logger.warning ( str(val) + " is not a valid yesno value." )
- return -1
+ ret = str_to_bool ( val, nofail=True )
+ if ret is None:
+ self.logger.warning ( str(val) + " is not a valid yesno value." )
+ return -1
+ else:
+ return int(ret)
# --- end of yesno (...) ---
def fs_path ( val ):
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2018-05-28 8:41 Benda XU
0 siblings, 0 replies; 54+ messages in thread
From: Benda XU @ 2018-05-28 8:41 UTC (permalink / raw
To: gentoo-commits
commit: 29cec600df6c36b53e9b662ae7cb0865ab4eb61e
Author: Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Mon May 28 08:40:27 2018 +0000
Commit: Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Mon May 28 08:40:27 2018 +0000
URL: https://gitweb.gentoo.org/proj/R_overlay.git/commit/?id=29cec600
remove cvs header and bump to EAPI=6.
roverlay/config/const.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/roverlay/config/const.py b/roverlay/config/const.py
index 046268b..2235ab5 100644
--- a/roverlay/config/const.py
+++ b/roverlay/config/const.py
@@ -46,10 +46,9 @@ _CONSTANTS = dict (
default_header = (
'# Copyright 1999-{year:d} Gentoo Foundation\n'
'# Distributed under the terms of the GNU General Public License v2\n'
- '# $Header: $\n'
).format ( year=time.gmtime()[0] ),
# EAPI=N and inherit <eclasses> are no longer part of the default header
- eapi = 5,
+ eapi = 6,
# number of workers used by OverlayCreator
# when 0 => dont use threads
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/
@ 2018-05-30 5:31 Benda XU
0 siblings, 0 replies; 54+ messages in thread
From: Benda XU @ 2018-05-30 5:31 UTC (permalink / raw
To: gentoo-commits
commit: 9266d275e95b3cefd8b93828dd4a3952959b9ac8
Author: Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Wed May 30 05:23:08 2018 +0000
Commit: Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Wed May 30 05:23:08 2018 +0000
URL: https://gitweb.gentoo.org/proj/R_overlay.git/commit/?id=9266d275
const.py: do not split on ',' inside a pair of '()'.
roverlay/config/const.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/roverlay/config/const.py b/roverlay/config/const.py
index 2235ab5..68856b6 100644
--- a/roverlay/config/const.py
+++ b/roverlay/config/const.py
@@ -33,7 +33,7 @@ _CONSTANTS = dict (
DESCRIPTION = dict (
field_separator = ':',
comment_chars = '#;',
- list_split_regex = '\s*[,;]{1}\s*',
+ list_split_regex = '\s*[,;]{1}\s*(?![^\(]*\))',
file_name = 'DESCRIPTION',
),
^ permalink raw reply related [flat|nested] 54+ messages in thread
end of thread, other threads:[~2018-05-30 5:31 UTC | newest]
Thread overview: 54+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-26 15:42 [gentoo-commits] proj/R_overlay:master commit in: roverlay/config/ André Erdmann
-- strict thread matches above, loose matches on Subject: below --
2018-05-30 5:31 Benda XU
2018-05-28 8:41 Benda XU
2014-08-23 19:03 André Erdmann
2014-08-23 19:03 André Erdmann
2014-04-01 16:38 André Erdmann
2014-04-01 16:38 André Erdmann
2014-04-01 16:38 André Erdmann
2014-01-26 19:06 André Erdmann
2013-09-13 15:10 André Erdmann
2013-09-11 11:14 André Erdmann
2013-09-11 10:30 André Erdmann
2013-09-11 10:27 André Erdmann
2013-09-11 10:27 André Erdmann
2013-09-10 14:40 André Erdmann
2013-09-10 14:40 André Erdmann
2013-09-06 17:27 André Erdmann
2013-09-04 10:16 André Erdmann
2013-08-14 14:56 André Erdmann
2013-08-12 8:18 André Erdmann
2013-08-09 15:27 André Erdmann
2013-08-09 15:27 André Erdmann
2013-08-06 10:58 André Erdmann
2013-08-05 11:44 André Erdmann
2013-08-02 13:39 André Erdmann
2013-07-30 18:40 André Erdmann
2013-07-29 14:56 André Erdmann
2013-07-24 17:45 André Erdmann
2013-07-16 16:36 André Erdmann
2013-07-12 13:57 André Erdmann
2013-07-12 13:57 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-12 13:57 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-07-11 16:29 André Erdmann
2013-07-10 15:10 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-10 16:16 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-06-30 15:58 André Erdmann
2013-06-19 18:59 André Erdmann
2013-06-13 16:34 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-06-18 14:12 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-06-04 21:06 André Erdmann
2013-02-09 20:45 André Erdmann
2013-02-09 20:45 André Erdmann
2013-02-09 20:45 André Erdmann
2013-01-28 23:54 André Erdmann
2013-01-28 23:54 André Erdmann
2012-08-09 9:26 André Erdmann
2012-08-08 23:46 André Erdmann
2012-08-02 15:14 André Erdmann
2012-08-01 21:10 André Erdmann
2012-07-11 18:43 André Erdmann
2012-07-06 22:19 André Erdmann
2012-07-06 22:19 André Erdmann
2012-07-05 16:00 André Erdmann
2012-07-03 17:48 André Erdmann
2012-06-29 22:48 André Erdmann
2012-06-25 18:19 André Erdmann
2012-06-25 18:19 André Erdmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox