Exemple #1
0
def buildSourcePackage(package):
    ret = 0
    ar = t.archive(package)
    klass = ar.getClass()
    pop = os.path.abspath(os.getcwd())
    if klass != t.SOURCE:
        l.l(l.CRITICAL, "Archive is not a source package")
        return -1
    l.l(l.PEDANTIC, "Archive is sourceful. May continue")
    build_root = c.getTempLocation()
    c.mkdir(build_root)
    c.cd(build_root)
    try:
        (build, logs) = Syn.build.build(ar)
        c.cp(build, pop + "/" + build)
        c.cp(logs, pop + "/" + logs)

        ret = 0
    except Syn.errors.BuildFailureException as e:
        l.l(l.CRITICAL, "Failure to build!")
        l.l(l.CRITICAL, "Check the package build root in /tmp/syn, plox")
        l.l(l.CRITICAL, str(e))
        ret = -2
        return ret  # f**k removing the dir

    c.rmdir(build_root)
    return ret
Exemple #2
0
def uninstallArchive(pkg, ver):
	db = Syn.db.loadCanonicalDB()
	try:
		state = db.queryState(pkg, ver)
		if state['status'] != Syn.db.INSTALLED:
			raise Syn.errors.PackageUninstalledException("Package is not installed")
		l.l(l.LOG,"Package is installed. Phew.")
	except Syn.errors.PackageNotFoundException as e:
		l.l(l.LOG,"Package not found. Crap")
		raise e

	l.l(l.LOG,"Moving on with the package uninstall")

	# XXX: Someone fix below this, please.
	#      use Syn.fspkg.fspkg()

	c.cd(Syn.reg.CHROOT + g.INSTALL_ROOT_PATH)
	c.cd(pkg)

	db.setState(pkg,ver,Syn.db.HALF_INSTALLED)
	db.sync()

	c.rmdir(ver)

	db.setState(pkg,ver,Syn.db.UNINSTALLED)
	db.sync()