Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas De Schampheleire <patrickdepinguin@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCHv2 08/10] toolchain: copy_toolchain_lib_root: clarify logic
Date: Sat,  4 Feb 2017 14:42:12 +0100	[thread overview]
Message-ID: <20170204134214.20592-9-patrickdepinguin@gmail.com> (raw)
In-Reply-To: <20170204134214.20592-1-patrickdepinguin@gmail.com>

From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

copy_toolchain_lib_root has slightly different logic depending on the type
of library object: file or link. All actions related to links are not
relevant in case you are working with a file. Hence, try to increase clarity
by not executing unnecessary lines in the 'file' case.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
v2: new patch

 toolchain/helpers.mk | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index dab9cd3..3e4c581 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -17,19 +17,17 @@ copy_toolchain_lib_root = \
 		mkdir -p $(TARGET_DIR)/$${DESTDIR}; \
 		while true ; do \
 			LIBNAME=`basename $${LIBPATH}`; \
-			LINKTARGET=`readlink $${LIBPATH}` ; \
 			rm -fr $(TARGET_DIR)/$${DESTDIR}/$${LIBNAME}; \
 			if test -h $${LIBPATH} ; then \
+				LINKTARGET=`readlink $${LIBPATH}` ; \
 				ln -sf `basename $${LINKTARGET}` $(TARGET_DIR)/$${DESTDIR}/$${LIBNAME} ; \
+				LIBPATH="`readlink -f $${LIBPATH}`"; \
 			elif test -f $${LIBPATH}; then \
 				$(INSTALL) -D -m0755 $${LIBPATH} $(TARGET_DIR)/$${DESTDIR}/$${LIBNAME}; \
+				break ; \
 			else \
 				exit -1; \
 			fi; \
-			if test -z "$${LINKTARGET}" ; then \
-				break ; \
-			fi ; \
-			LIBPATH="`readlink -f $${LIBPATH}`"; \
 		done; \
 	done
 
-- 
2.10.2

  parent reply	other threads:[~2017-02-04 13:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-04 13:42 [Buildroot] [PATCHv2 00/10] toolchain: improvements to copy_toolchain_sysroot and copy_toolchain_lib_root Thomas De Schampheleire
2017-02-04 13:42 ` [Buildroot] [PATCHv2 01/10] toolchain-external: clarify rsync excludes in copy_toolchain_sysroot Thomas De Schampheleire
2017-02-07 10:26   ` Romain Naour
2017-02-07 11:39     ` Thomas De Schampheleire
2017-02-04 13:42 ` [Buildroot] [PATCHv2 02/10] toolchain-external: handle ld.so fixups centrally Thomas De Schampheleire
2017-02-07 11:04   ` Romain Naour
2017-02-04 13:42 ` [Buildroot] [PATCHv2 03/10] toolchain helpers: introduce function relpath_prefix Thomas De Schampheleire
2017-02-07 11:20   ` Romain Naour
2017-02-04 13:42 ` [Buildroot] [PATCHv2 04/10] toolchain-external: cover multilib toolchains with lib/<variant> layout Thomas De Schampheleire
2017-02-04 13:42 ` [Buildroot] [PATCHv2 05/10] toolchain helpers: introduce simplify_symlink Thomas De Schampheleire
2017-02-04 13:42 ` [Buildroot] [PATCHv2 06/10] toolchain-external: simplify previously-broken symbolic links Thomas De Schampheleire
2017-02-04 13:42 ` [Buildroot] [PATCHv2 07/10] toolchain: copy_toolchain_lib_root: remove unused variable LIBDIR Thomas De Schampheleire
2017-02-04 13:42 ` Thomas De Schampheleire [this message]
2017-02-04 13:42 ` [Buildroot] [PATCHv2 09/10] toolchain: copy_toolchain_lib_root: clarify input parameter Thomas De Schampheleire
2017-02-04 13:42 ` [Buildroot] [PATCHv2 10/10] toolchain: copy_toolchain_lib_root: copy symlinks instead of recreating them Thomas De Schampheleire

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170204134214.20592-9-patrickdepinguin@gmail.com \
    --to=patrickdepinguin@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox