DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] scripts: fix relpath.sh output when build dir is a symlink
Date: Tue,  5 May 2015 11:00:09 +0200	[thread overview]
Message-ID: <1430816409-6773-1-git-send-email-olivier.matz@6wind.com> (raw)
In-Reply-To: <55476C37.8050702@netinsight.net>

The script relpath.sh return the relative path of the first directory
from the second directory. It is used to generate relative symlinks,
which can be useful if the build directory is embedded in the dpdk
directory: the whole dpdk can be moved without breaking the links,
which is helpful for an installation.

In case the build directory is a symlink, the script was not generating
the proper relative path. Fix this by calling "readlink -f" on the
arguments.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 scripts/relpath.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/relpath.sh b/scripts/relpath.sh
index 00030e5..7d2f48f 100755
--- a/scripts/relpath.sh
+++ b/scripts/relpath.sh
@@ -43,8 +43,13 @@ if [ $# -ne 2 ]; then
 	exit 1
 fi
 
-REL1=${1#/}
-REL2=${2#/}
+# get the real absolute path, derefencing symlinks
+ABS1=$(readlink -f $1)
+ABS2=$(readlink -f $2)
+
+# remove leading slash
+REL1=${ABS1#/}
+REL2=${ABS2#/}
 
 left1=${REL1%%/*}
 right1=${REL1#*/}
-- 
2.1.4

  reply	other threads:[~2015-05-05  9:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-04 12:42 [dpdk-dev] build issue with out-of-tree builds and multiple mounts Simon Kågström
2015-05-04 12:48 ` Olivier MATZ
2015-05-04 12:55   ` Simon Kågström
2015-05-05  9:00     ` Olivier Matz [this message]
2015-05-05  9:00       ` [dpdk-dev] [PATCH] scripts: fix relpath.sh output when build dir is a symlink Olivier MATZ
2015-05-05  9:14         ` Simon Kågström
2015-05-12 12:26           ` Thomas Monjalon

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=1430816409-6773-1-git-send-email-olivier.matz@6wind.com \
    --to=olivier.matz@6wind.com \
    --cc=dev@dpdk.org \
    /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;
as well as URLs for NNTP newsgroup(s).