Change the layout a bit

... to a more natural installation paths, and also include ct-ng into
$PATH in the containers.

Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
Alexey Neyman 2018-10-28 10:44:22 -07:00
parent dc01f61898
commit 9d43246664
10 changed files with 40 additions and 21 deletions

4
.gitignore vendored
View File

@ -32,7 +32,9 @@ temp.*
stamp-h1 stamp-h1
# Testing # Testing
testing/docker/build-* testing/docker/*/build
testing/docker/*/install
testing/docker/*/xtools
# This is the place where toolchains are built # This is the place where toolchains are built
.build/ .build/

View File

@ -7,5 +7,6 @@ RUN pacman -Syu --noconfirm
RUN pacman -S --noconfirm base-devel git help2man python unzip wget RUN pacman -S --noconfirm base-devel git help2man python unzip wget
RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64
RUN chmod a+x /sbin/dumb-init RUN chmod a+x /sbin/dumb-init
RUN echo 'export PATH=/opt/ctng/bin:$PATH' >> /etc/profile
RUN echo 'export MENUCONFIG_COLOR=mono' >> /etc/profile RUN echo 'export MENUCONFIG_COLOR=mono' >> /etc/profile
ENTRYPOINT [ "/sbin/dumb-init", "--" ] ENTRYPOINT [ "/sbin/dumb-init", "--" ]

View File

@ -7,4 +7,5 @@ RUN yum install -y autoconf gperf bison flex texinfo help2man gcc-c++ libtool li
ncurses-devel python-devel perl-Thread-Queue bzip2 git wget xz unzip ncurses-devel python-devel perl-Thread-Queue bzip2 git wget xz unzip
RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64
RUN chmod a+x /sbin/dumb-init RUN chmod a+x /sbin/dumb-init
RUN echo 'export PATH=/opt/ctng/bin:$PATH' >> /etc/profile
ENTRYPOINT [ "/sbin/dumb-init", "--" ] ENTRYPOINT [ "/sbin/dumb-init", "--" ]

View File

@ -7,4 +7,5 @@ RUN yum install -y autoconf gperf bison file flex texinfo help2man gcc-c++ libto
ncurses-devel python-devel perl-Thread-Queue bzip2 git wget which xz unzip ncurses-devel python-devel perl-Thread-Queue bzip2 git wget which xz unzip
RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64
RUN chmod a+x /sbin/dumb-init RUN chmod a+x /sbin/dumb-init
RUN echo 'export PATH=/opt/ctng/bin:$PATH' >> /etc/profile
ENTRYPOINT [ "/sbin/dumb-init", "--" ] ENTRYPOINT [ "/sbin/dumb-init", "--" ]

View File

@ -1,9 +1,5 @@
#!/bin/bash #!/bin/bash
set -e set -e
cd cd work
rm -rf work/bld-samples ct-ng build-all ${1+CT_SAMPLES="$*"}
mkdir -p work/bld-samples work/inst-xtools
cd work/bld-samples
export PATH=$HOME/work/inst-ctng/bin:$PATH
ct-ng build-all CT_PREFIX=$HOME/work/inst-xtools ${1+CT_SAMPLES="$*"}

View File

@ -1,10 +1,7 @@
#!/bin/bash #!/bin/bash
set -e set -e
cd cd work
rm -rf work/bld-ctng work/inst-ctng /crosstool-ng/configure --prefix=/opt/ctng
mkdir work/bld-ctng
cd work/bld-ctng
/crosstool-ng/configure --prefix=$HOME/work/inst-ctng
make make
make install make install

View File

@ -2,7 +2,6 @@
set -e set -e
cd cd
export PATH=$HOME/work/inst-ctng/bin:$PATH
ct-ng help ct-ng help
ct-ng list-samples ct-ng list-samples
ct-ng list-steps ct-ng list-steps

View File

@ -36,6 +36,17 @@ EOF
exit 1 exit 1
} }
do_cleanup()
{
local d
for d in "$@"; do
[ -d "$d" ] || continue
chmod -R a+w "$d"
rm -rf "$d"
done
}
# Build a docker container, store its ID. # Build a docker container, store its ID.
action_build() action_build()
{ {
@ -54,11 +65,13 @@ _dckr()
local scmd prefix local scmd prefix
shift shift
mkdir -p build-${cntr} mkdir -p ${cntr}/{build,install,xtools}
prefix="docker run --rm -i -t \ prefix="docker run --rm -i -t \
-v `pwd`/common-scripts:/common-scripts:ro \ -v `pwd`/common-scripts:/common-scripts:ro \
-v ${topdir}:/crosstool-ng:ro \ -v ${topdir}:/crosstool-ng:ro \
-v `pwd`/build-${cntr}:/home/ctng/work \ -v `pwd`/${cntr}/build:/home/ctng/work \
-v `pwd`/${cntr}/install:/opt/ctng \
-v `pwd`/${cntr}/xtools:/home/ctng/x-tools \
-v $HOME/src:/home/ctng/src:ro \ -v $HOME/src:/home/ctng/src:ro \
ctng-${cntr}" ctng-${cntr}"
if [ -n "${AS_ROOT}" ]; then if [ -n "${AS_ROOT}" ]; then
@ -77,6 +90,7 @@ action_install()
# The test assumes the top directory is bootstrapped, but clean. # The test assumes the top directory is bootstrapped, but clean.
msg "Setting up crosstool-NG in ${cntr}" msg "Setting up crosstool-NG in ${cntr}"
do_cleanup ${cntr}/build
_dckr "${cntr}" /common-scripts/ctng-install && \ _dckr "${cntr}" /common-scripts/ctng-install && \
_dckr "${cntr}" /common-scripts/ctng-test-basic _dckr "${cntr}" /common-scripts/ctng-test-basic
} }
@ -87,8 +101,8 @@ action_sample()
local cntr=$1 local cntr=$1
shift shift
# The test assumes the top directory is bootstrapped, but clean.
msg "Building samples in ${cntr} [$@]" msg "Building samples in ${cntr} [$@]"
do_cleanup ${cntr}/build
_dckr "${cntr}" /common-scripts/ctng-build-sample "$@" _dckr "${cntr}" /common-scripts/ctng-build-sample "$@"
} }
@ -117,10 +131,16 @@ action_clean()
local cntr=$1 local cntr=$1
msg "Cleaning up after ${cntr}" msg "Cleaning up after ${cntr}"
if [ -d build-${cntr} ]; then do_cleanup ${cntr}/build
chmod -R a+w build-${cntr} }
rm -rf build-${cntr}
fi # Clean up after test suite run
action_distclean()
{
local cntr=$1
msg "Dist cleaning ${cntr}"
do_cleanup ${cntr}/{build,install,xtools}
} }
all_containers=`ls */Dockerfile | sed 's,/Dockerfile,,'` all_containers=`ls */Dockerfile | sed 's,/Dockerfile,,'`
@ -132,7 +152,7 @@ if [ "${selected_containers}" = "all" ]; then
fi fi
case "${action}" in case "${action}" in
build|install|sample|enter|root|clean) build|install|sample|enter|root|clean|distclean)
for c in ${selected_containers}; do for c in ${selected_containers}; do
eval "action_${action} ${c} \"$@\"" eval "action_${action} ${c} \"$@\""
done done

View File

@ -5,4 +5,5 @@ RUN groupadd -g $CTNG_GID ctng
RUN useradd -d /home/ctng -m -g $CTNG_GID -u $CTNG_UID -s /bin/bash ctng RUN useradd -d /home/ctng -m -g $CTNG_GID -u $CTNG_UID -s /bin/bash ctng
RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64
RUN chmod a+x /sbin/dumb-init RUN chmod a+x /sbin/dumb-init
RUN echo 'export PATH=/opt/ctng/bin:$PATH' >> /etc/profile
ENTRYPOINT [ "/sbin/dumb-init", "--" ] ENTRYPOINT [ "/sbin/dumb-init", "--" ]

View File

@ -8,4 +8,5 @@ RUN apt-get install -y gcc gperf bison flex texinfo help2man make libncurses5-de
python-dev autoconf automake libtool libtool-bin gawk python-dev autoconf automake libtool libtool-bin gawk
RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64
RUN chmod a+x /sbin/dumb-init RUN chmod a+x /sbin/dumb-init
RUN echo 'export PATH=/opt/ctng/bin:$PATH' >> /etc/profile
ENTRYPOINT [ "/sbin/dumb-init", "--" ] ENTRYPOINT [ "/sbin/dumb-init", "--" ]