From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QZoa2-0000eL-D6 for garchives@archives.gentoo.org; Thu, 23 Jun 2011 18:24:45 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9D0621C06A; Thu, 23 Jun 2011 18:23:59 +0000 (UTC) Received: from smtprelay06.ispgateway.de (smtprelay06.ispgateway.de [80.67.31.95]) by pigeon.gentoo.org (Postfix) with ESMTP id 1F0951C06A for ; Thu, 23 Jun 2011 18:23:58 +0000 (UTC) Received: from [130.149.85.162] (helo=[10.23.42.168]) by smtprelay06.ispgateway.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1QZoZJ-0006c7-Ti; Thu, 23 Jun 2011 20:23:57 +0200 Message-ID: <4E0384BD.7060406@gentoo.org> Date: Thu, 23 Jun 2011 20:23:57 +0200 From: Sebastian Pipping User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110526 Thunderbird/3.1.10 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-catalyst@lists.gentoo.org Reply-to: gentoo-catalyst@lists.gentoo.org MIME-Version: 1.0 To: gentoo-catalyst@lists.gentoo.org, =?ISO-8859-1?Q?Ra=FAl_Porcel?= Subject: Re: [gentoo-catalyst] Undocumented subarches, e.g. core2 References: <4E02589E.9090006@gentoo.org> In-Reply-To: <4E02589E.9090006@gentoo.org> Content-Type: multipart/mixed; boundary="------------050001080304030905040506" X-Df-Sender: sping-gentoo@binera.de X-Archives-Salt: X-Archives-Hash: 911b63d301a23960b2501be7d91bcaa1 This is a multi-part message in MIME format. --------------050001080304030905040506 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hello again, attached is a new script to generate the table of subarches in GuideXML for copy and paste. With such a script I expect that it will be easier to keep the table in sync in the future. I would like to see 1) that script integrated into the catalyst_2 branch 2) its output replace the current table shown at http://www.gentoo.org/proj/en/releng/catalyst/ Please review and feed back. The script outputs both GuideXML and a plain text version. I'll paste the plain text output here to ease up review: ======================================================================= alpha [ 8] alpha ev4 ev45 ev5 ev56 ev6 ev67 pca56 amd64 [12] amd64 amdfam10 athlon64 athlon64-sse3 athlonfx barcelona core2 k8 k8-sse3 nocona opteron opteron-sse3 arm [13] arm armeb armv4l armv4tl armv5teb armv5tejl armv5tel armv5tl armv6j armv6z armv6zk armv7a armv7a_hardfp hppa [ 3] hppa hppa1.1 hppa2.0 ia64 [ 1] ia64 mips [27] cobalt cobalt_n32 ip27 ip27_n32 ip28 ip28_n32 ip30 ip30_n32 loongson2e loongson2e_n32 loongson2f loongson2f_n32 mips mips1 mips2 mips3 mips3_n32 mips3_n64 mips4 mips4_n32 mipsel mipsel1 mipsel2 mipsel3 mipsel3_n32 mipsel4 mipsel4_n32 ppc [ 6] g3 g4 g5 power power-ppc ppc ppc64 [ 7] 970 cell power3 power4 power5 power6 ppc64 s390 [ 1] s390 s390x [ 1] s390x sh [12] sh sh2 sh2a sh2aeb sh2eb sh3 sh3eb sh4 sh4a sh4aeb sh4eb sheb sparc [ 1] sparc sparc64 [ 1] sparc64 x86 [23] athlon athlon-4 athlon-mp athlon-tbird athlon-xp i386 i486 i586 i686 k6 k6-2 k6-3 pentium pentium-m pentium-mmx pentium2 pentium3 pentium3m pentium4 pentium4m pentiumpro prescott x86 ======================================================================= Best, Sebastian --------------050001080304030905040506 Content-Type: text/x-python; name="make_subarch_table_guidexml.py" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="make_subarch_table_guidexml.py" #! /usr/bin/env python # Copyright (C) 2011 Sebastian Pipping # Licensed under GPL v2 or later # 2011-06-23 20:14 UTC+2 import os import re import textwrap _pattern_arch_generic = re.compile('^class arch_([a-z0-9_.-]+)\\(generic_([a-z0-9_.-]+)\\):') _pattern_arch_arch = re.compile('^class arch_([a-z0-9_.-]+)\\(arch_([a-z0-9_.-]+)\\):') _pattern_title = re.compile('"([a-z0-9_.-]+)"[ \\t]*:[ \\t]*arch_([a-z0-9_.-]+),?') _pattern_arch_genericliases = { 'armeb':'arm', 'sheb':'sh', 'mipsel':'mips', } def handle_line(line, subarch_title_to_subarch_id, subarch_id_to_pattern_arch_genericrch_id): x = _pattern_arch_generic.search(line) if x is not None: subarch = x.group(1) arch = x.group(2) # Apply alias grouping arch = _pattern_arch_genericliases.get(arch, arch) assert(subarch not in subarch_id_to_pattern_arch_genericrch_id) subarch_id_to_pattern_arch_genericrch_id[subarch] = arch return x = _pattern_arch_arch.search(line) if x is not None: child_subarch = x.group(1) parent_subarch = x.group(2) assert(child_subarch not in subarch_id_to_pattern_arch_genericrch_id) subarch_id_to_pattern_arch_genericrch_id[child_subarch] = subarch_id_to_pattern_arch_genericrch_id[parent_subarch] return for x in re.finditer(_pattern_title, line): subarch_title = x.group(1) subarch_id = x.group(2) assert(subarch_title not in subarch_title_to_subarch_id) subarch_title_to_subarch_id[subarch_title] = subarch_id def handle_file(fn, subarch_title_to_subarch_id, subarch_id_to_pattern_arch_genericrch_id): f = open(fn, 'r') for l in f: line = l.rstrip() handle_line(line, subarch_title_to_subarch_id, subarch_id_to_pattern_arch_genericrch_id) f.close() def dump(subarch_title_to_subarch_id, subarch_id_to_pattern_arch_genericrch_id): arch_id_to_subarch_titles = dict() for subarch_title, subarch_id in subarch_title_to_subarch_id.items(): arch_id = subarch_id_to_pattern_arch_genericrch_id.get(subarch_id, subarch_id) if arch_id not in arch_id_to_subarch_titles: arch_id_to_subarch_titles[arch_id] = set() arch_id_to_subarch_titles[arch_id].add(subarch_title) # GuideXML version print """ """ for arch_id, subarch_titles in sorted(arch_id_to_subarch_titles.items()): print """%s%s""" % (arch_id, '\n'.join(textwrap.wrap(' '.join(sorted(subarch_titles)), 60))) print """
Architecture Sub-architectures
""" # Plain text for arch_id, subarch_titles in sorted(arch_id_to_subarch_titles.items()): print '%-8s [%2d] %s' % (arch_id, len(subarch_titles), ' '.join(sorted(subarch_titles))) if __name__ == '__main__': subarch_title_to_subarch_id = dict() subarch_id_to_pattern_arch_genericrch_id = dict() for (dirpath, dirnames, filenames) in os.walk('arch'): for _fn in filenames: if not _fn.endswith('.py'): continue fn = os.path.join(dirpath, _fn) handle_file(fn, subarch_title_to_subarch_id, subarch_id_to_pattern_arch_genericrch_id) dump(subarch_title_to_subarch_id, subarch_id_to_pattern_arch_genericrch_id) --------------050001080304030905040506--