webapp.ebuild provides the ability to hook a script via "webapp_hook_script", which runs later during the webapp-config phase. Many scripts of already existing vhosts aware ebuilds use something like "exit 1" do indicate an error condition. However, webapp-config merely displays the stdout and stderr output and then happily terminates, saying "* Install completed - success". Inspection /usr/lib/python2.6/site-packages/WebappConfig/ebuild.py shows that within subroutine "run_hook()", nobody cares to test the exit status of the spawned process: 126 if os.path.isdir(self.__hooksd): 127 for x in os.listdir(self.__hooksd): 128 129 if (os.path.isfile(self.__hooksd + '/' + x) and 130 os.access(self.__hooksd + '/' + x, os.X_OK)): 131 132 OUT.debug('Running hook script', 7) 133 134 fi, fo, fe = os.popen3(self.__hooksd + '/' + x + ' ' 135 + type) 136 fi.close() 137 result_lines = fo.readlines() 138 error_lines = fe.readlines() 139 fo.close() 140 fe.close() 141 142 if result_lines: 143 for i in result_lines: 144 OUT.notice(i) 145 146 if error_lines: 147 for i in error_lines: 148 OUT.warn(i) 149 150 sandbox.stop() Section 18.1.3.5 of http://docs.python.org/library/subprocess.html describes how to replace the now deprecated os.popen3 function, for example by the "Popen()" function. An object instance 'p' returned by "p=Popen()" would provide an attribute p.returncode.
Created attachment 210905 [details, diff] Patch against ebuild.py coming with version 1.50.16-r3 This patch uses "subprocess.Popen()" instead of "os.popen3()", hence it also cures the warning concerning "os.popen3" being deprecated. Tested using Python 2.6.3, works ok.
Devan can you take a look at this and make a recommendation.