From: Sebastian Pipping <sping@gentoo.org>
To: gentoo-catalyst@lists.gentoo.org, "Raúl Porcel" <armin76@gentoo.org>
Subject: Re: [gentoo-catalyst] Undocumented subarches, e.g. core2
Date: Thu, 23 Jun 2011 20:23:57 +0200 [thread overview]
Message-ID: <4E0384BD.7060406@gentoo.org> (raw)
In-Reply-To: <4E02589E.9090006@gentoo.org>
[-- Attachment #1: Type: text/plain, Size: 1874 bytes --]
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
[-- Attachment #2: make_subarch_table_guidexml.py --]
[-- Type: text/x-python, Size: 3127 bytes --]
#! /usr/bin/env python
# Copyright (C) 2011 Sebastian Pipping <sebastian@pipping.org>
# 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 """
<table>
<tr>
<th>Architecture</th>
<th>Sub-architectures</th>
</tr>"""
for arch_id, subarch_titles in sorted(arch_id_to_subarch_titles.items()):
print """<tr>
<ti><c>%s</c></ti>
<ti><c>%s</c></ti>
</tr>""" % (arch_id, '\n'.join(textwrap.wrap(' '.join(sorted(subarch_titles)), 60)))
print """</tr>
</table>
"""
# 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)
next prev parent reply other threads:[~2011-06-23 18:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-22 21:03 [gentoo-catalyst] Undocumented subarches, e.g. core2 Sebastian Pipping
2011-06-22 21:14 ` Peter Stuge
2011-06-23 18:23 ` Sebastian Pipping [this message]
2011-06-24 0:27 ` Sebastian Pipping
2011-06-24 0:31 ` Peter Stuge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E0384BD.7060406@gentoo.org \
--to=sping@gentoo.org \
--cc=armin76@gentoo.org \
--cc=gentoo-catalyst@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox