blob: 8ec0fc6d55c544655a84a5096d43afe5880b6023 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#!/usr/bin/env python
import glob
import re
import os
import shutil
from grs.Constants import CONST
from grs.MountDirectories import MountDirectories
class PivotChroot(Rotator):
""" doc here
more doc
"""
def __init__(self, tmpdir = CONST.TMPDIR, portage_configroot = CONST.PORTAGE_CONFIGROOT, \
logfile = CONST.LOGFILE):
""" doc here
more doc
"""
self.tmpdir = tmpdir
self.portage_configroot = portage_configroot
self.logfile = logfile
def pivot(self, subchroot, md):
""" doc here
more doc
"""
some_mounted, all_mounted = md.are_mounted()
if some_mounted:
md.umount_all()
# Move portage_configroot out of the way to system.0,
# then pivot out the inner chroot to system.
self.rotate(self.portage_configroot)
shutil.move(self.portage_configroot, '%s.0' % self.portage_configroot)
inner_chroot = os.path.join('%s.0' % self.portage_configroot, subchroot)
shutil.move(inner_chroot, os.path.join(self.tmpdir, 'system'))
if all_mounted:
md.mount_all()
|