From e6bce9dcbe294bf0ce061df3ad00526cfb753a58 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Thu, 19 Dec 2024 10:05:51 +0100 Subject: [PATCH] Make apt-get calls consistent - Don't install packages implicitely - Make quiet(er) - Use retries --- .azure-pipelines.yml | 4 ++-- .github/workflows/ci.yml | 10 +++++----- .github/workflows/old_ci.yml | 7 +++++-- ci/azure-pipelines/install.sh | 8 ++++---- ci/codecov.sh | 4 ++-- ci/drone/linux-cxx-install.sh | 12 +++++++++--- ci/setup_bdde.sh | 2 +- ci/setup_ccache.sh | 8 ++++---- 8 files changed, 32 insertions(+), 23 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 8a697c25..1f102df1 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -1,7 +1,7 @@ --- # Copyright 2015-2019 Rene Rivera. # Copyright 2019 Mateusz Loskot -# Copyright 2020-2021 Alexander Grund +# Copyright 2020-2024 Alexander Grund # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) @@ -127,7 +127,7 @@ stages: # Need (newer) git sudo add-apt-repository ppa:git-core/ppa sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y g++ python libpython-dev git + sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT -y -q --no-install-suggests --no-install-recommends install g++ python libpython-dev git displayName: 'Install required sw for containers' - task: Cache@2 condition: eq(variables.B2_USE_CCACHE, '1') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79b423d0..af10825c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ # Copyright 2020-2021 Peter Dimov # Copyright 2021 Andrey Semashev -# Copyright 2021 Alexander Grund +# Copyright 2021-2024 Alexander Grund # Copyright 2022 James E. King III # # Distributed under the Boost Software License, Version 1.0. @@ -128,7 +128,7 @@ jobs: fi if [ -n "${{matrix.container}}" ] && [ -f "/etc/debian_version" ]; then apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common curl + apt-get -o Acquire::Retries=$NET_RETRY_COUNT -y -q --no-install-suggests --no-install-recommends install sudo software-properties-common curl # Need (newer) git, and the older Ubuntu container may require requesting the key manually using port 80 curl -sSL --retry ${NET_RETRY_COUNT:-5} 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xE1DD270288B4E6030699E45FA1715D88E1DF1F24' | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/git-core_ubuntu_ppa.gpg for i in {1..${NET_RETRY_COUNT:-3}}; do sudo -E add-apt-repository -y ppa:git-core/ppa && break || sleep 10; done @@ -141,7 +141,7 @@ jobs: else pkgs+=" python libpython-dev" fi - apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs + apt-get -o Acquire::Retries=$NET_RETRY_COUNT -y -q --no-install-suggests --no-install-recommends install $pkgs fi # For jobs not compatible with ccache, use "ccache: no" in the matrix if [[ "${{ matrix.ccache }}" == "no" ]]; then @@ -200,7 +200,7 @@ jobs: else pkgs="${{matrix.install}}" fi - sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs + sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT -y -q --no-install-suggests --no-install-recommends install $pkgs - name: Setup GCC Toolchain if: matrix.gcc_toolchain @@ -208,7 +208,7 @@ jobs: GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" echo "GCC_TOOLCHAIN_ROOT=$GCC_TOOLCHAIN_ROOT" >> $GITHUB_ENV if ! command -v dpkg-architecture; then - apt-get install -y dpkg-dev + apt-get -o Acquire::Retries=$NET_RETRY_COUNT -y -q --no-install-suggests --no-install-recommends install dpkg-dev fi MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" mkdir -p "$GCC_TOOLCHAIN_ROOT" diff --git a/.github/workflows/old_ci.yml b/.github/workflows/old_ci.yml index 0651c8df..8ddeabeb 100644 --- a/.github/workflows/old_ci.yml +++ b/.github/workflows/old_ci.yml @@ -1,6 +1,6 @@ # Copyright 2020-2021 Peter Dimov # Copyright 2021 Andrey Semashev -# Copyright 2021 Alexander Grund +# Copyright 2021-2024 Alexander Grund # # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) @@ -19,6 +19,9 @@ concurrency: group: ${{format('compat-{0}:{1}', github.repository, github.ref)}} cancel-in-progress: true +env: + NET_RETRY_COUNT: 5 + jobs: posix: defaults: @@ -119,7 +122,7 @@ jobs: if: startsWith(matrix.os, 'ubuntu') run: | sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y ${{matrix.install}} + sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT -y -q --no-install-suggests --no-install-recommends install ${{matrix.install}} - name: Setup Boost run: source ci/github/install.sh diff --git a/ci/azure-pipelines/install.sh b/ci/azure-pipelines/install.sh index 324541d1..20d08b28 100755 --- a/ci/azure-pipelines/install.sh +++ b/ci/azure-pipelines/install.sh @@ -2,7 +2,7 @@ # # Copyright 2017 - 2019 James E. King III # Copyright 2019 Mateusz Loskot -# Copyright 2021 Alexander Grund +# Copyright 2021-2024 Alexander Grund # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) @@ -55,15 +55,15 @@ if [ "$AGENT_OS" != "Darwin" ]; then sudo -E apt-add-repository "deb http://apt.llvm.org/${LLVM_OS:-xenial}/ ${LLVM_REPO} main" && break || sleep 10 done fi - sudo apt-get ${NET_RETRY_COUNT:+ -o Acquire::Retries=$NET_RETRY_COUNT} update - sudo apt-get ${NET_RETRY_COUNT:+ -o Acquire::Retries=$NET_RETRY_COUNT} install -y ${PACKAGES} + sudo apt-get -o Acquire::Retries="${NET_RETRY_COUNT:-3}" update + sudo apt-get -o Acquire::Retries="${NET_RETRY_COUNT:-3}" -y -q --no-install-suggests --no-install-recommends install ${PACKAGES} fi if [[ -z "$GCC_TOOLCHAIN_ROOT" ]] && [[ -n "$GCC_TOOLCHAIN" ]]; then GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" echo "##vso[task.setvariable variable=GCC_TOOLCHAIN_ROOT]$GCC_TOOLCHAIN_ROOT" if ! command -v dpkg-architecture; then - apt-get install -y dpkg-dev + apt-get -o Acquire::Retries="${NET_RETRY_COUNT:-3}" -y -q --no-install-suggests --no-install-recommends install dpkg-dev fi MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" mkdir -p "$GCC_TOOLCHAIN_ROOT" diff --git a/ci/codecov.sh b/ci/codecov.sh index d5d7ecaa..792e9c6c 100755 --- a/ci/codecov.sh +++ b/ci/codecov.sh @@ -1,7 +1,7 @@ #!/bin/bash # # Copyright 2017 - 2022 James E. King III -# Copyright 2021 Alexander Grund +# Copyright 2021-2024 Alexander Grund # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) @@ -58,7 +58,7 @@ elif [[ "$coverage_action" == "collect" ]] || [[ "$coverage_action" == "upload" : "${LCOV_VERSION:=v1.15}" if [[ "$LCOV_VERSION" =~ ^v[2-9] ]]; then - sudo apt-get install -y libcapture-tiny-perl libdatetime-perl || true + sudo apt-get -o Acquire::Retries="${NET_RETRY_COUNT:-3}" -y -q --no-install-suggests --no-install-recommends install libcapture-tiny-perl libdatetime-perl || true LCOV_OPTIONS="${LCOV_OPTIONS} --ignore-errors unused" LCOV_OPTIONS=$(echo ${LCOV_OPTIONS} | xargs echo) fi diff --git a/ci/drone/linux-cxx-install.sh b/ci/drone/linux-cxx-install.sh index 025f8396..93b479e6 100755 --- a/ci/drone/linux-cxx-install.sh +++ b/ci/drone/linux-cxx-install.sh @@ -1,4 +1,10 @@ #!/bin/bash +# +# Copyright 2020-2022 Sam Darwin +# Copyright 2021-2024 Alexander Grund +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) set -e @@ -50,7 +56,7 @@ if [ -n "${LLVM_OS}" ]; then # Snapshot (i.e. trunk) build llvm_toolchain="llvm-toolchain-${LLVM_OS}" fi - add_repository "deb http://apt.llvm.org/${LLVM_OS}/ ${llvm_toolchain} main" + add_repository "deb https://apt.llvm.org/${LLVM_OS}/ ${llvm_toolchain} main" fi if [ -n "${SOURCES}" ]; then @@ -61,7 +67,7 @@ if [ -n "${SOURCES}" ]; then fi echo ">>>>> APT: UPDATE..." -sudo -E apt-get -o Acquire::Retries=3 update +sudo -E apt-get -o Acquire::Retries="${NET_RETRY_COUNT:-3}" update echo ">>>>> APT: INSTALL ${PACKAGES}..." -sudo -E DEBIAN_FRONTEND=noninteractive apt-get -o Acquire::Retries=3 -y --no-install-suggests --no-install-recommends install ${PACKAGES} +sudo -E DEBIAN_FRONTEND=noninteractive apt-get -o Acquire::Retries="${NET_RETRY_COUNT:-3}" -y -q --no-install-suggests --no-install-recommends install ${PACKAGES} diff --git a/ci/setup_bdde.sh b/ci/setup_bdde.sh index 7abf5751..937ba7c8 100755 --- a/ci/setup_bdde.sh +++ b/ci/setup_bdde.sh @@ -19,7 +19,7 @@ set -ex if [ -f "/etc/debian_version" ]; then - sudo apt-get install --no-install-recommends -y binfmt-support qemu-user-static + sudo apt-get -o Acquire::Retries="${NET_RETRY_COUNT:-3}" -y -q --no-install-suggests --no-install-recommends install binfmt-support qemu-user-static fi # this prepares the VM for multiarch docker diff --git a/ci/setup_ccache.sh b/ci/setup_ccache.sh index f9a97f05..b0dca7ac 100755 --- a/ci/setup_ccache.sh +++ b/ci/setup_ccache.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright 2021 Alexander Grund +# Copyright 2021-2024 Alexander Grund # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) @@ -11,7 +11,7 @@ set -ex if ! command -v ccache &> /dev/null; then if [ -f "/etc/debian_version" ]; then - sudo apt-get install ${NET_RETRY_COUNT:+ -o Acquire::Retries=$NET_RETRY_COUNT} -y ccache + sudo apt-get -o Acquire::Retries="${NET_RETRY_COUNT:-3}" -y -q --no-install-suggests --no-install-recommends install ccache elif command -v brew &> /dev/null; then brew update > /dev/null if ! brew install ccache; then @@ -24,7 +24,7 @@ if ! command -v ccache &> /dev/null; then fi fi fi -ccache --set-config=cache_dir=${B2_CCACHE_DIR:-~/.ccache} -ccache --set-config=max_size=${B2_CCACHE_SIZE:-500M} +ccache --set-config=cache_dir="${B2_CCACHE_DIR:-~/.ccache}" +ccache --set-config=max_size="${B2_CCACHE_SIZE:-500M}" ccache -z echo "CCache config: $(ccache -p)"