| … | |
… | |
| 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.3 2005/12/23 22:39:29 agaffney Exp $ |
8 | $Id: GLIPortage.py,v 1.4 2005/12/24 17:29:33 agaffney Exp $ |
| 9 | """ |
9 | """ |
| 10 | |
10 | |
| 11 | import os |
11 | import os |
| 12 | import re |
12 | import re |
| 13 | import GLIUtility |
13 | import GLIUtility |
| … | |
… | |
| 123 | if not self._grp_install: |
123 | if not self._grp_install: |
| 124 | del(os.environ['ROOT']) |
124 | del(os.environ['ROOT']) |
| 125 | return GLIUtility.spawn("emerge -p " + pkgs + r" | grep -e '^\[[a-z]' | cut -d ']' -f2 | sed -e 's:^ ::' -e 's: .\+$::'", chroot=self._chroot_dir, return_output=True)[1].split("\n") |
125 | return GLIUtility.spawn("emerge -p " + pkgs + r" | grep -e '^\[[a-z]' | cut -d ']' -f2 | sed -e 's:^ ::' -e 's: .\+$::'", chroot=self._chroot_dir, return_output=True)[1].split("\n") |
| 126 | os.environ['ROOT'] = self._chroot_dir |
126 | os.environ['ROOT'] = self._chroot_dir |
| 127 | else: |
127 | else: |
| 128 | pkglist = [] |
128 | return GLIUtility.spawn("../../runtimedeps.py " + pkgs, return_output=True)[1].split("\n")[:-1] |
| 129 | graph = depgraph() |
|
|
| 130 | for pkg in pkgs.split(): |
|
|
| 131 | if not self.vdb.match(pkg): |
|
|
| 132 | self._logger.log("get_deps(): " + pkg + " is not available via GRP...ignoring") |
|
|
| 133 | continue |
|
|
| 134 | self.calc_required_pkgs(pkg, graph) |
|
|
| 135 | while graph.node_count(): |
|
|
| 136 | leaf_nodes = graph.leaf_nodes() |
|
|
| 137 | if not leaf_nodes: |
|
|
| 138 | node = graph.important_node() |
|
|
| 139 | pkglist.append(node) |
|
|
| 140 | graph.remove(node) |
|
|
| 141 | continue |
|
|
| 142 | pkglist.extend(leaf_nodes) |
|
|
| 143 | for node in leaf_nodes: |
|
|
| 144 | graph.remove(node) |
|
|
| 145 | return pkglist |
|
|
| 146 | |
129 | |
| 147 | def copy_pkg_to_chroot(self, package): |
130 | def copy_pkg_to_chroot(self, package): |
| 148 | symlinks = { '/bin/': '/mnt/livecd/bin/', '/boot/': '/mnt/livecd/boot/', '/lib/': '/mnt/livecd/lib/', |
131 | symlinks = { '/bin/': '/mnt/livecd/bin/', '/boot/': '/mnt/livecd/boot/', '/lib/': '/mnt/livecd/lib/', |
| 149 | '/opt/': '/mnt/livecd/opt/', '/sbin/': '/mnt/livecd/sbin/', '/usr/': '/mnt/livecd/usr/', |
132 | '/opt/': '/mnt/livecd/opt/', '/sbin/': '/mnt/livecd/sbin/', '/usr/': '/mnt/livecd/usr/', |
| 150 | '/etc/gconf/': '/usr/livecd/gconf/' } |
133 | '/etc/gconf/': '/usr/livecd/gconf/' } |
| … | |
… | |
| 222 | expr = re.compile('^(.+?)(-\d.+)?$') |
205 | expr = re.compile('^(.+?)(-\d.+)?$') |
| 223 | res = expr.match(package) |
206 | res = expr.match(package) |
| 224 | if res: |
207 | if res: |
| 225 | GLIUtility.spawn("echo " + res.group(1) + " >> " + self._chroot_dir + "/var/lib/portage/world") |
208 | GLIUtility.spawn("echo " + res.group(1) + " >> " + self._chroot_dir + "/var/lib/portage/world") |
| 226 | |
209 | |
| 227 | def get_best_version_vdb(self, package): |
210 | # def get_best_version_vdb(self, package): |
| 228 | return portage.best(vdb.match(package)) |
211 | # return portage.best(vdb.match(package)) |
| 229 | |
212 | # |
| 230 | def get_best_version_tree(self, package): |
213 | # def get_best_version_tree(self, package): |
| 231 | return portage.best(tree.match(package)) |
214 | # return portage.best(tree.match(package)) |