From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id C3472138CD0 for ; Wed, 1 Jul 2015 21:19:24 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2898BE0817; Wed, 1 Jul 2015 21:19:19 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id BEBCBE0817 for ; Wed, 1 Jul 2015 21:19:18 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CDD353406F2 for ; Wed, 1 Jul 2015 21:19:17 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 2F30572B for ; Wed, 1 Jul 2015 21:19:16 +0000 (UTC) From: "Anthony G. Basile" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" Message-ID: <1435785694.78981c587563fc1721b9ebefe5f376355da7d4db.blueness@gentoo> Subject: [gentoo-commits] proj/grss:master commit in: /, utils/ X-VCS-Repository: proj/grss X-VCS-Files: make-worldconf setup.py utils/make-worldconf X-VCS-Directories: utils/ / X-VCS-Committer: blueness X-VCS-Committer-Name: Anthony G. Basile X-VCS-Revision: 78981c587563fc1721b9ebefe5f376355da7d4db X-VCS-Branch: master Date: Wed, 1 Jul 2015 21:19:16 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: bf54c392-db77-4610-8fe3-7923961d6463 X-Archives-Hash: 81d99770b5ca6fec3be993f0beb26562 commit: 78981c587563fc1721b9ebefe5f376355da7d4db Author: Anthony G. Basile gentoo org> AuthorDate: Wed Jul 1 21:21:34 2015 +0000 Commit: Anthony G. Basile gentoo 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'])] )