Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0bb782bd authored by Colin Cross's avatar Colin Cross
Browse files

Allow converting logtags to java without merged logtags file

Most logtags files only have entries with hardcoded numbers.
Allow these files to be converted to java without needing the
merged logtags file.

Test: m checkbuild
Change-Id: I4cd38aa502fc9b8e50af92ff8296d3ad6abfb56e
parent e89df932
Loading
Loading
Loading
Loading
+25 −18
Original line number Original line Diff line number Diff line
@@ -51,14 +51,15 @@ for o, a in opts:
    print >> sys.stderr, "unhandled option %s" % (o,)
    print >> sys.stderr, "unhandled option %s" % (o,)
    sys.exit(1)
    sys.exit(1)


if len(args) != 2:
if len(args) != 1 and len(args) != 2:
  print "need exactly two input files, not %d" % (len(args),)
  print "need one or two input files, not %d" % (len(args),)
  print __doc__
  print __doc__
  sys.exit(1)
  sys.exit(1)


fn = args[0]
fn = args[0]
tagfile = event_log_tags.TagFile(fn)
tagfile = event_log_tags.TagFile(fn)


if len(args) > 1:
  # Load the merged tag file (which should have numbers assigned for all
  # Load the merged tag file (which should have numbers assigned for all
  # tags.  Use the numbers from the merged file to fill in any missing
  # tags.  Use the numbers from the merged file to fill in any missing
  # numbers from the input file.
  # numbers from the input file.
@@ -75,6 +76,12 @@ for t in tagfile.tags:
        # them all an arbitrary number so we can emit the java and
        # them all an arbitrary number so we can emit the java and
        # compile the (unused) package.
        # compile the (unused) package.
        t.tagnum = 999999
        t.tagnum = 999999
else:
  # Not using the merged tag file, so all tags must have manually assigned
  # numbers
  for t in tagfile.tags:
    if t.tagnum is None:
      tagfilef.AddError("tag \"%s\" has no number" % (tagname,), tag.linenum)


if "java_package" not in tagfile.options:
if "java_package" not in tagfile.options:
  tagfile.AddError("java_package option not specified", linenum=0)
  tagfile.AddError("java_package option not specified", linenum=0)