From 202e4808b963bbd0a87879b54359c5289174712e Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Thu, 24 Jun 2021 22:57:41 +0200 Subject: [PATCH] Upgrade to debian Buster and disable python builder script Upgrade to debian Buster slim (later to debian bullseye, crosstool-ng must be updated first, version 1.23 is not compatible with debian bullseye) Disable python script (build-and-install-python.sh), the version of python in the repositories is recent enough for crosstool-ng 1.24 and above. Changed from python to python3 for compatibility Adding the manual launch of a github workflow Signed-off-by: Bensuperpc --- .github/workflows/main.yml | 2 ++ Dockerfile.in | 2 +- Makefile | 2 +- common.crosstool | 15 +++++---- common.debian | 33 ++++--------------- common.docker | 2 +- imagefiles/Fix-error-with-bash-5-and-up.patch | 28 ++++++++++++++++ imagefiles/build-and-install-python.sh | 2 ++ imagefiles/install-crosstool-ng-toolchain.sh | 4 ++- 9 files changed, 53 insertions(+), 37 deletions(-) create mode 100644 imagefiles/Fix-error-with-bash-5-and-up.patch diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f5615fc..50d3ef4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,6 +7,8 @@ on: pull_request: branches: - '*' +# Adding the manual launch of a github workflow + workflow_dispatch: jobs: base: diff --git a/Dockerfile.in b/Dockerfile.in index 53ae7e8..c2ecad6 100644 --- a/Dockerfile.in +++ b/Dockerfile.in @@ -1,4 +1,4 @@ -FROM debian:stretch-20190326-slim +FROM debian:buster-slim MAINTAINER Matt McCormick "matt.mccormick@kitware.com" #include "common.debian" diff --git a/Makefile b/Makefile index f75e1bf..5b7cc02 100644 --- a/Makefile +++ b/Makefile @@ -330,7 +330,7 @@ clean: .SECONDEXPANSION: $(addsuffix .test,$(STANDARD_IMAGES)): $$(basename $$@) $(DOCKER) run $(RM) $(ORG)/$(basename $@) > $(BIN)/dockcross-$(basename $@) && chmod +x $(BIN)/dockcross-$(basename $@) - $(BIN)/dockcross-$(basename $@) python test/run.py $($@_ARGS) + $(BIN)/dockcross-$(basename $@) python3 test/run.py $($@_ARGS) # # testing prerequisites implicit rule diff --git a/common.crosstool b/common.crosstool index 3749166..4bf1854 100644 --- a/common.crosstool +++ b/common.crosstool @@ -16,12 +16,14 @@ # Install Debian packages required for `ct-ng`. RUN apt-get update --yes && apt-get install --no-install-recommends --yes \ - gawk \ - gperf \ - help2man \ - python-dev \ - texinfo \ -&& apt-get clean --yes + gawk \ + gperf \ + help2man \ + python3-dev \ + texinfo \ + && apt-get clean autoclean --yes \ + && apt-get autoremove --yes \ + && rm -rf /var/lib/{apt,dpkg,cache,log}/ ENV XCC_PREFIX=/usr/xcc @@ -33,6 +35,7 @@ ENV XCC_PREFIX=/usr/xcc COPY \ imagefiles/install-crosstool-ng-toolchain.sh \ imagefiles/crosstool-ng-expat.patch \ + imagefiles/Fix-error-with-bash-5-and-up.patch \ crosstool-ng.config \ /dockcross/ diff --git a/common.debian b/common.debian index beec2df..d1cddac 100644 --- a/common.debian +++ b/common.debian @@ -1,11 +1,6 @@ ARG DEBIAN_FRONTEND=noninteractive -ARG REPO=http://cdn-fastly.deb.debian.org RUN \ - bash -c "echo \"deb $REPO/debian stretch main contrib non-free\" > /etc/apt/sources.list" && \ - bash -c "echo \"deb $REPO/debian stretch-updates main contrib non-free\" >> /etc/apt/sources.list" && \ - bash -c "echo \"deb $REPO/debian-security stretch/updates main\" >> /etc/apt/sources.list" && \ - bash -c "echo \"deb http://ftp.debian.org/debian stretch-backports main\" >> /etc/apt/sources.list" && \ apt-get update --yes && \ apt-get install --no-install-recommends --yes \ autogen \ @@ -30,8 +25,8 @@ RUN \ ncurses-dev \ pkg-config \ pax \ -# python3 \ -# python3-pip \ + python3 \ + python3-pip \ rsync \ sed \ ssh \ @@ -41,23 +36,7 @@ RUN \ xz-utils \ zip \ zlib1g-dev \ -# python build - libncurses5-dev \ - libgdbm-dev \ - libnss3-dev \ - libssl-dev \ - libsqlite3-dev \ - libreadline-dev \ - libffi-dev \ - libbz2-dev\ - && \ - apt-get clean --yes - -# build and install python -COPY \ - imagefiles/build-and-install-python.sh \ - /buildscripts/ -RUN \ - set -x && \ - /buildscripts/build-and-install-python.sh && \ - rm -rf /buildscripts \ No newline at end of file +# python-is-python3 \ + && apt-get clean autoclean --yes \ + && apt-get autoremove --yes \ + && rm -rf /var/lib/{apt,dpkg,cache,log}/ diff --git a/common.docker b/common.docker index 9177445..62a36c6 100644 --- a/common.docker +++ b/common.docker @@ -25,7 +25,7 @@ RUN \ /buildscripts/build-and-install-git.sh && \ /buildscripts/install-cmake-binary.sh $X86_FLAG && \ /buildscripts/install-liquidprompt-binary.sh && \ - PYTHON=$([ -e /opt/python/cp38-cp38/bin/python ] && echo "/opt/python/cp38-cp38/bin/python" || echo "python") && \ + PYTHON=$([ -e /opt/python/cp38-cp38/bin/python ] && echo "/opt/python/cp38-cp38/bin/python" || echo "python3") && \ /buildscripts/install-python-packages.sh -python ${PYTHON} && \ /buildscripts/build-and-install-ninja.sh -python ${PYTHON} && \ rm -rf /buildscripts diff --git a/imagefiles/Fix-error-with-bash-5-and-up.patch b/imagefiles/Fix-error-with-bash-5-and-up.patch new file mode 100644 index 0000000..3847d9b --- /dev/null +++ b/imagefiles/Fix-error-with-bash-5-and-up.patch @@ -0,0 +1,28 @@ +From 67368ebe9d9259e9f34a4f9166a33357858813f1 Mon Sep 17 00:00:00 2001 +From: Bensuperpc +Date: Thu, 24 Jun 2021 11:55:48 +0200 +Subject: [PATCH 1/1] Fix error with bash 5 and up + +Fix error with bash 5 and up + +Signed-off-by: Bensuperpc +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index d10bf71d..e2302b4c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -274,7 +274,7 @@ ACX_PROG_VERSION_REQ_STRICT([BASH_SHELL], + [GNU bash >= 3.1], + [bash], + [bash], +- ['^GNU bash, version (3\.[1-9]|4)']) ++ ['^GNU bash, version (3\.[1-9]|4|5)']) + + # We need a awk that *is* GNU awk + ACX_PROG_VERSION_REQ_STRICT([AWK], +-- +2.32.0 + diff --git a/imagefiles/build-and-install-python.sh b/imagefiles/build-and-install-python.sh index b51871d..887ac5a 100755 --- a/imagefiles/build-and-install-python.sh +++ b/imagefiles/build-and-install-python.sh @@ -6,6 +6,8 @@ # Usage: # # build-and-install-python.sh [-version 3.9.5] +# needed packages : libncurses5-dev libgdbm-dev libnss3-dev +# libssl-dev libsqlite3-dev libreadline-dev libffi-dev libbz2-dev PYTHON_VERSION=3.9.5 while [ $# -gt 0 ]; do diff --git a/imagefiles/install-crosstool-ng-toolchain.sh b/imagefiles/install-crosstool-ng-toolchain.sh index 8c0fb7a..384b13b 100755 --- a/imagefiles/install-crosstool-ng-toolchain.sh +++ b/imagefiles/install-crosstool-ng-toolchain.sh @@ -77,6 +77,8 @@ git checkout ${REV} if [ ${REV} = "crosstool-ng-1.23.0" ]; then patch scripts/build/companion_libs/210-expat.sh -i /dockcross/crosstool-ng-expat.patch + # Patch to fix error with bash 5 and up: https://github.com/pfalcon/esp-open-sdk/issues/365 + patch configure.ac -i /dockcross/Fix-error-with-bash-5-and-up.patch fi # Bootstrap and install the tool. @@ -112,5 +114,5 @@ unset LD_LIBRARY_PATH # Build and install the toolchain! # Print last 250 lines if build fail -"${BOOTSTRAP_PREFIX}/bin/ct-ng" build || tail -250 build.log +"${BOOTSTRAP_PREFIX}/bin/ct-ng" build || (tail -250 build.log && exit 1)