From patchwork Tue Jan 31 16:03:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas De Schampheleire X-Patchwork-Id: 722039 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vCWKQ0pNrz9sCG for ; Wed, 1 Feb 2017 03:04:10 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iFJJeG55"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id D36E78B78E; Tue, 31 Jan 2017 16:04:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id naBgvqvUpail; Tue, 31 Jan 2017 16:04:03 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id A250C8B678; Tue, 31 Jan 2017 16:04:03 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id A99DA1C072D for ; Tue, 31 Jan 2017 16:04:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id A51A68AD4A for ; Tue, 31 Jan 2017 16:04:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Fs7M2FjE5sbV for ; Tue, 31 Jan 2017 16:04:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by hemlock.osuosl.org (Postfix) with ESMTPS id CE3AA8AD44 for ; Tue, 31 Jan 2017 16:03:59 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id v77so23669941wmv.0 for ; Tue, 31 Jan 2017 08:03:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=goCEHg6lj9VuZKSfp6s6wkoxjye16JpEgQwi6MSdp/Y=; b=iFJJeG55LF/EA47vb9It7dGT99UssgTSD3E2jLGt5lXZ1H9fM11pYJt0nuUCXXPBbB IV6WYmJ/yxQdGOw/rxOFTDgwAwliXDP6qVWxSWBU3vnZjKqOfJA0+C16g0szUb2S7Sv9 sJ3J+sgIFINCbSTK/0CFvJ9iPq1s5rS5+QfAOvuSsQ9fYz0KmHtSKeEbC1Dcx8Htz1a5 dlN1jEk3EZyr7vzb0EHvHTzdBKRJypKTkb5eEpCu7MIiSix/1LtkN9MIYAPzZeWsyMKl WqZEjAKBazLt0HPuWrQaGwIyMINyMVb1ijhshh9Fz5ycWWqZxdQ1U3kFOxW5HrONTnLD q81Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=goCEHg6lj9VuZKSfp6s6wkoxjye16JpEgQwi6MSdp/Y=; b=cs4a4A/7li8vUYX5DV33T9in/FuqR0GZ+hjeSmFJJ8SSGM5F5cG0PrtbdSGlhbNjvY Zd6vqfiG+wTSDb99w4AQnkZtZTJmB776vyvVAaLhMhKVR9i2nntX4Dr/hpCcRf8NLyAM PEAnzW8UKWLWKhdYmzSRO50TiSJxUPRVk5EdxFbFg+vEXFi9Hty27+K9eZk72NHrI7eZ Zyn67kqvJpEO0U+F+C1KaOeJfGuWYwRR/+vqtI/Ui7qlPA5O2ASYKJfADixHafZ3IMpg rQZKTFsbIAokZWGEl15C+r7QfZTzRgDUMQVfl/JSUnW+PXupyMjcS8rERcIPU8i1pvxW KTpg== X-Gm-Message-State: AIkVDXLNYWc1QPMkQfldbSSXiaH+MzvJ9vpEZUfyIuzQEkSairAeuIB2HcEXThz2Slcm7w== X-Received: by 10.28.209.202 with SMTP id i193mr21254168wmg.20.1485878637955; Tue, 31 Jan 2017 08:03:57 -0800 (PST) Received: from argentina.be.alcatel-lucent.com ([195.207.101.112]) by smtp.gmail.com with ESMTPSA id w126sm28764704wmw.0.2017.01.31.08.03.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 31 Jan 2017 08:03:57 -0800 (PST) From: Thomas De Schampheleire To: buildroot@buildroot.org Date: Tue, 31 Jan 2017 17:03:39 +0100 Message-Id: <20170131160343.27144-3-patrickdepinguin@gmail.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170131160343.27144-1-patrickdepinguin@gmail.com> References: <20170131160343.27144-1-patrickdepinguin@gmail.com> Cc: Thomas Petazzoni , Thomas De Schampheleire Subject: [Buildroot] [PATCH 2/6] toolchain helpers: clarify rsync excludes in copy_toolchain_sysroot X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Thomas De Schampheleire The copy_toolchain_sysroot helper features a complex rsync loop that copies various directories from the extracted toolchain to the staging directory. The complexity mainly stems from the fact that we support multilib toolchain tarballs but only copy one of the multilib variants into staging. Increase understandability of this logic by explicitly restricting the rsync excludes to the iteration of the for loop they are relevant for. Additionally, update the function comment. Note: all attempts to reduce duplication between both rsync while keeping things nice and readable failed. One has to be extremely careful regarding line continuation, indentation, and single vs double quoting. In the end, a split up rsync seemed most clean. Signed-off-by: Thomas De Schampheleire --- toolchain/helpers.mk | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk index 72e7292..06dc197 100644 --- a/toolchain/helpers.mk +++ b/toolchain/helpers.mk @@ -39,11 +39,16 @@ copy_toolchain_lib_root = \ # dir. The operation of this function is rendered a little bit # complicated by the support for multilib toolchains. # -# We start by copying etc, lib, sbin and usr from the sysroot of the -# selected architecture variant (as pointed by ARCH_SYSROOT_DIR). This -# allows to import into the staging directory the C library and -# companion libraries for the correct architecture variant. We -# explictly only copy etc, lib, sbin and usr since other directories +# We start by copying etc, 'lib', sbin, usr and usr/'lib' from the +# sysroot of the selected architecture variant (as pointed to by +# ARCH_SYSROOT_DIR). This allows to import into the staging directory +# the C library and companion libraries for the correct architecture +# variant. 'lib' may not be literally 'lib' but could be something else, +# e.g. lib32-fp (as determined by ARCH_LIB_DIR) and we only want to copy +# that lib directory and no other. When copying usr, we therefore need +# to be extra careful not to include usr/lib* but we _do_ want to +# include usr/libexec. +# We are selective in the directories we copy since other directories # might exist for other architecture variants (on Codesourcery # toolchain, the sysroot for the default architecture variant contains # the armv4t and thumb2 subdirectories, which are the sysroot for the @@ -90,9 +95,14 @@ copy_toolchain_sysroot = \ SUPPORT_LIB_DIR="$(strip $5)" ; \ for i in etc $${ARCH_LIB_DIR} sbin usr usr/$${ARCH_LIB_DIR}; do \ if [ -d $${ARCH_SYSROOT_DIR}/$$i ] ; then \ - rsync -au --chmod=u=rwX,go=rX --exclude 'usr/lib/locale' \ - --include '/libexec*/' --exclude '/lib*/' \ - $${ARCH_SYSROOT_DIR}/$$i/ $(STAGING_DIR)/$$i/ ; \ + if [ "$$i" = "usr" ]; then \ + rsync -au --chmod=u=rwX,go=rX --exclude 'usr/lib/locale'\ + --include '/libexec*/' --exclude '/lib*/' \ + $${ARCH_SYSROOT_DIR}/$$i/ $(STAGING_DIR)/$$i/ ; \ + else \ + rsync -au --chmod=u=rwX,go=rX --exclude 'usr/lib/locale'\ + $${ARCH_SYSROOT_DIR}/$$i/ $(STAGING_DIR)/$$i/ ; \ + fi ; \ fi ; \ done ; \ if [ `readlink -f $${SYSROOT_DIR}` != `readlink -f $${ARCH_SYSROOT_DIR}` ] ; then \