diff options
Diffstat (limited to 'src/matchbox/__init__.py')
-rw-r--r-- | src/matchbox/__init__.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/matchbox/__init__.py b/src/matchbox/__init__.py index 34c9daa..35eb1a2 100644 --- a/src/matchbox/__init__.py +++ b/src/matchbox/__init__.py @@ -17,6 +17,12 @@ import matchbox.db.main.models as dbm from matchbox.db import DjangoDB class MatchboxServer(object): + """ + Class representing master Matchbox server deciding what needs to + be compiled. Tinderboxes connect to this server and ask for + packages to compile. When they return package contents (or errors) + Matchbox adds this information to database using DjangoDB backend. + """ def __init__(self, host, port): self.host = host @@ -26,6 +32,9 @@ class MatchboxServer(object): self.portsettings = portage.config(clone=portage.settings) def start_server(self): + """ + Starts matchbox server waiting for Tinderbox connections + """ try: self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) except socket.error: @@ -48,6 +57,15 @@ class MatchboxServer(object): def client_handler(self, client_socket, client_address): + """ + Service for one Tinderbox connection accepting + commands/replies + + @param client_socket: socket of client connection + @type client_socket: socket + @param client_address: (address,port) tuple of client + @type client_address: tuple + """ while 1: buffer = client_socket.recv(4096) data = "" @@ -89,6 +107,13 @@ class MatchboxServer(object): client_socket.close() def _get_next_package(self): + """ + Returns category/package string of next pacakge to be compiled + by tinderbox(en) + + @returns: category/package string + @rtype: string + """ override = self.__get_override_package() if override: return override @@ -147,6 +172,11 @@ class MatchboxServer(object): def __get_override_package(self): + """ + Function to simplify debugging. If file /tmp/matchbox_override + exists it reads first line and returns it. It's used to force + selection of certain package as next package for tinderbox to compile + """ try: line = None fin = open("/tmp/matchbox_override","r") |