@@ -50,6 +50,36 @@ rootfs_do_mounts_append() {
EOSUDO
}
+BUILDCHROOT_VARS_PREFIX ?= "${@'BUILDCHROOT_HOST_' if d.getVar('BOOTSTRAP_VARIANT') == 'HOST' else 'BUILDCHROOT_TARGET_'}"
+python() {
+ distro_apt_preferences = d.getVar(d.getVar("BUILDCHROOT_VARS_PREFIX") + "APT_PREFERENCES", True) or ""
+ for file in distro_apt_preferences.split():
+ d.appendVar("SRC_URI", " file://%s" % bb.parse.resolve_file(file, d))
+}
+
+APTPREFS = "${WORKDIR}/apt-preferences"
+
+do_buildchroot_prepare[vardeps] += " \
+ APTPREFS \
+ ${BUILDCHROOT_VARS_PREFIX}_APT_PREFERENCES \
+ "
+
+python do_buildchroot_prepare() {
+ apt_preferences_out = d.getVar("APTPREFS", True)
+ apt_preferences_list = (
+ d.getVar(d.getVar("BUILDCHROOT_VARS_PREFIX") + "APT_PREFERENCES", True) or ""
+ ).split()
+ aggregate_files(d, apt_preferences_list, apt_preferences_out)
+}
+addtask buildchroot_prepare before do_rootfs_install after do_unpack
+
+ROOTFS_CONFIGURE_COMMAND += "buildchroot_configure_preferences"
+buildchroot_configure_preferences() {
+ sudo install -v -m644 "${APTPREFS}" \
+ "${BUILDCHROOT_DIR}/etc/apt/preferences.d/buildchroot"
+}
+
+
ROOTFS_POSTPROCESS_COMMAND =+ "buildchroot_install_files"
buildchroot_install_files() {
sudo mkdir -p "${BUILDCHROOT_DIR}/home/builder"
Add provision to set apt preferences for buildchroot-host and target. Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com> --- .../buildchroot/buildchroot.inc | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+)