Modify devserver and gmerge to be friendlier
1. If devserver detects that you are trying to build a cros_workon
package that isn't actually cros_workon'd, it will fail. This should
prevent an infrequent, but highly frustrating error case.
2. You can supply USE flags on the gmerge command line
3. Some unit tests added for gmerge
BUG=N0NE
TEST=unit tests + manual testing
Change-Id: I6dacdf16496efb90e18fba7a412339051eebc4e4
Review URL: http://codereview.chromium.org/6305004
diff --git a/devserver.py b/devserver.py
index 7d744c5..7d4162d 100755
--- a/devserver.py
+++ b/devserver.py
@@ -9,9 +9,11 @@
import cherrypy
import optparse
import os
+import subprocess
import sys
import autoupdate
+import builder
CACHED_ENTRIES=12
@@ -69,7 +71,7 @@
'DEVSERVER')
-class DevServerRoot:
+class DevServerRoot(object):
"""The Root Class for the Dev Server.
CherryPy works as follows:
@@ -81,17 +83,12 @@
cherrypy uses the update method and puts the extra paths in args.
"""
- def build(self, board, pkg):
+ def __init__(self):
+ self._builder = builder.Builder()
+
+ def build(self, board, pkg, **kwargs):
"""Builds the package specified."""
- cherrypy.log('emerging %s' % pkg, 'BUILD')
- emerge_command = 'emerge-%s %s' % (board, pkg)
- err = os.system(emerge_command)
- if err != 0:
- raise Exception('failed to execute %s' % emerge_command)
- eclean_command = 'eclean-%s -d packages' % board
- err = os.system(eclean_command)
- if err != 0:
- raise Exception('failed to execute %s' % emerge_command)
+ return self._builder.Build(board, pkg, kwargs)
def index(self):
return 'Welcome to the Dev Server!'