Skip to contentSkip to conversation

buildtools: allow symlinks within a source directory

PATCH Applied Bruce Richardson 2 participants 2 messages Jan 23, 2017 – Jan 29, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 buildtools: allow symlinks within a source directory

When creating the symlinks for header files to the include folder, the relpath script dereferenced all symlinks. This made it impossible to have file A.h renamed to B.h and then symlinked back to its original name. This is useful to be able to do when refactoring or reworking a library. Change this so that we just use the dirname of the path from readlink, we can use the basename as it was originally, even if it was a symlink.

---
 buildtools/relpath.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
buildtools/relpath.sh +1 -1
index 4ff4671..139b781 100755
@@ -44,7 +44,7 @@ if [ $# -ne 2 ]; then
 fi
 
 # get the real absolute path, derefencing symlinks
-ABS1=$(readlink -f $1)
+ABS1="$(dirname $(readlink -f $1))/$(basename $1)"
 ABS2=$(readlink -f $2)
 
 # remove leading slash
Signature · 1 line
2.9.3
#1 lore raw

2017-01-23 12:11, Bruce Richardson:

Quoted 9 lines

When creating the symlinks for header files to the include folder, the relpath script dereferenced all symlinks. This made it impossible to have file A.h renamed to B.h and then symlinked back to its original name. This is useful to be able to do when refactoring or reworking a library. Change this so that we just use the dirname of the path from readlink, we can use the basename as it was originally, even if it was a symlink.

Applied, thanks