[PATCH] osmo-ttcn3-hacks[master]: fix gen_links.sh: don't include source dir as link target

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Mar 15 23:11:46 UTC 2018


Review at  https://gerrit.osmocom.org/7311

fix gen_links.sh: don't include source dir as link target

First of all, use one common place to define the gen_links() macro, in
gen_links.sh.inc.

In this new file, add a 'shift' to exclude the $DIR arg from also appearing in
$FILES.

This prevents the following wrong symlinks in the source dirs:

  M3UA_CNL113537/src/src
  MTP3asp_CNL113337/src/src
  SCCP_CNL113341/src/src

Change-Id: Ia8493e77df1ba8723f2c5d2a49816247b0fb55f7
---
M bsc-nat/gen_links.sh
M bsc/gen_links.sh
M bts/gen_links.sh
A gen_links.sh.inc
M ggsn_tests/gen_links.sh
M hlr/gen_links.sh
M lapdm/gen_links.sh
M mgw/gen_links.sh
M msc/gen_links.sh
M pcu/gen_links.sh
M selftest/gen_links.sh
M sgsn/gen_links.sh
M sysinfo/gen_links.sh
13 files changed, 24 insertions(+), 96 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/11/7311/1

diff --git a/bsc-nat/gen_links.sh b/bsc-nat/gen_links.sh
index e9280e6..8aa47a9 100755
--- a/bsc-nat/gen_links.sh
+++ b/bsc-nat/gen_links.sh
@@ -2,14 +2,7 @@
 
 BASEDIR=../deps
 
-gen_links() {
-	DIR=$1
-	FILES=$*
-	for f in $FILES; do
-		echo "Linking $f"
-		ln -sf $DIR/$f $f
-	done
-}
+. ../gen_links.sh.inc
 
 #DIR=$BASEDIR/titan.TestPorts.UNIX_DOMAIN_SOCKETasp/src
 #FILES="UD_PT.cc  UD_PT.hh  UD_PortType.ttcn  UD_Types.ttcn"
diff --git a/bsc/gen_links.sh b/bsc/gen_links.sh
index a173aac..9145ff7 100755
--- a/bsc/gen_links.sh
+++ b/bsc/gen_links.sh
@@ -2,14 +2,7 @@
 
 BASEDIR=../deps
 
-gen_links() {
-	DIR=$1
-	FILES=$*
-	for f in $FILES; do
-		echo "Linking $f"
-		ln -sf $DIR/$f $f
-	done
-}
+. ../gen_links.sh.inc
 
 #DIR=$BASEDIR/titan.TestPorts.UNIX_DOMAIN_SOCKETasp/src
 #FILES="UD_PT.cc  UD_PT.hh  UD_PortType.ttcn  UD_Types.ttcn"
diff --git a/bts/gen_links.sh b/bts/gen_links.sh
index d9c05ff..b2b7e92 100755
--- a/bts/gen_links.sh
+++ b/bts/gen_links.sh
@@ -2,14 +2,7 @@
 
 BASEDIR=../deps
 
-gen_links() {
-	DIR=$1
-	FILES=$*
-	for f in $FILES; do
-		echo "Linking $f"
-		ln -sf $DIR/$f $f
-	done
-}
+. ../gen_links.sh.inc
 
 #DIR=$BASEDIR/titan.TestPorts.UNIX_DOMAIN_SOCKETasp/src
 #FILES="UD_PT.cc  UD_PT.hh  UD_PortType.ttcn  UD_Types.ttcn"
diff --git a/gen_links.sh.inc b/gen_links.sh.inc
new file mode 100644
index 0000000..2fcb9d1
--- /dev/null
+++ b/gen_links.sh.inc
@@ -0,0 +1,12 @@
+#!dont_run_this
+# This file is sourced by */gen_links.sh
+
+gen_links() {
+	DIR=$1
+	shift
+	FILES=$*
+	for f in $FILES; do
+		echo "Linking $f"
+		ln -sf $DIR/$f $f
+	done
+}
diff --git a/ggsn_tests/gen_links.sh b/ggsn_tests/gen_links.sh
index 071c6c8..25990d3 100755
--- a/ggsn_tests/gen_links.sh
+++ b/ggsn_tests/gen_links.sh
@@ -2,14 +2,7 @@
 
 BASEDIR=../deps
 
-gen_links() {
-	DIR=$1
-	FILES=$*
-	for f in $FILES; do
-		echo "Linking $f"
-		ln -sf $DIR/$f $f
-	done
-}
+. ../gen_links.sh.inc
 
 #DIR=$BASEDIR/titan.TestPorts.UNIX_DOMAIN_SOCKETasp/src
 #FILES="UD_PT.cc  UD_PT.hh  UD_PortType.ttcn  UD_Types.ttcn"
diff --git a/hlr/gen_links.sh b/hlr/gen_links.sh
index 7a6ebad..391ef73 100755
--- a/hlr/gen_links.sh
+++ b/hlr/gen_links.sh
@@ -2,14 +2,7 @@
 
 BASEDIR=../deps
 
-gen_links() {
-	DIR=$1
-	FILES=$*
-	for f in $FILES; do
-		echo "Linking $f"
-		ln -sf $DIR/$f $f
-	done
-}
+. ../gen_links.sh.inc
 
 DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src
 FILES="TCCInterface_Functions.ttcn TCCConversion_Functions.ttcn TCCConversion.cc
diff --git a/lapdm/gen_links.sh b/lapdm/gen_links.sh
index 5ecc45c..83c6699 100755
--- a/lapdm/gen_links.sh
+++ b/lapdm/gen_links.sh
@@ -2,14 +2,7 @@
 
 BASEDIR=../deps
 
-gen_links() {
-	DIR=$1
-	FILES=$*
-	for f in $FILES; do
-		echo "Linking $f"
-		ln -sf $DIR/$f $f
-	done
-}
+. ../gen_links.sh.inc
 
 DIR=$BASEDIR/titan.TestPorts.UNIX_DOMAIN_SOCKETasp/src
 FILES="UD_PT.cc  UD_PT.hh  UD_PortType.ttcn  UD_Types.ttcn"
diff --git a/mgw/gen_links.sh b/mgw/gen_links.sh
index 03b7db2..445be50 100755
--- a/mgw/gen_links.sh
+++ b/mgw/gen_links.sh
@@ -2,14 +2,7 @@
 
 BASEDIR=../deps
 
-gen_links() {
-	DIR=$1
-	FILES=$*
-	for f in $FILES; do
-		echo "Linking $f"
-		ln -sf $DIR/$f $f
-	done
-}
+. ../gen_links.sh.inc
 
 #DIR=$BASEDIR/titan.TestPorts.UNIX_DOMAIN_SOCKETasp/src
 #FILES="UD_PT.cc  UD_PT.hh  UD_PortType.ttcn  UD_Types.ttcn"
diff --git a/msc/gen_links.sh b/msc/gen_links.sh
index b2e2ff0..b9cbd0a 100755
--- a/msc/gen_links.sh
+++ b/msc/gen_links.sh
@@ -2,14 +2,7 @@
 
 BASEDIR=../deps
 
-gen_links() {
-	DIR=$1
-	FILES=$*
-	for f in $FILES; do
-		echo "Linking $f"
-		ln -sf $DIR/$f $f
-	done
-}
+. ../gen_links.sh.inc
 
 DIR=$BASEDIR/titan.TestPorts.UNIX_DOMAIN_SOCKETasp/src
 FILES="UD_PT.cc  UD_PT.hh  UD_PortType.ttcn  UD_Types.ttcn"
diff --git a/pcu/gen_links.sh b/pcu/gen_links.sh
index 54d2bdd..4852981 100755
--- a/pcu/gen_links.sh
+++ b/pcu/gen_links.sh
@@ -2,14 +2,7 @@
 
 BASEDIR=../deps
 
-gen_links() {
-	DIR=$1
-	FILES=$*
-	for f in $FILES; do
-		echo "Linking $f"
-		ln -sf $DIR/$f $f
-	done
-}
+. ../gen_links.sh.inc
 
 #DIR=$BASEDIR/titan.TestPorts.UNIX_DOMAIN_SOCKETasp/src
 #FILES="UD_PT.cc  UD_PT.hh  UD_PortType.ttcn  UD_Types.ttcn"
diff --git a/selftest/gen_links.sh b/selftest/gen_links.sh
index b0b2688..542e3c2 100755
--- a/selftest/gen_links.sh
+++ b/selftest/gen_links.sh
@@ -2,14 +2,7 @@
 
 BASEDIR=../deps
 
-gen_links() {
-	DIR=$1
-	FILES=$*
-	for f in $FILES; do
-		echo "Linking $f"
-		ln -sf $DIR/$f $f
-	done
-}
+. ../gen_links.sh.inc
 
 #DIR=$BASEDIR/titan.TestPorts.UNIX_DOMAIN_SOCKETasp/src
 #FILES="UD_PT.cc  UD_PT.hh  UD_PortType.ttcn  UD_Types.ttcn"
diff --git a/sgsn/gen_links.sh b/sgsn/gen_links.sh
index 1dedda2..c3c6add 100755
--- a/sgsn/gen_links.sh
+++ b/sgsn/gen_links.sh
@@ -2,14 +2,7 @@
 
 BASEDIR=../deps
 
-gen_links() {
-	DIR=$1
-	FILES=$*
-	for f in $FILES; do
-		echo "Linking $f"
-		ln -sf $DIR/$f $f
-	done
-}
+. ../gen_links.sh.inc
 
 #DIR=$BASEDIR/titan.TestPorts.UNIX_DOMAIN_SOCKETasp/src
 #FILES="UD_PT.cc  UD_PT.hh  UD_PortType.ttcn  UD_Types.ttcn"
diff --git a/sysinfo/gen_links.sh b/sysinfo/gen_links.sh
index ba07733..ad7891a 100755
--- a/sysinfo/gen_links.sh
+++ b/sysinfo/gen_links.sh
@@ -2,14 +2,7 @@
 
 BASEDIR=../deps
 
-gen_links() {
-	DIR=$1
-	FILES=$*
-	for f in $FILES; do
-		echo "Linking $f"
-		ln -sf $DIR/$f $f
-	done
-}
+. ../gen_links.sh.inc
 
 DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src
 FILES="TCCInterface_Functions.ttcn TCCConversion_Functions.ttcn TCCConversion.cc TCCInterface.cc TCCInterface_ip.h"

-- 
To view, visit https://gerrit.osmocom.org/7311
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia8493e77df1ba8723f2c5d2a49816247b0fb55f7
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list