Revert "Include .buildenv file inside the buildroot"
This reverts commit d30bf4a19f.
This also includes the get_buildservice_env_name method in Defaults
to centralize '.buildenv' occurrences.
This commit is contained in:
parent
a13ac7559d
commit
3efbdba4c7
@ -527,7 +527,7 @@ class DiskBuilder(object):
|
||||
|
||||
def _get_exclude_list_for_root_data_sync(self, device_map):
|
||||
exclude_list = [
|
||||
'image', '.profile', '.kconfig', '.buildenv',
|
||||
'image', '.profile', '.kconfig',
|
||||
Defaults.get_shared_cache_location()
|
||||
]
|
||||
if 'boot' in device_map and self.bootloader == 'grub2_s390x_emu':
|
||||
|
||||
@ -75,6 +75,13 @@ class Defaults(object):
|
||||
# we are building inside of the open buildservice
|
||||
return os.path.exists('/.buildenv')
|
||||
|
||||
@classmethod
|
||||
def get_buildservice_env_name(self):
|
||||
"""
|
||||
The base name of the environment file in a buildservice worker
|
||||
"""
|
||||
return '.buildenv'
|
||||
|
||||
@classmethod
|
||||
def get_obs_download_server_url(self):
|
||||
"""
|
||||
|
||||
@ -19,6 +19,7 @@ import stat
|
||||
from pwd import getpwnam
|
||||
from tempfile import mkdtemp
|
||||
from shutil import rmtree
|
||||
from shutil import copy
|
||||
import os
|
||||
|
||||
# project
|
||||
@ -84,9 +85,8 @@ class RootInit(object):
|
||||
data.sync_data(
|
||||
options=['-a', '--ignore-existing']
|
||||
)
|
||||
Command.run([
|
||||
'touch', os.sep.join([self.root_dir, '.buildenv'])
|
||||
])
|
||||
if Defaults.is_buildservice_worker():
|
||||
copy(Defaults.get_buildservice_env_name(), self.root_dir)
|
||||
except Exception as e:
|
||||
self.delete()
|
||||
raise KiwiRootInitCreationError(
|
||||
|
||||
@ -329,7 +329,7 @@ class TestDiskBuilder(object):
|
||||
call = filesystem.sync_data.call_args_list[2]
|
||||
assert filesystem.sync_data.call_args_list[2] == \
|
||||
call([
|
||||
'image', '.profile', '.kconfig', '.buildenv', 'var/cache/kiwi',
|
||||
'image', '.profile', '.kconfig', 'var/cache/kiwi',
|
||||
'boot/*', 'boot/.*', 'boot/efi/*', 'boot/efi/.*'
|
||||
])
|
||||
assert mock_open.call_args_list[0:3] == [
|
||||
@ -449,7 +449,7 @@ class TestDiskBuilder(object):
|
||||
call = filesystem.sync_data.call_args_list[2]
|
||||
assert filesystem.sync_data.call_args_list[2] == \
|
||||
call([
|
||||
'image', '.profile', '.kconfig', '.buildenv', 'var/cache/kiwi',
|
||||
'image', '.profile', '.kconfig', 'var/cache/kiwi',
|
||||
'boot/*', 'boot/.*', 'boot/efi/*', 'boot/efi/.*'
|
||||
])
|
||||
assert mock_open.call_args_list == [
|
||||
@ -547,7 +547,7 @@ class TestDiskBuilder(object):
|
||||
assert squashfs.create_on_file.call_args_list == [
|
||||
call(exclude=['var/cache/kiwi'], filename='tempname'),
|
||||
call(exclude=[
|
||||
'image', '.profile', '.kconfig', '.buildenv', 'var/cache/kiwi',
|
||||
'image', '.profile', '.kconfig', 'var/cache/kiwi',
|
||||
'boot/*', 'boot/.*', 'boot/efi/*', 'boot/efi/.*'
|
||||
], filename='tempname')
|
||||
]
|
||||
@ -708,7 +708,7 @@ class TestDiskBuilder(object):
|
||||
volume_manager.mount_volumes.call_args_list[0].assert_called_once_with()
|
||||
volume_manager.get_fstab.assert_called_once_with(None, 'btrfs')
|
||||
volume_manager.sync_data.assert_called_once_with([
|
||||
'image', '.profile', '.kconfig', '.buildenv', 'var/cache/kiwi',
|
||||
'image', '.profile', '.kconfig', 'var/cache/kiwi',
|
||||
'boot/*', 'boot/.*', 'boot/efi/*', 'boot/efi/.*'
|
||||
])
|
||||
volume_manager.umount_volumes.call_args_list[0].assert_called_once_with()
|
||||
|
||||
@ -10,6 +10,7 @@ from kiwi.exceptions import (
|
||||
)
|
||||
|
||||
from kiwi.system.root_init import RootInit
|
||||
from kiwi.defaults import Defaults
|
||||
|
||||
|
||||
class TestRootInit(object):
|
||||
@ -45,12 +46,13 @@ class TestRootInit(object):
|
||||
@patch('os.mknod')
|
||||
@patch('os.symlink')
|
||||
@patch('os.makedev')
|
||||
@patch('kiwi.system.root_init.copy')
|
||||
@patch('kiwi.system.root_init.rmtree')
|
||||
@patch('kiwi.system.root_init.DataSync')
|
||||
@patch('kiwi.system.root_init.mkdtemp')
|
||||
@patch('kiwi.system.root_init.Command.run')
|
||||
def test_create(
|
||||
self, mock_command, mock_temp, mock_data_sync, mock_rmtree,
|
||||
self, mock_command, mock_temp, mock_data_sync, mock_rmtree, mock_copy,
|
||||
mock_makedev, mock_symlink, mock_mknod, mock_chwon, mock_makedirs,
|
||||
mock_path
|
||||
):
|
||||
@ -58,7 +60,7 @@ class TestRootInit(object):
|
||||
mock_data_sync.return_value = data_sync
|
||||
mock_makedev.return_value = 'makedev'
|
||||
mock_path_return = [
|
||||
True, True, True, False, False, False, False, False, False, False
|
||||
True, True, True, True, False, False, False, False, False, False, False
|
||||
]
|
||||
|
||||
def path_exists(self):
|
||||
@ -125,8 +127,7 @@ class TestRootInit(object):
|
||||
'cp',
|
||||
'/var/adm/fillup-templates/sysconfig.proxy',
|
||||
'tmpdir/etc/sysconfig/proxy'
|
||||
]),
|
||||
call(['touch', 'root_dir/.buildenv'])
|
||||
])
|
||||
]
|
||||
mock_data_sync.assert_called_once_with(
|
||||
'tmpdir/', 'root_dir'
|
||||
@ -138,6 +139,10 @@ class TestRootInit(object):
|
||||
'tmpdir', ignore_errors=True
|
||||
)
|
||||
|
||||
mock_copy.assert_called_once_with(
|
||||
Defaults.get_buildservice_env_name(), 'root_dir'
|
||||
)
|
||||
|
||||
@patch('kiwi.command.Command.run')
|
||||
@patch('os.path.exists')
|
||||
def test_delete(self, mock_path, mock_command):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user