本文整理汇总了Python中kiwi.defaults.Defaults.get_shared_cache_location方法的典型用法代码示例。如果您正苦于以下问题:Python Defaults.get_shared_cache_location方法的具体用法?Python Defaults.get_shared_cache_location怎么用?Python Defaults.get_shared_cache_location使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kiwi.defaults.Defaults
的用法示例。
在下文中一共展示了Defaults.get_shared_cache_location方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_custom_shared_cache_location
# 需要导入模块: from kiwi.defaults import Defaults [as 别名]
# 或者: from kiwi.defaults.Defaults import get_shared_cache_location [as 别名]
def test_get_custom_shared_cache_location(self):
sys.argv = [
sys.argv[0],
'--shared-cache-dir', '/my/cachedir',
'system', 'prepare',
'--description', 'description', '--root', 'directory'
]
assert Defaults.get_shared_cache_location() == 'my/cachedir'
示例2: __init__
# 需要导入模块: from kiwi.defaults import Defaults [as 别名]
# 或者: from kiwi.defaults.Defaults import get_shared_cache_location [as 别名]
def __init__(self, root_init):
self.root_dir = root_init.root_dir
self.cleanup_files = []
self.mount_stack = []
self.dir_stack = []
# need resolv.conf/hosts for chroot name resolution
# need /etc/sysconfig/proxy for chroot proxy usage
self.config_files = [
'/etc/resolv.conf',
'/etc/hosts',
'/etc/sysconfig/proxy'
]
# need kernel filesystems bind mounted
self.bind_locations = [
'/proc',
'/dev',
'/var/run/dbus',
'/sys'
]
# share the following directory with the host
self.shared_location = '/' + Defaults.get_shared_cache_location()
示例3: _operate_on_loop
# 需要导入模块: from kiwi.defaults import Defaults [as 别名]
# 或者: from kiwi.defaults.Defaults import get_shared_cache_location [as 别名]
def _operate_on_loop(self):
filesystem = None
loop_provider = LoopDevice(
self.filename,
self.filesystem_setup.get_size_mbytes(),
self.blocksize
)
loop_provider.create()
filesystem = FileSystem(
self.requested_filesystem, loop_provider,
self.root_dir, self.filesystem_custom_parameters
)
filesystem.create_on_device(self.label)
log.info(
'--> Syncing data to filesystem on %s', loop_provider.get_device()
)
exclude_list = [
'image', '.profile', '.kconfig',
Defaults.get_shared_cache_location()
]
filesystem.sync_data(exclude_list)
示例4: _create_base_directories
# 需要导入模块: from kiwi.defaults import Defaults [as 别名]
# 或者: from kiwi.defaults.Defaults import get_shared_cache_location [as 别名]
def _create_base_directories(self, root):
"""
Create minimum collection of directories in the new
root system required for kiwi to operate
"""
base_system_paths = (
Defaults.get_shared_cache_location(),
'dev/pts',
'proc',
'etc/sysconfig',
'run',
'sys',
'var'
)
root_uid = getpwnam('root').pw_uid
root_gid = getpwnam('root').pw_gid
for path in base_system_paths:
root_path = os.sep.join([root, path])
if not os.path.exists(root_path):
os.makedirs(root_path)
os.chown(root_path, root_uid, root_gid)
示例5: test_get_default_shared_cache_location
# 需要导入模块: from kiwi.defaults import Defaults [as 别名]
# 或者: from kiwi.defaults.Defaults import get_shared_cache_location [as 别名]
def test_get_default_shared_cache_location(self):
assert Defaults.get_shared_cache_location() == 'var/cache/kiwi'
示例6: _build_and_map_disk_partitions
# 需要导入模块: from kiwi.defaults import Defaults [as 别名]
# 或者: from kiwi.defaults.Defaults import get_shared_cache_location [as 别名]
def _build_and_map_disk_partitions(self): # noqa: C901
self.disk.wipe()
if self.firmware.legacy_bios_mode():
log.info('--> creating EFI CSM(legacy bios) partition')
self.disk.create_efi_csm_partition(
self.firmware.get_legacy_bios_partition_size()
)
if self.firmware.efi_mode():
log.info('--> creating EFI partition')
self.disk.create_efi_partition(
self.firmware.get_efi_partition_size()
)
if self.firmware.ofw_mode():
log.info('--> creating PReP partition')
self.disk.create_prep_partition(
self.firmware.get_prep_partition_size()
)
if self.disk_setup.need_boot_partition():
log.info('--> creating boot partition')
self.disk.create_boot_partition(
self.disk_setup.boot_partition_size()
)
if self.spare_part_mbsize:
log.info('--> creating spare partition')
self.disk.create_spare_partition(
self.spare_part_mbsize
)
if self.root_filesystem_is_overlay:
log.info('--> creating readonly root partition')
squashed_root_file = NamedTemporaryFile()
squashed_root = FileSystemSquashFs(
device_provider=None, root_dir=self.root_dir
)
squashed_root.create_on_file(
filename=squashed_root_file.name,
exclude=[Defaults.get_shared_cache_location()]
)
squashed_rootfs_mbsize = os.path.getsize(
squashed_root_file.name
) / 1048576
self.disk.create_root_readonly_partition(
int(squashed_rootfs_mbsize + 50)
)
if self.volume_manager_name and self.volume_manager_name == 'lvm':
log.info('--> creating LVM root partition')
self.disk.create_root_lvm_partition('all_free')
elif self.mdraid:
log.info('--> creating mdraid root partition')
self.disk.create_root_raid_partition('all_free')
else:
log.info('--> creating root partition')
self.disk.create_root_partition('all_free')
if self.firmware.bios_mode():
log.info('--> setting active flag to primary boot partition')
self.disk.activate_boot_partition()
if self.firmware.ofw_mode():
log.info('--> setting active flag to primary PReP partition')
self.disk.activate_boot_partition()
if self.firmware.efi_mode():
if self.force_mbr:
log.info('--> converting partition table to MBR')
self.disk.create_mbr()
elif self.hybrid_mbr:
log.info('--> converting partition table to hybrid GPT/MBR')
self.disk.create_hybrid_mbr()
self.disk.map_partitions()
return self.disk.get_device()