THRIFT-5641: [build infra] install deps for swift in bionic and focal dockerfile (#2678)

* install deps for swift in bionic and focal dockerfile

* update add -yq for apt-get update

* remove cppcheck version fixes

* use bionic not focal for now

* Revert "use bionic not focal for now"

This reverts commit e3093477f0bf91122957616f1d9c768c675e03dc.
diff --git a/build/docker/ubuntu-bionic/Dockerfile b/build/docker/ubuntu-bionic/Dockerfile
index 679f509..c554c09 100644
--- a/build/docker/ubuntu-bionic/Dockerfile
+++ b/build/docker/ubuntu-bionic/Dockerfile
@@ -16,12 +16,12 @@
 #
 
 FROM buildpack-deps:bionic-scm
-MAINTAINER Apache Thrift <dev@thrift.apache.org>
+LABEL MAINTAINER='Apache Thrift <dev@thrift.apache.org>'
 ENV DEBIAN_FRONTEND noninteractive
 
 ### Add apt repos
 
-RUN apt-get update && \
+RUN apt-get update -yq && \
       apt-get dist-upgrade -y && \
       apt-get install -y --no-install-recommends --fix-missing \
       apt \
@@ -259,7 +259,12 @@
 ENV PATH /root/.cargo/bin:$PATH
 
 # Swift on Linux for cross tests
-RUN cd / && \
+RUN apt-get install -yq \
+      libedit-dev \
+      libz3-dev \
+      libpython-dev \
+      libxml2-dev && \
+      cd / && \
       wget --quiet https://swift.org/builds/swift-5.1.4-release/ubuntu1804/swift-5.1.4-RELEASE/swift-5.1.4-RELEASE-ubuntu18.04.tar.gz && \
       tar xf swift-5.1.4-RELEASE-ubuntu18.04.tar.gz --strip-components=1 && \
       rm swift-5.1.4-RELEASE-ubuntu18.04.tar.gz && \
@@ -273,15 +278,11 @@
       locale-gen de_DE.UTF-8 && \
       update-locale
 
-# cppcheck-1.82 has a nasty cpp parser bug, so we're using something newer
 RUN apt-get install -y --no-install-recommends \
       `# Static Code Analysis dependencies` \
       cppcheck \
       sloccount && \
-      pip install flake8 && \
-      wget -q "https://launchpad.net/ubuntu/+source/cppcheck/1.83-2/+build/14874703/+files/cppcheck_1.83-2_amd64.deb" && \
-      dpkg -i cppcheck_1.83-2_amd64.deb && \
-      rm cppcheck_1.83-2_amd64.deb
+      pip install flake8
 
 # NOTE: this does not reduce the image size but adds an additional layer.
 # # Clean up
diff --git a/build/docker/ubuntu-focal/Dockerfile b/build/docker/ubuntu-focal/Dockerfile
index a9a9ab9..b356245 100644
--- a/build/docker/ubuntu-focal/Dockerfile
+++ b/build/docker/ubuntu-focal/Dockerfile
@@ -21,7 +21,7 @@
 
 ### Add apt repos
 
-RUN apt-get update && \
+RUN apt-get update -yq && \
       apt-get dist-upgrade -y && \
       apt-get install -y --no-install-recommends --fix-missing \
       apt \
@@ -48,7 +48,8 @@
       echo "deb https://deb.nodesource.com/node_16.x focal main" | tee /etc/apt/sources.list.d/nodesource.list
 
 ### install general dependencies
-RUN apt-get update && apt-get install -y --no-install-recommends \
+RUN apt-get update -yq && \
+      apt-get install -y --no-install-recommends \
       `# General dependencies` \
       bash-completion \
       bison \
@@ -244,7 +245,12 @@
 ENV PATH /root/.cargo/bin:$PATH
 
 # Swift on Linux for cross tests
-RUN cd / && \
+RUN apt-get install -yq \
+      libedit-dev \
+      libz3-dev \
+      libpython2-dev \
+      libxml2-dev && \
+      cd / && \
       wget --quiet https://swift.org/builds/swift-5.3.3-release/ubuntu2004/swift-5.3.3-RELEASE/swift-5.3.3-RELEASE-ubuntu20.04.tar.gz && \
       tar xf swift-5.3.3-RELEASE-ubuntu20.04.tar.gz --strip-components=1 && \
       rm swift-5.3.3-RELEASE-ubuntu20.04.tar.gz && \
@@ -258,15 +264,11 @@
       locale-gen de_DE.UTF-8 && \
       update-locale
 
-# cppcheck-1.82 has a nasty cpp parser bug, so we're using something newer
 RUN apt-get install -y --no-install-recommends \
       `# Static Code Analysis dependencies` \
       cppcheck \
       sloccount && \
-      pip install flake8 && \
-      wget -q "https://launchpad.net/ubuntu/+source/cppcheck/1.83-2/+build/14874703/+files/cppcheck_1.83-2_amd64.deb" && \
-      dpkg -i cppcheck_1.83-2_amd64.deb && \
-      rm cppcheck_1.83-2_amd64.deb
+      pip install flake8
 
 # NOTE: this does not reduce the image size but adds an additional layer.
 # # Clean up