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
def package(metainf): for x in g.SYN_SRC_TO_BIN_FILESPEC: c.cp(x, "../" + g.SYN_SRC_TO_BIN_FILESPEC[x]) c.cd("..") for x in g.INSTALL_BLACKLIST: Syn.log.l(Syn.log.LOG,"checking blacklisted file: %s" % x) if c.xists(g.ARCHIVE_FS_ROOT_NOSLASH + x): Syn.log.l(Syn.log.LOG,"Removing: %s (blacklist)" % x) c.rm(g.ARCHIVE_FS_ROOT_NOSLASH + x) files = c.md5sumwd(g.ARCHIVE_FS_ROOT_NOSLASH) output = json.dumps(files, sort_keys = True, indent = 4) f = open(g.ARCHIVE_FS_ROOT + "/" + g.SYN_BINARY_FILESUMS, 'w') f.write(output) f.close() pkg = metainf['package'] ver = metainf['version'] b_pth = pkg + "-" + ver + "." + g.SYN_BIN_PKG_XTN l_pth = pkg + "-" + ver + "." + g.SYN_LOG_PKG_XTN ar = t.newArchive( [ g.ARCHIVE_FS_ROOT ], b_pth, t.BINARY ) ( r_errs, n_errs, g_errs ) = Syn.synlint.runCheck(b_pth) errs = "Errors (on the binary)\n" errs += "\n" errs += "Report for:" errs += " " + pkg + "-" + ver errs += "\n" errs += " Serious: " + str(r_errs) + "\n" errs += " Important: " + str(n_errs) + "\n" errs += " Pedantic: " + str(g_errs) + "\n" errs += "\n" logLog("./", "synlint", errs) ar = t.newArchive( [ g.LOG_FS_ROOT ], l_pth, t.UNKNOWN ) return ( b_pth, l_pth )