<commit_before>#
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
import recipe
import time
import files
import commit
import os
import util

def cook(reppath, srcdirs, builddir, recipeFile):
    classList = recipe.RecipeLoader(recipeFile)

    if recipeFile[0] != "/":
	raise IOError, "recipe file names must be absolute paths"

    for (name, theClass) in classList.items():
	print "Building", name

	recp = theClass()

	ourBuildDir = builddir + "/" + recp.name

	recp.setup()
	recp.unpackSources(srcdirs, ourBuildDir)
	recp.doBuild(ourBuildDir)

	rootDir = "/var/tmp/srs/%s-%d" % (recp.name, int(time.time()))
        util.mkdirChain(rootDir)
	recp.doInstall(ourBuildDir, rootDir)

        recp.packages(rootDir)
        pkgSet = recp.getPackageSet()

	for (name, buildPkg) in pkgSet.packageSet():
	    fileList = []

	    for filePath in buildPkg.keys():
		f = files.FileFromFilesystem(recp.name, rootDir, filePath)
		fileList.append(f)

	    commit.finalCommit(reppath, recp.name + "/" + name, recp.version, 
			       rootDir, fileList)

	f = files.FileFromFilesystem(recp.name, "/", recipeFile, "src")
	fileList = [ f ]
	for file in recp.allSources():
            src = util.findFile(file, srcdirs)
	    f = files.FileFromFilesystem(recp.name, "/", src, "src")
	    fileList.append(f)

	commit.finalCommit(reppath, recp.name + "/sources", recp.version,
			    "/", fileList)
<commit_msg>1) take full configuration as a paraemter rather then individual items 2) call Recipie.cleanup() 3) prepend packagenamespace to package names<commit_after>#
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
import recipe
import time
import files
import commit
import os
import util

def cook(cfg, srcdirs, recipeFile):
    classList = recipe.RecipeLoader(recipeFile)

    if recipeFile[0] != "/":
	raise IOError, "recipe file names must be absolute paths"

    for (name, theClass) in classList.items():
	print "Building", name

	recp = theClass()

	ourBuildDir = cfg.buildpath + "/" + recp.name

	recp.setup()
	recp.unpackSources(srcdirs, ourBuildDir)
	recp.doBuild(ourBuildDir)

	rootDir = "/var/tmp/srs/%s-%d" % (recp.name, int(time.time()))
        util.mkdirChain(rootDir)
	recp.doInstall(ourBuildDir, rootDir)

        recp.packages(rootDir)
        pkgSet = recp.getPackageSet()

	for (name, buildPkg) in pkgSet.packageSet():
	    fileList = []

	    for filePath in buildPkg.keys():
		f = files.FileFromFilesystem(recp.name, rootDir, filePath)
		fileList.append(f)

	    commit.finalCommit(cfg.reppath, 
			   cfg.packagenamespace + "/" + recp.name + "/" + name, 
			   recp.version, 
			   rootDir, fileList)

	f = files.FileFromFilesystem(recp.name, "/", recipeFile, "src")
	fileList = [ f ]
	for file in recp.allSources():
            src = util.findFile(file, srcdirs)
	    f = files.FileFromFilesystem(recp.name, "/", src, "src")
	    fileList.append(f)

	commit.finalCommit(cfg.reppath, 
			   cfg.packagenamespace + "/" + recp.name + "/sources",
			   recp.version, "/", fileList)

	recp.cleanup(ourBuildDir, rootDir)

{'fraction_non_alphanumeric': 0.1332020997375328, 'fraction_numerical': 0.00426509186351706, 'mean_word_length': 3.578078078078078, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '598474', 'n_tokens_mistral': 1136, 'n_tokens_neox': 1061, 'n_words': 242}