summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/sstate.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/sstate.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/sstate.py67
1 files changed, 0 insertions, 67 deletions
diff --git a/meta/lib/oeqa/selftest/cases/sstate.py b/meta/lib/oeqa/selftest/cases/sstate.py
deleted file mode 100644
index 80ce9e353c..0000000000
--- a/meta/lib/oeqa/selftest/cases/sstate.py
+++ /dev/null
@@ -1,67 +0,0 @@
1#
2# SPDX-License-Identifier: MIT
3#
4
5import datetime
6import unittest
7import os
8import re
9import shutil
10
11import oeqa.utils.ftools as ftools
12from oeqa.selftest.case import OESelftestTestCase
13from oeqa.utils.commands import runCmd, bitbake, get_bb_vars, get_test_layer
14
15
16class SStateBase(OESelftestTestCase):
17
18 def setUpLocal(self):
19 super(SStateBase, self).setUpLocal()
20 self.temp_sstate_location = None
21 needed_vars = ['SSTATE_DIR', 'NATIVELSBSTRING', 'TCLIBC', 'TUNE_ARCH',
22 'TOPDIR', 'TARGET_VENDOR', 'TARGET_OS']
23 bb_vars = get_bb_vars(needed_vars)
24 self.sstate_path = bb_vars['SSTATE_DIR']
25 self.hostdistro = bb_vars['NATIVELSBSTRING']
26 self.tclibc = bb_vars['TCLIBC']
27 self.tune_arch = bb_vars['TUNE_ARCH']
28 self.topdir = bb_vars['TOPDIR']
29 self.target_vendor = bb_vars['TARGET_VENDOR']
30 self.target_os = bb_vars['TARGET_OS']
31 self.distro_specific_sstate = os.path.join(self.sstate_path, self.hostdistro)
32
33 # Creates a special sstate configuration with the option to add sstate mirrors
34 def config_sstate(self, temp_sstate_location=False, add_local_mirrors=[]):
35 self.temp_sstate_location = temp_sstate_location
36
37 if self.temp_sstate_location:
38 temp_sstate_path = os.path.join(self.builddir, "temp_sstate_%s" % datetime.datetime.now().strftime('%Y%m%d%H%M%S'))
39 config_temp_sstate = "SSTATE_DIR = \"%s\"" % temp_sstate_path
40 self.append_config(config_temp_sstate)
41 self.track_for_cleanup(temp_sstate_path)
42 bb_vars = get_bb_vars(['SSTATE_DIR', 'NATIVELSBSTRING'])
43 self.sstate_path = bb_vars['SSTATE_DIR']
44 self.hostdistro = bb_vars['NATIVELSBSTRING']
45 self.distro_specific_sstate = os.path.join(self.sstate_path, self.hostdistro)
46
47 if add_local_mirrors:
48 config_set_sstate_if_not_set = 'SSTATE_MIRRORS ?= ""'
49 self.append_config(config_set_sstate_if_not_set)
50 for local_mirror in add_local_mirrors:
51 self.assertFalse(os.path.join(local_mirror) == os.path.join(self.sstate_path), msg='Cannot add the current sstate path as a sstate mirror')
52 config_sstate_mirror = "SSTATE_MIRRORS += \"file://.* file:///%s/PATH\"" % local_mirror
53 self.append_config(config_sstate_mirror)
54
55 # Returns a list containing sstate files
56 def search_sstate(self, filename_regex, distro_specific=True, distro_nonspecific=True):
57 result = []
58 for root, dirs, files in os.walk(self.sstate_path):
59 if distro_specific and re.search(r"%s/%s/[a-z0-9]{2}/[a-z0-9]{2}$" % (self.sstate_path, self.hostdistro), root):
60 for f in files:
61 if re.search(filename_regex, f):
62 result.append(f)
63 if distro_nonspecific and re.search(r"%s/[a-z0-9]{2}/[a-z0-9]{2}$" % self.sstate_path, root):
64 for f in files:
65 if re.search(filename_regex, f):
66 result.append(f)
67 return result