[PATCH] osmo-ttcn3-hacks[master]: gen_links.sh: auto-generate .gitignore files to ignore symlinks

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/7312

gen_links.sh: auto-generate .gitignore files to ignore symlinks

In each subdir that is a target for symlinks, automatically ignore the results
of gen_links():

- At the top of gen_links.sh.inc, clear the .gitignore.
- In the loop, add each link name to the local .gitignore.
- In selected gen_links.sh, there is also a "manual" link creationg. So that
  this also ends up in the local .gitignore, have the link creation as separate
  gen_link() macro which at the same time adds to ./.gitignore.
- in the root .gitignore, ignore all the subdirs' generated */.gitignore files.

Change-Id: I73c11fe8362358bf7e1bdf0e1be53399b5d3351b
---
M .gitignore
M bsc-nat/gen_links.sh
M bsc/gen_links.sh
M gen_links.sh.inc
M msc/gen_links.sh
M selftest/gen_links.sh
6 files changed, 16 insertions(+), 6 deletions(-)


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

diff --git a/.gitignore b/.gitignore
index d8c3ab3..cc06c3c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@
 *.log
 *.so
 compile
+*/.gitignore
diff --git a/bsc-nat/gen_links.sh b/bsc-nat/gen_links.sh
index 8aa47a9..946fbaf 100755
--- a/bsc-nat/gen_links.sh
+++ b/bsc-nat/gen_links.sh
@@ -28,7 +28,7 @@
 DIR=../SCCP_CNL113341/src
 FILES="SCCP_Emulation.ttcn  SCCP_EncDec.cc  SCCP_Mapping.ttcnpp  SCCP_Types.ttcn  SCCPasp_Types.ttcn"
 gen_links $DIR $FILES
-ln -sf SCCP_Mapping.ttcnpp SCCP_Mapping.ttcn
+gen_link SCCP_Mapping.ttcnpp SCCP_Mapping.ttcn
 
 DIR=$BASEDIR/titan.ProtocolModules.BSSMAP_v11.2.0/src
 FILES="BSSAP_Types.ttcn"
diff --git a/bsc/gen_links.sh b/bsc/gen_links.sh
index 9145ff7..50d7329 100755
--- a/bsc/gen_links.sh
+++ b/bsc/gen_links.sh
@@ -49,7 +49,7 @@
 DIR=../SCCP_CNL113341/src
 FILES="SCCP_Emulation.ttcn  SCCP_Mapping.ttcnpp  SCCP_Types.ttcn  SCCPasp_Types.ttcn"
 gen_links $DIR $FILES
-ln -sf SCCP_Mapping.ttcnpp SCCP_Mapping.ttcn
+gen_link SCCP_Mapping.ttcnpp SCCP_Mapping.ttcn
 
 DIR=$BASEDIR/titan.ProtocolModules.BSSMAP_v11.2.0/src
 FILES="BSSAP_Types.ttcn"
diff --git a/gen_links.sh.inc b/gen_links.sh.inc
index 2fcb9d1..aba8ca1 100644
--- a/gen_links.sh.inc
+++ b/gen_links.sh.inc
@@ -1,12 +1,21 @@
 #!dont_run_this
 # This file is sourced by */gen_links.sh
 
+rm -f .gitignore
+
+gen_link() {
+	src="$1"
+	f="$2"
+	echo "Linking $f"
+	ln -sf "$src" "$f"
+	echo "$f" >> .gitignore
+}
+
 gen_links() {
 	DIR=$1
 	shift
 	FILES=$*
 	for f in $FILES; do
-		echo "Linking $f"
-		ln -sf $DIR/$f $f
+		gen_link "$DIR/$f" "$f"
 	done
 }
diff --git a/msc/gen_links.sh b/msc/gen_links.sh
index b9cbd0a..fe09155 100755
--- a/msc/gen_links.sh
+++ b/msc/gen_links.sh
@@ -44,7 +44,7 @@
 DIR=../SCCP_CNL113341/src
 FILES="SCCP_Emulation.ttcn  SCCP_EncDec.cc  SCCP_Mapping.ttcnpp  SCCP_Types.ttcn  SCCPasp_Types.ttcn"
 gen_links $DIR $FILES
-ln -s SCCP_Mapping.ttcnpp SCCP_Mapping.ttcn
+gen_link SCCP_Mapping.ttcnpp SCCP_Mapping.ttcn
 
 DIR=$BASEDIR/titan.ProtocolModules.BSSMAP_v11.2.0/src
 FILES="BSSAP_Types.ttcn"
diff --git a/selftest/gen_links.sh b/selftest/gen_links.sh
index 542e3c2..2a98aaf 100755
--- a/selftest/gen_links.sh
+++ b/selftest/gen_links.sh
@@ -29,7 +29,7 @@
 DIR=../SCCP_CNL113341/src
 FILES="SCCP_Emulation.ttcn  SCCP_Mapping.ttcnpp  SCCP_Types.ttcn  SCCPasp_Types.ttcn"
 gen_links $DIR $FILES
-ln -sf SCCP_Mapping.ttcnpp SCCP_Mapping.ttcn
+gen_link SCCP_Mapping.ttcnpp SCCP_Mapping.ttcn
 
 DIR=$BASEDIR/titan.ProtocolModules.BSSMAP_v11.2.0/src
 FILES="BSSAP_Types.ttcn"

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I73c11fe8362358bf7e1bdf0e1be53399b5d3351b
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