From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7036005094436896768 X-Received: by 2002:a5d:6849:: with SMTP id o9mr33779979wrw.515.1638197600705; Mon, 29 Nov 2021 06:53:20 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a1c:80c3:: with SMTP id b186ls6698759wmd.2.gmail; Mon, 29 Nov 2021 06:53:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwAib/izE3vZBBgnjUaox2HouwYFyVofJRFAXiFehcW3Pd1vBtYnl33XjkTbquMC22C/RsB X-Received: by 2002:a05:600c:1993:: with SMTP id t19mr37886899wmq.21.1638197599745; Mon, 29 Nov 2021 06:53:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638197599; cv=none; d=google.com; s=arc-20160816; b=WxAxC3cVxZduLFoGCtnIwgsIYbxqnronamot+lIbzhonf00fBkAdj02V4yccMpJ1cA NO2lYua2aV915bXbcenED/LDvz3PIy0mNXYQFOQwnqDvQM8iiU1E3lubAJvgzumwsyAn gRTEVWGaquIeOEqJZDOBmaTJFV15xg4N1L2XqjVs7cXAS/auxGLFB8i7EptfIAdZU0m7 aQriMFL4OVWpAOcJC9Mu0K9HgSp2tolzSMISmQbnJN2/tiU1ZgPubJ92SvIjHcBaav+l 9odrVAMIcy2ogB69J+tygB7pbRYLt7Q3Y02viR2oON/i/M6EoGPf79DdV6raHJ/GntJt ySNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=fGBJLrc9blmrfd6GE3rmZiAHECFu1kDuFTyKPB3qjds=; b=DoFE6JagmEOf7LAgine9tuIFTcADd753Ga5S3S/KSKSF/Oc5zHn/RuZ1O9YZ2G2TOd A3aA9/J+boV0nBRJQ10T+JwCoKq4wyO9AMvi7obrx0+FnnBsaxDu0qb21HcpQboPO8MM i6BfnJjZYm7Ng3vtTmolkGyefp7nvRVhkEgQYzG3j6BSbkd0TkISLgihuLmr93o2PMlO ZzFDoYRw/GkQVmyOgooPc+OxxbkRC+5/efq03SoSRBhRo5VlSfMxdAjac8HT5gMxVJuZ gvkZH/lhcBh/ibUKvT0/BAzXFKRHRUMn+gRBBY8BTiYoY9STVjAgxZ7O4DDfEF16DkPf MIMQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of vijaikumar_kanagarajan@mentor.com designates 68.232.137.252 as permitted sender) smtp.mailfrom=Vijaikumar_Kanagarajan@mentor.com Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com. [68.232.137.252]) by gmr-mx.google.com with ESMTPS id 125si1841390wmc.1.2021.11.29.06.53.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Nov 2021 06:53:19 -0800 (PST) Received-SPF: pass (google.com: domain of vijaikumar_kanagarajan@mentor.com designates 68.232.137.252 as permitted sender) client-ip=68.232.137.252; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of vijaikumar_kanagarajan@mentor.com designates 68.232.137.252 as permitted sender) smtp.mailfrom=Vijaikumar_Kanagarajan@mentor.com IronPort-SDR: WhSy9RCPPTM1ioP/5TbAu/6BH1r0Yoib52e51dXWSpOuz5LVv1Efg+LWUTTECnCEjijRLbUNsx a17dxdk49DAjjY8GJg3qsM54vwfsDDJA4+BUP7FMmUYrc8L4oyjf0xEqc1h5GTWELowwi1fziW v8qOC5EgTNu+/YPq/JEn70jRYQ4zDM59SI4Dbn4GOfA0Y7IjnSQ8gGF7Hmr6gPJeHzJyHMO5TG ZnXn1bpq+0Yf38mj+7LLC8ohGGW7V4kp86UR2b1gpIuSa1IcuGTAtc/4OF7a9uQbN9nybrmXAS VNtdwx9WrWWA4qUMnsDFgFqv X-IronPort-AV: E=Sophos;i="5.87,273,1631606400"; d="scan'208";a="69034266" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 29 Nov 2021 06:53:18 -0800 IronPort-SDR: R5I7/meWaQK5XOctBcggrD/ZqEPnBKVw6toI6CsJE7uRAEFAvmasxPEFtHpNYuqaJNgmTqmqY7 m7UKNJqn4MZ2faZ6Buei8ZQErcr8kbrHdWXiNTIs4FNzpoUR2MvamQGPs8e5Rf/1xRo9nNLYaF eYhy6ArAuP3UTnudmVkElajt4rv+zYjuVk5y1kMglfr7Dhe1foUDoBTcFuvY+ZcJGo7YZdSFff c4VSTZBlS5niu0xOSs0980eEAirnjudKoYbRf+l7FU6m9lg8bhvwctdvqPo15+8J16jVky3MzA bY8= From: Vijai Kumar K To: , , CC: Vijai Kumar K Subject: [RFC PATCH 2/2] buildchroot: Add provision to specify apt preferences Date: Mon, 29 Nov 2021 20:22:41 +0530 Message-ID: <20211129145241.2932943-3-Vijaikumar_Kanagarajan@mentor.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211129145241.2932943-1-Vijaikumar_Kanagarajan@mentor.com> References: <20211129145241.2932943-1-Vijaikumar_Kanagarajan@mentor.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Return-Path: Vijaikumar_Kanagarajan@mentor.com X-ClientProxiedBy: svr-orw-mbx-14.mgc.mentorg.com (147.34.90.214) To svr-orw-mbx-01.mgc.mentorg.com (147.34.90.201) X-TUID: jEuEBALfIgeP Add provision to set apt preferences for buildchroot-host and target. Signed-off-by: Vijai Kumar K --- .../buildchroot/buildchroot.inc | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/meta/recipes-devtools/buildchroot/buildchroot.inc b/meta/recipes-devtools/buildchroot/buildchroot.inc index 726c7bb..fd06b80 100644 --- a/meta/recipes-devtools/buildchroot/buildchroot.inc +++ b/meta/recipes-devtools/buildchroot/buildchroot.inc @@ -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" -- 2.25.1