d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_ar_configured' % pn)
}
+do_ar_prepare[vardeps] += " \
+ ARCHIVER_MODE \
+ ARCHIVER_MIRROR_EXCLUDE \
+ COPYLEFT_LICENSE_EXCLUDE \
+ COPYLEFT_LICENSE_INCLUDE \
+ COPYLEFT_PN_EXCLUDE \
+ COPYLEFT_PN_INCLUDE \
+ COPYLEFT_RECIPE_TYPES \
+"
+do_ar_prepare[cleandirs] = "${ARCHIVER_TOPDIR}"
+do_ar_prepare() {
+ :
+}
+
# Take all the sources for a recipe and put them in WORKDIR/archiver-work/.
# Files in SRC_URI are copied directly, anything that's a directory
# (e.g. git repositories) is "unpacked" and then put into a tarball.
do_deploy_archives[sstate-outputdirs] = "${DEPLOY_DIR_SRC}"
addtask do_deploy_archives_setscene
-addtask do_ar_original after do_unpack
-addtask do_unpack_and_patch after do_patch do_preconfigure
+addtask do_ar_prepare
+addtask do_ar_original after do_unpack do_ar_prepare
+addtask do_unpack_and_patch after do_patch do_preconfigure do_ar_prepare
addtask do_ar_patched after do_unpack_and_patch
addtask do_ar_configured after do_unpack_and_patch
-addtask do_ar_mirror after do_fetch
-addtask do_dumpdata
-addtask do_ar_recipe
-addtask do_deploy_archives
+addtask do_ar_mirror after do_fetch do_ar_prepare
+addtask do_dumpdata after do_ar_prepare
+addtask do_ar_recipe after do_ar_prepare
+addtask do_deploy_archives after do_ar_prepare
do_build[recrdeptask] += "do_deploy_archives"
do_rootfs[recrdeptask] += "do_deploy_archives"
do_populate_sdk[recrdeptask] += "do_deploy_archives"
]:
target_path = os.path.join(bb_vars['DEPLOY_DIR_SRC'], 'mirror', target_file_name)
self.assertTrue(os.path.exists(target_path))
+
+ def test_archiver_cleanup(self):
+ """
+ Test that the archiver removes no longer needed artifacts when its
+ configuration is modified.
+ """
+
+ target = 'selftest-ed-native'
+ target_file_name = 'selftest-ed-native-1.21.1-r0-showdata.dump'
+
+ def assert_dumpdata_present(expect_present):
+ bb_vars = get_bb_vars(['DEPLOY_DIR_SRC', 'BUILD_SYS'])
+ glob_str = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['BUILD_SYS'], '%s-*' % target)
+ glob_result = glob.glob(glob_str)
+ self.assertTrue(glob_result, 'Missing archiver directory for %s' % target)
+
+ archive_path = os.path.join(glob_result[0], target_file_name)
+ if expect_present:
+ self.assertTrue(os.path.exists(archive_path),
+ 'Missing archive file %s' % target_file_name)
+ else:
+ self.assertFalse(os.path.exists(archive_path),
+ 'Unexpected archive file %s' % target_file_name)
+
+ features = 'INHERIT += "archiver"\n'
+ self.write_config(features)
+ bitbake('-c deploy_archives %s -f' % target)
+ assert_dumpdata_present(False)
+
+ features += 'ARCHIVER_MODE[dumpdata] = "1"\n'
+ self.write_config(features)
+ bitbake('-c deploy_archives %s -f' % target)
+ assert_dumpdata_present(True)
+
+ features = 'INHERIT += "archiver"\n'
+ self.write_config(features)
+ bitbake('-c deploy_archives %s -f' % target)
+ assert_dumpdata_present(False)