From aea3d9cf573a17400d4c1d399f410cb87ec58c6d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 30 Dec 2022 18:56:19 +0100 Subject: Include everything in our pkg-config autopkgtest GCC defaults to C++17 currently, but our library users could be on other (newer/older) standard still e.g. by explicit request, so to avoid accidentally breaking them the pkg-config-test is adapted to include all of our public headers as a smoke test for if you can build an application against our library in a certain C++ standard. The test script is also adapted to be runnable outside of autopkgtest like in our CI or manually. --- .gitlab-ci.yml | 1 + debian/tests/pkg-config-test | 66 +++++++++++++++++++++++++++++++++++++++----- 2 files changed, 60 insertions(+), 7 deletions(-) mode change 100644 => 100755 debian/tests/pkg-config-test diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4a6d56c0e..42d1b6a58 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -50,6 +50,7 @@ test as user: script: - apt-get install --no-install-recommends -qq libxml2-utils - ./prepare-release post-build --report-failure + - sudo -u travis unbuffer ./debian/tests/pkg-config-test - sudo -u travis CTEST_OUTPUT_ON_FAILURE=1 ninja -C build test - chmod -R o-w $PWD - sudo -u travis unbuffer ./test/integration/run-tests -q -j 4 diff --git a/debian/tests/pkg-config-test b/debian/tests/pkg-config-test old mode 100644 new mode 100755 index e074b1603..a11ab4d78 --- a/debian/tests/pkg-config-test +++ b/debian/tests/pkg-config-test @@ -1,6 +1,28 @@ #!/bin/sh set -e +BUILDDIR="$(readlink -f "$(dirname "$0")")/../../build" +if [ -z "$AUTOPKGTEST_TMP" ]; then + if [ -f "${BUILDDIR}/apt-pkg/apt-pkg.pc" ]; then + if [ -n "$PKG_CONFIG_PATH" ]; then + PKG_CONFIG_PATH="${BUILDDIR}/apt-pkg:${PKG_CONFIG_PATH}" + else + PKG_CONFIG_PATH="${BUILDDIR}/apt-pkg" + fi + export PKG_CONFIG_PATH + echo 'Using PKG_CONFIG_PATH:' "$PKG_CONFIG_PATH" + fi +fi + +INCDIR="$(pkg-config --variable=includedir apt-pkg)" +if [ -z "$AUTOPKGTEST_TMP" ]; then + if [ -d "${BUILDDIR}/include/apt-pkg" ]; then + INCDIR="${BUILDDIR}/include" + CPPFLAGS="${CPPFLAGS} -I${INCDIR}" + fi +fi +echo 'Using include dir:' "$INCDIR" + if [ -z "$AUTOPKGTEST_TMP" ]; then WORKDIR='' cleanup() { @@ -14,8 +36,11 @@ else cd "$AUTOPKGTEST_TMP" fi -cat >pkgconfigtest.cc < +find "${INCDIR}/apt-pkg" -name '*.h' -type f \ + ! -name 'debsrcrecords.h' \ + ! -name 'header-is-private.h' ! -name 'cachefilter-patterns.h' ! -name 'tagfile-keys.h' \ + -printf '#include \n' > pkgconfigtest.cc +cat >>pkgconfigtest.cc < int main() @@ -25,8 +50,35 @@ int main() } EOF -g++ -Wall -Wextra -o pkgconfigtest pkgconfigtest.cc `pkg-config --cflags --libs apt-pkg` -echo 'build: OK' -test -x pkgconfigtest -./pkgconfigtest -echo 'run: OK' +FAILURE_COUNT=0 +runwithstatus() { + echo -n "${1}: " + local OKAY="$2" + local FAIL="$3" + shift 3 + if "$@"; then + if [ -n "$OKAY" ]; then echo "$OKAY"; fi + else + FAILURE_COUNT=$(($FAILURE_COUNT + 1)) + if [ -n "$FAIL" ]; then echo "$FAIL"; fi + fi +} + +runcompilerwithstandard() { + local COMPILER="$1" + shift + if ! command -v "$COMPILER" >/dev/null; then + echo "SKIP testing with compiler $COMPILER as it is not available!" + return + fi + for CPPSTD in "$@"; do + runwithstatus "build $COMPILER ${CPPSTD:-default}" 'OK' '' "$COMPILER" -Wall -Wextra ${CPPFLAGS} ${CPPSTD} -o pkgconfigtest pkgconfigtest.cc `pkg-config --cflags --libs apt-pkg` + if [ -x pkgconfigtest ]; then + runwithstatus "run $COMPILER ${CPPSTD:-default}" '' 'FAILED' ./pkgconfigtest + rm pkgconfigtest + fi + done +} +runcompilerwithstandard 'g++' '-std=c++23' '-std=c++20' '-std=c++17' '' + +exit $FAILURE_COUNT -- cgit v1.2.3-70-g09d2 From fb57847947daa41291e87ce2a9e66e8dcca104b3 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 6 May 2025 18:40:09 +0200 Subject: Ubuntu: Enable 3.0 solver by default in apt CLI tools Update our vendor config to enable the 3.0 solver by default, using the legacy compat mode for apt-get, where it is allowed to remove manually installed packages. --- vendor/ubuntu/apt.conf-01-vendor-ubuntu | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vendor/ubuntu/apt.conf-01-vendor-ubuntu b/vendor/ubuntu/apt.conf-01-vendor-ubuntu index 30d25a717..64797799a 100644 --- a/vendor/ubuntu/apt.conf-01-vendor-ubuntu +++ b/vendor/ubuntu/apt.conf-01-vendor-ubuntu @@ -1,2 +1,9 @@ Acquire::Changelogs::AlwaysOnline "true"; Acquire::http::User-Agent-Non-Interactive "true"; + +// Enable the new solver by default for our commands +binary::apt::APT::Solver "3.0"; +binary::apt-get::APT::Solver "3.0"; +// Allow apt-get to remove manually installed packages for the +// first phase. +binary::apt-get::APT::Solver::RemoveManual "true"; -- cgit v1.2.3-70-g09d2 From 1eb729ef1c795f6b5944dd217994f8d8279672bc Mon Sep 17 00:00:00 2001 From: "Demi M. Obenour" Date: Mon, 28 Dec 2020 18:33:22 -0500 Subject: Fail on stdio errors If there is an error writing to cout, cerr, or clog, APT should return a non-zero exit code. This allows automated tools to reliably check for warnings. --- apt-private/private-cmndline.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc index 67a34a2c7..e16aa7280 100644 --- a/apt-private/private-cmndline.cc +++ b/apt-private/private-cmndline.cc @@ -622,7 +622,7 @@ unsigned short DispatchCommandLine(CommandLine &CmdL, std::vectorDumpErrors(); else _error->DumpErrors(GlobalError::NOTICE); - if (returned == false) + if (returned == false || std::cout.bad() || std::cerr.bad() || std::clog.bad()) return 100; return Errors == true ? 100 : 0; } -- cgit v1.2.3-70-g09d2