Changeset 9b642f92 in mainline for tools


Ignore:
Timestamp:
2017-10-27T18:44:07Z (8 years ago)
Author:
jzr <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d088616
Parents:
0798689 (diff), f9c4bc5a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge reproducibility improvements.

These improvements reduce the alteration to output files due to outside influences and randomness. This makes most of the output files reproducible, and by consequence more easily comparable.

Location:
tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tools/config.py

    r0798689 r9b642f92  
    445445def create_output(mkname, mcname, config, rules):
    446446        "Create output configuration"
    447 
    448         timestamp_unix = int(time.time())
     447       
     448        varname_strip = 'CONFIG_STRIP_REVISION_INFO'
     449        strip_rev_info = (varname_strip in config) and (config[varname_strip] == 'y')
     450       
     451        if strip_rev_info:
     452                timestamp_unix = int(0)
     453        else:
     454                # TODO: Use commit timestamp instead of build time.
     455                timestamp_unix = int(time.time())
     456       
    449457        timestamp = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(timestamp_unix))
    450458       
     
    458466                sys.stderr.write("failed\n")
    459467       
    460         if len(version) == 3:
     468        if (not strip_rev_info) and (len(version) == 3):
    461469                revision = version[1]
    462470                if version[0] != 1:
  • tools/mkarray.py

    r0798689 r9b642f92  
    7070        section = sys.argv[4]
    7171       
     72        timestamp = (1980, 1, 1, 0, 0, 0)
     73       
    7274        header_ctx = []
    7375        desc_ctx = []
     
    7981        archive = zipfile.ZipFile("%s.zip" % dest, "w", zipfile.ZIP_STORED)
    8082       
    81         for src in sys.argv[5:]:
     83        for src in sorted(sys.argv[5:]):
    8284                basename = os.path.basename(src)
    8385                plainname = os.path.splitext(basename)[0]
     
    9597                        src_data = deflate(src_data)
    9698                        src_fname = os.path.basename("%s.deflate" % src)
    97                         archive.writestr(src_fname, src_data)
     99                        zipinfo = zipfile.ZipInfo(src_fname, timestamp)
     100                        archive.writestr(zipinfo, src_data)
    98101                else:
    99102                        src_fname = src
     
    155158        data += "\n\n"
    156159        data += "#endif\n"
    157         archive.writestr("%s.h" % dest, data)
     160        zipinfo = zipfile.ZipInfo("%s.h" % dest, timestamp)
     161        archive.writestr(zipinfo, data)
    158162       
    159163        data = ''
     
    166170        data += "\n".join(data_ctx)
    167171        data += "\n"
    168         archive.writestr("%s.s" % dest, data)
     172        zipinfo = zipfile.ZipInfo("%s.s" % dest, timestamp)
     173        archive.writestr(zipinfo, data)
    169174       
    170175        data = ''
     
    180185        data += "\n".join(size_ctx)
    181186        data += "\n"
    182         archive.writestr("%s_desc.c" % dest, data)
     187        zipinfo = zipfile.ZipInfo("%s_desc.c" % dest, timestamp)
     188        archive.writestr(zipinfo, data)
    183189       
    184190        archive.close()
Note: See TracChangeset for help on using the changeset viewer.