ttcn3: move prepare code to shared script

Move the git fetch/checkout code and make call to build the testsuite,
to debian-stretch-titan/ttcn3-docker-prepare.sh. In the next patch, I
will extend the script to update deps right before building too (e.g.
because OSMO_TTCN3_BRANCH changed).

Related: OS#5017
Change-Id: I4b5bedf058dc527e821f9b7204c632820e671af9
This commit is contained in:
Oliver Smith 2021-02-10 15:22:21 +01:00
parent 73d23109b1
commit 892d910444
19 changed files with 47 additions and 102 deletions

View File

@ -61,3 +61,5 @@ RUN if ! diff -q /tmp/deps-Makefile /osmo-ttcn3-hacks/deps/Makefile; then \
git pull && \
make deps; \
fi
ADD ttcn3-docker-prepare.sh /usr/local/bin/ttcn3-docker-prepare

View File

@ -0,0 +1,28 @@
#!/bin/sh -e
if [ $# -lt 2 ]; then
echo
echo "usage: ttcn3-docker-prepare OSMO_TTCN3_BRANCH PROJECT [PROJECT ...]"
echo "arguments:"
echo " OSMO_TTCN3_BRANCH: as passed from docker"
echo " PROJECT: make target from osmo-ttcn3-hacks.git, e.g. 'msc'"
echo
exit 1
fi
set -x
OSMO_TTCN3_BRANCH=$1
PROJECT=$2
cd /osmo-ttcn3-hacks
git fetch
git checkout "$OSMO_TTCN3_BRANCH"
if git symbolic-ref -q HEAD; then
git reset --hard origin/"$OSMO_TTCN3_BRANCH"
fi
git rev-parse --abbrev-ref HEAD
git rev-parse HEAD
make "$PROJECT"

View File

@ -3,12 +3,7 @@ FROM $USER/debian-stretch-titan
ARG OSMO_TTCN3_BRANCH="master"
ADD http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
RUN cd osmo-ttcn3-hacks && \
git fetch && \
git checkout $OSMO_TTCN3_BRANCH && \
(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
make bsc
RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" bsc
VOLUME /data

View File

@ -3,12 +3,7 @@ FROM $USER/debian-stretch-titan
ARG OSMO_TTCN3_BRANCH="master"
ADD http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
RUN cd osmo-ttcn3-hacks && \
git fetch && \
git checkout $OSMO_TTCN3_BRANCH && \
(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
make bsc-nat
RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" bsc-nat
VOLUME /data

View File

@ -3,12 +3,7 @@ FROM $USER/debian-stretch-titan
ARG OSMO_TTCN3_BRANCH="master"
ADD http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
RUN cd osmo-ttcn3-hacks && \
git fetch && \
git checkout $OSMO_TTCN3_BRANCH && \
(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
make deps-update bts
RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" bts
VOLUME /data

View File

@ -3,12 +3,7 @@ FROM $USER/debian-stretch-titan
ARG OSMO_TTCN3_BRANCH="master"
ADD http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
RUN cd osmo-ttcn3-hacks && \
git fetch && \
git checkout $OSMO_TTCN3_BRANCH && \
(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
make fr fr-net
RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" fr fr-net
VOLUME /data

View File

@ -3,12 +3,7 @@ FROM $USER/debian-stretch-titan
ARG OSMO_TTCN3_BRANCH="master"
ADD http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
RUN cd osmo-ttcn3-hacks && \
git fetch && \
git checkout $OSMO_TTCN3_BRANCH && \
(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
make gbproxy
RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" gbproxy
VOLUME /data

View File

@ -3,12 +3,7 @@ FROM $USER/debian-stretch-titan
ARG OSMO_TTCN3_BRANCH="master"
ADD http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
RUN cd osmo-ttcn3-hacks && \
git fetch && \
git checkout $OSMO_TTCN3_BRANCH && \
(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
make ggsn_tests
RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" ggsn_tests
VOLUME /data

View File

@ -3,12 +3,7 @@ FROM $USER/debian-stretch-titan
ARG OSMO_TTCN3_BRANCH="master"
ADD http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
RUN cd osmo-ttcn3-hacks && \
git fetch && \
git checkout $OSMO_TTCN3_BRANCH && \
(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
make deps-update hlr
RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" hlr
VOLUME /data

View File

@ -3,12 +3,7 @@ FROM $USER/debian-stretch-titan
ARG OSMO_TTCN3_BRANCH="master"
ADD http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
RUN cd osmo-ttcn3-hacks && \
git fetch && \
git checkout $OSMO_TTCN3_BRANCH && \
(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
make mgw
RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" mgw
VOLUME /data

View File

@ -3,12 +3,7 @@ FROM $USER/debian-stretch-titan
ARG OSMO_TTCN3_BRANCH="master"
ADD http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
RUN cd osmo-ttcn3-hacks && \
git fetch && \
git checkout $OSMO_TTCN3_BRANCH && \
(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
make msc
RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" msc
VOLUME /data

View File

@ -3,12 +3,7 @@ FROM $USER/debian-stretch-titan
ARG OSMO_TTCN3_BRANCH="master"
ADD http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
RUN cd osmo-ttcn3-hacks && \
git fetch && \
git checkout $OSMO_TTCN3_BRANCH && \
(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
make sysinfo
RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" sysinfo
VOLUME /data

View File

@ -3,12 +3,7 @@ FROM $USER/debian-stretch-titan
ARG OSMO_TTCN3_BRANCH="master"
ADD http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
RUN cd osmo-ttcn3-hacks && \
git fetch && \
git checkout $OSMO_TTCN3_BRANCH && \
(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
make pcu
RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" pcu
VOLUME /data

View File

@ -3,12 +3,7 @@ FROM $USER/debian-stretch-titan
ARG OSMO_TTCN3_BRANCH="master"
ADD http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
RUN cd osmo-ttcn3-hacks && \
git fetch && \
git checkout $OSMO_TTCN3_BRANCH && \
(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
make deps-update remsim
RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" remsim
VOLUME /data

View File

@ -3,12 +3,7 @@ FROM $USER/debian-stretch-titan
ARG OSMO_TTCN3_BRANCH="master"
ADD http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
RUN cd osmo-ttcn3-hacks && \
git fetch && \
git checkout $OSMO_TTCN3_BRANCH && \
(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
make sccp
RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" sccp
VOLUME /data

View File

@ -3,12 +3,7 @@ FROM $USER/debian-stretch-titan
ARG OSMO_TTCN3_BRANCH="master"
ADD http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
RUN cd osmo-ttcn3-hacks && \
git fetch && \
git checkout $OSMO_TTCN3_BRANCH && \
(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
make sgsn
RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" sgsn
VOLUME /data

View File

@ -3,12 +3,7 @@ FROM $USER/debian-stretch-titan
ARG OSMO_TTCN3_BRANCH="master"
ADD http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
RUN cd osmo-ttcn3-hacks && \
git fetch && \
git checkout $OSMO_TTCN3_BRANCH && \
(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
make sip
RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" sip
VOLUME /data

View File

@ -3,12 +3,7 @@ FROM $USER/debian-stretch-titan
ARG OSMO_TTCN3_BRANCH="master"
ADD http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
RUN cd osmo-ttcn3-hacks && \
git fetch && \
git checkout $OSMO_TTCN3_BRANCH && \
(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
make smlc
RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" smlc
VOLUME /data

View File

@ -3,12 +3,7 @@ FROM $USER/debian-stretch-titan
ARG OSMO_TTCN3_BRANCH="master"
ADD http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
RUN cd osmo-ttcn3-hacks && \
git fetch && \
git checkout $OSMO_TTCN3_BRANCH && \
(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
make stp
RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" stp
VOLUME /data