diff options
Diffstat (limited to 'src/tinderbox')
-rw-r--r-- | src/tinderbox/__init__.py | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/src/tinderbox/__init__.py b/src/tinderbox/__init__.py index c90e0f7..641e12d 100644 --- a/src/tinderbox/__init__.py +++ b/src/tinderbox/__init__.py @@ -31,8 +31,14 @@ from logger import log, init_logging class Tinderbox(object): + """ + Class for basic worker object called Tinderbox. Tinderbox connects to Matchbox + and asks for package(s) to compile. Tinderbox tries to compile given packages + and responds to Matchbox either with package contents or error messages + """ NOMERGE_PKGS=['sys-apps/portage'] + """These packages will never be (re)merged""" def __init__(self): self.hostname = config.MATCHBOX_HOST @@ -48,12 +54,15 @@ class Tinderbox(object): def start_tinderbox(self): + """ + This function starts tinderbox process (connects to Matchbox + server) and then starts compiling packages requested by + Matchbox. + """ self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - # TODO load settings for contacting matchbox self.sock.connect((self.hostname,self.port)) while 1: - # TODO error/exception checking msg = protocol.GetNextPackage() msg_pickled = pickle.dumps(msg) self.sock.sendall(msg_pickled) @@ -77,6 +86,14 @@ class Tinderbox(object): def emerge_package(self, package): + """ + Top level emerge function for compiling packages + + @param package: package to be compiled, optionally with + version/useflag information + @type package: tinderbox Package + @return: None + """ log.debug("emerge_package starting for %s" % package.name) settings = self.settings @@ -167,10 +184,24 @@ class Tinderbox(object): msg = protocol.AddPackageInfo(package_infos) self.sock.sendall(pickle.dumps(msg)) - #TODO make binpkg def _emerge_package_subprocess(self, pkg, dep_groups, package): + """ + This functions is running inside chrooted environment. It's + purpose is to try and emerge packages group-by-group and then + package specified. All information is stored inside + package_infos to be retrieved later by calling function + + @param pkg: cpv string (category/package-version) + @type pkg: string + @param dep_groups: dependency groups as returned by create_dep_groups function + @type dep_groups: list of lists of dependency cpvs + @param package: package class for filling out information + @type package: tinderbox.Package + + @return None + """ # We are chrooted inside WORK_CHROOT remember! porttree = self.trees[portage.root]['porttree'] portdb = porttree.dbapi @@ -283,6 +314,16 @@ class Tinderbox(object): self._save_info('package_infos', package_infos) def _add_attachment(self, pkg, path): + """ + Adds file content with given path to package pkg as attachment + + @param pkg: Package that will get embedded data + @type pkg: tinderbox.Package + @param path: Path to attachment file + @type path: string + + @return None + """ try: attfile = open(path,"r") except IOError, (errno, strerror): @@ -504,5 +545,5 @@ class Package(object): cat, pkg = portage.catsplit(cpv) dblink = portage.dblink(cat, pkg, portage.root, vartree.settings, treetype="vartree", vartree=vartree) - + return dblink.getcontents() |