diff options
10 files changed, 0 insertions, 1789 deletions
diff --git a/recipes-networking/openvswitch/openvswitch-git/0001-Python3-compatibility-Convert-print-statements.patch b/recipes-networking/openvswitch/openvswitch-git/0001-Python3-compatibility-Convert-print-statements.patch deleted file mode 100644 index 7bdcc003..00000000 --- a/recipes-networking/openvswitch/openvswitch-git/0001-Python3-compatibility-Convert-print-statements.patch +++ /dev/null | |||
| @@ -1,1262 +0,0 @@ | |||
| 1 | From 3658d861c3c83caab9040bec04b195be3f86d4ce Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jason Wessel <jason.wessel@windriver.com> | ||
| 3 | Date: Thu, 29 Jun 2017 20:33:23 -0700 | ||
| 4 | Subject: [PATCH] Python3 compatibility: Convert print statements | ||
| 5 | |||
| 6 | Commit d34a1cc02536f9a812517a71accec3fbd3c6c98b from | ||
| 7 | https://github.com/openvswitch/ovs.git | ||
| 8 | |||
| 9 | This patch fixes up all the print statements to work with python3 or | ||
| 10 | python2. | ||
| 11 | |||
| 12 | Signed-off-by: Jason Wessel <jason.wessel@windriver.com> | ||
| 13 | Signed-off-by: Ben Pfaff <blp@ovn.org> | ||
| 14 | |||
| 15 | --- | ||
| 16 | build-aux/check-structs | 4 +- | ||
| 17 | build-aux/extract-ofp-actions | 68 +++--- | ||
| 18 | build-aux/extract-ofp-errors | 2 +- | ||
| 19 | build-aux/extract-ofp-fields | 2 +- | ||
| 20 | build-aux/extract-ofp-msgs | 6 +- | ||
| 21 | ovsdb/ovsdb-doc | 6 +- | ||
| 22 | ovsdb/ovsdb-idlc.in | 523 +++++++++++++++++++++--------------------- | ||
| 23 | 7 files changed, 306 insertions(+), 305 deletions(-) | ||
| 24 | |||
| 25 | diff --git a/build-aux/check-structs b/build-aux/check-structs | ||
| 26 | index 5129b72..cbb19b6 100755 | ||
| 27 | --- a/build-aux/check-structs | ||
| 28 | +++ b/build-aux/check-structs | ||
| 29 | @@ -211,7 +211,7 @@ def checkStructs(): | ||
| 30 | |||
| 31 | if '--help' in sys.argv: | ||
| 32 | argv0 = os.path.basename(sys.argv[0]) | ||
| 33 | - print '''\ | ||
| 34 | + print('''\ | ||
| 35 | %(argv0)s, for checking struct and struct member alignment | ||
| 36 | usage: %(argv0)s -Ipath HEADER [HEADER]... | ||
| 37 | |||
| 38 | @@ -226,7 +226,7 @@ assertions using OFP_ASSERT. | ||
| 39 | |||
| 40 | This program is specialized for reading Open vSwitch's OpenFlow header | ||
| 41 | files. It will not work on arbitrary header files without extensions.\ | ||
| 42 | -''' % {"argv0": argv0} | ||
| 43 | +''' % {"argv0": argv0}) | ||
| 44 | sys.exit(0) | ||
| 45 | |||
| 46 | global fileName | ||
| 47 | diff --git a/build-aux/extract-ofp-actions b/build-aux/extract-ofp-actions | ||
| 48 | index ee8c4ff..67e3848 100755 | ||
| 49 | --- a/build-aux/extract-ofp-actions | ||
| 50 | +++ b/build-aux/extract-ofp-actions | ||
| 51 | @@ -67,7 +67,7 @@ def fatal(msg): | ||
| 52 | |||
| 53 | def usage(): | ||
| 54 | argv0 = os.path.basename(sys.argv[0]) | ||
| 55 | - print ('''\ | ||
| 56 | + print('''\ | ||
| 57 | %(argv0)s, for extracting OpenFlow action data | ||
| 58 | usage: %(argv0)s OFP_ACTIONS.C [--prototypes | --definitions] | ||
| 59 | |||
| 60 | @@ -238,36 +238,36 @@ def extract_ofp_actions(fn, definitions): | ||
| 61 | if n_errors: | ||
| 62 | sys.exit(1) | ||
| 63 | |||
| 64 | - print """\ | ||
| 65 | + print("""\ | ||
| 66 | /* Generated automatically; do not modify! -*- buffer-read-only: t -*- */ | ||
| 67 | -""" | ||
| 68 | +""") | ||
| 69 | |||
| 70 | if definitions: | ||
| 71 | - print "/* Verify that structs used as actions are reasonable sizes. */" | ||
| 72 | + print("/* Verify that structs used as actions are reasonable sizes. */") | ||
| 73 | for s in sorted(arg_structs): | ||
| 74 | - print "BUILD_ASSERT_DECL(sizeof(%s) %% OFP_ACTION_ALIGN == 0);" % s | ||
| 75 | + print("BUILD_ASSERT_DECL(sizeof(%s) %% OFP_ACTION_ALIGN == 0);" % s) | ||
| 76 | |||
| 77 | - print "\nstatic struct ofpact_raw_instance all_raw_instances[] = {" | ||
| 78 | + print("\nstatic struct ofpact_raw_instance all_raw_instances[] = {") | ||
| 79 | for vendor in domain: | ||
| 80 | for type_ in domain[vendor]: | ||
| 81 | for version in domain[vendor][type_]: | ||
| 82 | d = domain[vendor][type_][version] | ||
| 83 | - print " { { 0x%08x, %2d, 0x%02x }, " % ( | ||
| 84 | - vendor, type_, version) | ||
| 85 | - print " %s," % d["enum"] | ||
| 86 | - print " HMAP_NODE_NULL_INITIALIZER," | ||
| 87 | - print " HMAP_NODE_NULL_INITIALIZER," | ||
| 88 | - print " %s," % d["min_length"] | ||
| 89 | - print " %s," % d["max_length"] | ||
| 90 | - print " %s," % d["arg_ofs"] | ||
| 91 | - print " %s," % d["arg_len"] | ||
| 92 | - print " \"%s\"," % re.sub('_RAW[0-9]*', '', d["enum"], 1) | ||
| 93 | + print(" { { 0x%08x, %2d, 0x%02x }, " % ( | ||
| 94 | + vendor, type_, version)) | ||
| 95 | + print(" %s," % d["enum"]) | ||
| 96 | + print(" HMAP_NODE_NULL_INITIALIZER,") | ||
| 97 | + print(" HMAP_NODE_NULL_INITIALIZER,") | ||
| 98 | + print(" %s," % d["min_length"]) | ||
| 99 | + print(" %s," % d["max_length"]) | ||
| 100 | + print(" %s," % d["arg_ofs"]) | ||
| 101 | + print(" %s," % d["arg_len"]) | ||
| 102 | + print(" \"%s\"," % re.sub('_RAW[0-9]*', '', d["enum"], 1)) | ||
| 103 | if d["deprecation"]: | ||
| 104 | - print " \"%s\"," % re.sub(r'(["\\])', r'\\\1', d["deprecation"]) | ||
| 105 | + print(" \"%s\"," % re.sub(r'(["\\])', r'\\\1', d["deprecation"])) | ||
| 106 | else: | ||
| 107 | - print " NULL," | ||
| 108 | - print " }," | ||
| 109 | - print "};"; | ||
| 110 | + print(" NULL,") | ||
| 111 | + print(" },") | ||
| 112 | + print("};") | ||
| 113 | |||
| 114 | for versions in enums.values(): | ||
| 115 | need_ofp_version = False | ||
| 116 | @@ -314,11 +314,11 @@ def extract_ofp_actions(fn, definitions): | ||
| 117 | decl += "}" | ||
| 118 | else: | ||
| 119 | decl += ";" | ||
| 120 | - print decl | ||
| 121 | |||
| 122 | + print(decl) | ||
| 123 | + print("") | ||
| 124 | |||
| 125 | if definitions: | ||
| 126 | - print """\ | ||
| 127 | + print("""\ | ||
| 128 | static enum ofperr | ||
| 129 | ofpact_decode(const struct ofp_action_header *a, enum ofp_raw_action_type raw, | ||
| 130 | enum ofp_version version, uint64_t arg, | ||
| 131 | @@ -326,14 +326,14 @@ ofpact_decode(const struct ofp_action_header *a, enum ofp_raw_action_type raw, | ||
| 132 | uint64_t *tlv_bitmap, struct ofpbuf *out) | ||
| 133 | { | ||
| 134 | switch (raw) {\ | ||
| 135 | -""" | ||
| 136 | +""") | ||
| 137 | for versions in enums.values(): | ||
| 138 | enum = versions[0]["enum"] | ||
| 139 | - print " case %s:" % enum | ||
| 140 | + print(" case %s:" % enum) | ||
| 141 | base_argtype = versions[0]["base_argtype"] | ||
| 142 | arg_vl_mff_map = versions[0]["arg_vl_mff_map"] | ||
| 143 | if base_argtype == 'void': | ||
| 144 | - print " return decode_%s(out);" % enum | ||
| 145 | + print(" return decode_%s(out);" % enum) | ||
| 146 | else: | ||
| 147 | if base_argtype.startswith('struct'): | ||
| 148 | arg = "ALIGNED_CAST(const %s *, a)" % base_argtype | ||
| 149 | @@ -344,16 +344,16 @@ ofpact_decode(const struct ofp_action_header *a, enum ofp_raw_action_type raw, | ||
| 150 | else: | ||
| 151 | arg = "arg" | ||
| 152 | if arg_vl_mff_map: | ||
| 153 | - print " return decode_%s(%s, version, vl_mff_map, tlv_bitmap, out);" % (enum, arg) | ||
| 154 | + print(" return decode_%s(%s, version, vl_mff_map, tlv_bitmap, out);" % (enum, arg)) | ||
| 155 | else: | ||
| 156 | - print " return decode_%s(%s, version, out);" % (enum, arg) | ||
| 157 | |||
| 158 | - print """\ | ||
| 159 | + print(" return decode_%s(%s, version, out);" % (enum, arg)) | ||
| 160 | + print("") | ||
| 161 | + print("""\ | ||
| 162 | default: | ||
| 163 | OVS_NOT_REACHED(); | ||
| 164 | } | ||
| 165 | }\ | ||
| 166 | -""" | ||
| 167 | +""") | ||
| 168 | else: | ||
| 169 | for versions in enums.values(): | ||
| 170 | enum = versions[0]["enum"] | ||
| 171 | @@ -368,15 +368,15 @@ ofpact_decode(const struct ofp_action_header *a, enum ofp_raw_action_type raw, | ||
| 172 | if arg_vl_mff_map: | ||
| 173 | prototype += 'const struct vl_mff_map *, uint64_t *, ' | ||
| 174 | prototype += "struct ofpbuf *);" | ||
| 175 | - print prototype | ||
| 176 | + print(prototype) | ||
| 177 | |||
| 178 | - print """ | ||
| 179 | + print(""" | ||
| 180 | static enum ofperr ofpact_decode(const struct ofp_action_header *, | ||
| 181 | enum ofp_raw_action_type raw, | ||
| 182 | enum ofp_version version, | ||
| 183 | uint64_t arg, const struct vl_mff_map *vl_mff_map, | ||
| 184 | uint64_t *tlv_bitmap, struct ofpbuf *out); | ||
| 185 | -""" | ||
| 186 | +""") | ||
| 187 | |||
| 188 | if __name__ == '__main__': | ||
| 189 | if '--help' in sys.argv: | ||
| 190 | diff --git a/build-aux/extract-ofp-errors b/build-aux/extract-ofp-errors | ||
| 191 | index e36444e..97d62d2 100755 | ||
| 192 | --- a/build-aux/extract-ofp-errors | ||
| 193 | +++ b/build-aux/extract-ofp-errors | ||
| 194 | @@ -426,7 +426,7 @@ static const struct ofperr_domain %s = { | ||
| 195 | vendor, type_, code = map[enum] | ||
| 196 | if code == None: | ||
| 197 | code = -1 | ||
| 198 | - print " { %#8x, %2d, %3d }, /* %s */" % (vendor, type_, code, enum) | ||
| 199 | + print (" { %#8x, %2d, %3d }, /* %s */" % (vendor, type_, code, enum)) | ||
| 200 | else: | ||
| 201 | print (" { -1, -1, -1 }, /* %s */" % enum) | ||
| 202 | print ("""\ | ||
| 203 | diff --git a/build-aux/extract-ofp-fields b/build-aux/extract-ofp-fields | ||
| 204 | index c248e76..80c7d35 100755 | ||
| 205 | --- a/build-aux/extract-ofp-fields | ||
| 206 | +++ b/build-aux/extract-ofp-fields | ||
| 207 | @@ -728,7 +728,7 @@ def make_ovs_fields(meta_flow_h, meta_flow_xml): | ||
| 208 | ovs\-fields \- protocol header fields in OpenFlow and Open vSwitch | ||
| 209 | . | ||
| 210 | .PP | ||
| 211 | -''') % version | ||
| 212 | +''' % version) | ||
| 213 | |||
| 214 | recursively_replace(doc, 'oxm_classes', make_oxm_classes_xml(document)) | ||
| 215 | |||
| 216 | diff --git a/build-aux/extract-ofp-msgs b/build-aux/extract-ofp-msgs | ||
| 217 | index c2a91f9..92c4bda 100755 | ||
| 218 | --- a/build-aux/extract-ofp-msgs | ||
| 219 | +++ b/build-aux/extract-ofp-msgs | ||
| 220 | @@ -56,14 +56,14 @@ def fatal(msg): | ||
| 221 | |||
| 222 | def usage(): | ||
| 223 | argv0 = os.path.basename(sys.argv[0]) | ||
| 224 | - print '''\ | ||
| 225 | + print('''\ | ||
| 226 | %(argv0)s, for extracting OpenFlow message types from header files | ||
| 227 | usage: %(argv0)s INPUT OUTPUT | ||
| 228 | where INPUT is the name of the input header file | ||
| 229 | and OUTPUT is the output file name. | ||
| 230 | Despite OUTPUT, the output is written to stdout, and the OUTPUT argument | ||
| 231 | only controls #line directives in the output.\ | ||
| 232 | -''' % {"argv0": argv0} | ||
| 233 | +''' % {"argv0": argv0}) | ||
| 234 | sys.exit(0) | ||
| 235 | |||
| 236 | def make_sizeof(s): | ||
| 237 | @@ -378,5 +378,5 @@ if __name__ == '__main__': | ||
| 238 | line_number = 0 | ||
| 239 | |||
| 240 | for line in extract_ofp_msgs(sys.argv[2]): | ||
| 241 | - print line | ||
| 242 | + print(line) | ||
| 243 | |||
| 244 | diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc | ||
| 245 | index bdf2dcc..e82ad59 100755 | ||
| 246 | --- a/ovsdb/ovsdb-doc | ||
| 247 | +++ b/ovsdb/ovsdb-doc | ||
| 248 | @@ -258,7 +258,7 @@ represent strong references; thin lines represent weak references. | ||
| 249 | return s | ||
| 250 | |||
| 251 | def usage(): | ||
| 252 | - print """\ | ||
| 253 | + print("""\ | ||
| 254 | %(argv0)s: ovsdb schema documentation generator | ||
| 255 | Prints documentation for an OVSDB schema as an nroff-formatted manpage. | ||
| 256 | usage: %(argv0)s [OPTIONS] SCHEMA XML | ||
| 257 | @@ -269,7 +269,7 @@ The following options are also available: | ||
| 258 | --er-diagram=DIAGRAM.PIC include E-R diagram from DIAGRAM.PIC | ||
| 259 | --version=VERSION use VERSION to display on document footer | ||
| 260 | -h, --help display this help message\ | ||
| 261 | -""" % {'argv0': argv0} | ||
| 262 | +""" % {'argv0': argv0}) | ||
| 263 | sys.exit(0) | ||
| 264 | |||
| 265 | if __name__ == "__main__": | ||
| 266 | @@ -304,7 +304,7 @@ if __name__ == "__main__": | ||
| 267 | for line in s.split("\n"): | ||
| 268 | line = line.strip() | ||
| 269 | if len(line): | ||
| 270 | - print line | ||
| 271 | + print(line) | ||
| 272 | |||
| 273 | except error.Error, e: | ||
| 274 | sys.stderr.write("%s: %s\n" % (argv0, e.msg)) | ||
| 275 | diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in | ||
| 276 | index bfbcf23..62442ee 100755 | ||
| 277 | --- a/ovsdb/ovsdb-idlc.in | ||
| 278 | +++ b/ovsdb/ovsdb-idlc.in | ||
| 279 | @@ -1,5 +1,6 @@ | ||
| 280 | #! /usr/bin/env @PYTHON@ | ||
| 281 | |||
| 282 | +from __future__ import print_function | ||
| 283 | import getopt | ||
| 284 | import os | ||
| 285 | import re | ||
| 286 | @@ -123,7 +124,7 @@ def sorted_columns(table): | ||
| 287 | def printCIDLHeader(schemaFile): | ||
| 288 | schema = parseSchema(schemaFile) | ||
| 289 | prefix = schema.idlPrefix | ||
| 290 | - print '''\ | ||
| 291 | + print('''\ | ||
| 292 | /* Generated automatically -- do not modify! -*- buffer-read-only: t -*- */ | ||
| 293 | |||
| 294 | #ifndef %(prefix)sIDL_HEADER | ||
| 295 | @@ -135,39 +136,39 @@ def printCIDLHeader(schemaFile): | ||
| 296 | #include "ovsdb-data.h" | ||
| 297 | #include "ovsdb-idl-provider.h" | ||
| 298 | #include "smap.h" | ||
| 299 | -#include "uuid.h"''' % {'prefix': prefix.upper()} | ||
| 300 | +#include "uuid.h"''' % {'prefix': prefix.upper()}) | ||
| 301 | |||
| 302 | for tableName, table in sorted(schema.tables.iteritems()): | ||
| 303 | structName = "%s%s" % (prefix, tableName.lower()) | ||
| 304 | |||
| 305 | - print "" | ||
| 306 | - print "/* %s table. */" % tableName | ||
| 307 | - print "struct %s {" % structName | ||
| 308 | - print "\tstruct ovsdb_idl_row header_;" | ||
| 309 | + print("") | ||
| 310 | + print("/* %s table. */" % tableName) | ||
| 311 | + print("struct %s {" % structName) | ||
| 312 | + print("\tstruct ovsdb_idl_row header_;") | ||
| 313 | for columnName, column in sorted_columns(table): | ||
| 314 | - print "\n\t/* %s column. */" % columnName | ||
| 315 | + print("\n\t/* %s column. */" % columnName) | ||
| 316 | comment, members = cMembers(prefix, tableName, | ||
| 317 | columnName, column, False) | ||
| 318 | for member in members: | ||
| 319 | - print "\t%(type)s%(name)s;%(comment)s" % member | ||
| 320 | - print "};" | ||
| 321 | + print("\t%(type)s%(name)s;%(comment)s" % member) | ||
| 322 | + print("};") | ||
| 323 | |||
| 324 | # Column indexes. | ||
| 325 | printEnum("%s_column_id" % structName.lower(), ["%s_COL_%s" % (structName.upper(), columnName.upper()) | ||
| 326 | for columnName, column in sorted_columns(table)] | ||
| 327 | + ["%s_N_COLUMNS" % structName.upper()]) | ||
| 328 | |||
| 329 | |||
| 330 | + print("") | ||
| 331 | for columnName in table.columns: | ||
| 332 | - print "#define %(s)s_col_%(c)s (%(s)s_columns[%(S)s_COL_%(C)s])" % { | ||
| 333 | + print("#define %(s)s_col_%(c)s (%(s)s_columns[%(S)s_COL_%(C)s])" % { | ||
| 334 | 's': structName, | ||
| 335 | 'S': structName.upper(), | ||
| 336 | 'c': columnName, | ||
| 337 | - 'C': columnName.upper()} | ||
| 338 | + 'C': columnName.upper()}) | ||
| 339 | |||
| 340 | - print "\nextern struct ovsdb_idl_column %s_columns[%s_N_COLUMNS];" % (structName, structName.upper()) | ||
| 341 | + print("\nextern struct ovsdb_idl_column %s_columns[%s_N_COLUMNS];" % (structName, structName.upper())) | ||
| 342 | |||
| 343 | - print ''' | ||
| 344 | + print(''' | ||
| 345 | const struct %(s)s *%(s)s_get_for_uuid(const struct ovsdb_idl *, const struct uuid *); | ||
| 346 | const struct %(s)s *%(s)s_first(const struct ovsdb_idl *); | ||
| 347 | const struct %(s)s *%(s)s_next(const struct %(s)s *); | ||
| 348 | @@ -205,87 +206,87 @@ void %(s)s_init(struct %(s)s *); | ||
| 349 | void %(s)s_delete(const struct %(s)s *); | ||
| 350 | struct %(s)s *%(s)s_insert(struct ovsdb_idl_txn *); | ||
| 351 | bool %(s)s_is_updated(const struct %(s)s *, enum %(s)s_column_id); | ||
| 352 | -''' % {'s': structName, 'S': structName.upper()} | ||
| 353 | +''' % {'s': structName, 'S': structName.upper()}) | ||
| 354 | |||
| 355 | for columnName, column in sorted_columns(table): | ||
| 356 | - print 'void %(s)s_verify_%(c)s(const struct %(s)s *);' % {'s': structName, 'c': columnName} | ||
| 357 | + print('void %(s)s_verify_%(c)s(const struct %(s)s *);' % {'s': structName, 'c': columnName}) | ||
| 358 | |||
| 359 | |||
| 360 | + print("") | ||
| 361 | for columnName, column in sorted_columns(table): | ||
| 362 | if column.type.value: | ||
| 363 | valueParam = ', enum ovsdb_atomic_type value_type' | ||
| 364 | else: | ||
| 365 | valueParam = '' | ||
| 366 | - print 'const struct ovsdb_datum *%(s)s_get_%(c)s(const struct %(s)s *, enum ovsdb_atomic_type key_type%(v)s);' % { | ||
| 367 | - 's': structName, 'c': columnName, 'v': valueParam} | ||
| 368 | + print('const struct ovsdb_datum *%(s)s_get_%(c)s(const struct %(s)s *, enum ovsdb_atomic_type key_type%(v)s);' % { | ||
| 369 | + 's': structName, 'c': columnName, 'v': valueParam}) | ||
| 370 | |||
| 371 | |||
| 372 | + print("") | ||
| 373 | for columnName, column in sorted_columns(table): | ||
| 374 | - print 'void %(s)s_set_%(c)s(const struct %(s)s *,' % {'s': structName, 'c': columnName}, | ||
| 375 | + print('void %(s)s_set_%(c)s(const struct %(s)s *,' % {'s': structName, 'c': columnName}, end=' ') | ||
| 376 | if column.type.is_smap(): | ||
| 377 | args = ['const struct smap *'] | ||
| 378 | else: | ||
| 379 | comment, members = cMembers(prefix, tableName, columnName, | ||
| 380 | column, True) | ||
| 381 | args = ['%(type)s%(name)s' % member for member in members] | ||
| 382 | - print '%s);' % ', '.join(args) | ||
| 383 | + print('%s);' % ', '.join(args)) | ||
| 384 | |||
| 385 | |||
| 386 | + print("") | ||
| 387 | for columnName, column in sorted_columns(table): | ||
| 388 | if column.type.is_map(): | ||
| 389 | - print 'void %(s)s_update_%(c)s_setkey(const struct %(s)s *, ' % {'s': structName, 'c': columnName}, | ||
| 390 | - print '%(coltype)s, %(valtype)s);' % {'coltype':column.type.key.to_const_c_type(prefix), 'valtype':column.type.value.to_const_c_type(prefix)} | ||
| 391 | - print 'void %(s)s_update_%(c)s_delkey(const struct %(s)s *, ' % {'s': structName, 'c': columnName}, | ||
| 392 | - print '%(coltype)s);' % {'coltype':column.type.key.to_const_c_type(prefix)} | ||
| 393 | + print('void %(s)s_update_%(c)s_setkey(const struct %(s)s *, ' % {'s': structName, 'c': columnName}, end=' ') | ||
| 394 | + print('%(coltype)s, %(valtype)s);' % {'coltype':column.type.key.to_const_c_type(prefix), 'valtype':column.type.value.to_const_c_type(prefix)}) | ||
| 395 | + print('void %(s)s_update_%(c)s_delkey(const struct %(s)s *, ' % {'s': structName, 'c': columnName}, end=' ') | ||
| 396 | + print('%(coltype)s);' % {'coltype':column.type.key.to_const_c_type(prefix)}) | ||
| 397 | if column.type.is_set(): | ||
| 398 | - print 'void %(s)s_update_%(c)s_addvalue(const struct %(s)s *, ' % {'s': structName, 'c': columnName}, | ||
| 399 | - print '%(valtype)s);' % {'valtype':column.type.key.to_const_c_type(prefix)} | ||
| 400 | - print 'void %(s)s_update_%(c)s_delvalue(const struct %(s)s *, ' % {'s': structName, 'c': columnName}, | ||
| 401 | - print '%(valtype)s);' % {'valtype':column.type.key.to_const_c_type(prefix)} | ||
| 402 | + print('void %(s)s_update_%(c)s_addvalue(const struct %(s)s *, ' % {'s': structName, 'c': columnName}, end=' ') | ||
| 403 | + print('%(valtype)s);' % {'valtype':column.type.key.to_const_c_type(prefix)}) | ||
| 404 | + print('void %(s)s_update_%(c)s_delvalue(const struct %(s)s *, ' % {'s': structName, 'c': columnName}, end=' ') | ||
| 405 | + print('%(valtype)s);' % {'valtype':column.type.key.to_const_c_type(prefix)}) | ||
| 406 | |||
| 407 | - print 'void %(s)s_add_clause_%(c)s(struct ovsdb_idl_condition *, enum ovsdb_function function,' % {'s': structName, 'c': columnName}, | ||
| 408 | + print('void %(s)s_add_clause_%(c)s(struct ovsdb_idl_condition *, enum ovsdb_function function,' % {'s': structName, 'c': columnName}, end=' ') | ||
| 409 | if column.type.is_smap(): | ||
| 410 | args = ['const struct smap *'] | ||
| 411 | else: | ||
| 412 | comment, members = cMembers(prefix, tableName, columnName, | ||
| 413 | column, True, refTable=False) | ||
| 414 | args = ['%(type)s%(name)s' % member for member in members] | ||
| 415 | - print '%s);' % ', '.join(args) | ||
| 416 | + print('%s);' % ', '.join(args)) | ||
| 417 | |||
| 418 | - print 'void %(s)s_set_condition(struct ovsdb_idl *, struct ovsdb_idl_condition *);' % {'s': structName}, | ||
| 419 | + print('void %(s)s_set_condition(struct ovsdb_idl *, struct ovsdb_idl_condition *);' % {'s': structName}) | ||
| 420 | |||
| 421 | |||
| 422 | + print("") | ||
| 423 | |||
| 424 | # Table indexes. | ||
| 425 | printEnum("%stable_id" % prefix.lower(), ["%sTABLE_%s" % (prefix.upper(), tableName.upper()) for tableName in sorted(schema.tables)] + ["%sN_TABLES" % prefix.upper()]) | ||
| 426 | |||
| 427 | + print("") | ||
| 428 | for tableName in schema.tables: | ||
| 429 | - print "#define %(p)stable_%(t)s (%(p)stable_classes[%(P)sTABLE_%(T)s])" % { | ||
| 430 | + print("#define %(p)stable_%(t)s (%(p)stable_classes[%(P)sTABLE_%(T)s])" % { | ||
| 431 | 'p': prefix, | ||
| 432 | 'P': prefix.upper(), | ||
| 433 | 't': tableName.lower(), | ||
| 434 | - 'T': tableName.upper()} | ||
| 435 | - print "\nextern struct ovsdb_idl_table_class %stable_classes[%sN_TABLES];" % (prefix, prefix.upper()) | ||
| 436 | + 'T': tableName.upper()}) | ||
| 437 | + print("\nextern struct ovsdb_idl_table_class %stable_classes[%sN_TABLES];" % (prefix, prefix.upper())) | ||
| 438 | |||
| 439 | - print "\nextern struct ovsdb_idl_class %sidl_class;" % prefix | ||
| 440 | + print("\nextern struct ovsdb_idl_class %sidl_class;" % prefix) | ||
| 441 | |||
| 442 | - print "\nconst char * %sget_db_version(void);" % prefix | ||
| 443 | - print "\n#endif /* %(prefix)sIDL_HEADER */" % {'prefix': prefix.upper()} | ||
| 444 | + print("\nconst char * %sget_db_version(void);" % prefix) | ||
| 445 | + print("\n#endif /* %(prefix)sIDL_HEADER */" % {'prefix': prefix.upper()}) | ||
| 446 | |||
| 447 | def printEnum(type, members): | ||
| 448 | if len(members) == 0: | ||
| 449 | return | ||
| 450 | |||
| 451 | - print "\nenum %s {" % type | ||
| 452 | + print("\nenum %s {" % type) | ||
| 453 | for member in members[:-1]: | ||
| 454 | - print " %s," % member | ||
| 455 | - print " %s" % members[-1] | ||
| 456 | - print "};" | ||
| 457 | + print(" %s," % member) | ||
| 458 | + print(" %s" % members[-1]) | ||
| 459 | + print("};") | ||
| 460 | |||
| 461 | def printCIDLSource(schemaFile): | ||
| 462 | schema = parseSchema(schemaFile) | ||
| 463 | prefix = schema.idlPrefix | ||
| 464 | - print '''\ | ||
| 465 | + print('''\ | ||
| 466 | /* Generated automatically -- do not modify! -*- buffer-read-only: t -*- */ | ||
| 467 | |||
| 468 | #include <config.h> | ||
| 469 | @@ -296,33 +297,33 @@ def printCIDLSource(schemaFile): | ||
| 470 | #include "ovsdb-error.h" | ||
| 471 | #include "util.h" | ||
| 472 | |||
| 473 | -''' % schema.idlHeader | ||
| 474 | +''' % schema.idlHeader) | ||
| 475 | |||
| 476 | # Cast functions. | ||
| 477 | for tableName, table in sorted(schema.tables.iteritems()): | ||
| 478 | structName = "%s%s" % (prefix, tableName.lower()) | ||
| 479 | - print ''' | ||
| 480 | + print(''' | ||
| 481 | static struct %(s)s * | ||
| 482 | %(s)s_cast(const struct ovsdb_idl_row *row) | ||
| 483 | { | ||
| 484 | return row ? CONTAINER_OF(row, struct %(s)s, header_) : NULL; | ||
| 485 | }\ | ||
| 486 | -''' % {'s': structName} | ||
| 487 | +''' % {'s': structName}) | ||
| 488 | |||
| 489 | |||
| 490 | for tableName, table in sorted(schema.tables.iteritems()): | ||
| 491 | structName = "%s%s" % (prefix, tableName.lower()) | ||
| 492 | - print "" | ||
| 493 | - print "/* %s table. */" % (tableName) | ||
| 494 | + print("") | ||
| 495 | + print("/* %s table. */" % (tableName)) | ||
| 496 | |||
| 497 | # Parse functions. | ||
| 498 | for columnName, column in sorted_columns(table): | ||
| 499 | - print ''' | ||
| 500 | + print(''' | ||
| 501 | static void | ||
| 502 | %(s)s_parse_%(c)s(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum) | ||
| 503 | { | ||
| 504 | struct %(s)s *row = %(s)s_cast(row_);''' % {'s': structName, | ||
| 505 | - 'c': columnName} | ||
| 506 | + 'c': columnName}) | ||
| 507 | type = column.type | ||
| 508 | if type.value: | ||
| 509 | keyVar = "row->key_%s" % columnName | ||
| 510 | @@ -332,89 +333,89 @@ static void | ||
| 511 | valueVar = None | ||
| 512 | |||
| 513 | if type.is_smap(): | ||
| 514 | - print " smap_init(&row->%s);" % columnName | ||
| 515 | - print " for (size_t i = 0; i < datum->n; i++) {" | ||
| 516 | - print " smap_add(&row->%s," % columnName | ||
| 517 | - print " datum->keys[i].string," | ||
| 518 | - print " datum->values[i].string);" | ||
| 519 | - print " }" | ||
| 520 | + print(" smap_init(&row->%s);" % columnName) | ||
| 521 | + print(" for (size_t i = 0; i < datum->n; i++) {") | ||
| 522 | + print(" smap_add(&row->%s," % columnName) | ||
| 523 | + print(" datum->keys[i].string,") | ||
| 524 | + print(" datum->values[i].string);") | ||
| 525 | + print(" }") | ||
| 526 | elif (type.n_min == 1 and type.n_max == 1) or type.is_optional_pointer(): | ||
| 527 | |||
| 528 | - print " if (datum->n >= 1) {" | ||
| 529 | + print("") | ||
| 530 | + print(" if (datum->n >= 1) {") | ||
| 531 | if not type.key.ref_table: | ||
| 532 | - print " %s = datum->keys[0].%s;" % (keyVar, type.key.type.to_string()) | ||
| 533 | + print(" %s = datum->keys[0].%s;" % (keyVar, type.key.type.to_string())) | ||
| 534 | else: | ||
| 535 | - print " %s = %s%s_cast(ovsdb_idl_get_row_arc(row_, &%stable_%s, &datum->keys[0].uuid));" % (keyVar, prefix, type.key.ref_table.name.lower(), prefix, type.key.ref_table.name.lower()) | ||
| 536 | + print(" %s = %s%s_cast(ovsdb_idl_get_row_arc(row_, &%stable_%s, &datum->keys[0].uuid));" % (keyVar, prefix, type.key.ref_table.name.lower(), prefix, type.key.ref_table.name.lower())) | ||
| 537 | |||
| 538 | if valueVar: | ||
| 539 | if not type.value.ref_table: | ||
| 540 | - print " %s = datum->values[0].%s;" % (valueVar, type.value.type.to_string()) | ||
| 541 | + print(" %s = datum->values[0].%s;" % (valueVar, type.value.type.to_string())) | ||
| 542 | else: | ||
| 543 | - print " %s = %s%s_cast(ovsdb_idl_get_row_arc(row_, &%stable_%s, &datum->values[0].uuid));" % (valueVar, prefix, type.value.ref_table.name.lower(), prefix, type.value.ref_table.name.lower()) | ||
| 544 | - print " } else {" | ||
| 545 | - print " %s" % type.key.initCDefault(keyVar, type.n_min == 0) | ||
| 546 | + print(" %s = %s%s_cast(ovsdb_idl_get_row_arc(row_, &%stable_%s, &datum->values[0].uuid));" % (valueVar, prefix, type.value.ref_table.name.lower(), prefix, type.value.ref_table.name.lower())) | ||
| 547 | + print(" } else {") | ||
| 548 | + print(" %s" % type.key.initCDefault(keyVar, type.n_min == 0)) | ||
| 549 | if valueVar: | ||
| 550 | - print " %s" % type.value.initCDefault(valueVar, type.n_min == 0) | ||
| 551 | - print " }" | ||
| 552 | + print(" %s" % type.value.initCDefault(valueVar, type.n_min == 0)) | ||
| 553 | + print(" }") | ||
| 554 | else: | ||
| 555 | if type.n_max != sys.maxint: | ||
| 556 | - print " size_t n = MIN(%d, datum->n);" % type.n_max | ||
| 557 | + print(" size_t n = MIN(%d, datum->n);" % type.n_max) | ||
| 558 | nMax = "n" | ||
| 559 | else: | ||
| 560 | nMax = "datum->n" | ||
| 561 | - print " %s = NULL;" % keyVar | ||
| 562 | + print(" %s = NULL;" % keyVar) | ||
| 563 | if valueVar: | ||
| 564 | - print " %s = NULL;" % valueVar | ||
| 565 | - print " row->n_%s = 0;" % columnName | ||
| 566 | - print " for (size_t i = 0; i < %s; i++) {" % nMax | ||
| 567 | + print(" %s = NULL;" % valueVar) | ||
| 568 | + print(" row->n_%s = 0;" % columnName) | ||
| 569 | + print(" for (size_t i = 0; i < %s; i++) {" % nMax) | ||
| 570 | if type.key.ref_table: | ||
| 571 | - print """\ | ||
| 572 | + print("""\ | ||
| 573 | struct %s%s *keyRow = %s%s_cast(ovsdb_idl_get_row_arc(row_, &%stable_%s, &datum->keys[i].uuid)); | ||
| 574 | if (!keyRow) { | ||
| 575 | continue; | ||
| 576 | }\ | ||
| 577 | -""" % (prefix, type.key.ref_table.name.lower(), prefix, type.key.ref_table.name.lower(), prefix, type.key.ref_table.name.lower()) | ||
| 578 | +""" % (prefix, type.key.ref_table.name.lower(), prefix, type.key.ref_table.name.lower(), prefix, type.key.ref_table.name.lower())) | ||
| 579 | keySrc = "keyRow" | ||
| 580 | else: | ||
| 581 | keySrc = "datum->keys[i].%s" % type.key.type.to_string() | ||
| 582 | if type.value and type.value.ref_table: | ||
| 583 | - print """\ | ||
| 584 | + print("""\ | ||
| 585 | struct %s%s *valueRow = %s%s_cast(ovsdb_idl_get_row_arc(row_, &%stable_%s, &datum->values[i].uuid)); | ||
| 586 | if (!valueRow) { | ||
| 587 | continue; | ||
| 588 | }\ | ||
| 589 | -""" % (prefix, type.value.ref_table.name.lower(), prefix, type.value.ref_table.name.lower(), prefix, type.value.ref_table.name.lower()) | ||
| 590 | +""" % (prefix, type.value.ref_table.name.lower(), prefix, type.value.ref_table.name.lower(), prefix, type.value.ref_table.name.lower())) | ||
| 591 | valueSrc = "valueRow" | ||
| 592 | elif valueVar: | ||
| 593 | valueSrc = "datum->values[i].%s" % type.value.type.to_string() | ||
| 594 | - print " if (!row->n_%s) {" % (columnName) | ||
| 595 | + print(" if (!row->n_%s) {" % (columnName)) | ||
| 596 | |||
| 597 | - print " %s = xmalloc(%s * sizeof *%s);" % ( | ||
| 598 | - keyVar, nMax, keyVar) | ||
| 599 | + print(" %s = xmalloc(%s * sizeof *%s);" % ( | ||
| 600 | + keyVar, nMax, keyVar)) | ||
| 601 | if valueVar: | ||
| 602 | - print " %s = xmalloc(%s * sizeof *%s);" % ( | ||
| 603 | - valueVar, nMax, valueVar) | ||
| 604 | - print " }" | ||
| 605 | - print " %s[row->n_%s] = %s;" % (keyVar, columnName, keySrc) | ||
| 606 | + print(" %s = xmalloc(%s * sizeof *%s);" % ( | ||
| 607 | + valueVar, nMax, valueVar)) | ||
| 608 | + print(" }") | ||
| 609 | + print(" %s[row->n_%s] = %s;" % (keyVar, columnName, keySrc)) | ||
| 610 | if valueVar: | ||
| 611 | - print " %s[row->n_%s] = %s;" % (valueVar, columnName, valueSrc) | ||
| 612 | - print " row->n_%s++;" % columnName | ||
| 613 | - print " }" | ||
| 614 | - print "}" | ||
| 615 | + print(" %s[row->n_%s] = %s;" % (valueVar, columnName, valueSrc)) | ||
| 616 | + print(" row->n_%s++;" % columnName) | ||
| 617 | + print(" }") | ||
| 618 | + print("}") | ||
| 619 | |||
| 620 | # Unparse functions. | ||
| 621 | for columnName, column in sorted_columns(table): | ||
| 622 | type = column.type | ||
| 623 | if type.is_smap() or (type.n_min != 1 or type.n_max != 1) and not type.is_optional_pointer(): | ||
| 624 | - print ''' | ||
| 625 | + print(''' | ||
| 626 | static void | ||
| 627 | %(s)s_unparse_%(c)s(struct ovsdb_idl_row *row_) | ||
| 628 | { | ||
| 629 | struct %(s)s *row = %(s)s_cast(row_);''' % {'s': structName, | ||
| 630 | - 'c': columnName} | ||
| 631 | + 'c': columnName}) | ||
| 632 | |||
| 633 | if type.is_smap(): | ||
| 634 | - print " smap_destroy(&row->%s);" % columnName | ||
| 635 | + print(" smap_destroy(&row->%s);" % columnName) | ||
| 636 | else: | ||
| 637 | if type.value: | ||
| 638 | keyVar = "row->key_%s" % columnName | ||
| 639 | @@ -422,45 +423,45 @@ static void | ||
| 640 | else: | ||
| 641 | keyVar = "row->%s" % columnName | ||
| 642 | valueVar = None | ||
| 643 | - print " free(%s);" % keyVar | ||
| 644 | + print(" free(%s);" % keyVar) | ||
| 645 | if valueVar: | ||
| 646 | - print " free(%s);" % valueVar | ||
| 647 | - print '}' | ||
| 648 | + print(" free(%s);" % valueVar) | ||
| 649 | + print('}') | ||
| 650 | else: | ||
| 651 | - print ''' | ||
| 652 | + print(''' | ||
| 653 | static void | ||
| 654 | %(s)s_unparse_%(c)s(struct ovsdb_idl_row *row OVS_UNUSED) | ||
| 655 | { | ||
| 656 | /* Nothing to do. */ | ||
| 657 | -}''' % {'s': structName, 'c': columnName} | ||
| 658 | +}''' % {'s': structName, 'c': columnName}) | ||
| 659 | |||
| 660 | # Generic Row Initialization function. | ||
| 661 | - print """ | ||
| 662 | + print(""" | ||
| 663 | static void | ||
| 664 | %(s)s_init__(struct ovsdb_idl_row *row) | ||
| 665 | { | ||
| 666 | %(s)s_init(%(s)s_cast(row)); | ||
| 667 | -}""" % {'s': structName} | ||
| 668 | +}""" % {'s': structName}) | ||
| 669 | |||
| 670 | # Row Initialization function. | ||
| 671 | - print """ | ||
| 672 | + print(""" | ||
| 673 | /* Clears the contents of 'row' in table "%(t)s". */ | ||
| 674 | void | ||
| 675 | %(s)s_init(struct %(s)s *row) | ||
| 676 | { | ||
| 677 | - memset(row, 0, sizeof *row); """ % {'s': structName, 't': tableName} | ||
| 678 | + memset(row, 0, sizeof *row); """ % {'s': structName, 't': tableName}) | ||
| 679 | for columnName, column in sorted_columns(table): | ||
| 680 | if column.type.is_smap(): | ||
| 681 | - print " smap_init(&row->%s);" % columnName | ||
| 682 | + print(" smap_init(&row->%s);" % columnName) | ||
| 683 | elif (column.type.n_min == 1 and | ||
| 684 | column.type.n_max == 1 and | ||
| 685 | column.type.key.type == ovs.db.types.StringType and | ||
| 686 | not column.type.value): | ||
| 687 | - print " row->%s = \"\";" % columnName | ||
| 688 | - print "}" | ||
| 689 | + print(" row->%s = \"\";" % columnName) | ||
| 690 | + print("}") | ||
| 691 | |||
| 692 | # First, next functions. | ||
| 693 | - print ''' | ||
| 694 | + print(''' | ||
| 695 | /* Searches table "%(t)s" in 'idl' for a row with UUID 'uuid'. Returns | ||
| 696 | * a pointer to the row if there is one, otherwise a null pointer. */ | ||
| 697 | const struct %(s)s * | ||
| 698 | @@ -514,9 +515,9 @@ const struct %(s)s | ||
| 699 | 'P': prefix.upper(), | ||
| 700 | 't': tableName, | ||
| 701 | 'tl': tableName.lower(), | ||
| 702 | - 'T': tableName.upper()} | ||
| 703 | + 'T': tableName.upper()}) | ||
| 704 | |||
| 705 | - print ''' | ||
| 706 | + print(''' | ||
| 707 | |||
| 708 | /* Deletes 'row' from table "%(t)s". 'row' may be freed, so it must not be | ||
| 709 | * accessed afterward. | ||
| 710 | @@ -550,11 +551,11 @@ bool | ||
| 711 | 'P': prefix.upper(), | ||
| 712 | 't': tableName, | ||
| 713 | 'tl': tableName.lower(), | ||
| 714 | - 'T': tableName.upper()} | ||
| 715 | + 'T': tableName.upper()}) | ||
| 716 | |||
| 717 | # Verify functions. | ||
| 718 | for columnName, column in sorted_columns(table): | ||
| 719 | - print ''' | ||
| 720 | + print(''' | ||
| 721 | /* Causes the original contents of column "%(c)s" in 'row' to be | ||
| 722 | * verified as a prerequisite to completing the transaction. That is, if | ||
| 723 | * "%(c)s" in 'row' changed (or if 'row' was deleted) between the | ||
| 724 | @@ -585,7 +586,7 @@ void | ||
| 725 | }''' % {'s': structName, | ||
| 726 | 'S': structName.upper(), | ||
| 727 | 'c': columnName, | ||
| 728 | - 'C': columnName.upper()} | ||
| 729 | + 'C': columnName.upper()}) | ||
| 730 | |||
| 731 | # Get functions. | ||
| 732 | for columnName, column in sorted_columns(table): | ||
| 733 | @@ -597,7 +598,7 @@ void | ||
| 734 | valueParam = '' | ||
| 735 | valueType = '' | ||
| 736 | valueComment = '' | ||
| 737 | - print """ | ||
| 738 | + print(""" | ||
| 739 | /* Returns the "%(c)s" column's value from the "%(t)s" table in 'row' | ||
| 740 | * as a struct ovsdb_datum. This is useful occasionally: for example, | ||
| 741 | * ovsdb_datum_find_key() is an easier and more efficient way to search | ||
| 742 | @@ -625,7 +626,7 @@ const struct ovsdb_datum * | ||
| 743 | return ovsdb_idl_read(&row->header_, &%(s)s_col_%(c)s); | ||
| 744 | }""" % {'t': tableName, 's': structName, 'c': columnName, | ||
| 745 | 'kt': column.type.key.toAtomicType(), | ||
| 746 | - 'v': valueParam, 'vt': valueType, 'vc': valueComment} | ||
| 747 | + 'v': valueParam, 'vt': valueType, 'vc': valueComment}) | ||
| 748 | |||
| 749 | # Set functions. | ||
| 750 | for columnName, column in sorted_columns(table): | ||
| 751 | @@ -635,8 +636,8 @@ const struct ovsdb_datum * | ||
| 752 | column, True) | ||
| 753 | |||
| 754 | if type.is_smap(): | ||
| 755 | - print comment | ||
| 756 | - print """void | ||
| 757 | + print(comment) | ||
| 758 | + print("""void | ||
| 759 | %(s)s_set_%(c)s(const struct %(s)s *row, const struct smap *%(c)s) | ||
| 760 | { | ||
| 761 | struct ovsdb_datum datum; | ||
| 762 | @@ -654,7 +655,7 @@ const struct ovsdb_datum * | ||
| 763 | 's': structName, | ||
| 764 | 'S': structName.upper(), | ||
| 765 | 'c': columnName, | ||
| 766 | - 'C': columnName.upper()} | ||
| 767 | + 'C': columnName.upper()}) | ||
| 768 | continue | ||
| 769 | |||
| 770 | keyVar = members[0]['name'] | ||
| 771 | @@ -668,84 +669,84 @@ const struct ovsdb_datum * | ||
| 772 | if len(members) > 1: | ||
| 773 | nVar = members[1]['name'] | ||
| 774 | |||
| 775 | - print comment | ||
| 776 | - print """\ | ||
| 777 | + print(comment) | ||
| 778 | + print("""\ | ||
| 779 | void | ||
| 780 | %(s)s_set_%(c)s(const struct %(s)s *row, %(args)s) | ||
| 781 | { | ||
| 782 | struct ovsdb_datum datum;""" % {'s': structName, | ||
| 783 | 'c': columnName, | ||
| 784 | 'args': ', '.join(['%(type)s%(name)s' | ||
| 785 | - % m for m in members])} | ||
| 786 | + % m for m in members])}) | ||
| 787 | if type.n_min == 1 and type.n_max == 1: | ||
| 788 | - print " union ovsdb_atom key;" | ||
| 789 | + print(" union ovsdb_atom key;") | ||
| 790 | if type.value: | ||
| 791 | - print " union ovsdb_atom value;" | ||
| 792 | |||
| 793 | - print " datum.n = 1;" | ||
| 794 | - print " datum.keys = &key;" | ||
| 795 | - print " " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), keyVar) | ||
| 796 | + print(" union ovsdb_atom value;") | ||
| 797 | + print("") | ||
| 798 | + print(" datum.n = 1;") | ||
| 799 | + print(" datum.keys = &key;") | ||
| 800 | + print(" " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), keyVar)) | ||
| 801 | if type.value: | ||
| 802 | - print " datum.values = &value;" | ||
| 803 | - print " "+ type.value.assign_c_value_casting_away_const("value.%s" % type.value.type.to_string(), valueVar) | ||
| 804 | + print(" datum.values = &value;") | ||
| 805 | + print(" "+ type.value.assign_c_value_casting_away_const("value.%s" % type.value.type.to_string(), valueVar)) | ||
| 806 | else: | ||
| 807 | - print " datum.values = NULL;" | ||
| 808 | + print(" datum.values = NULL;") | ||
| 809 | txn_write_func = "ovsdb_idl_txn_write_clone" | ||
| 810 | elif type.is_optional_pointer(): | ||
| 811 | - print " union ovsdb_atom key;" | ||
| 812 | |||
| 813 | - print " if (%s) {" % keyVar | ||
| 814 | - print " datum.n = 1;" | ||
| 815 | - print " datum.keys = &key;" | ||
| 816 | - print " " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), keyVar) | ||
| 817 | - print " } else {" | ||
| 818 | - print " datum.n = 0;" | ||
| 819 | - print " datum.keys = NULL;" | ||
| 820 | - print " }" | ||
| 821 | - print " datum.values = NULL;" | ||
| 822 | + print(" union ovsdb_atom key;") | ||
| 823 | + print("") | ||
| 824 | + print(" if (%s) {" % keyVar) | ||
| 825 | + print(" datum.n = 1;") | ||
| 826 | + print(" datum.keys = &key;") | ||
| 827 | + print(" " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), keyVar)) | ||
| 828 | + print(" } else {") | ||
| 829 | + print(" datum.n = 0;") | ||
| 830 | + print(" datum.keys = NULL;") | ||
| 831 | + print(" }") | ||
| 832 | + print(" datum.values = NULL;") | ||
| 833 | txn_write_func = "ovsdb_idl_txn_write_clone" | ||
| 834 | elif type.n_max == 1: | ||
| 835 | - print " union ovsdb_atom key;" | ||
| 836 | |||
| 837 | - print " if (%s) {" % nVar | ||
| 838 | - print " datum.n = 1;" | ||
| 839 | - print " datum.keys = &key;" | ||
| 840 | - print " " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), "*" + keyVar) | ||
| 841 | - print " } else {" | ||
| 842 | - print " datum.n = 0;" | ||
| 843 | - print " datum.keys = NULL;" | ||
| 844 | - print " }" | ||
| 845 | - print " datum.values = NULL;" | ||
| 846 | + print(" union ovsdb_atom key;") | ||
| 847 | + print("") | ||
| 848 | + print(" if (%s) {" % nVar) | ||
| 849 | + print(" datum.n = 1;") | ||
| 850 | + print(" datum.keys = &key;") | ||
| 851 | + print(" " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), "*" + keyVar)) | ||
| 852 | + print(" } else {") | ||
| 853 | + print(" datum.n = 0;") | ||
| 854 | + print(" datum.keys = NULL;") | ||
| 855 | + print(" }") | ||
| 856 | + print(" datum.values = NULL;") | ||
| 857 | txn_write_func = "ovsdb_idl_txn_write_clone" | ||
| 858 | else: | ||
| 859 | |||
| 860 | - print " datum.n = %s;" % nVar | ||
| 861 | - print " datum.keys = %s ? xmalloc(%s * sizeof *datum.keys) : NULL;" % (nVar, nVar) | ||
| 862 | + print("") | ||
| 863 | + print(" datum.n = %s;" % nVar) | ||
| 864 | + print(" datum.keys = %s ? xmalloc(%s * sizeof *datum.keys) : NULL;" % (nVar, nVar)) | ||
| 865 | if type.value: | ||
| 866 | - print " datum.values = xmalloc(%s * sizeof *datum.values);" % nVar | ||
| 867 | + print(" datum.values = xmalloc(%s * sizeof *datum.values);" % nVar) | ||
| 868 | else: | ||
| 869 | - print " datum.values = NULL;" | ||
| 870 | - print " for (size_t i = 0; i < %s; i++) {" % nVar | ||
| 871 | - print " " + type.key.copyCValue("datum.keys[i].%s" % type.key.type.to_string(), "%s[i]" % keyVar) | ||
| 872 | + print(" datum.values = NULL;") | ||
| 873 | + print(" for (size_t i = 0; i < %s; i++) {" % nVar) | ||
| 874 | + print(" " + type.key.copyCValue("datum.keys[i].%s" % type.key.type.to_string(), "%s[i]" % keyVar)) | ||
| 875 | if type.value: | ||
| 876 | - print " " + type.value.copyCValue("datum.values[i].%s" % type.value.type.to_string(), "%s[i]" % valueVar) | ||
| 877 | - print " }" | ||
| 878 | + print(" " + type.value.copyCValue("datum.values[i].%s" % type.value.type.to_string(), "%s[i]" % valueVar)) | ||
| 879 | + print(" }") | ||
| 880 | if type.value: | ||
| 881 | valueType = type.value.toAtomicType() | ||
| 882 | else: | ||
| 883 | valueType = "OVSDB_TYPE_VOID" | ||
| 884 | txn_write_func = "ovsdb_idl_txn_write" | ||
| 885 | - print " %(f)s(&row->header_, &%(s)s_col_%(c)s, &datum);" \ | ||
| 886 | + print(" %(f)s(&row->header_, &%(s)s_col_%(c)s, &datum);" \ | ||
| 887 | % {'f': txn_write_func, | ||
| 888 | 's': structName, | ||
| 889 | 'S': structName.upper(), | ||
| 890 | - 'c': columnName} | ||
| 891 | - print "}" | ||
| 892 | + 'c': columnName}) | ||
| 893 | + print("}") | ||
| 894 | # Update/Delete of partial map column functions | ||
| 895 | for columnName, column in sorted_columns(table): | ||
| 896 | type = column.type | ||
| 897 | if type.is_map(): | ||
| 898 | - print ''' | ||
| 899 | + print(''' | ||
| 900 | /* Sets an element of the "%(c)s" map column from the "%(t)s" table in 'row' | ||
| 901 | * to 'new_value' given the key value 'new_key'. | ||
| 902 | * | ||
| 903 | @@ -761,17 +762,17 @@ void | ||
| 904 | datum->values = xmalloc(datum->n * sizeof *datum->values); | ||
| 905 | ''' % {'s': structName, 'c': columnName,'coltype':column.type.key.to_const_c_type(prefix), | ||
| 906 | 'valtype':column.type.value.to_const_c_type(prefix), 'S': structName.upper(), | ||
| 907 | - 'C': columnName.upper(), 't': tableName} | ||
| 908 | + 'C': columnName.upper(), 't': tableName}) | ||
| 909 | |||
| 910 | - print " "+ type.key.copyCValue("datum->keys[0].%s" % type.key.type.to_string(), "new_key") | ||
| 911 | - print " "+ type.value.copyCValue("datum->values[0].%s" % type.value.type.to_string(), "new_value") | ||
| 912 | - print ''' | ||
| 913 | + print(" "+ type.key.copyCValue("datum->keys[0].%s" % type.key.type.to_string(), "new_key")) | ||
| 914 | + print(" "+ type.value.copyCValue("datum->values[0].%s" % type.value.type.to_string(), "new_value")) | ||
| 915 | + print(''' | ||
| 916 | ovsdb_idl_txn_write_partial_map(&row->header_, | ||
| 917 | &%(s)s_col_%(c)s, | ||
| 918 | datum); | ||
| 919 | }''' % {'s': structName, 'c': columnName,'coltype':column.type.key.toCType(prefix), | ||
| 920 | - 'valtype':column.type.value.to_const_c_type(prefix), 'S': structName.upper()} | ||
| 921 | - print ''' | ||
| 922 | + 'valtype':column.type.value.to_const_c_type(prefix), 'S': structName.upper()}) | ||
| 923 | + print(''' | ||
| 924 | /* Deletes an element of the "%(c)s" map column from the "%(t)s" table in 'row' | ||
| 925 | * given the key value 'delete_key'. | ||
| 926 | * | ||
| 927 | @@ -787,19 +788,19 @@ void | ||
| 928 | datum->values = NULL; | ||
| 929 | ''' % {'s': structName, 'c': columnName,'coltype':column.type.key.to_const_c_type(prefix), | ||
| 930 | 'valtype':column.type.value.to_const_c_type(prefix), 'S': structName.upper(), | ||
| 931 | - 'C': columnName.upper(), 't': tableName} | ||
| 932 | + 'C': columnName.upper(), 't': tableName}) | ||
| 933 | |||
| 934 | - print " "+ type.key.copyCValue("datum->keys[0].%s" % type.key.type.to_string(), "delete_key") | ||
| 935 | - print ''' | ||
| 936 | + print(" "+ type.key.copyCValue("datum->keys[0].%s" % type.key.type.to_string(), "delete_key")) | ||
| 937 | + print(''' | ||
| 938 | ovsdb_idl_txn_delete_partial_map(&row->header_, | ||
| 939 | &%(s)s_col_%(c)s, | ||
| 940 | datum); | ||
| 941 | }''' % {'s': structName, 'c': columnName,'coltype':column.type.key.toCType(prefix), | ||
| 942 | - 'valtype':column.type.value.to_const_c_type(prefix), 'S': structName.upper()} | ||
| 943 | + 'valtype':column.type.value.to_const_c_type(prefix), 'S': structName.upper()}) | ||
| 944 | # End Update/Delete of partial maps | ||
| 945 | # Update/Delete of partial set column functions | ||
| 946 | if type.is_set(): | ||
| 947 | - print ''' | ||
| 948 | + print(''' | ||
| 949 | /* Adds the value 'new_value' to the "%(c)s" set column from the "%(t)s" table | ||
| 950 | * in 'row'. | ||
| 951 | * | ||
| 952 | @@ -814,16 +815,16 @@ void | ||
| 953 | datum->keys = xmalloc(datum->n * sizeof *datum->values); | ||
| 954 | datum->values = NULL; | ||
| 955 | ''' % {'s': structName, 'c': columnName, | ||
| 956 | - 'valtype':column.type.key.to_const_c_type(prefix), 't': tableName} | ||
| 957 | + 'valtype':column.type.key.to_const_c_type(prefix), 't': tableName}) | ||
| 958 | |||
| 959 | - print " "+ type.key.copyCValue("datum->keys[0].%s" % type.key.type.to_string(), "new_value") | ||
| 960 | - print ''' | ||
| 961 | + print(" "+ type.key.copyCValue("datum->keys[0].%s" % type.key.type.to_string(), "new_value")) | ||
| 962 | + print(''' | ||
| 963 | ovsdb_idl_txn_write_partial_set(&row->header_, | ||
| 964 | &%(s)s_col_%(c)s, | ||
| 965 | datum); | ||
| 966 | }''' % {'s': structName, 'c': columnName,'coltype':column.type.key.toCType(prefix), | ||
| 967 | - 'valtype':column.type.key.to_const_c_type(prefix), 'S': structName.upper()} | ||
| 968 | - print ''' | ||
| 969 | + 'valtype':column.type.key.to_const_c_type(prefix), 'S': structName.upper()}) | ||
| 970 | + print(''' | ||
| 971 | /* Deletes the value 'delete_value' from the "%(c)s" set column from the | ||
| 972 | * "%(t)s" table in 'row'. | ||
| 973 | * | ||
| 974 | @@ -839,15 +840,15 @@ void | ||
| 975 | datum->values = NULL; | ||
| 976 | ''' % {'s': structName, 'c': columnName,'coltype':column.type.key.to_const_c_type(prefix), | ||
| 977 | 'valtype':column.type.key.to_const_c_type(prefix), 'S': structName.upper(), | ||
| 978 | - 'C': columnName.upper(), 't': tableName} | ||
| 979 | + 'C': columnName.upper(), 't': tableName}) | ||
| 980 | |||
| 981 | - print " "+ type.key.copyCValue("datum->keys[0].%s" % type.key.type.to_string(), "delete_value") | ||
| 982 | - print ''' | ||
| 983 | + print(" "+ type.key.copyCValue("datum->keys[0].%s" % type.key.type.to_string(), "delete_value")) | ||
| 984 | + print(''' | ||
| 985 | ovsdb_idl_txn_delete_partial_set(&row->header_, | ||
| 986 | &%(s)s_col_%(c)s, | ||
| 987 | datum); | ||
| 988 | }''' % {'s': structName, 'c': columnName,'coltype':column.type.key.toCType(prefix), | ||
| 989 | - 'valtype':column.type.key.to_const_c_type(prefix), 'S': structName.upper()} | ||
| 990 | + 'valtype':column.type.key.to_const_c_type(prefix), 'S': structName.upper()}) | ||
| 991 | # End Update/Delete of partial set | ||
| 992 | |||
| 993 | # Add clause functions. | ||
| 994 | @@ -858,8 +859,8 @@ void | ||
| 995 | column, True, refTable=False) | ||
| 996 | |||
| 997 | if type.is_smap(): | ||
| 998 | - print comment | ||
| 999 | - print """void | ||
| 1000 | + print(comment) | ||
| 1001 | + print("""void | ||
| 1002 | %(s)s_add_clause_%(c)s(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *%(c)s) | ||
| 1003 | { | ||
| 1004 | struct ovsdb_datum datum; | ||
| 1005 | @@ -884,7 +885,7 @@ void | ||
| 1006 | 'P': prefix.upper(), | ||
| 1007 | 's': structName, | ||
| 1008 | 'S': structName.upper(), | ||
| 1009 | - 'c': columnName} | ||
| 1010 | + 'c': columnName}) | ||
| 1011 | continue | ||
| 1012 | |||
| 1013 | keyVar = members[0]['name'] | ||
| 1014 | @@ -898,73 +899,73 @@ void | ||
| 1015 | if len(members) > 1: | ||
| 1016 | nVar = members[1]['name'] | ||
| 1017 | |||
| 1018 | - print comment | ||
| 1019 | - print 'void' | ||
| 1020 | - print '%(s)s_add_clause_%(c)s(struct ovsdb_idl_condition *cond, enum ovsdb_function function, %(args)s)' % \ | ||
| 1021 | + print(comment) | ||
| 1022 | + print('void') | ||
| 1023 | + print('%(s)s_add_clause_%(c)s(struct ovsdb_idl_condition *cond, enum ovsdb_function function, %(args)s)' % \ | ||
| 1024 | {'s': structName, 'c': columnName, | ||
| 1025 | - 'args': ', '.join(['%(type)s%(name)s' % m for m in members])} | ||
| 1026 | - print "{" | ||
| 1027 | - print " struct ovsdb_datum datum;" | ||
| 1028 | + 'args': ', '.join(['%(type)s%(name)s' % m for m in members])}) | ||
| 1029 | + print("{") | ||
| 1030 | + print(" struct ovsdb_datum datum;") | ||
| 1031 | free = [] | ||
| 1032 | if type.n_min == 1 and type.n_max == 1: | ||
| 1033 | - print " union ovsdb_atom key;" | ||
| 1034 | + print(" union ovsdb_atom key;") | ||
| 1035 | if type.value: | ||
| 1036 | - print " union ovsdb_atom value;" | ||
| 1037 | |||
| 1038 | - print " datum.n = 1;" | ||
| 1039 | - print " datum.keys = &key;" | ||
| 1040 | - print " " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), keyVar, refTable=False) | ||
| 1041 | + print(" union ovsdb_atom value;") | ||
| 1042 | + print("") | ||
| 1043 | + print(" datum.n = 1;") | ||
| 1044 | + print(" datum.keys = &key;") | ||
| 1045 | + print(" " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), keyVar, refTable=False)) | ||
| 1046 | if type.value: | ||
| 1047 | - print " datum.values = &value;" | ||
| 1048 | - print " "+ type.value.assign_c_value_casting_away_const("value.%s" % type.value.type.to_string(), valueVar, refTable=False) | ||
| 1049 | + print(" datum.values = &value;") | ||
| 1050 | + print(" "+ type.value.assign_c_value_casting_away_const("value.%s" % type.value.type.to_string(), valueVar, refTable=False)) | ||
| 1051 | else: | ||
| 1052 | - print " datum.values = NULL;" | ||
| 1053 | + print(" datum.values = NULL;") | ||
| 1054 | elif type.is_optional_pointer(): | ||
| 1055 | - print " union ovsdb_atom key;" | ||
| 1056 | |||
| 1057 | - print " if (%s) {" % keyVar | ||
| 1058 | - print " datum.n = 1;" | ||
| 1059 | - print " datum.keys = &key;" | ||
| 1060 | - print " " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), keyVar, refTable=False) | ||
| 1061 | - print " } else {" | ||
| 1062 | - print " datum.n = 0;" | ||
| 1063 | - print " datum.keys = NULL;" | ||
| 1064 | - print " }" | ||
| 1065 | - print " datum.values = NULL;" | ||
| 1066 | + print(" union ovsdb_atom key;") | ||
| 1067 | + print("") | ||
| 1068 | + print(" if (%s) {" % keyVar) | ||
| 1069 | + print(" datum.n = 1;") | ||
| 1070 | + print(" datum.keys = &key;") | ||
| 1071 | + print(" " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), keyVar, refTable=False)) | ||
| 1072 | + print(" } else {") | ||
| 1073 | + print(" datum.n = 0;") | ||
| 1074 | + print(" datum.keys = NULL;") | ||
| 1075 | + print(" }") | ||
| 1076 | + print(" datum.values = NULL;") | ||
| 1077 | elif type.n_max == 1: | ||
| 1078 | - print " union ovsdb_atom key;" | ||
| 1079 | |||
| 1080 | - print " if (%s) {" % nVar | ||
| 1081 | - print " datum.n = 1;" | ||
| 1082 | - print " datum.keys = &key;" | ||
| 1083 | - print " " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), "*" + keyVar, refTable=False) | ||
| 1084 | - print " } else {" | ||
| 1085 | - print " datum.n = 0;" | ||
| 1086 | - print " datum.keys = NULL;" | ||
| 1087 | - print " }" | ||
| 1088 | - print " datum.values = NULL;" | ||
| 1089 | + print(" union ovsdb_atom key;") | ||
| 1090 | + print("") | ||
| 1091 | + print(" if (%s) {" % nVar) | ||
| 1092 | + print(" datum.n = 1;") | ||
| 1093 | + print(" datum.keys = &key;") | ||
| 1094 | + print(" " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), "*" + keyVar, refTable=False)) | ||
| 1095 | + print(" } else {") | ||
| 1096 | + print(" datum.n = 0;") | ||
| 1097 | + print(" datum.keys = NULL;") | ||
| 1098 | + print(" }") | ||
| 1099 | + print(" datum.values = NULL;") | ||
| 1100 | else: | ||
| 1101 | - print " datum.n = %s;" % nVar | ||
| 1102 | - print " datum.keys = %s ? xmalloc(%s * sizeof *datum.keys) : NULL;" % (nVar, nVar) | ||
| 1103 | + print(" datum.n = %s;" % nVar) | ||
| 1104 | + print(" datum.keys = %s ? xmalloc(%s * sizeof *datum.keys) : NULL;" % (nVar, nVar)) | ||
| 1105 | free += ['datum.keys'] | ||
| 1106 | if type.value: | ||
| 1107 | - print " datum.values = xmalloc(%s * sizeof *datum.values);" % nVar | ||
| 1108 | + print(" datum.values = xmalloc(%s * sizeof *datum.values);" % nVar) | ||
| 1109 | free += ['datum.values'] | ||
| 1110 | else: | ||
| 1111 | - print " datum.values = NULL;" | ||
| 1112 | - print " for (size_t i = 0; i < %s; i++) {" % nVar | ||
| 1113 | - print " " + type.key.assign_c_value_casting_away_const("datum.keys[i].%s" % type.key.type.to_string(), "%s[i]" % keyVar, refTable=False) | ||
| 1114 | + print(" datum.values = NULL;") | ||
| 1115 | + print(" for (size_t i = 0; i < %s; i++) {" % nVar) | ||
| 1116 | + print(" " + type.key.assign_c_value_casting_away_const("datum.keys[i].%s" % type.key.type.to_string(), "%s[i]" % keyVar, refTable=False)) | ||
| 1117 | if type.value: | ||
| 1118 | - print " " + type.value.assign_c_value_casting_away_const("datum.values[i].%s" % type.value.type.to_string(), "%s[i]" % valueVar, refTable=False) | ||
| 1119 | - print " }" | ||
| 1120 | + print(" " + type.value.assign_c_value_casting_away_const("datum.values[i].%s" % type.value.type.to_string(), "%s[i]" % valueVar, refTable=False)) | ||
| 1121 | + print(" }") | ||
| 1122 | if type.value: | ||
| 1123 | valueType = type.value.toAtomicType() | ||
| 1124 | else: | ||
| 1125 | valueType = "OVSDB_TYPE_VOID" | ||
| 1126 | - print " ovsdb_datum_sort_unique(&datum, %s, %s);" % ( | ||
| 1127 | - type.key.toAtomicType(), valueType) | ||
| 1128 | + print(" ovsdb_datum_sort_unique(&datum, %s, %s);" % ( | ||
| 1129 | + type.key.toAtomicType(), valueType)) | ||
| 1130 | |||
| 1131 | - print""" ovsdb_idl_condition_add_clause(cond, | ||
| 1132 | + print(""" ovsdb_idl_condition_add_clause(cond, | ||
| 1133 | function, | ||
| 1134 | &%(s)s_col_%(c)s, | ||
| 1135 | &datum);\ | ||
| 1136 | @@ -974,28 +975,28 @@ void | ||
| 1137 | 'P': prefix.upper(), | ||
| 1138 | 's': structName, | ||
| 1139 | 'S': structName.upper(), | ||
| 1140 | - 'c': columnName} | ||
| 1141 | + 'c': columnName}) | ||
| 1142 | for var in free: | ||
| 1143 | - print " free(%s);" % var | ||
| 1144 | - print "}" | ||
| 1145 | + print(" free(%s);" % var) | ||
| 1146 | + print("}") | ||
| 1147 | |||
| 1148 | - print """ | ||
| 1149 | + print(""" | ||
| 1150 | void | ||
| 1151 | %(s)s_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition) | ||
| 1152 | { | ||
| 1153 | ovsdb_idl_set_condition(idl, &%(p)stable_%(tl)s, condition); | ||
| 1154 | }""" % {'p': prefix, | ||
| 1155 | 's': structName, | ||
| 1156 | - 'tl': tableName.lower()} | ||
| 1157 | + 'tl': tableName.lower()}) | ||
| 1158 | |||
| 1159 | # Table columns. | ||
| 1160 | for columnName, column in sorted_columns(table): | ||
| 1161 | prereqs = [] | ||
| 1162 | x = column.type.cInitType("%s_col_%s" % (tableName, columnName), prereqs) | ||
| 1163 | if prereqs: | ||
| 1164 | - print '\n'.join(prereqs) | ||
| 1165 | - print "\nstruct ovsdb_idl_column %s_columns[%s_N_COLUMNS] = {" % ( | ||
| 1166 | - structName, structName.upper()) | ||
| 1167 | + print('\n'.join(prereqs)) | ||
| 1168 | + print("\nstruct ovsdb_idl_column %s_columns[%s_N_COLUMNS] = {" % ( | ||
| 1169 | + structName, structName.upper())) | ||
| 1170 | for columnName, column in sorted_columns(table): | ||
| 1171 | if column.mutable: | ||
| 1172 | mutable = "true" | ||
| 1173 | @@ -1003,7 +1004,7 @@ void | ||
| 1174 | mutable = "false" | ||
| 1175 | type_init = '\n'.join(" " + x | ||
| 1176 | for x in column.type.cInitType("%s_col_%s" % (tableName, columnName), prereqs)) | ||
| 1177 | - print """\ | ||
| 1178 | + print("""\ | ||
| 1179 | [%(P)s%(T)s_COL_%(C)s] = { | ||
| 1180 | .name = "%(c)s", | ||
| 1181 | .type = { | ||
| 1182 | @@ -1018,38 +1019,38 @@ void | ||
| 1183 | 'C': columnName.upper(), | ||
| 1184 | 's': structName, | ||
| 1185 | 'mutable': mutable, | ||
| 1186 | - 'type': type_init} | ||
| 1187 | - print "};" | ||
| 1188 | + 'type': type_init}) | ||
| 1189 | + print("};") | ||
| 1190 | |||
| 1191 | # Table classes. | ||
| 1192 | - print "" | ||
| 1193 | - print "struct ovsdb_idl_table_class %stable_classes[%sN_TABLES] = {" % (prefix, prefix.upper()) | ||
| 1194 | + print("") | ||
| 1195 | + print("struct ovsdb_idl_table_class %stable_classes[%sN_TABLES] = {" % (prefix, prefix.upper())) | ||
| 1196 | for tableName, table in sorted(schema.tables.iteritems()): | ||
| 1197 | structName = "%s%s" % (prefix, tableName.lower()) | ||
| 1198 | if table.is_root: | ||
| 1199 | is_root = "true" | ||
| 1200 | else: | ||
| 1201 | is_root = "false" | ||
| 1202 | - print " {\"%s\", %s," % (tableName, is_root) | ||
| 1203 | - print " %s_columns, ARRAY_SIZE(%s_columns)," % ( | ||
| 1204 | - structName, structName) | ||
| 1205 | - print " sizeof(struct %s), %s_init__}," % (structName, structName) | ||
| 1206 | - print "};" | ||
| 1207 | + print(" {\"%s\", %s," % (tableName, is_root)) | ||
| 1208 | + print(" %s_columns, ARRAY_SIZE(%s_columns)," % ( | ||
| 1209 | + structName, structName)) | ||
| 1210 | + print(" sizeof(struct %s), %s_init__}," % (structName, structName)) | ||
| 1211 | + print("};") | ||
| 1212 | |||
| 1213 | # IDL class. | ||
| 1214 | - print "\nstruct ovsdb_idl_class %sidl_class = {" % prefix | ||
| 1215 | - print " \"%s\", %stable_classes, ARRAY_SIZE(%stable_classes)" % ( | ||
| 1216 | - schema.name, prefix, prefix) | ||
| 1217 | - print "};" | ||
| 1218 | + print("\nstruct ovsdb_idl_class %sidl_class = {" % prefix) | ||
| 1219 | + print(" \"%s\", %stable_classes, ARRAY_SIZE(%stable_classes)" % ( | ||
| 1220 | + schema.name, prefix, prefix)) | ||
| 1221 | + print("};") | ||
| 1222 | |||
| 1223 | - print """ | ||
| 1224 | + print(""" | ||
| 1225 | /* Return the schema version. The caller must not free the returned value. */ | ||
| 1226 | const char * | ||
| 1227 | %sget_db_version(void) | ||
| 1228 | { | ||
| 1229 | return "%s"; | ||
| 1230 | } | ||
| 1231 | -""" % (prefix, schema.version) | ||
| 1232 | +""" % (prefix, schema.version)) | ||
| 1233 | |||
| 1234 | |||
| 1235 | |||
| 1236 | @@ -1075,7 +1076,7 @@ def ovsdb_escape(string): | ||
| 1237 | return re.sub(r'["\\\000-\037]', escape, string) | ||
| 1238 | |||
| 1239 | def usage(): | ||
| 1240 | - print """\ | ||
| 1241 | + print("""\ | ||
| 1242 | %(argv0)s: ovsdb schema compiler | ||
| 1243 | usage: %(argv0)s [OPTIONS] COMMAND ARG... | ||
| 1244 | |||
| 1245 | @@ -1087,7 +1088,7 @@ The following commands are supported: | ||
| 1246 | The following options are also available: | ||
| 1247 | -h, --help display this help message | ||
| 1248 | -V, --version display version information\ | ||
| 1249 | -""" % {'argv0': argv0} | ||
| 1250 | +""" % {'argv0': argv0}) | ||
| 1251 | sys.exit(0) | ||
| 1252 | |||
| 1253 | if __name__ == "__main__": | ||
| 1254 | @@ -1105,7 +1106,7 @@ if __name__ == "__main__": | ||
| 1255 | if key in ['-h', '--help']: | ||
| 1256 | usage() | ||
| 1257 | elif key in ['-V', '--version']: | ||
| 1258 | - print "ovsdb-idlc (Open vSwitch) @VERSION@" | ||
| 1259 | + print("ovsdb-idlc (Open vSwitch) @VERSION@") | ||
| 1260 | elif key in ['-C', '--directory']: | ||
| 1261 | os.chdir(value) | ||
| 1262 | else: | ||
diff --git a/recipes-networking/openvswitch/openvswitch-git/0001-use-the-linux-if_packet.h-Interface-directly.patch b/recipes-networking/openvswitch/openvswitch-git/0001-use-the-linux-if_packet.h-Interface-directly.patch deleted file mode 100644 index f1f9befe..00000000 --- a/recipes-networking/openvswitch/openvswitch-git/0001-use-the-linux-if_packet.h-Interface-directly.patch +++ /dev/null | |||
| @@ -1,33 +0,0 @@ | |||
| 1 | From 28b2d17de9414161d5edd67766bd4b452cd809ef Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Mon, 20 Mar 2017 12:12:51 -0700 | ||
| 4 | Subject: [PATCH] use the linux if_packet.h Interface directly | ||
| 5 | |||
| 6 | Helps compiling with musl | ||
| 7 | |||
| 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 9 | |||
| 10 | --- | ||
| 11 | lib/netdev-linux.c | 3 +-- | ||
| 12 | 1 file changed, 1 insertion(+), 2 deletions(-) | ||
| 13 | |||
| 14 | diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c | ||
| 15 | index fccf88f..b703156 100644 | ||
| 16 | --- a/lib/netdev-linux.c | ||
| 17 | +++ b/lib/netdev-linux.c | ||
| 18 | @@ -33,14 +33,13 @@ | ||
| 19 | #include <linux/pkt_sched.h> | ||
| 20 | #include <linux/rtnetlink.h> | ||
| 21 | #include <linux/sockios.h> | ||
| 22 | +#include <linux/if_packet.h> | ||
| 23 | #include <sys/types.h> | ||
| 24 | #include <sys/ioctl.h> | ||
| 25 | #include <sys/socket.h> | ||
| 26 | #include <sys/utsname.h> | ||
| 27 | -#include <netpacket/packet.h> | ||
| 28 | #include <net/if.h> | ||
| 29 | #include <net/if_arp.h> | ||
| 30 | -#include <net/if_packet.h> | ||
| 31 | #include <net/route.h> | ||
| 32 | #include <netinet/in.h> | ||
| 33 | #include <poll.h> | ||
diff --git a/recipes-networking/openvswitch/openvswitch-git/0002-Python3-compatibility-exception-cleanup.patch b/recipes-networking/openvswitch/openvswitch-git/0002-Python3-compatibility-exception-cleanup.patch deleted file mode 100644 index 70abd263..00000000 --- a/recipes-networking/openvswitch/openvswitch-git/0002-Python3-compatibility-exception-cleanup.patch +++ /dev/null | |||
| @@ -1,77 +0,0 @@ | |||
| 1 | From c0ba116eab401431b4f11b66bd7d1b42741b03c3 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jason Wessel <jason.wessel@windriver.com> | ||
| 3 | Date: Thu, 29 Jun 2017 20:33:23 -0700 | ||
| 4 | Subject: [PATCH] Python3 compatibility: exception cleanup | ||
| 5 | |||
| 6 | Commit 52e4a477f0b3c0a0ece7adeede6e06e07814f8b9 from | ||
| 7 | https://github.com/openvswitch/ovs.git | ||
| 8 | |||
| 9 | The exception syntax which is compatible with python2 and python3 is | ||
| 10 | to use the "as" form for "except:". | ||
| 11 | |||
| 12 | Signed-off-by: Jason Wessel <jason.wessel@windriver.com> | ||
| 13 | Signed-off-by: Ben Pfaff <blp@ovn.org> | ||
| 14 | |||
| 15 | --- | ||
| 16 | build-aux/extract-ofp-fields | 2 +- | ||
| 17 | ovsdb/ovsdb-doc | 4 ++-- | ||
| 18 | ovsdb/ovsdb-idlc.in | 4 ++-- | ||
| 19 | 3 files changed, 5 insertions(+), 5 deletions(-) | ||
| 20 | |||
| 21 | diff --git a/build-aux/extract-ofp-fields b/build-aux/extract-ofp-fields | ||
| 22 | index 80c7d35..6286c9c 100755 | ||
| 23 | --- a/build-aux/extract-ofp-fields | ||
| 24 | +++ b/build-aux/extract-ofp-fields | ||
| 25 | @@ -784,7 +784,7 @@ if __name__ == "__main__": | ||
| 26 | try: | ||
| 27 | options, args = getopt.gnu_getopt(sys.argv[1:], 'h', | ||
| 28 | ['help', 'ovs-version=']) | ||
| 29 | - except getopt.GetoptError, geo: | ||
| 30 | + except getopt.GetoptError as geo: | ||
| 31 | sys.stderr.write("%s: %s\n" % (argv0, geo.msg)) | ||
| 32 | sys.exit(1) | ||
| 33 | |||
| 34 | diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc | ||
| 35 | index e82ad59..9448713 100755 | ||
| 36 | --- a/ovsdb/ovsdb-doc | ||
| 37 | +++ b/ovsdb/ovsdb-doc | ||
| 38 | @@ -278,7 +278,7 @@ if __name__ == "__main__": | ||
| 39 | options, args = getopt.gnu_getopt(sys.argv[1:], 'hV', | ||
| 40 | ['er-diagram=', | ||
| 41 | 'version=', 'help']) | ||
| 42 | - except getopt.GetoptError, geo: | ||
| 43 | + except getopt.GetoptError as geo: | ||
| 44 | sys.stderr.write("%s: %s\n" % (argv0, geo.msg)) | ||
| 45 | sys.exit(1) | ||
| 46 | |||
| 47 | @@ -306,7 +306,7 @@ if __name__ == "__main__": | ||
| 48 | if len(line): | ||
| 49 | print(line) | ||
| 50 | |||
| 51 | - except error.Error, e: | ||
| 52 | + except error.Error as e: | ||
| 53 | sys.stderr.write("%s: %s\n" % (argv0, e.msg)) | ||
| 54 | sys.exit(1) | ||
| 55 | |||
| 56 | diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in | ||
| 57 | index 62442ee..e7e1c6b 100755 | ||
| 58 | --- a/ovsdb/ovsdb-idlc.in | ||
| 59 | +++ b/ovsdb/ovsdb-idlc.in | ||
| 60 | @@ -1098,7 +1098,7 @@ if __name__ == "__main__": | ||
| 61 | ['directory', | ||
| 62 | 'help', | ||
| 63 | 'version']) | ||
| 64 | - except getopt.GetoptError, geo: | ||
| 65 | + except getopt.GetoptError as geo: | ||
| 66 | sys.stderr.write("%s: %s\n" % (argv0, geo.msg)) | ||
| 67 | sys.exit(1) | ||
| 68 | |||
| 69 | @@ -1136,7 +1136,7 @@ if __name__ == "__main__": | ||
| 70 | sys.exit(1) | ||
| 71 | |||
| 72 | func(*args[1:]) | ||
| 73 | - except ovs.db.error.Error, e: | ||
| 74 | + except ovs.db.error.Error as e: | ||
| 75 | sys.stderr.write("%s: %s\n" % (argv0, e)) | ||
| 76 | sys.exit(1) | ||
| 77 | |||
diff --git a/recipes-networking/openvswitch/openvswitch-git/0003-Python3-compatibility-execfile-to-exec.patch b/recipes-networking/openvswitch/openvswitch-git/0003-Python3-compatibility-execfile-to-exec.patch deleted file mode 100644 index 98d77c8a..00000000 --- a/recipes-networking/openvswitch/openvswitch-git/0003-Python3-compatibility-execfile-to-exec.patch +++ /dev/null | |||
| @@ -1,31 +0,0 @@ | |||
| 1 | From 8557d51e8c7325a17219911e9a65eeb3946e869f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jason Wessel <jason.wessel@windriver.com> | ||
| 3 | Date: Thu, 29 Jun 2017 20:33:23 -0700 | ||
| 4 | Subject: [PATCH] Python3 compatibility: execfile to exec | ||
| 5 | |||
| 6 | Commit a4d10a7ca937d73873f6f98619d88682e69f5dbe from | ||
| 7 | https://github.com/openvswitch/ovs.git | ||
| 8 | |||
| 9 | Allow compability with python3 and python2 by changing execfile() to | ||
| 10 | exec(). | ||
| 11 | |||
| 12 | Signed-off-by: Jason Wessel <jason.wessel@windriver.com> | ||
| 13 | Signed-off-by: Ben Pfaff <blp@ovn.org> | ||
| 14 | |||
| 15 | --- | ||
| 16 | ovsdb/ovsdb-idlc.in | 2 +- | ||
| 17 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 18 | |||
| 19 | diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in | ||
| 20 | index e7e1c6b..e1551f9 100755 | ||
| 21 | --- a/ovsdb/ovsdb-idlc.in | ||
| 22 | +++ b/ovsdb/ovsdb-idlc.in | ||
| 23 | @@ -17,7 +17,7 @@ def parseSchema(filename): | ||
| 24 | |||
| 25 | def annotateSchema(schemaFile, annotationFile): | ||
| 26 | schemaJson = ovs.json.from_file(schemaFile) | ||
| 27 | - execfile(annotationFile, globals(), {"s": schemaJson}) | ||
| 28 | + exec(compile(open(annotationFile, "rb").read(), annotationFile, 'exec'), globals(), {"s": schemaJson}) | ||
| 29 | ovs.json.to_stream(schemaJson, sys.stdout) | ||
| 30 | sys.stdout.write('\n') | ||
| 31 | |||
diff --git a/recipes-networking/openvswitch/openvswitch-git/0004-Python3-compatibility-iteritems-to-items.patch b/recipes-networking/openvswitch/openvswitch-git/0004-Python3-compatibility-iteritems-to-items.patch deleted file mode 100644 index 092c42d6..00000000 --- a/recipes-networking/openvswitch/openvswitch-git/0004-Python3-compatibility-iteritems-to-items.patch +++ /dev/null | |||
| @@ -1,100 +0,0 @@ | |||
| 1 | From 7e4bd5c2af85b1293be0a92b18f7930bda2ab41a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jason Wessel <jason.wessel@windriver.com> | ||
| 3 | Date: Thu, 29 Jun 2017 20:33:23 -0700 | ||
| 4 | Subject: [PATCH] Python3 compatibility: iteritems to items | ||
| 5 | |||
| 6 | Commit 4ab665623cbb4c6506e48b82e0c9fe8585f42e13 from | ||
| 7 | https://github.com/openvswitch/ovs.git | ||
| 8 | |||
| 9 | Allow compability with python3 and python2 by changing iteritems() to | ||
| 10 | items(). | ||
| 11 | |||
| 12 | Signed-off-by: Jason Wessel <jason.wessel@windriver.com> | ||
| 13 | Signed-off-by: Ben Pfaff <blp@ovn.org> | ||
| 14 | |||
| 15 | --- | ||
| 16 | build-aux/extract-ofp-actions | 2 +- | ||
| 17 | build-aux/extract-ofp-errors | 2 +- | ||
| 18 | build-aux/extract-ofp-fields | 2 +- | ||
| 19 | ovsdb/ovsdb-idlc.in | 8 ++++---- | ||
| 20 | 4 files changed, 7 insertions(+), 7 deletions(-) | ||
| 21 | |||
| 22 | diff --git a/build-aux/extract-ofp-actions b/build-aux/extract-ofp-actions | ||
| 23 | index 67e3848..c7858bd 100755 | ||
| 24 | --- a/build-aux/extract-ofp-actions | ||
| 25 | +++ b/build-aux/extract-ofp-actions | ||
| 26 | @@ -13,7 +13,7 @@ version_map = {"1.0": 0x01, | ||
| 27 | "1.3": 0x04, | ||
| 28 | "1.4": 0x05, | ||
| 29 | "1.5": 0x06} | ||
| 30 | -version_reverse_map = dict((v, k) for (k, v) in version_map.iteritems()) | ||
| 31 | +version_reverse_map = dict((v, k) for (k, v) in version_map.items()) | ||
| 32 | |||
| 33 | # Map from vendor name to the length of the action header. | ||
| 34 | vendor_map = {"OF": (0x00000000, 4), | ||
| 35 | diff --git a/build-aux/extract-ofp-errors b/build-aux/extract-ofp-errors | ||
| 36 | index 97d62d2..58ba006 100755 | ||
| 37 | --- a/build-aux/extract-ofp-errors | ||
| 38 | +++ b/build-aux/extract-ofp-errors | ||
| 39 | @@ -14,7 +14,7 @@ version_map = {"1.0": 0x01, | ||
| 40 | "1.4": 0x05, | ||
| 41 | "1.5": 0x06, | ||
| 42 | "1.6": 0x07} | ||
| 43 | -version_reverse_map = dict((v, k) for (k, v) in version_map.iteritems()) | ||
| 44 | +version_reverse_map = dict((v, k) for (k, v) in version_map.items()) | ||
| 45 | |||
| 46 | token = None | ||
| 47 | line = "" | ||
| 48 | diff --git a/build-aux/extract-ofp-fields b/build-aux/extract-ofp-fields | ||
| 49 | index 6286c9c..f624728 100755 | ||
| 50 | --- a/build-aux/extract-ofp-fields | ||
| 51 | +++ b/build-aux/extract-ofp-fields | ||
| 52 | @@ -16,7 +16,7 @@ VERSION = {"1.0": 0x01, | ||
| 53 | "1.3": 0x04, | ||
| 54 | "1.4": 0x05, | ||
| 55 | "1.5": 0x06} | ||
| 56 | -VERSION_REVERSE = dict((v,k) for k, v in VERSION.iteritems()) | ||
| 57 | +VERSION_REVERSE = dict((v,k) for k, v in VERSION.items()) | ||
| 58 | |||
| 59 | TYPES = {"u8": (1, False), | ||
| 60 | "be16": (2, False), | ||
| 61 | diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in | ||
| 62 | index e1551f9..b70a599 100755 | ||
| 63 | --- a/ovsdb/ovsdb-idlc.in | ||
| 64 | +++ b/ovsdb/ovsdb-idlc.in | ||
| 65 | @@ -138,7 +138,7 @@ def printCIDLHeader(schemaFile): | ||
| 66 | #include "smap.h" | ||
| 67 | #include "uuid.h"''' % {'prefix': prefix.upper()}) | ||
| 68 | |||
| 69 | - for tableName, table in sorted(schema.tables.iteritems()): | ||
| 70 | + for tableName, table in sorted(schema.tables.items()): | ||
| 71 | structName = "%s%s" % (prefix, tableName.lower()) | ||
| 72 | |||
| 73 | print("") | ||
| 74 | @@ -300,7 +300,7 @@ def printCIDLSource(schemaFile): | ||
| 75 | ''' % schema.idlHeader) | ||
| 76 | |||
| 77 | # Cast functions. | ||
| 78 | - for tableName, table in sorted(schema.tables.iteritems()): | ||
| 79 | + for tableName, table in sorted(schema.tables.items()): | ||
| 80 | structName = "%s%s" % (prefix, tableName.lower()) | ||
| 81 | print(''' | ||
| 82 | static struct %(s)s * | ||
| 83 | @@ -311,7 +311,7 @@ static struct %(s)s * | ||
| 84 | ''' % {'s': structName}) | ||
| 85 | |||
| 86 | |||
| 87 | - for tableName, table in sorted(schema.tables.iteritems()): | ||
| 88 | + for tableName, table in sorted(schema.tables.items()): | ||
| 89 | structName = "%s%s" % (prefix, tableName.lower()) | ||
| 90 | print("") | ||
| 91 | print("/* %s table. */" % (tableName)) | ||
| 92 | @@ -1025,7 +1025,7 @@ void | ||
| 93 | # Table classes. | ||
| 94 | print("") | ||
| 95 | print("struct ovsdb_idl_table_class %stable_classes[%sN_TABLES] = {" % (prefix, prefix.upper())) | ||
| 96 | - for tableName, table in sorted(schema.tables.iteritems()): | ||
| 97 | + for tableName, table in sorted(schema.tables.items()): | ||
| 98 | structName = "%s%s" % (prefix, tableName.lower()) | ||
| 99 | if table.is_root: | ||
| 100 | is_root = "true" | ||
diff --git a/recipes-networking/openvswitch/openvswitch-git/0005-Python3-compatibility-fix-integer-problems.patch b/recipes-networking/openvswitch/openvswitch-git/0005-Python3-compatibility-fix-integer-problems.patch deleted file mode 100644 index d6f93646..00000000 --- a/recipes-networking/openvswitch/openvswitch-git/0005-Python3-compatibility-fix-integer-problems.patch +++ /dev/null | |||
| @@ -1,49 +0,0 @@ | |||
| 1 | From d22c7f1c6ade82a0cd646cfcd8df9adda6cd1ad6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jason Wessel <jason.wessel@windriver.com> | ||
| 3 | Date: Thu, 29 Jun 2017 20:33:23 -0700 | ||
| 4 | Subject: [PATCH] Python3 compatibility: fix integer problems | ||
| 5 | |||
| 6 | Commit fa145f1a53943243f94a32ce98525db8494b0052 from | ||
| 7 | https://github.com/openvswitch/ovs.git | ||
| 8 | |||
| 9 | In python3 maxint is not defined, but maxsize is defined in both | ||
| 10 | python2 and python3. | ||
| 11 | |||
| 12 | The put_text() will not automatically use a value which came in as | ||
| 13 | float due to a pior math function and python3 will throw an exception. | ||
| 14 | The simple answer is to convert it with int() and move on. | ||
| 15 | |||
| 16 | Signed-off-by: Jason Wessel <jason.wessel@windriver.com> | ||
| 17 | Signed-off-by: Ben Pfaff <blp@ovn.org> | ||
| 18 | |||
| 19 | --- | ||
| 20 | ovsdb/ovsdb-idlc.in | 2 +- | ||
| 21 | python/build/nroff.py | 2 ++ | ||
| 22 | 2 files changed, 3 insertions(+), 1 deletion(-) | ||
| 23 | |||
| 24 | diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in | ||
| 25 | index b70a599..3645275 100755 | ||
| 26 | --- a/ovsdb/ovsdb-idlc.in | ||
| 27 | +++ b/ovsdb/ovsdb-idlc.in | ||
| 28 | @@ -358,7 +358,7 @@ static void | ||
| 29 | print(" %s" % type.value.initCDefault(valueVar, type.n_min == 0)) | ||
| 30 | print(" }") | ||
| 31 | else: | ||
| 32 | - if type.n_max != sys.maxint: | ||
| 33 | + if type.n_max != sys.maxsize: | ||
| 34 | print(" size_t n = MIN(%d, datum->n);" % type.n_max) | ||
| 35 | nMax = "n" | ||
| 36 | else: | ||
| 37 | diff --git a/python/build/nroff.py b/python/build/nroff.py | ||
| 38 | index c23837f..401f699 100644 | ||
| 39 | --- a/python/build/nroff.py | ||
| 40 | +++ b/python/build/nroff.py | ||
| 41 | @@ -148,6 +148,8 @@ def fatal(msg): | ||
| 42 | |||
| 43 | |||
| 44 | def put_text(text, x, y, s): | ||
| 45 | + x = int(x) | ||
| 46 | + y = int(y) | ||
| 47 | extend = x + len(s) - len(text[y]) | ||
| 48 | if extend > 0: | ||
| 49 | text[y] += ' ' * extend | ||
diff --git a/recipes-networking/openvswitch/openvswitch-git/0006-Python3-compatibility-math-error-compatibility.patch b/recipes-networking/openvswitch/openvswitch-git/0006-Python3-compatibility-math-error-compatibility.patch deleted file mode 100644 index c53502b5..00000000 --- a/recipes-networking/openvswitch/openvswitch-git/0006-Python3-compatibility-math-error-compatibility.patch +++ /dev/null | |||
| @@ -1,54 +0,0 @@ | |||
| 1 | From 7f542122d62b20d11198bfdb0f2c6a460261b5e7 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jason Wessel <jason.wessel@windriver.com> | ||
| 3 | Date: Thu, 29 Jun 2017 20:33:23 -0700 | ||
| 4 | Subject: [PATCH] Python3 compatibility: math error compatibility | ||
| 5 | |||
| 6 | Commit 3fa5aa4294377e0f35267936d0c5caea3e61db48 from | ||
| 7 | https://github.com/openvswitch/ovs.git | ||
| 8 | |||
| 9 | The way math is handled with typing is completely different in python3. | ||
| 10 | |||
| 11 | % python2<<EOF | ||
| 12 | x=10 | ||
| 13 | y=8 | ||
| 14 | print((x + (y - 1)) / y * y) | ||
| 15 | EOF | ||
| 16 | 16 | ||
| 17 | |||
| 18 | python3<<EOF | ||
| 19 | x=10 | ||
| 20 | y=8 | ||
| 21 | print((x + (y - 1)) / y * y) | ||
| 22 | EOF | ||
| 23 | 17.0 | ||
| 24 | |||
| 25 | So we need to force an integer for the round function as follows and | ||
| 26 | maintain compatibility with python2. | ||
| 27 | |||
| 28 | python3<<EOF | ||
| 29 | x=10 | ||
| 30 | y=8 | ||
| 31 | print(int((x + (y - 1)) / y) * y) | ||
| 32 | EOF | ||
| 33 | 16 | ||
| 34 | |||
| 35 | Signed-off-by: Jason Wessel <jason.wessel@windriver.com> | ||
| 36 | Signed-off-by: Ben Pfaff <blp@ovn.org> | ||
| 37 | |||
| 38 | --- | ||
| 39 | build-aux/extract-ofp-actions | 2 +- | ||
| 40 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 41 | |||
| 42 | diff --git a/build-aux/extract-ofp-actions b/build-aux/extract-ofp-actions | ||
| 43 | index c7858bd..4d05ef9 100755 | ||
| 44 | --- a/build-aux/extract-ofp-actions | ||
| 45 | +++ b/build-aux/extract-ofp-actions | ||
| 46 | @@ -35,7 +35,7 @@ line = "" | ||
| 47 | arg_structs = set() | ||
| 48 | |||
| 49 | def round_up(x, y): | ||
| 50 | - return (x + (y - 1)) / y * y | ||
| 51 | + return int((x + (y - 1)) / y) * y | ||
| 52 | |||
| 53 | def open_file(fn): | ||
| 54 | global file_name | ||
diff --git a/recipes-networking/openvswitch/openvswitch-git/0007-Python3-compatibility-unicode-to-str.patch b/recipes-networking/openvswitch/openvswitch-git/0007-Python3-compatibility-unicode-to-str.patch deleted file mode 100644 index 753490f8..00000000 --- a/recipes-networking/openvswitch/openvswitch-git/0007-Python3-compatibility-unicode-to-str.patch +++ /dev/null | |||
| @@ -1,49 +0,0 @@ | |||
| 1 | From c78b39ae9ba6337210d6a9e4ccc4753cb1c3b48f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jason Wessel <jason.wessel@windriver.com> | ||
| 3 | Date: Thu, 29 Jun 2017 20:33:23 -0700 | ||
| 4 | Subject: [PATCH] Python3 compatibility: unicode to str | ||
| 5 | |||
| 6 | Commit 7430959d4ad17db89b8387c3aef58c8b230cad10 from | ||
| 7 | https://github.com/openvswitch/ovs.git | ||
| 8 | |||
| 9 | When transitioning from python2 to python3 the following type class | ||
| 10 | changes occured: | ||
| 11 | |||
| 12 | python2 -> python3 | ||
| 13 | unicode -> str | ||
| 14 | str -> bytes | ||
| 15 | |||
| 16 | That means we have to check the python version and do the right type | ||
| 17 | check python3 will throw an error when it tries to use the unicode | ||
| 18 | type because it doesn't exist. | ||
| 19 | |||
| 20 | Signed-off-by: Jason Wessel <jason.wessel@windriver.com> | ||
| 21 | Signed-off-by: Ben Pfaff <blp@ovn.org> | ||
| 22 | |||
| 23 | --- | ||
| 24 | ovsdb/ovsdb-doc | 12 +++++++++--- | ||
| 25 | 1 file changed, 9 insertions(+), 3 deletions(-) | ||
| 26 | |||
| 27 | diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc | ||
| 28 | index 9448713..d55c6e6 100755 | ||
| 29 | --- a/ovsdb/ovsdb-doc | ||
| 30 | +++ b/ovsdb/ovsdb-doc | ||
| 31 | @@ -65,9 +65,15 @@ def columnGroupToNroff(table, groupXml, documented_columns): | ||
| 32 | if node.hasAttribute('type'): | ||
| 33 | type_string = node.attributes['type'].nodeValue | ||
| 34 | type_json = ovs.json.from_string(str(type_string)) | ||
| 35 | - if type(type_json) in (str, unicode): | ||
| 36 | - raise error.Error("%s %s:%s has invalid 'type': %s" | ||
| 37 | - % (table.name, name, key, type_json)) | ||
| 38 | + # py2 -> py3 means str -> bytes and unicode -> str | ||
| 39 | + try: | ||
| 40 | + if type(type_json) in (str, unicode): | ||
| 41 | + raise error.Error("%s %s:%s has invalid 'type': %s" | ||
| 42 | + % (table.name, name, key, type_json)) | ||
| 43 | + except: | ||
| 44 | + if type(type_json) in (bytes, str): | ||
| 45 | + raise error.Error("%s %s:%s has invalid 'type': %s" | ||
| 46 | + % (table.name, name, key, type_json)) | ||
| 47 | type_ = ovs.db.types.BaseType.from_json(type_json) | ||
| 48 | else: | ||
| 49 | type_ = column.type.value | ||
diff --git a/recipes-networking/openvswitch/openvswitch-git/0008-AUTHORS-Add-Jason-Wessel.patch b/recipes-networking/openvswitch/openvswitch-git/0008-AUTHORS-Add-Jason-Wessel.patch deleted file mode 100644 index f55a5caf..00000000 --- a/recipes-networking/openvswitch/openvswitch-git/0008-AUTHORS-Add-Jason-Wessel.patch +++ /dev/null | |||
| @@ -1,26 +0,0 @@ | |||
| 1 | From f8491645416952b31000f42777ff79486a7b0511 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Ben Pfaff <blp@ovn.org> | ||
| 3 | Date: Thu, 6 Jul 2017 14:01:27 -0700 | ||
| 4 | Subject: [PATCH] AUTHORS: Add Jason Wessel. | ||
| 5 | |||
| 6 | Commit a91c4cfaf863718bc94fb9c88939bd0b0385a6fe from | ||
| 7 | https://github.com/openvswitch/ovs.git | ||
| 8 | |||
| 9 | Signed-off-by: Ben Pfaff <blp@ovn.org> | ||
| 10 | |||
| 11 | --- | ||
| 12 | AUTHORS.rst | 1 + | ||
| 13 | 1 file changed, 1 insertion(+) | ||
| 14 | |||
| 15 | diff --git a/AUTHORS.rst b/AUTHORS.rst | ||
| 16 | index 63e6a8d..d0dc70d 100644 | ||
| 17 | --- a/AUTHORS.rst | ||
| 18 | +++ b/AUTHORS.rst | ||
| 19 | @@ -156,6 +156,7 @@ Jan Scheurich jan.scheurich@ericsson.com | ||
| 20 | Jan Vansteenkiste jan@vstone.eu | ||
| 21 | Jarno Rajahalme jarno@ovn.org | ||
| 22 | Jason Kölker jason@koelker.net | ||
| 23 | +Jason Wessel jason.wessel@windriver.com | ||
| 24 | Jasper Capel jasper@capel.tv | ||
| 25 | Jean Tourrilhes jt@hpl.hp.com | ||
| 26 | Jeremy Stribling strib@nicira.com | ||
diff --git a/recipes-networking/openvswitch/openvswitch-git/openvswitch-add-ptest-b8dcfbebee9e7dbc74ec5eecc9b45d335d6150c1.patch b/recipes-networking/openvswitch/openvswitch-git/openvswitch-add-ptest-b8dcfbebee9e7dbc74ec5eecc9b45d335d6150c1.patch deleted file mode 100644 index 4ae86c38..00000000 --- a/recipes-networking/openvswitch/openvswitch-git/openvswitch-add-ptest-b8dcfbebee9e7dbc74ec5eecc9b45d335d6150c1.patch +++ /dev/null | |||
| @@ -1,108 +0,0 @@ | |||
| 1 | From fb68120ef8aed625b04b2fbd2cb78fc59a7b7432 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: He Zhe <zhe.he@windriver.com> | ||
| 3 | Date: Wed, 30 Mar 2016 06:23:45 -0400 | ||
| 4 | Subject: [PATCH] openvswitch: Add test-install rule to support ptest execution | ||
| 5 | |||
| 6 | Signed-off-by: Radu Patriu <radu.patriu@enea.com> | ||
| 7 | |||
| 8 | Fix ptest for v2.5 | ||
| 9 | - Copy certain files from srcdir since it has been different from | ||
| 10 | build directory. | ||
| 11 | - Copy more necessary files for new added test cases. | ||
| 12 | - Modify config files for running on target. | ||
| 13 | |||
| 14 | Signed-off-by: He Zhe <zhe.he@windriver.com> | ||
| 15 | |||
| 16 | --- | ||
| 17 | Makefile.am | 1 + | ||
| 18 | test.mk | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
| 19 | 2 files changed, 73 insertions(+) | ||
| 20 | create mode 100644 test.mk | ||
| 21 | |||
| 22 | diff --git a/Makefile.am b/Makefile.am | ||
| 23 | index ea63acb..ff7d70a 100644 | ||
| 24 | --- a/Makefile.am | ||
| 25 | +++ b/Makefile.am | ||
| 26 | @@ -429,3 +429,4 @@ include windows/automake.mk | ||
| 27 | include ovn/automake.mk | ||
| 28 | include selinux/automake.mk | ||
| 29 | include build-aux/automake.mk | ||
| 30 | +include test.mk | ||
| 31 | diff --git a/test.mk b/test.mk | ||
| 32 | new file mode 100644 | ||
| 33 | index 0000000..b10a581 | ||
| 34 | --- /dev/null | ||
| 35 | +++ b/test.mk | ||
| 36 | @@ -0,0 +1,72 @@ | ||
| 37 | +TEST_DEST ?= ${prefix}/lib/openvswitch | ||
| 38 | +TEST_ROOT ?= ${prefix}/lib/openvswitch | ||
| 39 | +TEST_DEPEND = | ||
| 40 | + | ||
| 41 | +if HAVE_OPENSSL | ||
| 42 | +TEST_DEPEND += $(TESTPKI_FILES) | ||
| 43 | +endif | ||
| 44 | + | ||
| 45 | +test-install: $(TEST_DEPEND) | ||
| 46 | + @list='$(noinst_PROGRAMS) $(EXTRA_DIST) $(dist_check_SCRIPTS) $(TEST_DEPEND) tests/atlocal tests/atconfig' ;\ | ||
| 47 | + install -d $(TEST_DEST)/tests ;\ | ||
| 48 | + install $(srcdir)/vtep/ovs-vtep $(TEST_DEST)/tests ;\ | ||
| 49 | + install -d $(TEST_DEST)/python ;\ | ||
| 50 | + install -d $(TEST_DEST)/python/ovs ;\ | ||
| 51 | + install -d $(TEST_DEST)/python/ovs/db ;\ | ||
| 52 | + install -d $(TEST_DEST)/python/ovs/unixctl ;\ | ||
| 53 | + install -d $(TEST_DEST)/vswitchd ;\ | ||
| 54 | + install $(srcdir)/vswitchd/vswitch.ovsschema $(TEST_DEST)/vswitchd ;\ | ||
| 55 | + install vswitchd/ovs-vswitchd $(TEST_DEST)/vswitchd ;\ | ||
| 56 | + install -d $(TEST_DEST)/debian ;\ | ||
| 57 | + install $(srcdir)/debian/ovs-monitor-ipsec $(TEST_DEST)/debian ;\ | ||
| 58 | + install -d $(TEST_DEST)/build-aux ;\ | ||
| 59 | + install $(srcdir)/build-aux/check-structs $(TEST_DEST)/build-aux ;\ | ||
| 60 | + install -d $(TEST_DEST)/xenserver ;\ | ||
| 61 | + install $(srcdir)/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync $(TEST_DEST)/xenserver ;\ | ||
| 62 | + install $(srcdir)/xenserver/opt_xensource_libexec_interface-reconfigure $(TEST_DEST)/xenserver ;\ | ||
| 63 | + install $(srcdir)/xenserver/opt_xensource_libexec_InterfaceReconfigure.py $(TEST_DEST)/xenserver ;\ | ||
| 64 | + install $(srcdir)/xenserver/opt_xensource_libexec_InterfaceReconfigureBridge.py $(TEST_DEST)/xenserver ;\ | ||
| 65 | + install $(srcdir)/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py $(TEST_DEST)/xenserver ;\ | ||
| 66 | + install -d $(TEST_DEST)/vtep ;\ | ||
| 67 | + install $(srcdir)/vtep/vtep.ovsschema $(TEST_DEST)/vtep ;\ | ||
| 68 | + install -d $(TEST_DEST)/ovn ;\ | ||
| 69 | + install $(srcdir)/ovn/ovn-nb.ovsschema $(TEST_DEST)/ovn ;\ | ||
| 70 | + install $(srcdir)/ovn/ovn-sb.ovsschema $(TEST_DEST)/ovn ;\ | ||
| 71 | + install -d $(TEST_DEST)/utilities ;\ | ||
| 72 | + install $(srcdir)/utilities/ovs-pcap.in $(TEST_DEST)/utilities ;\ | ||
| 73 | + install $(srcdir)/utilities/ovs-pki.in $(TEST_DEST)/utilities ;\ | ||
| 74 | + for p in $$list ; do \ | ||
| 75 | + echo $$p ;\ | ||
| 76 | + p=$${p#../git/} ;\ | ||
| 77 | + pre=$${p#tests\/} ;\ | ||
| 78 | + if test $$pre != $$p ; then \ | ||
| 79 | + echo installing $$p to $(TEST_DEST)/tests/$$pre ;\ | ||
| 80 | + if test -f $$p ; then \ | ||
| 81 | + install $$p $(TEST_DEST)/tests/$$pre ;\ | ||
| 82 | + else \ | ||
| 83 | + install $(srcdir)/$$p $(TEST_DEST)/tests/$$pre ;\ | ||
| 84 | + fi ;\ | ||
| 85 | + continue ;\ | ||
| 86 | + fi ;\ | ||
| 87 | + pre=$${p#python\/ovs\/} ;\ | ||
| 88 | + if test $$pre != $$p ; then \ | ||
| 89 | + echo installing $$p to $(TEST_DEST)/python/ovs/$$pre ;\ | ||
| 90 | + if test -f $$p ; then \ | ||
| 91 | + install $$p $(TEST_DEST)/python/ovs/$$pre ;\ | ||
| 92 | + else \ | ||
| 93 | + install $(srcdir)/$$p $(TEST_DEST)/python/ovs/$$pre ;\ | ||
| 94 | + fi ;\ | ||
| 95 | + continue ;\ | ||
| 96 | + fi; \ | ||
| 97 | + done ;\ | ||
| 98 | + sed -i 's|abs_builddir=.*|abs_builddir='"'"'$(TEST_ROOT)/tests'"'"'|g' $(TEST_DEST)/tests/atconfig | ||
| 99 | + sed -i 's|abs_srcdir=.*|abs_srcdir='"'"'$(TEST_ROOT)/tests'"'"'|g' $(TEST_DEST)/tests/atconfig | ||
| 100 | + sed -i 's|abs_top_srcdir=.*|abs_top_srcdir='"'"'$(TEST_ROOT)'"'"'|g' $(TEST_DEST)/tests/atconfig | ||
| 101 | + sed -i 's|abs_top_builddir=.*|abs_top_builddir='"'"'$(TEST_ROOT)'"'"'|g' $(TEST_DEST)/tests/atconfig | ||
| 102 | + sed -i 's|at_srcdir=.*|at_srcdir='"'"'.'"'"'|g' $(TEST_DEST)/tests/atconfig | ||
| 103 | + sed -i 's|at_top_srcdir=.*|at_top_srcdir='"'"'..'"'"'|g' $(TEST_DEST)/tests/atconfig | ||
| 104 | + sed -i 's|at_top_build_prefix=.*|at_top_build_prefix='"'"'../'"'"'|g' $(TEST_DEST)/tests/atconfig | ||
| 105 | + sed -i 's|^\(.*config\.log.*\)|#\1|g' $(TEST_DEST)/tests/testsuite | ||
| 106 | + sed -i 's|$$srcdir|$$abs_srcdir|g' $(TEST_DEST)/tests/testsuite | ||
| 107 | + sed -i 's|ovs-appctl-bashcomp\.bash|/etc/bash_completion.d/ovs-appctl-bashcomp\.bash|g' $(TEST_DEST)/tests/testsuite | ||
| 108 | + sed -i 's|ovs-vsctl-bashcomp\.bash|/etc/bash_completion.d/ovs-vsctl-bashcomp\.bash|g' $(TEST_DEST)/tests/testsuite | ||
