diff mbox series

[3/8] GTM19-448: Fix script to work without realpath

Message ID PA4PR09MB4864148D80DAFFF5698F1A40846B2@PA4PR09MB4864.eurprd09.prod.outlook.com (mailing list archive)
State New, archived
Headers show
Series [1/8] Add CP0 MemoryMapID register implementation | expand

Commit Message

Aleksandar Rakic Sept. 27, 2024, 12:02 p.m. UTC
The archive-source.sh script depends on realpath command, which was
introduced in coreutils-8.15. CentOS-6 build systems use coreutils-4.7,
which does not have realpath, so fix the script to use 'readlink -e' to
perform the same action.

Cherry-picked 5d1d5766f0219ce2bec4e41c2467317df920ec0a
and 8003ab4032772a0e5b46e5983fe06268d3469289
from https://github.com/MIPS/gnutools-qemu

Signed-off-by: Faraz Shahbazker <fshahbazker@wavecomp.com>
Signed-off-by: Chao-ying Fu <cfu@mips.com>
Signed-off-by: Aleksandar Rakic <aleksandar.rakic@htecgroup.com>
---
 scripts/archive-source.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh
index 65af8063e4..7f16803772 100755
--- a/scripts/archive-source.sh
+++ b/scripts/archive-source.sh
@@ -18,7 +18,13 @@  if test $# -lt 1; then
     error "Usage: $0 <output tarball>"
 fi
 
-tar_file=$(realpath "$1")
+which realpath
+if [ $? -eq 0 ]; then
+    tar_file=$(realpath -s "$1")
+else
+    d=$(dirname "$1")
+    tar_file=$(readlink -e "$d")"/"$(basename "$1")
+fi
 sub_tdir=$(mktemp -d "${tar_file%.tar}.sub.XXXXXXXX")
 sub_file="${sub_tdir}/submodule.tar"