Example #1
0
func makeFakeDB(graph *dag.DAG, sig []byte) BuildDB {
	var bdb BuildDB = db.NewFakeDB()
	for _, node := range graph.Nodes() {
		record := db.NewBuildRecord()
		record.SetTargetSignature(sig)
		for _, parent := range graph.ParentNodes(node) {
			record.AddParent(parent.Name(), sig)
		}
		bdb.WriteNode(node.Name(), record)
	}
	return bdb
}
Example #2
0
func (self *BuildState) recordNode(node dag.Node) error {
	log.Debug(log.BUILD, "recording successful build of %s %s", node.Typename(), node)
	sig, err := node.Signature()
	log.Debug(log.BUILD, "sig=%v, err=%v", sig, err)
	if err != nil {
		return fmt.Errorf("could not compute signature of target %s: %s",
			node, err)
	}

	record := db.NewBuildRecord()
	record.SetTargetSignature(sig)
	for _, parent := range self.graph.ParentNodes(node) {
		sig, err = parent.Signature()
		if err != nil {
			return err
		}
		record.AddParent(parent.Name(), sig)
	}
	err = self.db.WriteNode(node.Name(), record)
	if err != nil {
		return err
	}
	return nil
}