Ejemplo n.º 1
0
func (g *GenRule) Hash() []byte {
	h := sha1.New()

	io.WriteString(h, g.Name)
	util.HashStrings(h, g.Commands)
	util.HashStrings(h, os.Environ())
	return []byte{}
}
Ejemplo n.º 2
0
func (cb *CBin) Hash() []byte {

	h := sha1.New()
	io.WriteString(h, CCVersion)
	io.WriteString(h, cb.Name)
	util.HashFilesWithExt(h, cb.Includes, ".h")
	util.HashFiles(h, []string(cb.Sources))
	util.HashStrings(h, cb.CompilerOptions)
	util.HashStrings(h, cb.LinkerOptions)
	return h.Sum(nil)
}
Ejemplo n.º 3
0
func (y *Yacc) Hash() []byte {
	h := sha1.New()
	io.WriteString(h, YaccVersion)
	io.WriteString(h, y.Name)
	util.HashFiles(h, y.Sources)
	util.HashStrings(h, y.YaccOptions)
	return h.Sum(nil)
}
Ejemplo n.º 4
0
func (mp *ManPage) Hash() []byte {
	h := sha1.New()

	io.WriteString(h, mp.Name)

	util.HashFiles(h, mp.Sources)
	util.HashStrings(h, os.Environ())
	return []byte{}
}
Ejemplo n.º 5
0
func (cl *CLib) Hash() []byte {
	h := sha1.New()

	io.WriteString(h, CCVersion)
	io.WriteString(h, cl.Name)
	util.HashFiles(h, cl.Includes)
	io.WriteString(h, "clib")
	util.HashFiles(h, []string(cl.Sources))
	util.HashStrings(h, cl.CompilerOptions)
	util.HashStrings(h, cl.LinkerOptions)
	if cl.LinkShared {
		io.WriteString(h, "shared")
	}
	if cl.LinkStatic {
		io.WriteString(h, "static")
	}
	return h.Sum(nil)
}
Ejemplo n.º 6
0
func (k *Config) Hash() []byte {

	h := sha1.New()
	util.HashFiles(h, k.RamFiles)
	util.HashStrings(h, k.Code)
	util.HashStrings(h, k.Dev)
	util.HashStrings(h, k.Ip)
	util.HashStrings(h, k.Link)
	util.HashStrings(h, k.Sd)
	util.HashStrings(h, k.Uart)
	util.HashStrings(h, k.VGA)
	io.WriteString(h, k.Name)
	return h.Sum(nil)
}
Ejemplo n.º 7
0
func (n *Node) HashNode() []byte {
	// node hashes should not change after a build,
	// they should be deterministic, therefore they should and can be cached.
	if len(n.hash) > 0 {
		return n.hash
	}
	h := sha1.New()
	h.Write(n.Target.Hash())
	util.HashStrings(h, n.Target.GetDependencies())
	var bn ByName
	for _, e := range n.Children {
		bn = append(bn, e)

	}
	sort.Sort(bn)
	for _, e := range bn {
		h.Write(e.HashNode())
	}
	n.hash = h.Sum(nil)
	return n.hash
}