* [gentoo-commits] proj/grss:master commit in: /, utils/
@ 2015-07-01 21:19 Anthony G. Basile
0 siblings, 0 replies; only message in thread
From: Anthony G. Basile @ 2015-07-01 21:19 UTC (permalink / raw
To: gentoo-commits
commit: 78981c587563fc1721b9ebefe5f376355da7d4db
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 1 21:21:34 2015 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Jul 1 21:21:34 2015 +0000
URL: https://gitweb.gentoo.org/proj/grss.git/commit/?id=78981c58
make-worldconf: approximately build world.conf from and existing system.
utils/make-worldconf => make-worldconf | 28 ++++++++++++++++++----------
setup.py | 2 +-
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/utils/make-worldconf b/make-worldconf
similarity index 81%
rename from utils/make-worldconf
rename to make-worldconf
index 29cf5b8..5ab0b46 100755
--- a/utils/make-worldconf
+++ b/make-worldconf
@@ -6,45 +6,52 @@ import os
import re
import sys
+from grs import CONST
+
from _emerge.main import parse_opts
from _emerge.actions import load_emerge_config, create_depgraph_params
from _emerge.depgraph import backtrack_depgraph
-PORTAGE_CONFIGDIR = '/etc/portage'
-
def useflags(config, p):
# Get all IUSE, enabled USE and EXPAND_HIDDEN flags.
try:
iuse = list(p.iuse.all)
use = list(p.use.enabled)
- expand_hidden = list(p.use._expand_hidden)
+ # expand = list(p.use.expand)
+ expand_hidden = list(p.use.expand_hidden)
except AttributeError:
return
except TypeError:
return
- # Remove any EXPAND_HIDDEN flags from IUSE flags
+ # We only include select USE_EXPAND flags. Note becaue of how we match 'abi_',
+ # for example, will match abi_ppc, abi_mips etc. Hopefully this will not lead
+ # to any false hits.
+ expand = [ 'kernel_', 'elibc_', 'userland_', 'abi_', 'linguas_', 'python_' ]
+
+ # Remove any selected USE_EXPAND and any EXPAND_HIDDEN flags from IUSE flags
my_iuse = copy.deepcopy(iuse)
for u in iuse:
- for e in expand_hidden:
+ for e in expand + expand_hidden:
while re.match(e, u):
try:
my_iuse.remove(u)
except ValueError:
break
- # Remove any EXPAND_HIDDEN flags from the enabled USE flags
+ # Remove the same flags from the enabled USE flags
my_use = copy.deepcopy(use)
for u in use:
- for e in expand_hidden:
+ for e in expand + expand_hidden:
while re.match(e, u):
try:
my_use.remove(u)
except ValueError:
break
- # Remove the arch flag - this needs to be generalized
+ # Remove the arch flag.
+ # TODO: this needs to be generalized.
my_use.remove('amd64')
# Go through all the IUSE flags and put a - in front
@@ -72,6 +79,7 @@ def keywords(config, p):
if p.get_keyword_mask() == 'missing':
keyword = '**'
if p.get_keyword_mask() == 'unstable':
+ # This needs to be generalized
keyword = '~amd64'
except AttributeError:
pass
@@ -82,7 +90,7 @@ def keywords(config, p):
def envvars(config, p):
try:
- fpath = os.path.join(PORTAGE_CONFIGDIR, 'package.env')
+ fpath = os.path.join(CONST.PORTAGE_CONFIGDIR, 'package.env')
with open(fpath, 'r') as g:
for l in g.readlines():
# This matching needs to be made more strick.
@@ -90,7 +98,7 @@ def envvars(config, p):
config[p.slot_atom]['+package.env'] = '%s %s' % (p.slot_atom,
re.sub('[/:]', '_', p.slot_atom))
m = re.search('(\S+)\s+(\S+)', l)
- env_file = os.path.join(PORTAGE_CONFIGDIR, 'env')
+ env_file = os.path.join(CONST.PORTAGE_CONFIGDIR, 'env')
env_file = os.path.join(env_file, m.group(2))
with open(env_file, 'r') as h:
config[p.slot_atom]['env/%s' % re.sub('[/:]', '_', p.slot_atom)] = h.read()
diff --git a/setup.py b/setup.py
index e5934a8..3c5f444 100755
--- a/setup.py
+++ b/setup.py
@@ -17,6 +17,6 @@ setup(
author_email = 'blueness@gentoo.org',
license = 'GNU General Public License, Version 2',
packages = ['grs'],
- scripts = ['grsrun', 'grsup', 'clean-worldconf', 'install-worldconf'],
+ scripts = ['grsrun', 'grsup', 'clean-worldconf', 'install-worldconf', 'make-worldconf'],
data_files = [('/etc/grs', ['systems.conf'])]
)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-07-01 21:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-01 21:19 [gentoo-commits] proj/grss:master commit in: /, utils/ Anthony G. Basile
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox