Skip to content

Commit

Permalink
Make apt-get calls consistent
Browse files Browse the repository at this point in the history
- Don't install packages implicitely
- Make quiet(er)
- Use retries
  • Loading branch information
Flamefire committed Dec 19, 2024
1 parent 58d2450 commit e6bce9d
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# Copyright 2015-2019 Rene Rivera.
# Copyright 2019 Mateusz Loskot <mateusz at loskot dot net>
# 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)

Expand Down Expand Up @@ -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')
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -200,15 +200,15 @@ 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
run: |
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"
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/old_ci.yml
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions ci/azure-pipelines/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Copyright 2017 - 2019 James E. King III
# Copyright 2019 Mateusz Loskot <mateusz at loskot dot net>
# 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)
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions ci/codecov.sh
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 deletions ci/drone/linux-cxx-install.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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}
2 changes: 1 addition & 1 deletion ci/setup_bdde.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions ci/setup_ccache.sh
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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
Expand All @@ -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)"

0 comments on commit e6bce9d

Please sign in to comment.