| … | |
… | |
| 3 | # This source code is distributed under the terms of version 2 of the GNU |
3 | # This source code is distributed under the terms of version 2 of the GNU |
| 4 | # General Public License as published by the Free Software Foundation, a copy |
4 | # General Public License as published by the Free Software Foundation, a copy |
| 5 | # of which can be found in the main directory of this project. |
5 | # of which can be found in the main directory of this project. |
| 6 | Gentoo Linux Installer |
6 | Gentoo Linux Installer |
| 7 | |
7 | |
| 8 | $Id: GLIPortage.py,v 1.53 2006/06/25 02:28:19 agaffney Exp $ |
8 | $Id: GLIPortage.py,v 1.54 2006/07/10 05:56:31 agaffney Exp $ |
| 9 | """ |
9 | """ |
| 10 | |
10 | |
| 11 | import re |
11 | import re |
| 12 | import os |
12 | import os |
| 13 | import sys |
13 | import sys |
| … | |
… | |
| 181 | # if not GLIUtility.exitsuccess(GLIUtility.spawn("mv " + self._chroot_dir + image_dir + symlinks[symlink] + " " + self._chroot_dir + image_dir + symlink)): |
181 | # if not GLIUtility.exitsuccess(GLIUtility.spawn("mv " + self._chroot_dir + image_dir + symlinks[symlink] + " " + self._chroot_dir + image_dir + symlink)): |
| 182 | # raise GLIException("CopyPackageToChrootError", 'fatal', 'copy_pkg_to_chroot', "Could not fix " + symlink + " symlink ickiness for " + package) |
182 | # raise GLIException("CopyPackageToChrootError", 'fatal', 'copy_pkg_to_chroot', "Could not fix " + symlink + " symlink ickiness for " + package) |
| 183 | |
183 | |
| 184 | # Run pkg_setup |
184 | # Run pkg_setup |
| 185 | if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): running pkg_setup for " + package) |
185 | if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): running pkg_setup for " + package) |
| 186 | if not GLIUtility.exitsuccess(GLIUtility.spawn("env " + root_cmd + " PORTAGE_TMPDIR=" + portage_tmpdir + " ebuild " + vdb_dir + package + "/*.ebuild setup", chroot=tmp_chroot_dir, logfile=self._compile_logfile, append_log=True)): |
186 | if not GLIUtility.exitsuccess(GLIUtility.spawn("env " + root_cmd + " PORTAGE_TMPDIR=" + portage_tmpdir + " FEATURES=noauto ebuild " + vdb_dir + package + "/*.ebuild setup", chroot=tmp_chroot_dir, logfile=self._compile_logfile, append_log=True)): |
| 187 | raise GLIException("CopyPackageToChrootError", 'fatal', 'copy_pkg_to_chroot', "Could not execute pkg_setup for " + package) |
187 | raise GLIException("CopyPackageToChrootError", 'fatal', 'copy_pkg_to_chroot', "Could not execute pkg_setup for " + package) |
| 188 | |
188 | |
| 189 | # Run pkg_preinst |
189 | # Run pkg_preinst |
| 190 | if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): running preinst for " + package) |
190 | if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): running preinst for " + package) |
| 191 | if not GLIUtility.exitsuccess(GLIUtility.spawn("env " + root_cmd + " PORTAGE_TMPDIR=" + portage_tmpdir + " ebuild " + vdb_dir + package + "/*.ebuild preinst", chroot=tmp_chroot_dir, logfile=self._compile_logfile, append_log=True)): |
191 | if not GLIUtility.exitsuccess(GLIUtility.spawn("env " + root_cmd + " PORTAGE_TMPDIR=" + portage_tmpdir + " FEATURES=noauto ebuild " + vdb_dir + package + "/*.ebuild preinst", chroot=tmp_chroot_dir, logfile=self._compile_logfile, append_log=True)): |
| 192 | raise GLIException("CopyPackageToChrootError", 'fatal', 'copy_pkg_to_chroot', "Could not execute preinst for " + package) |
192 | raise GLIException("CopyPackageToChrootError", 'fatal', 'copy_pkg_to_chroot', "Could not execute preinst for " + package) |
| 193 | |
193 | |
| 194 | # Copy files from image_dir to chroot |
194 | # Copy files from image_dir to chroot |
| 195 | if not entries: |
195 | if not entries: |
| 196 | if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): no files for " + package + "...skipping copy from image dir to /") |
196 | if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): no files for " + package + "...skipping copy from image dir to /") |
| … | |
… | |
| 200 | if not GLIUtility.exitsuccess(GLIUtility.spawn("tar -C " + self._chroot_dir + image_dir + "/ -cp . | tar -C " + self._chroot_dir + "/ -xp", logfile=self._compile_logfile, append_log=True)): |
200 | if not GLIUtility.exitsuccess(GLIUtility.spawn("tar -C " + self._chroot_dir + image_dir + "/ -cp . | tar -C " + self._chroot_dir + "/ -xp", logfile=self._compile_logfile, append_log=True)): |
| 201 | raise GLIException("CopyPackageToChrootError", 'fatal', 'copy_pkg_to_chroot', "Could not copy files from " + image_dir + " to / for " + package) |
201 | raise GLIException("CopyPackageToChrootError", 'fatal', 'copy_pkg_to_chroot', "Could not copy files from " + image_dir + " to / for " + package) |
| 202 | |
202 | |
| 203 | # Run pkg_postinst |
203 | # Run pkg_postinst |
| 204 | if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): running postinst for " + package) |
204 | if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): running postinst for " + package) |
| 205 | if not GLIUtility.exitsuccess(GLIUtility.spawn("env " + root_cmd + " PORTAGE_TMPDIR=" + portage_tmpdir + " ebuild " + vdb_dir + package + "/*.ebuild postinst", chroot=tmp_chroot_dir, logfile=self._compile_logfile, append_log=True)): |
205 | if not GLIUtility.exitsuccess(GLIUtility.spawn("env " + root_cmd + " PORTAGE_TMPDIR=" + portage_tmpdir + " FEATURES=noauto ebuild " + vdb_dir + package + "/*.ebuild postinst", chroot=tmp_chroot_dir, logfile=self._compile_logfile, append_log=True)): |
| 206 | raise GLIException("CopyPackageToChrootError", 'fatal', 'copy_pkg_to_chroot', "Could not execute postinst for " + package) |
206 | raise GLIException("CopyPackageToChrootError", 'fatal', 'copy_pkg_to_chroot', "Could not execute postinst for " + package) |
| 207 | |
207 | |
| 208 | # Remove image_dir |
208 | # Remove image_dir |
| 209 | if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): removing " + image_dir + " for " + package) |
209 | if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): removing " + image_dir + " for " + package) |
| 210 | if not GLIUtility.exitsuccess(GLIUtility.spawn("rm -rf " + self._chroot_dir + image_dir, logfile=self._compile_logfile, append_log=True)): |
210 | if not GLIUtility.exitsuccess(GLIUtility.spawn("rm -rf " + self._chroot_dir + image_dir, logfile=self._compile_logfile, append_log=True)): |