diff options
author | Stefan Hajnoczi | 2010-07-11 09:52:57 +0200 |
---|---|---|
committer | Michael Brown | 2010-07-17 18:04:16 +0200 |
commit | 232c208882047210b0054d3d939ae5d45ab214f7 (patch) | |
tree | a3d21dda1794222c9ab41f26b80447bc9e19d369 /contrib | |
parent | [settings] Unregister the children when unregistering the parent (diff) | |
download | ipxe-232c208882047210b0054d3d939ae5d45ab214f7.tar.gz ipxe-232c208882047210b0054d3d939ae5d45ab214f7.tar.xz ipxe-232c208882047210b0054d3d939ae5d45ab214f7.zip |
[errcode] Remove unused contrib/errcode scripts
The new errdb error code database is more accurate than the regular
expression-based errcode scripts. This patch removes errcode scripts
in favor of errdb.
The gpxebot.py script is no longer needed, gpxebot has been released
as a separate open source codebase:
http://git.etherboot.org/?p=people/stefanha/gpxebot.git;a=summary
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/errcode/README | 35 | ||||
-rwxr-xr-x | contrib/errcode/build_errcodedb.py | 93 | ||||
-rw-r--r-- | contrib/errcode/errcode.php | 83 | ||||
-rwxr-xr-x | contrib/errcode/errcode.py | 78 | ||||
-rwxr-xr-x | contrib/errcode/gpxebot.py | 124 |
5 files changed, 0 insertions, 413 deletions
diff --git a/contrib/errcode/README b/contrib/errcode/README deleted file mode 100644 index eb66d069..00000000 --- a/contrib/errcode/README +++ /dev/null @@ -1,35 +0,0 @@ -Error Code Lookup for iPXE -========================== -This program looks up iPXE error codes so you can locate the line of source -code which produced the error. - -Setup ------ -You must run: -./build_errcodedb.py >errcodedb.py - -This extracts error code definitions from the iPXE source code and produces a -"database" which is used by the main program. - -Once you have done this errcode.py and errcodedb.py are the only files you -need. They are now independent of the iPXE source code and can be moved -anywhere. - -[OPTIONAL] -A PHP script is provided as a web interface. First edit errcode.php to point -$ERRCODE_PATH to the errcode.py script. Then move errcode.php to a location -visible from your web server. - -[OPTIONAL] -A simple IRC bot is provided. Edit ipxebot.py to fill in the IRC details. - -Usage ------ -Looking up error codes on the command-line: -./errcode.py 0x12345678 - -Further information -------------------- -See http://etherboot.org/. - -Released under the GPL and written by Stefan Hajnoczi <stefanha@gmail.com>. diff --git a/contrib/errcode/build_errcodedb.py b/contrib/errcode/build_errcodedb.py deleted file mode 100755 index 99072922..00000000 --- a/contrib/errcode/build_errcodedb.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env python -# Copyright (C) 2008 Stefan Hajnoczi <stefanha@gmail.com>. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -import sys -import re - -pxenv_status_files = ('../../src/include/errno.h', ) -errfile_files = ('../../src/include/ipxe/errfile.h', - '../../src/arch/i386/include/bits/errfile.h') -posix_errno_files = ('../../src/include/errno.h', ) - -PXENV_STATUS_RE = re.compile(r'^#define\s+(PXENV_STATUS_[^\s]+)\s+(.+)$', re.M) -ERRFILE_RE = re.compile(r'^#define\s+(ERRFILE_[^\s]+)\s+(.+)$', re.M) -POSIX_ERRNO_RE = re.compile(r'^#define\s+(E[A-Z0-9]+)\s+(?:\\\n)?.*(0x[0-9a-f]+).*$', re.M) - -def err(msg): - sys.stderr.write('%s: %s\n' % (sys.argv[0], msg)) - sys.exit(1) - -def to_pxenv_status(errno): - return errno & 0xff - -def to_errfile(errno): - return (errno >> 13) & 0x7ff - -def to_posix_errno(errno): - return (errno >> 24) & 0x7f - -def load_header_file(filename, regexp): - defines = {} - data = open(filename, 'r').read() - for m in regexp.finditer(data): - key, val = m.groups() - defines[key] = val - return defines - -def evaluate(defines, expr): - pyexpr = '' - for token in expr.split(): - if token in '()': - pass - elif token.startswith('/*') or token.startswith('//'): - break - elif token.startswith('0x') or token == '|': - pyexpr += token - else: - if token in defines: - pyexpr += '0x%x' % defines[token] - else: - return -1 - if not re.match(r'^[0-9a-zA-Z_|]+$', pyexpr): - err('invalid expression') - return eval(pyexpr) - -def build(filenames, regexp, selector): - unevaluated = {} - for filename in filenames: - unevaluated.update(load_header_file(filename, regexp)) - - evaluated = {} - changed = True - while changed: - changed = False - for key in list(unevaluated.keys()): - val = evaluate(evaluated, unevaluated[key]) - if val != -1: - del unevaluated[key] - evaluated[key] = val - changed = True - if unevaluated: - err('unable to evaluate all #defines') - - lookup = {} - for key, val in evaluated.iteritems(): - lookup[selector(val)] = key - return lookup - -print 'pxenv_status =', repr(build(pxenv_status_files, PXENV_STATUS_RE, to_pxenv_status)) -print 'errfile =', repr(build(errfile_files, ERRFILE_RE, to_errfile)) -print 'posix_errno =', repr(build(posix_errno_files, POSIX_ERRNO_RE, to_posix_errno)) diff --git a/contrib/errcode/errcode.php b/contrib/errcode/errcode.php deleted file mode 100644 index f4774f03..00000000 --- a/contrib/errcode/errcode.php +++ /dev/null @@ -1,83 +0,0 @@ -<? -/* - * Copyright (C) 2008 Stefan Hajnoczi <stefanha@gmail.com>. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -// The path to the errcode.py script. -$ERRCODE_PATH = './errcode.py'; -?> - -<html> - <head> - <title>iPXE Error Code Lookup</title> - <style> - body, pre, div, form, p, h2, b, tt { - padding: 0; - border: 0; - margin: 0; - } - body { - padding: 0.5em; - width: 750px; - font-family: sans-serif; - } - pre { - margin: 0.2em; - padding: 0.1em; - background-color: #ddd; - } - form { - margin: 0.2em; - } - div { - margin: 0.2em; - padding: 0.4em; - border: 1px dashed black; - } - </style> - </head> - <body> -<? -if (!empty($_REQUEST['e']) && preg_match('/^(0x)?[0-9a-f]{8}$/', $_REQUEST['e'])) { -?> - <pre> -<? - system($ERRCODE_PATH . " " . $_REQUEST['e']); -?> - </pre> -<? -} -?> - <form action="" method="post"> - <label for="e">Error code:</label> - <input type="text" name="e" id="e" value="0x12345678"></input> - <input type="submit" value="Lookup"></input> - </form> - - <div> - <h2>Hint:</h2> - <p> - Firefox users can right-click on the <b>Error code</b> - text box and select <b>Add a Keyword for this Search...</b>. - Set <b>name</b> to <tt>iPXE Error Code Lookup</tt> and - <b>keyword</b> to <tt>gxpe</tt> Then you can look up error - codes by typing something like the following in your address - bar: <tt>ipxe 0x3c018003</tt> - <p> - </div> - </body> -</html> diff --git a/contrib/errcode/errcode.py b/contrib/errcode/errcode.py deleted file mode 100755 index 7bc8d9e1..00000000 --- a/contrib/errcode/errcode.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python -# Copyright (C) 2008 Stefan Hajnoczi <stefanha@gmail.com>. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -import sys - -try: - import errcodedb -except ImportError: - sys.stderr.write('Please run this first: ./build_errcodedb.py >errcodedb.py\n') - sys.exit(1) - -def to_pxenv_status(errno): - return errno & 0xff - -def to_uniq(errno): - return (errno >> 8) & 0x1f - -def to_errfile(errno): - return (errno >> 13) & 0x7ff - -def to_posix_errno(errno): - return (errno >> 24) & 0x7f - -def lookup_errno_component(defines, component): - if component in defines: - return defines[component] - else: - return '0x%x' % component - -class Errcode(object): - def __init__(self, errno): - self.pxenv_status = to_pxenv_status(errno) - self.uniq = to_uniq(errno) - self.errfile = to_errfile(errno) - self.posix_errno = to_posix_errno(errno) - - def rawstr(self): - return 'pxenv_status=0x%x uniq=%d errfile=0x%x posix_errno=0x%x' % (self.pxenv_status, self.uniq, self.errfile, self.posix_errno) - - def prettystr(self): - return 'pxenv_status=%s uniq=%d errfile=%s posix_errno=%s' % ( - lookup_errno_component(errcodedb.pxenv_status, self.pxenv_status), - self.uniq, - lookup_errno_component(errcodedb.errfile, self.errfile), - lookup_errno_component(errcodedb.posix_errno, self.posix_errno) - ) - - def __str__(self): - return self.prettystr() - -def usage(): - sys.stderr.write('usage: %s ERROR_NUMBER\n' % sys.argv[0]) - sys.exit(1) - -if __name__ == '__main__': - if len(sys.argv) != 2: - usage() - - try: - errno = int(sys.argv[1], 16) - except ValueError: - usage() - - print Errcode(errno) - sys.exit(0) diff --git a/contrib/errcode/gpxebot.py b/contrib/errcode/gpxebot.py deleted file mode 100755 index 4db4033c..00000000 --- a/contrib/errcode/gpxebot.py +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/env python -# Copyright (C) 2008 Stefan Hajnoczi <stefanha@gmail.com>. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -import re -import socket -import errcode - -HOST = 'irc.freenode.net' -PORT = 6667 -NICK = 'ipxebot' -CHAN = '#etherboot' -NICKSERV_PASSWORD = None -IDENT = 'ipxebot' -REALNAME = 'iPXE bot' - -ERRCODE_RE = re.compile(r'(errcode|Error)\s+((0x)?[0-9a-fA-F]{8})') - -NO_ARGS = -1 - -handlers = {} - -def nick_from_mask(mask): - return (mask.find('!') > -1 and mask.split('!', 1)[0]) or mask - -def autojoin(): - del handlers['376'] - if NICKSERV_PASSWORD: - pmsg('nickserv', 'identify %s' % NICKSERV_PASSWORD) - if CHAN: - cmd('JOIN %s' % CHAN) - -def ping(_, arg): - cmd('PONG %s' % arg) - -def privmsg(_, target, msg): - if target == CHAN: - replyto = target - if msg.find(NICK) == -1: - return - elif target == NICK: - replyto = nick_from_mask(who) - m = ERRCODE_RE.search(msg) - if m: - try: - pmsg(replyto, str(errcode.Errcode(int(m.groups()[1], 16)))) - except ValueError: - pass - if msg.find('help') > -1: - pmsg(replyto, 'I look up iPXE error codes. Message me like this:') - pmsg(replyto, 'errcode 0x12345678 OR Error 0x12345678') - -def add_handler(command, handler, nargs): - handlers[command] = (handler, nargs) - -def cmd(msg): - sock.sendall('%s\r\n' % msg) - -def pmsg(target, msg): - cmd('PRIVMSG %s :%s' % (target, msg)) - -def dispatch(args): - command = args[0] - if command in handlers: - h = handlers[command] - if h[1] == NO_ARGS: - h[0]() - elif len(args) == h[1]: - h[0](*args) - -def parse(line): - if line[0] == ':': - who, line = line.split(None, 1) - who = who[1:] - else: - who = None - args = [] - while line and line[0] != ':' and line.find(' ') != -1: - fields = line.split(None, 1) - if len(fields) == 1: - fields.append(None) - arg, line = fields - args.append(arg) - if line: - if line[0] == ':': - args.append(line[1:]) - else: - args.append(line) - return who, args - -add_handler('376', autojoin, NO_ARGS) -add_handler('PING', ping, 2) -add_handler('PRIVMSG', privmsg, 3) - -sock = socket.socket() -sock.connect((HOST, PORT)) -cmd('NICK %s' % NICK) -cmd('USER %s none none :%s' % (IDENT, REALNAME)) - -rbuf = '' -while True: - r = sock.recv(4096) - if not r: - break - rbuf += r - - while rbuf.find('\r\n') != -1: - line, rbuf = rbuf.split('\r\n', 1) - if not line: - continue - who, args = parse(line) - dispatch(args) |