Example #1
0
def packageBuiltBinaryFolder():
	"""
	This packages the binary DESTDIR folders (root and metadata)
	into a tarball, and returns it as a binary_package.

	Note: This needs to have the env set up from the build,
	this uses the env gto get the build directory. Don't be stupid :)
	"""
	# Note, this *NEEDS* the envsetup before use.
	broot = Syn.common.getenv(S.BINARY_ROOT)
	metadir = Syn.common.getenv(S.DESTDIR)

	popdir = Syn.common.getcwd()
	Syn.sh.cd(broot) # n-cwd - ./bash-4.1/ 

	# checksum bs
	Syn.md5sum.makemd5sumfile(".", S.STAGE_META + "/" + B.FILESUMS)

	bblob = Syn.json_bfile.json_bfile("./" + S.STAGE_META + "/" + B.METAFILE)
	packagedata = bblob.getContent()
	fullid = "%s-%s" % ( packagedata["package"], packagedata["version"] )
	tarball = tarfile.open(fullid + B.XTN, 'w:gz')
	tarball.add(S.STAGE_META)
	tarball.add(S.STAGE_FOLD)
	tarball.close()
	synball = Syn.binary_tarball.binary_tarball(fullid + B.XTN)

	Syn.sh.cd(popdir)
	return synball
Example #2
0
def packageSynd():
	"""
	packageSynd tars and compresses the synd for
	use as a builder. There is only a mild ammount of sanity
	checking in the source_tarball class that ensures this is OK.
	"""
	mf = Syn.json_file.json_file(S.SOURCE_DIRECTORY + "/" + S.METAFILE)
	dickt = mf.getContent()
	pkg = dickt['package']
	ver = dickt['version']
	fullpath="%s-%s" % (pkg, ver)
	wdir = Syn.common.getcwd()
	package = os.path.basename(wdir)
	Syn.log.l(Syn.log.PEDANTIC,"Found package top-level as: %s" % package)
	FPATH = fullpath + S.XTN
	Syn.sh.cd("..")
	tarball = tarfile.open(FPATH, 'w:gz')
	tarball.add(package)
	tarball.close()
	ret = Syn.source_tarball.source_tarball(FPATH)
	Syn.sh.cd(package)
	return ret