diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2018-06-14 02:22:19 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2018-06-14 02:22:56 -0500 |
commit | b1eb50599e4db7eb4501af75cbbfa22007081ea5 (patch) | |
tree | c94a34c882cc17adedd781e8c5f34349b2a62416 /user/libevent | |
parent | b9e85bbdcf38547ef2ca4e5c2a6e6293bbcd2752 (diff) | |
download | packages-b1eb50599e4db7eb4501af75cbbfa22007081ea5.tar.gz packages-b1eb50599e4db7eb4501af75cbbfa22007081ea5.tar.bz2 packages-b1eb50599e4db7eb4501af75cbbfa22007081ea5.tar.xz packages-b1eb50599e4db7eb4501af75cbbfa22007081ea5.zip |
The New Plan
all pkgs needed to bootstrap -> system
others -> user
Diffstat (limited to 'user/libevent')
-rw-r--r-- | user/libevent/APKBUILD | 65 | ||||
-rw-r--r-- | user/libevent/dont-test-fallback.patch | 16 | ||||
-rw-r--r-- | user/libevent/fix-test-on-32bit.patch | 11 | ||||
-rw-r--r-- | user/libevent/libressl.patch | 97 | ||||
-rw-r--r-- | user/libevent/py3_dumpevents.patch | 30 | ||||
-rw-r--r-- | user/libevent/py3_rpcgen.patch | 423 |
6 files changed, 642 insertions, 0 deletions
diff --git a/user/libevent/APKBUILD b/user/libevent/APKBUILD new file mode 100644 index 000000000..d49dfa5e1 --- /dev/null +++ b/user/libevent/APKBUILD @@ -0,0 +1,65 @@ +# Contributor: Sergei Lukin <sergej.lukin@gmail.com> +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=libevent +pkgver=2.1.8 +pkgrel=3 +pkgdesc="An event notification library" +url="http://libevent.org/" +arch="all" +license="BSD" +depends="" +depends_dev="python3" +makedepends="$depends_dev openssl-dev" +subpackages="$pkgname-dev" +source="https://github.com/$pkgname/$pkgname/releases/download/release-${pkgver}-stable/$pkgname-${pkgver}-stable.tar.gz + dont-test-fallback.patch + fix-test-on-32bit.patch + py3_dumpevents.patch + py3_rpcgen.patch + " + +# secfixes: +# 2.1.8-r0: +# - CVE-2016-10195 +# - CVE-2016-10196 +# - CVE-2016-10197 + +builddir="$srcdir"/$pkgname-$pkgver-stable + +prepare() { + cd "$builddir" + default_prepare +} + +build() { + cd "$builddir" + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --sysconfdir=/etc \ + --disable-static + make +} + +check() { + cd "$builddir" + make check +} + +package() { + cd "$builddir" + make -j1 DESTDIR=$pkgdir install +} + +dev() { + replaces="libevent" + default_dev + mv "$pkgdir"/usr/bin "$subpkgdir"/usr/ +} + +sha512sums="a2fd3dd111e73634e4aeb1b29d06e420b15c024d7b47778883b5f8a4ff320b5057a8164c6d50b53bd196c79d572ce2639fe6265e03a93304b09c22b41e4c2a17 libevent-2.1.8-stable.tar.gz +d059a592252f83a918f0b6237e2dbee1d05822c83372bcd0f658a25428cce109fd088c5dec8320fef4c1aa7a713ada53aae9b7c04d7ca9b039ed4a483ba84146 dont-test-fallback.patch +7898a00eeab4af7ff3b7c1ee3b90e0d718beba435dfadf015f62084524b2b0f4049c8dd9e16926c61017c01faabf7a51c2f19be7f9532e01278d691acb98465d fix-test-on-32bit.patch +1f51788db3797870392997d0314fb744ee54d3b1a326d1b67f522fc7af65d50210cb137e8213d35a788bbf3c97aac18cd9860de8af3cb8c82f25e3ae07d662ae py3_dumpevents.patch +00d0b09425835638a5e29d96d70c855a5c57efb188157b80a3885a2dcbe88709b49ae57aeb6b8b590458a934116cf59934e6e32fbf684b2b3b8333c0dcac837e py3_rpcgen.patch" diff --git a/user/libevent/dont-test-fallback.patch b/user/libevent/dont-test-fallback.patch new file mode 100644 index 000000000..42a40094a --- /dev/null +++ b/user/libevent/dont-test-fallback.patch @@ -0,0 +1,16 @@ +The libevent fallback monotonic clock is broken, but it should never be used +anyway on musl, so disable testing it. + +(the brokenness involves gettimeofday, you don't want to know) + +--- libevent-2.1.8-stable/test/regress_util.c.old 2017-01-15 03:04:34.000000000 -0600 ++++ libevent-2.1.8-stable/test/regress_util.c 2017-09-14 16:25:58.887687965 -0500 +@@ -1482,7 +1482,7 @@ + { "monotonic_res_fallback", test_evutil_monotonic_res, TT_OFF_BY_DEFAULT, &basic_setup, (void*)"fallback" }, + { "monotonic_prc", test_evutil_monotonic_prc, 0, &basic_setup, (void*)"" }, + { "monotonic_prc_precise", test_evutil_monotonic_prc, 0, &basic_setup, (void*)"precise" }, +- { "monotonic_prc_fallback", test_evutil_monotonic_prc, 0, &basic_setup, (void*)"fallback" }, ++ /* { "monotonic_prc_fallback", test_evutil_monotonic_prc, 0, &basic_setup, (void*)"fallback" }, */ + { "date_rfc1123", test_evutil_date_rfc1123, 0, NULL, NULL }, + END_OF_TESTCASES, + }; diff --git a/user/libevent/fix-test-on-32bit.patch b/user/libevent/fix-test-on-32bit.patch new file mode 100644 index 000000000..ec120a78c --- /dev/null +++ b/user/libevent/fix-test-on-32bit.patch @@ -0,0 +1,11 @@ +--- libevent-2.1.8-stable/test/regress_util.c.old 2018-03-04 21:14:24.344542520 -0600 ++++ libevent-2.1.8-stable/test/regress_util.c 2018-03-04 21:24:23.788814572 -0600 +@@ -1411,7 +1411,7 @@ + { 1255132800, "Sat, 10 Oct 2009 00:00:00 GMT"}, + { 1289433600, "Thu, 11 Nov 2010 00:00:00 GMT"}, + { 1323648000, "Mon, 12 Dec 2011 00:00:00 GMT"}, +-#ifndef _WIN32 ++#if !defined(_WIN32) && (!defined(__SIZEOF_LONG__) || __SIZEOF_LONG__ > 4) + /** In win32 case we have max "23:59:59 January 18, 2038, UTC" for time32 */ + { 4294967296, "Sun, 07 Feb 2106 06:28:16 GMT"} /* 2^32 */, + /** In win32 case we have max "23:59:59, December 31, 3000, UTC" for time64 */ diff --git a/user/libevent/libressl.patch b/user/libevent/libressl.patch new file mode 100644 index 000000000..21a750c2c --- /dev/null +++ b/user/libevent/libressl.patch @@ -0,0 +1,97 @@ +diff -ru a/openssl-compat.h b/openssl-compat.h +--- a/openssl-compat.h ++++ b/openssl-compat.h +@@ -1,7 +1,7 @@ + #ifndef OPENSSL_COMPAT_H + #define OPENSSL_COMPAT_H + +-#if OPENSSL_VERSION_NUMBER < 0x10100000L ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + + static inline BIO_METHOD *BIO_meth_new(int type, const char *name) + { +@@ -30,6 +30,6 @@ + + #define TLS_method SSLv23_method + +-#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */ ++#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) */ + + #endif /* OPENSSL_COMPAT_H */ +diff -ru a/sample/https-client.c b/sample/https-client.c +--- a/sample/https-client.c ++++ b/sample/https-client.c +@@ -312,7 +312,7 @@ + } + uri[sizeof(uri) - 1] = '\0'; + +-#if OPENSSL_VERSION_NUMBER < 0x10100000L ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + // Initialize OpenSSL + SSL_library_init(); + ERR_load_crypto_strings(); +@@ -480,7 +480,7 @@ + SSL_CTX_free(ssl_ctx); + if (type == HTTP && ssl) + SSL_free(ssl); +-#if OPENSSL_VERSION_NUMBER < 0x10100000L ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + EVP_cleanup(); + ERR_free_strings(); + +@@ -492,7 +492,7 @@ + CRYPTO_cleanup_all_ex_data(); + + sk_SSL_COMP_free(SSL_COMP_get_compression_methods()); +-#endif /*OPENSSL_VERSION_NUMBER < 0x10100000L */ ++#endif /*OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) */ + + #ifdef _WIN32 + WSACleanup(); +diff -ru a/sample/le-proxy.c b/sample/le-proxy.c +--- a/sample/le-proxy.c ++++ b/sample/le-proxy.c +@@ -259,7 +259,7 @@ + + if (use_ssl) { + int r; +-#if OPENSSL_VERSION_NUMBER < 0x10100000L ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + SSL_library_init(); + ERR_load_crypto_strings(); + SSL_load_error_strings(); +diff -ru a/sample/openssl_hostname_validation.c b/sample/openssl_hostname_validation.c +--- a/sample/openssl_hostname_validation.c ++++ b/sample/openssl_hostname_validation.c +@@ -48,7 +48,7 @@ + + #define HOSTNAME_MAX_SIZE 255 + +-#if OPENSSL_VERSION_NUMBER < 0x10100000L ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + #define ASN1_STRING_get0_data ASN1_STRING_data + #endif + +diff -ru a/test/regress_ssl.c b/test/regress_ssl.c +--- a/test/regress_ssl.c ++++ b/test/regress_ssl.c +@@ -186,7 +186,7 @@ + void + init_ssl(void) + { +-#if OPENSSL_VERSION_NUMBER < 0x10100000L ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + SSL_library_init(); + ERR_load_crypto_strings(); + SSL_load_error_strings(); +@@ -194,6 +194,10 @@ + if (SSLeay() != OPENSSL_VERSION_NUMBER) { + TT_DECLARE("WARN", ("Version mismatch for openssl: compiled with %lx but running with %lx", (unsigned long)OPENSSL_VERSION_NUMBER, (unsigned long) SSLeay())); + } ++ if (SSLeay() != LIBRESSL_VERSION_NUMBER) { ++ TT_DECLARE("WARN", ("Version mismatch for libressl: compiled with %lx but running with %lx", (unsigned long)LIBRESSL_VERSION_NUMBER, (unsigned long) SSLeay())); ++ } ++ + #endif + } + diff --git a/user/libevent/py3_dumpevents.patch b/user/libevent/py3_dumpevents.patch new file mode 100644 index 000000000..3c012ef89 --- /dev/null +++ b/user/libevent/py3_dumpevents.patch @@ -0,0 +1,30 @@ +--- libevent-2.1.8-stable/test/check-dumpevents.py 2016-10-04 14:55:31.000000000 -0500 ++++ libevent-2.1.8-py3-rpcgen/test/check-dumpevents.py 2017-09-14 15:51:16.000000000 -0500 +@@ -15,12 +15,12 @@ + got_inserted_pos = text.index("Inserted events:\n") + got_active_pos = text.index("Active events:\n") + except ValueError: +- print >>sys.stderr, "Missing expected dividing line in dumpevents output" ++ sys.stderr.write("Missing expected dividing line in dumpevents output\n") + sys.exit(1) + + if not (expect_inserted_pos < expect_active_pos < + got_inserted_pos < got_active_pos): +- print >>sys.stderr, "Sections out of order in dumpevents output" ++ sys.stderr.write("Sections out of order in dumpevents output\n") + sys.exit(1) + + now,T= text[1].split() +@@ -45,10 +45,10 @@ + if "Internal" not in s) + + if cleaned_inserted != want_inserted: +- print >>sys.stderr, "Inserted event lists were not as expected!" ++ sys.stderr.write("Inserted event lists were not as expected!\n") + sys.exit(1) + + if set(got_active) != set(want_active): +- print >>sys.stderr, "Active event lists were not as expected!" ++ sys.stderr.write("Active event lists were not as expected!\n") + sys.exit(1) + diff --git a/user/libevent/py3_rpcgen.patch b/user/libevent/py3_rpcgen.patch new file mode 100644 index 000000000..2ebe974a6 --- /dev/null +++ b/user/libevent/py3_rpcgen.patch @@ -0,0 +1,423 @@ +--- libevent-2.1.8-stable/event_rpcgen.py 2016-12-06 03:44:11.000000000 -0600 ++++ libevent-2.1.8-py3-rpcgen/event_rpcgen.py 2017-09-14 15:17:51.000000000 -0500 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python2 ++#!/usr/bin/env python3 + # + # Copyright (c) 2005-2007 Niels Provos <provos@citi.umich.edu> + # Copyright (c) 2007-2012 Niels Provos and Nick Mathewson +@@ -36,10 +36,10 @@ + + def declare(s): + if not QUIETLY: +- print s ++ print(s) + + def TranslateList(mylist, mydict): +- return map(lambda x: x % mydict, mylist) ++ return [x % mydict for x in mylist] + + # Exception class for parse errors + class RpcGenError(Exception): +@@ -57,7 +57,7 @@ + declare(' Created struct: %s' % name) + + def AddEntry(self, entry): +- if self._tags.has_key(entry.Tag()): ++ if entry.Tag() in self._tags: + raise RpcGenError( + 'Entry "%s" duplicates tag number %d from "%s" ' + 'around line %d' % (entry.Name(), entry.Tag(), +@@ -78,7 +78,8 @@ + def PrintIndented(self, file, ident, code): + """Takes an array, add indentation to each entry and prints it.""" + for entry in code: +- print >>file, '%s%s' % (ident, entry) ++ file.write('{}{}\n'.format(ident, entry)) ++ #file.write('%s%s' % (ident, entry)) + + class StructCCode(Struct): + """ Knows how to generate C code for a struct """ +@@ -88,20 +89,19 @@ + + def PrintTags(self, file): + """Prints the tag definitions for a structure.""" +- print >>file, '/* Tag definition for %s */' % self._name +- print >>file, 'enum %s_ {' % self._name.lower() ++ file.write('/* Tag definition for %s */\n' % self._name) ++ file.write('enum %s_ {\n' % self._name.lower()) + for entry in self._entries: +- print >>file, ' %s=%d,' % (self.EntryTagName(entry), +- entry.Tag()) +- print >>file, ' %s_MAX_TAGS' % (self._name.upper()) +- print >>file, '};\n' ++ file.write(' %s=%d,\n' % (self.EntryTagName(entry), entry.Tag())) ++ file.write(' %s_MAX_TAGS\n' % (self._name.upper())) ++ file.write('};\n\n') + + def PrintForwardDeclaration(self, file): +- print >>file, 'struct %s;' % self._name ++ file.write('struct %s;\n' % self._name) + + def PrintDeclaration(self, file): +- print >>file, '/* Structure declaration for %s */' % self._name +- print >>file, 'struct %s_access_ {' % self._name ++ file.write('/* Structure declaration for %s */\n' % self._name) ++ file.write('struct %s_access_ {\n' % self._name) + for entry in self._entries: + dcl = entry.AssignDeclaration('(*%s_assign)' % entry.Name()) + dcl.extend( +@@ -110,20 +110,19 @@ + dcl.extend( + entry.AddDeclaration('(*%s_add)' % entry.Name())) + self.PrintIndented(file, ' ', dcl) +- print >>file, '};\n' ++ file.write('};\n\n') + +- print >>file, 'struct %s {' % self._name +- print >>file, ' struct %s_access_ *base;\n' % self._name ++ file.write('struct %s {\n' % self._name) ++ file.write(' struct %s_access_ *base;\n\n' % self._name) + for entry in self._entries: + dcl = entry.Declaration() + self.PrintIndented(file, ' ', dcl) +- print >>file, '' ++ file.write('\n') + for entry in self._entries: +- print >>file, ' ev_uint8_t %s_set;' % entry.Name() +- print >>file, '};\n' ++ file.write(' ev_uint8_t %s_set;\n' % entry.Name()) ++ file.write('};\n\n') + +- print >>file, \ +-"""struct %(name)s *%(name)s_new(void); ++ file.write("""struct %(name)s *%(name)s_new(void); + struct %(name)s *%(name)s_new_with_arg(void *); + void %(name)s_free(struct %(name)s *); + void %(name)s_clear(struct %(name)s *); +@@ -133,7 +132,7 @@ + void evtag_marshal_%(name)s(struct evbuffer *, ev_uint32_t, + const struct %(name)s *); + int evtag_unmarshal_%(name)s(struct evbuffer *, ev_uint32_t, +- struct %(name)s *);""" % { 'name' : self._name } ++ struct %(name)s *);\n""" % { 'name' : self._name }) + + + # Write a setting function of every variable +@@ -146,22 +145,21 @@ + self.PrintIndented(file, '', entry.AddDeclaration( + entry.AddFuncName())) + +- print >>file, '/* --- %s done --- */\n' % self._name ++ file.write('/* --- %s done --- */\n\n' % self._name) + + def PrintCode(self, file): +- print >>file, ('/*\n' ++ file.write(('/*\n' + ' * Implementation of %s\n' +- ' */\n') % self._name ++ ' */\n\n') % self._name) + +- print >>file, \ +- 'static struct %(name)s_access_ %(name)s_base__ = {' % \ +- { 'name' : self._name } ++ file.write('static struct %(name)s_access_ %(name)s_base__ = {\n' % \ ++ { 'name' : self._name }) + for entry in self._entries: + self.PrintIndented(file, ' ', entry.CodeBase()) +- print >>file, '};\n' ++ file.write('};\n\n') + + # Creation +- print >>file, ( ++ file.write(( + 'struct %(name)s *\n' + '%(name)s_new(void)\n' + '{\n' +@@ -176,77 +174,77 @@ + ' event_warn("%%s: malloc", __func__);\n' + ' return (NULL);\n' + ' }\n' +- ' tmp->base = &%(name)s_base__;\n') % { 'name' : self._name } ++ ' tmp->base = &%(name)s_base__;\n\n') % { 'name' : self._name }) + + for entry in self._entries: + self.PrintIndented(file, ' ', entry.CodeInitialize('tmp')) +- print >>file, ' tmp->%s_set = 0;\n' % entry.Name() ++ file.write(' tmp->%s_set = 0;\n\n' % entry.Name()) + +- print >>file, ( ++ file.write(( + ' return (tmp);\n' +- '}\n') ++ '}\n\n')) + + # Adding + for entry in self._entries: + if entry.Array(): + self.PrintIndented(file, '', entry.CodeAdd()) +- print >>file, '' ++ file.write('\n') + + # Assigning + for entry in self._entries: + self.PrintIndented(file, '', entry.CodeAssign()) +- print >>file, '' ++ file.write('\n') + + # Getting + for entry in self._entries: + self.PrintIndented(file, '', entry.CodeGet()) +- print >>file, '' ++ file.write('\n') + + # Clearing +- print >>file, ( 'void\n' ++ file.write(( 'void\n' + '%(name)s_clear(struct %(name)s *tmp)\n' + '{' +- ) % { 'name' : self._name } ++ '\n') % { 'name' : self._name }) + for entry in self._entries: + self.PrintIndented(file, ' ', entry.CodeClear('tmp')) + +- print >>file, '}\n' ++ file.write('}\n\n') + + # Freeing +- print >>file, ( 'void\n' ++ file.write(( 'void\n' + '%(name)s_free(struct %(name)s *tmp)\n' + '{' +- ) % { 'name' : self._name } ++ '\n') % { 'name' : self._name }) + + for entry in self._entries: + self.PrintIndented(file, ' ', entry.CodeFree('tmp')) + +- print >>file, (' free(tmp);\n' +- '}\n') ++ file.write((' free(tmp);\n' ++ '}\n\n')) + + # Marshaling +- print >>file, ('void\n' ++ file.write(('void\n' + '%(name)s_marshal(struct evbuffer *evbuf, ' + 'const struct %(name)s *tmp)' +- '{') % { 'name' : self._name } ++ '{\n') % { 'name' : self._name }) + for entry in self._entries: + indent = ' ' + # Optional entries do not have to be set + if entry.Optional(): + indent += ' ' +- print >>file, ' if (tmp->%s_set) {' % entry.Name() ++ file.write(' if (tmp->%s_set) {\n' % entry.Name()) + self.PrintIndented( + file, indent, + entry.CodeMarshal('evbuf', self.EntryTagName(entry), + entry.GetVarName('tmp'), + entry.GetVarLen('tmp'))) + if entry.Optional(): +- print >>file, ' }' ++ file.write(' }\n') + +- print >>file, '}\n' ++ file.write('}\n\n') + + # Unmarshaling +- print >>file, ('int\n' ++ file.write(('int\n' + '%(name)s_unmarshal(struct %(name)s *tmp, ' + ' struct evbuffer *evbuf)\n' + '{\n' +@@ -255,14 +253,14 @@ + ' if (evtag_peek(evbuf, &tag) == -1)\n' + ' return (-1);\n' + ' switch (tag) {\n' +- ) % { 'name' : self._name } ++ '\n') % { 'name' : self._name }) + for entry in self._entries: +- print >>file, ' case %s:\n' % self.EntryTagName(entry) ++ file.write(' case %s:\n' % self.EntryTagName(entry)) + if not entry.Array(): +- print >>file, ( ++ file.write(( + ' if (tmp->%s_set)\n' + ' return (-1);' +- ) % (entry.Name()) ++ '\n') % (entry.Name())) + + self.PrintIndented( + file, ' ', +@@ -271,26 +269,26 @@ + entry.GetVarName('tmp'), + entry.GetVarLen('tmp'))) + +- print >>file, ( ' tmp->%s_set = 1;\n' % entry.Name() + +- ' break;\n' ) +- print >>file, ( ' default:\n' ++ file.write(( ' tmp->%s_set = 1;\n' % entry.Name() + ++ ' break;\n' )) ++ file.write(( ' default:\n' + ' return -1;\n' + ' }\n' +- ' }\n' ) ++ ' }\n\n' )) + # Check if it was decoded completely +- print >>file, ( ' if (%(name)s_complete(tmp) == -1)\n' ++ file.write(( ' if (%(name)s_complete(tmp) == -1)\n' + ' return (-1);' +- ) % { 'name' : self._name } ++ '\n') % { 'name' : self._name }) + + # Successfully decoded +- print >>file, ( ' return (0);\n' +- '}\n') ++ file.write(( ' return (0);\n' ++ '}\n\n')) + + # Checking if a structure has all the required data +- print >>file, ( ++ file.write(( + 'int\n' + '%(name)s_complete(struct %(name)s *msg)\n' +- '{' ) % { 'name' : self._name } ++ '{\n' ) % { 'name' : self._name }) + for entry in self._entries: + if not entry.Optional(): + code = [ +@@ -303,12 +301,12 @@ + self.PrintIndented( + file, ' ', + entry.CodeComplete('msg', entry.GetVarName('msg'))) +- print >>file, ( ++ file.write(( + ' return (0);\n' +- '}\n' ) ++ '}\n\n' )) + + # Complete message unmarshaling +- print >>file, ( ++ file.write(( + 'int\n' + 'evtag_unmarshal_%(name)s(struct evbuffer *evbuf, ' + 'ev_uint32_t need_tag, struct %(name)s *msg)\n' +@@ -330,10 +328,10 @@ + ' error:\n' + ' evbuffer_free(tmp);\n' + ' return (res);\n' +- '}\n' ) % { 'name' : self._name } ++ '}\n\n' ) % { 'name' : self._name }) + + # Complete message marshaling +- print >>file, ( ++ file.write(( + 'void\n' + 'evtag_marshal_%(name)s(struct evbuffer *evbuf, ev_uint32_t tag, ' + 'const struct %(name)s *msg)\n' +@@ -343,7 +341,7 @@ + ' %(name)s_marshal(buf_, msg);\n' + ' evtag_marshal_buffer(evbuf, tag, buf_);\n ' + ' evbuffer_free(buf_);\n' +- '}\n' ) % { 'name' : self._name } ++ '}\n\n' ) % { 'name' : self._name }) + + class Entry: + def __init__(self, type, name, tag): +@@ -420,7 +418,7 @@ + "optaddarg" : + self._optaddarg and ", const %s value" % self._ctype or "" + } +- for (k, v) in extradict.items(): ++ for (k, v) in list(extradict.items()): + mapping[k] = v + + return mapping +@@ -1127,7 +1125,7 @@ + + codearrayassign = self._entry.CodeArrayAssign( + 'msg->%(name)s_data[off]' % self.GetTranslation(), 'value') +- code += map(lambda x: ' ' + x, codearrayassign) ++ code += [' ' + x for x in codearrayassign] + + code += TranslateList([ + ' }', +@@ -1168,7 +1166,7 @@ + + code = TranslateList(code, self.GetTranslation()) + +- code += map(lambda x: ' ' + x, codearrayadd) ++ code += [' ' + x for x in codearrayadd] + + code += TranslateList([ + ' msg->%(name)s_set = 1;', +@@ -1196,7 +1194,7 @@ + + code = TranslateList(code, translate) + +- code += map(lambda x: ' ' + x, tmp) ++ code += [' ' + x for x in tmp] + + code += [ + ' }', +@@ -1261,7 +1259,7 @@ + code = TranslateList(code, translate) + + if codearrayfree: +- code += map(lambda x: ' ' + x, codearrayfree) ++ code += [' ' + x for x in codearrayfree] + code += [ + ' }' ] + +@@ -1687,23 +1685,23 @@ + + declare('... creating "%s"' % header_file) + header_fp = open(header_file, 'w') +- print >>header_fp, factory.HeaderPreamble(filename) ++ header_fp.write(factory.HeaderPreamble(filename)) + + # Create forward declarations: allows other structs to reference + # each other + for entry in entities: + entry.PrintForwardDeclaration(header_fp) +- print >>header_fp, '' ++ header_fp.write('\n') + + for entry in entities: + entry.PrintTags(header_fp) + entry.PrintDeclaration(header_fp) +- print >>header_fp, factory.HeaderPostamble(filename) ++ header_fp.write(factory.HeaderPostamble(filename)) + header_fp.close() + + declare('... creating "%s"' % impl_file) + impl_fp = open(impl_file, 'w') +- print >>impl_fp, factory.BodyPreamble(filename, header_file) ++ impl_fp.write(factory.BodyPreamble(filename, header_file)) + for entry in entities: + entry.PrintCode(impl_fp) + impl_fp.close() +@@ -1713,16 +1711,16 @@ + CommandLine(sys.argv).run() + sys.exit(0) + +- except RpcGenError, e: +- print >>sys.stderr, e ++ except RpcGenError as e: ++ sys.stderr.write(e) + sys.exit(1) + +- except EnvironmentError, e: ++ except EnvironmentError as e: + if e.filename and e.strerror: +- print >>sys.stderr, "%s: %s" % (e.filename, e.strerror) ++ sys.stderr.write("%s: %s" % (e.filename, e.strerror)) + sys.exit(1) + elif e.strerror: +- print >> sys.stderr, e.strerror ++ sys.stderr.write(e.strerror) + sys.exit(1) + else: + raise |