diff options
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/reproducible.py')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/reproducible.py | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/meta/lib/oeqa/selftest/cases/reproducible.py b/meta/lib/oeqa/selftest/cases/reproducible.py index c6cc0b7d0e..b3bbb70158 100644 --- a/meta/lib/oeqa/selftest/cases/reproducible.py +++ b/meta/lib/oeqa/selftest/cases/reproducible.py | |||
@@ -123,45 +123,53 @@ class ReproducibleTests(OESelftestTestCase): | |||
123 | def test_reproducible_builds(self): | 123 | def test_reproducible_builds(self): |
124 | capture_vars = ['DEPLOY_DIR_' + c.upper() for c in self.package_classes] | 124 | capture_vars = ['DEPLOY_DIR_' + c.upper() for c in self.package_classes] |
125 | 125 | ||
126 | # Build native utilities | ||
127 | self.write_config('') | ||
128 | bitbake("diffutils-native -c addto_recipe_sysroot") | ||
129 | diffutils_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "diffutils-native") | ||
130 | |||
131 | # Reproducible builds should not pull from sstate or mirrors, but | ||
132 | # sharing DL_DIR is fine | ||
126 | common_config = textwrap.dedent('''\ | 133 | common_config = textwrap.dedent('''\ |
127 | INHERIT += "reproducible_build" | 134 | INHERIT += "reproducible_build" |
128 | PACKAGE_CLASSES = "%s" | 135 | PACKAGE_CLASSES = "%s" |
136 | SSTATE_DIR = "${TMPDIR}/sstate" | ||
137 | SSTATE_MIRROR = "" | ||
129 | ''') % (' '.join('package_%s' % c for c in self.package_classes)) | 138 | ''') % (' '.join('package_%s' % c for c in self.package_classes)) |
130 | 139 | ||
131 | # Do an initial build. It's acceptable for this build to use sstate | 140 | # Perform a build. |
132 | self.write_config(common_config) | 141 | reproducibleA_tmp = os.path.join(self.topdir, 'reproducibleA', 'tmp') |
133 | vars_reference = get_bb_vars(capture_vars) | 142 | if os.path.exists(reproducibleA_tmp): |
134 | bitbake(' '.join(self.images)) | 143 | bb.utils.remove(reproducibleA_tmp, recurse=True) |
135 | 144 | ||
136 | # Build native utilities | 145 | self.write_config((textwrap.dedent('''\ |
137 | bitbake("diffutils-native -c addto_recipe_sysroot") | 146 | TMPDIR = "%s" |
138 | diffutils_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "diffutils-native") | 147 | ''') % reproducibleA_tmp) + common_config) |
148 | vars_A = get_bb_vars(capture_vars) | ||
149 | bitbake(' '.join(self.images)) | ||
139 | 150 | ||
140 | reproducible_tmp = os.path.join(self.topdir, 'reproducible', 'tmp') | 151 | # Perform another build. |
141 | if os.path.exists(reproducible_tmp): | 152 | reproducibleB_tmp = os.path.join(self.topdir, 'reproducibleB', 'tmp') |
142 | bb.utils.remove(reproducible_tmp, recurse=True) | 153 | if os.path.exists(reproducibleB_tmp): |
154 | bb.utils.remove(reproducibleB_tmp, recurse=True) | ||
143 | 155 | ||
144 | # Perform another build. This build should *not* share sstate or pull | ||
145 | # from any mirrors, but sharing a DL_DIR is fine | ||
146 | self.write_config((textwrap.dedent('''\ | 156 | self.write_config((textwrap.dedent('''\ |
147 | TMPDIR = "%s" | 157 | TMPDIR = "%s" |
148 | SSTATE_DIR = "${TMPDIR}/sstate" | 158 | ''') % reproducibleB_tmp) + common_config) |
149 | SSTATE_MIRROR = "" | 159 | vars_B = get_bb_vars(capture_vars) |
150 | ''') % reproducible_tmp) + common_config) | ||
151 | vars_test = get_bb_vars(capture_vars) | ||
152 | bitbake(' '.join(self.images)) | 160 | bitbake(' '.join(self.images)) |
153 | 161 | ||
154 | # NOTE: The temp directory from the reproducible build is purposely | 162 | # NOTE: The temp directories from the reproducible build are purposely |
155 | # kept after the build so it can be diffed for debugging. | 163 | # kept after the build so it can be diffed for debugging. |
156 | 164 | ||
157 | for c in self.package_classes: | 165 | for c in self.package_classes: |
158 | with self.subTest(package_class=c): | 166 | with self.subTest(package_class=c): |
159 | package_class = 'package_' + c | 167 | package_class = 'package_' + c |
160 | 168 | ||
161 | deploy_reference = vars_reference['DEPLOY_DIR_' + c.upper()] | 169 | deploy_A = vars_A['DEPLOY_DIR_' + c.upper()] |
162 | deploy_test = vars_test['DEPLOY_DIR_' + c.upper()] | 170 | deploy_B = vars_B['DEPLOY_DIR_' + c.upper()] |
163 | 171 | ||
164 | result = self.compare_packages(deploy_reference, deploy_test, diffutils_sysroot) | 172 | result = self.compare_packages(deploy_A, deploy_B, diffutils_sysroot) |
165 | 173 | ||
166 | self.logger.info('Reproducibility summary for %s: %s' % (c, result)) | 174 | self.logger.info('Reproducibility summary for %s: %s' % (c, result)) |
167 | 175 | ||