diff options
| -rw-r--r-- | .gitlab-ci.yml | 1 | ||||
| -rw-r--r-- | apt-private/private-cmndline.cc | 2 | ||||
| -rwxr-xr-x[-rw-r--r--] | debian/tests/pkg-config-test | 66 | ||||
| -rw-r--r-- | vendor/ubuntu/apt.conf-01-vendor-ubuntu | 7 |
4 files changed, 68 insertions, 8 deletions
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/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::vector<CommandLine::D _error->DumpErrors(); 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; } diff --git a/debian/tests/pkg-config-test b/debian/tests/pkg-config-test index e074b1603..a11ab4d78 100644..100755 --- 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 <<EOF -#include <apt-pkg/init.h> +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 <apt-pkg/%f>\n' > pkgconfigtest.cc +cat >>pkgconfigtest.cc <<EOF #include <cstdio> 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 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"; |
