Skip to content

Commit

Permalink
Build fix for debian installs (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
grafnu authored Jan 12, 2022
1 parent ad44643 commit a8ecc2a
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 59 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
inst/
dist/
build/
.git/
14 changes: 8 additions & 6 deletions controller/bin/controller_go
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,22 @@ if [ -n "$CLEAN_MAC_PREFIX" ]; then
bin/rename_site_config $CLEAN_MAC_PREFIX
fi

echo Forch config
cat $FORCH_CONFIG

/usr/bin/gauge_go &
forch/bin/run_forch &

if [[ -z $DTS_IP || $DTS_IP == localhost ]]; then
echo Starting daq, output in daq/inst/cmdrun.log
sudo \
PYTHONPATH=$PYTHONPATH \
PATH=$DAQ_ROOT/mininet:$PATH \
FAUCET_EVENT_SOCK=$DAQ_EVENT_SOCK \
daq/cmd/start ../$DAQ_BASE $DAQ_OVERRIDE ../$DAQ_CONFIG -k $no_test > daq/inst/cmdrun.log 2>&1 &
sleep 2 # Handle race-condition with forch starting for grpc connection.
fi

echo Forch config
cat $FORCH_CONFIG

/usr/bin/gauge_go &
forch/bin/run_forch &


echo Blocking forever...
tail -f /dev/null
22 changes: 2 additions & 20 deletions controller/bin/install_faucet
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
#!/bin/bash -ex
#!/bin/bash -e

set -uo pipefail

APK="apt-get -qqy"
BUILDDEPS="gcc python3-dev musl-dev parallel"
PIP3="pip3 -q --no-cache-dir install --upgrade"
FROOT="/root/faucet"

dir=$(dirname "$0")

${APK} install git ${BUILDDEPS}
"${dir}/retry_cmd" "${PIP3} pip"
"${dir}/retry_cmd" "${PIP3} setuptools"
"${dir}/retry_cmd" "${PIP3} wheel"
"${dir}/retry_cmd" "${PIP3} -r ${FROOT}/requirements.txt"
${PIP3} ${FROOT}

for i in ${BUILDDEPS} ; do
${APK} remove "$i"
done
bin/install_target /root/faucet

# Smoke test
faucet -V
26 changes: 3 additions & 23 deletions controller/bin/install_forch
Original file line number Diff line number Diff line change
@@ -1,29 +1,9 @@
#!/bin/bash -e

set -uo pipefail
# The target install doesn't install the executable, so do that separately.
pip3 install yq

APK="apt-get -yqq"
BUILDDEPS="gcc g++ python3-dev musl-dev parallel"
TESTDEPS="bitstring pytest wheel virtualenv"
PIP3="pip3 --no-cache-dir install --upgrade"
FROOT="/root/forch"

dir=$(dirname "$0")

${APK} install git ${BUILDDEPS}
${PIP3} pip
${PIP3} setuptools
${PIP3} setuptools ${TESTDEPS}
${PIP3} -r ${FROOT}/etc/requirements.txt
git init ${FROOT}
${PIP3} ${FROOT}

cp ${FROOT}/controller/bin/gauge_go /usr/bin/

pip3 uninstall -y ${TESTDEPS} || exit 1
for i in ${BUILDDEPS} ; do
${APK} remove "$i" || exit 1
done
bin/install_target /root/forch

# Sanity check
forch -V
43 changes: 43 additions & 0 deletions controller/bin/install_target
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash -e

set -uo pipefail

if [[ -z $1 ]]; then
echo Usage: $0 [target]
false
fi

FROOT=$1
dir=$(dirname "$0")

if [[ -f ${FROOT}/requirements.txt ]]; then
REQUIREMENTS=${FROOT}/requirements.txt
else
REQUIREMENTS=${FROOT}/etc/requirements.txt
fi

APK="apt-get -qqy"
BUILDDEPS="gcc python3-dev musl-dev parallel"
${APK} install git ${BUILDDEPS}

PIP3_BASE="pip3 -q --no-cache-dir install --upgrade"
${dir}/retry_cmd "${PIP3_BASE} pip"

# Some OS versions (e.g. Debian) don't always have site-packages in the
# default search path, which is the default place where packages are installed.
# Rather, install target into the distribution path so it will be always available.
INST_DIR=`pip3 show pip | fgrep Location: | sed -e 's/Location: //'`
echo Installing $FROOT into $INST_DIR
PIP3="$PIP3_BASE -t $INST_DIR"

${dir}/retry_cmd "${PIP3} setuptools"
${dir}/retry_cmd "${PIP3} -r ${REQUIREMENTS}"

# Installing target to the alternate install directory doesn't handle the bin/
# files, so first do the normal install and then replace/move with the new target.
${PIP3_BASE} ${FROOT}
${PIP3} ${FROOT}

for i in ${BUILDDEPS} ; do
${APK} remove "$i"
done
6 changes: 1 addition & 5 deletions etc/Dockerfile.controller
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ RUN $AG update && $AG install ash iptables sudo openvswitch-switch openvswitch-c

RUN update-alternatives --install /usr/bin/python3 python /usr/bin/python3.8 2

COPY controller/bin bin/

COPY controller/bin/install_faucet bin/
COPY faucet/ faucet/
RUN bin/install_faucet && rm -rf faucet/.git

COPY controller/bin/install_forch bin/
COPY . forch/
RUN rm -rf forch/venv && bin/install_forch && rm -rf forch/.git

Expand All @@ -38,7 +37,4 @@ RUN daq/bin/setup_dev simple && rm -rf daq/.git

COPY controller/site_config /site

# Don't copy this earlier to optimize build.
COPY controller/bin bin/

CMD ["bin/controller_go"]
1 change: 1 addition & 0 deletions etc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
coverage
eventlet==0.25.1
grpcio
grpcio-testing
grpcio-tools
Expand Down
5 changes: 1 addition & 4 deletions radius_server/Dockerfile.freeradius
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ ENV TZ=America/Los_Angeles
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN apt-get update && \
apt-get install -y tzdata

RUN apt-get update && \
apt-get install -y freeradius iproute2 vim sudo tcpdump iputils-ping
apt-get install -y freeradius iproute2 vim sudo tcpdump iputils-ping tzdata

USER root

Expand Down

0 comments on commit a8ecc2a

Please sign in to comment.