| … | |
… | |
| 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.51 2006/03/05 06:21:21 agaffney Exp $ |
8 | $Id: GLIPortage.py,v 1.52 2006/04/19 16:31:18 agaffney Exp $ |
| 9 | """ |
9 | """ |
| 10 | |
10 | |
| 11 | import re |
11 | import re |
| 12 | import os |
12 | import os |
| 13 | import sys |
13 | import sys |
| … | |
… | |
| 159 | if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): running 'tar -cp --files-from=/tmp/tarfilelist --no-recursion 2>/dev/null | tar -C " + self._chroot_dir + image_dir + " -xp'") |
159 | if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): running 'tar -cp --files-from=/tmp/tarfilelist --no-recursion 2>/dev/null | tar -C " + self._chroot_dir + image_dir + " -xp'") |
| 160 | if not GLIUtility.exitsuccess(GLIUtility.spawn("tar -cp --files-from=/tmp/tarfilelist --no-recursion 2>/dev/null | tar -C " + self._chroot_dir + image_dir + " -xp", logfile=self._compile_logfile, append_log=True)): |
160 | if not GLIUtility.exitsuccess(GLIUtility.spawn("tar -cp --files-from=/tmp/tarfilelist --no-recursion 2>/dev/null | tar -C " + self._chroot_dir + image_dir + " -xp", logfile=self._compile_logfile, append_log=True)): |
| 161 | raise GLIException("CopyPackageToChrootError", 'fatal', 'copy_pkg_to_chroot', "Could not execute tar for " + package) |
161 | raise GLIException("CopyPackageToChrootError", 'fatal', 'copy_pkg_to_chroot', "Could not execute tar for " + package) |
| 162 | |
162 | |
| 163 | # Fix mode, uid, and gid of directories |
163 | # Fix mode, uid, and gid of directories |
| 164 | if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): running find " + self._chroot_dir + image_dir + " -type d 2>/dev/null | sed -e 's:^" + self._chroot_dir + image_dir + "::' | grep -v '^$'") |
164 | # if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): running find " + self._chroot_dir + image_dir + " -type d 2>/dev/null | sed -e 's:^" + self._chroot_dir + image_dir + "::' | grep -v '^$'") |
| 165 | dirlist = GLIUtility.spawn("find " + self._chroot_dir + image_dir + " -type d 2>/dev/null | sed -e 's:^" + self._chroot_dir + image_dir + "::' | grep -v '^$'", return_output=True)[1].strip().split("\n") |
165 | # dirlist = GLIUtility.spawn("find " + self._chroot_dir + image_dir + " -type d 2>/dev/null | sed -e 's:^" + self._chroot_dir + image_dir + "::' | grep -v '^$'", return_output=True)[1].strip().split("\n") |
| 166 | if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): found the following directories: " + str(dirlist)) |
166 | # if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): found the following directories: " + str(dirlist)) |
| 167 | if not dirlist or dirlist[0] == "": |
167 | # if not dirlist or dirlist[0] == "": |
| 168 | raise GLIException("CopyPackageToChrootError", 'fatal', 'copy_pkg_to_chroot', "directory list entry for " + package + "...this shouldn't happen!") |
168 | # raise GLIException("CopyPackageToChrootError", 'fatal', 'copy_pkg_to_chroot', "directory list entry for " + package + "...this shouldn't happen!") |
| 169 | for dir in dirlist: |
169 | # for dir in dirlist: |
| 170 | dirstat = os.stat(dir) |
170 | # dirstat = os.stat(dir) |
| 171 | if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): setting mode " + str(dirstat[0]) + " and uid/gid " + str(dirstat[4]) + "/" + str(dirstat[5]) + " for directory " + self._chroot_dir + image_dir + dir) |
171 | # if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): setting mode " + str(dirstat[0]) + " and uid/gid " + str(dirstat[4]) + "/" + str(dirstat[5]) + " for directory " + self._chroot_dir + image_dir + dir) |
| 172 | os.chown(self._chroot_dir + image_dir + dir, dirstat[4], dirstat[5]) |
172 | # os.chown(self._chroot_dir + image_dir + dir, dirstat[4], dirstat[5]) |
| 173 | os.chmod(self._chroot_dir + image_dir + dir, dirstat[0]) |
173 | # os.chmod(self._chroot_dir + image_dir + dir, dirstat[0]) |
| 174 | |
174 | |
| 175 | # # More symlink crappiness hacks |
175 | # # More symlink crappiness hacks |
| 176 | # for symlink in symlinks: |
176 | # for symlink in symlinks: |
| 177 | ## if GLIUtility.is_file(self._chroot_dir + image_dir + symlinks[symlink]): |
177 | ## if GLIUtility.is_file(self._chroot_dir + image_dir + symlinks[symlink]): |
| 178 | # if os.path.islink(self._chroot_dir + image_dir + symlink): |
178 | # if os.path.islink(self._chroot_dir + image_dir + symlink): |