Commit d6b3076b authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make the vmod->file_id a hash over the .vcc file.

I belive this makes our builds reproducible.

Fixes:	#2436
parent 61dc72e0
......@@ -59,7 +59,7 @@
* VRT_STRANDS_string() removed from vrt.h (never implemented)
* VRT_Healthy() changed prototype
* VRT_Vmod_Init signature changed
* VRT_Vmod_Fini changed to VRT_Vmod_Unload
* VRT_Vmod_Fini changed to VRT_Vmod_Unload
* 7.0 (2018-03-15)
* lots of stuff moved from cache.h to cache_varnishd.h
* (ie: from "$Abi vrt" to "$Abi strict")
......
......@@ -44,6 +44,7 @@ import unittest
import random
import copy
import json
import hashlib
AMBOILERPLATE = '''
# Boilerplate generated by vmodtool.py - changes will be overwritten
......@@ -858,6 +859,7 @@ class vcc(object):
def parse(self):
global inputline
a = "\n" + open(self.inputfile, "r").read()
self.file_id = hashlib.sha256(a).hexdigest()
s = a.split("\n$")
self.copyright = s.pop(0).strip()
while s:
......@@ -983,14 +985,7 @@ class vcc(object):
fo.write('\t.proto =\tVmod_Proto,\n')
fo.write('\t.json =\t\tVmod_Json,\n')
fo.write('\t.abi =\t\tVMOD_ABI_Version,\n')
# NB: Sort of hackish:
# Fill file_id with random stuff, so we can tell if
# VCC and VRT_Vmod_Init() dlopens the same file
#
fo.write("\t.file_id =\t\"")
for i in range(32):
fo.write("%c" % random.randint(0x40, 0x5a))
fo.write("\",\n")
fo.write("\t.file_id =\t\"%s\",\n" % self.file_id)
fo.write("};\n")
def cfile(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment