def assign(self, task):
		db.assign_task(self.address, self.fingerprint, task.jobid, task.arch, task.os, task.release)
		conf.print('info', "Task submitted to " + self.address)
		lib.targz('%s%s/%s/%s' % (conf.general['dir']['processing'], str(task.jobid), task.os, task.release), 'temp.tar.gz')
		data = {
			'callbackurl' : 'http://localhost:6500/callback',
			'jobid' : task.jobid,
			'arch' : task.arch,
			'os' : task.os,
			'release' : task.release
		}
		lib.upload('temp.tar.gz', self.address+'/build/submit', data)
def pkg_build(buildid, callbackurl, jobid, arch, os, release, filepath):
	filepath = untar(filepath, conf['dir']['processing'])
	filepath = conf['dir']['processing'] + filepath

	build_arch = arch
	if arch == 'all':
		build_arch = get_arch()

	if os == get_os():
		if not pbuilder_basetgz_exists(build_arch, release):
			print("Creating basetgz for %s, %s" % (build_arch, release))
			pbuilder_basetgz_create(build_arch, release)
		else:
			print("Updating basetgz")
			pbuilder_basetgz_update(build_arch, release)

		print('Running debuild')
		pbuilder_debuild(buildid, filepath, build_arch, release)
		targz(conf['dir']['buildfiles']+buildid+'/*', conf['dir']['result']+jobid+'/result.tar.gz')
		build_callback(buildid, callbackurl, jobid, arch, os, release)

	else:
		print('Unsupported os: ' + os)