summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2022-05-11 09:21:23 +0000
committerJulian Andres Klode <jak@debian.org>2022-05-11 09:21:23 +0000
commitbed5d00b5c6f70ae80d180ef162316e3bafb0ad0 (patch)
tree85585f36ef08b56f0ed87bf6342a0c7c24d3a82d
parent4fe52f98c7d12bc8fb07411b1c0594a032eadb3a (diff)
parent018cf7c225837b65e2b146788f786685629a5b12 (diff)
Merge branch 'ci/nomorelessdocs' into 'main'
Support building with no/less docs and use it more in CI See merge request apt-team/apt!238
-rw-r--r--.gitlab-ci.yml32
-rw-r--r--CMakeLists.txt11
-rw-r--r--apt-pkg/contrib/fileutl.h3
-rw-r--r--apt-pkg/contrib/proxy.cc2
-rw-r--r--apt-pkg/metaindex.cc2
-rw-r--r--apt-pkg/statechanges.cc2
-rw-r--r--apt-private/private-cmndline.cc1
-rw-r--r--apt-private/private-json-hooks.cc2
-rw-r--r--debian/apt-utils.examples1
-rw-r--r--debian/apt-utils.install7
-rw-r--r--debian/apt-utils.manpages6
-rw-r--r--debian/apt.docs1
-rw-r--r--debian/apt.examples1
-rw-r--r--debian/apt.install27
-rw-r--r--debian/apt.manpages26
-rw-r--r--debian/control13
-rwxr-xr-xdebian/rules17
-rw-r--r--debian/tests/control13
-rw-r--r--debian/tests/pkg-config-test31
-rw-r--r--debian/tests/run-tests29
-rw-r--r--doc/CMakeLists.txt13
-rw-r--r--ftparchive/sources.cc2
-rw-r--r--po/CMakeLists.txt4
-rwxr-xr-xprepare-release69
-rwxr-xr-xtest/integration/create-test-data2
-rw-r--r--test/integration/framework51
-rwxr-xr-xtest/integration/run-tests4
-rwxr-xr-xtest/integration/test-apt-helper-cat-file2
-rwxr-xr-xtest/integration/test-no-fds-leaked-to-maintainer-scripts6
-rw-r--r--test/interactive-helper/CMakeLists.txt27
-rw-r--r--test/interactive-helper/createdeb-cve-2020-27350.cc2
-rw-r--r--test/interactive-helper/test_fileutl.cc2
-rw-r--r--test/libapt/extracttar_test.cc2
-rw-r--r--test/libapt/file-helpers.cc2
-rw-r--r--test/libapt/gtest_runner.cc4
-rw-r--r--vendor/CMakeLists.txt2
36 files changed, 249 insertions, 172 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 93a577ad2..487437847 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,22 +3,29 @@ variables:
DEBIAN_FRONTEND: noninteractive
CCACHE_DIR: $CI_PROJECT_DIR/.ccache
CCACHE_BASEDIR: $CI_PROJECT_DIR
+ APT_CMAKE_BUILD_OPTIONS: ''
+ DEB_BUILD_PROFILES: ''
cache:
paths:
- .ccache
-
-test as root:
- stage: test
- script:
+before_script:
- adduser --home /home/travis travis --quiet --disabled-login --gecos "" --uid 1000
- rm -f /etc/dpkg/dpkg.cfg.d/excludes
- apt-get update
- - apt-get install -qq build-essential expect sudo ccache
+ - apt-get install --no-install-recommends -qq build-essential expect sudo ccache moreutils
+ - chmod 755 /root
- chmod -R o+rwX $PWD
- ./prepare-release travis-ci
- sudo -u travis mkdir -p build .ccache
- - sudo -u travis env -C build cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -G Ninja ..
+ - sudo -u travis env -C build cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ${APT_CMAKE_BUILD_OPTIONS} -G Ninja ..
- sudo -u travis --preserve-env=CCACHE_DIR,CCACHE_BASEDIR ninja -C build
+
+test as root:
+ stage: test
+ variables:
+ APT_CMAKE_BUILD_OPTIONS: '-DWITH_DOC=OFF -DUSE_NLS=OFF'
+ DEB_BUILD_PROFILES: 'nodoc'
+ script:
- CTEST_OUTPUT_ON_FAILURE=1 ninja -C build test
- unbuffer ./test/integration/run-tests -q -j 4
@@ -26,15 +33,8 @@ test as user:
image: i386/debian:unstable
stage: test
script:
- - adduser --home /home/travis travis --quiet --disabled-login --gecos "" --uid 1000
- - rm -f /etc/dpkg/dpkg.cfg.d/excludes
- - apt-get update
- - apt-get install -qq build-essential expect sudo ccache
- - chmod 755 /root
- - chmod -R o+rwX $PWD
- - ./prepare-release travis-ci
- - sudo -u travis mkdir -p build .ccache
- - sudo -u travis env -C build cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -G Ninja ..
- - sudo -u travis --preserve-env=CCACHE_DIR,CCACHE_BASEDIR ninja -C build
+ - apt-get install --no-install-recommends -qq libxml2-utils
+ - ./prepare-release post-build --report-failure
- 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/CMakeLists.txt b/CMakeLists.txt
index 86e5060d1..7f3a6a7c2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,7 +10,12 @@ include_directories(${PROJECT_BINARY_DIR}/include)
enable_testing()
-option(WITH_DOC "Build documentation." ON)
+option(WITH_DOC "Build all documentation." ON)
+include(CMakeDependentOption)
+cmake_dependent_option(WITH_DOC_MANPAGES "Force building manpages." OFF "NOT WITH_DOC" OFF)
+cmake_dependent_option(WITH_DOC_GUIDES "Force building guides." OFF "NOT WITH_DOC" OFF)
+cmake_dependent_option(WITH_DOC_DOXYGEN "Force building doxygen documentation." OFF "NOT WITH_DOC" OFF)
+cmake_dependent_option(WITH_DOC_EXAMPLES "Force building example configurations." OFF "NOT WITH_DOC" OFF)
option(WITH_TESTS "Build tests" ON)
option(USE_NLS "Localisation support." ON)
@@ -235,8 +240,10 @@ configure_file(CMake/apti18n.h.in ${PROJECT_BINARY_DIR}/include/apti18n.h)
# Add our subdirectories
add_subdirectory(vendor)
+if (NOT USE_SYSTEM_APTPKG)
add_subdirectory(apt-pkg)
add_subdirectory(apt-private)
+endif()
add_subdirectory(cmdline)
add_subdirectory(completions)
add_subdirectory(doc)
@@ -247,7 +254,9 @@ add_subdirectory(test)
if (USE_NLS)
add_subdirectory(po)
+endif()
+if(TARGET update-po AND TARGET update-po4a)
# Link update-po4a into the update-po target
add_dependencies(update-po update-po4a)
endif()
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index dd16aa754..f4eefd7c2 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/apt-pkg/contrib/fileutl.h
@@ -28,9 +28,6 @@
#include <vector>
#include <time.h>
-#include <zlib.h>
-
-
/* Define this for python-apt */
#define APT_HAS_GZIP 1
diff --git a/apt-pkg/contrib/proxy.cc b/apt-pkg/contrib/proxy.cc
index 6dc3b0686..a99f44f49 100644
--- a/apt-pkg/contrib/proxy.cc
+++ b/apt-pkg/contrib/proxy.cc
@@ -7,6 +7,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/configuration.h>
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
diff --git a/apt-pkg/metaindex.cc b/apt-pkg/metaindex.cc
index fc03f3db0..97996b3f1 100644
--- a/apt-pkg/metaindex.cc
+++ b/apt-pkg/metaindex.cc
@@ -1,4 +1,6 @@
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/indexfile.h>
#include <apt-pkg/metaindex.h>
#include <apt-pkg/pkgcachegen.h>
diff --git a/apt-pkg/statechanges.cc b/apt-pkg/statechanges.cc
index 45468e462..bbcde71d3 100644
--- a/apt-pkg/statechanges.cc
+++ b/apt-pkg/statechanges.cc
@@ -1,3 +1,5 @@
+#include <config.h>
+
#include <apt-pkg/cacheset.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/debsystem.h>
diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc
index e9af3a8c2..f607c4ccc 100644
--- a/apt-private/private-cmndline.cc
+++ b/apt-private/private-cmndline.cc
@@ -15,6 +15,7 @@
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include <algorithm>
#include <iomanip>
diff --git a/apt-private/private-json-hooks.cc b/apt-private/private-json-hooks.cc
index 957140525..ddf1c89d6 100644
--- a/apt-private/private-json-hooks.cc
+++ b/apt-private/private-json-hooks.cc
@@ -5,6 +5,7 @@
*
* SPDX-License-Identifier: GPL-2.0+
*/
+#include <config.h>
#include <apt-pkg/debsystem.h>
#include <apt-pkg/fileutl.h>
@@ -22,6 +23,7 @@
#include <signal.h>
#include <sys/socket.h>
#include <sys/types.h>
+#include <unistd.h>
/**
* @brief Simple JSON writer
diff --git a/debian/apt-utils.examples b/debian/apt-utils.examples
new file mode 100644
index 000000000..b66de3cdd
--- /dev/null
+++ b/debian/apt-utils.examples
@@ -0,0 +1 @@
+usr/share/doc/apt-utils/examples/*
diff --git a/debian/apt-utils.install b/debian/apt-utils.install
index a27f1e1e4..9b304e535 100644
--- a/debian/apt-utils.install
+++ b/debian/apt-utils.install
@@ -3,11 +3,4 @@ usr/bin/apt-ftparchive
usr/bin/apt-sortpkgs
usr/lib/apt/planners/
usr/lib/apt/solvers/
-usr/share/doc/apt-utils
usr/share/locale/*/*/apt-utils.mo
-usr/share/man/*/*/apt-extracttemplates.*
-usr/share/man/*/*/apt-ftparchive.*
-usr/share/man/*/*/apt-sortpkgs.*
-usr/share/man/*/apt-extracttemplates.*
-usr/share/man/*/apt-ftparchive.*
-usr/share/man/*/apt-sortpkgs.*
diff --git a/debian/apt-utils.manpages b/debian/apt-utils.manpages
new file mode 100644
index 000000000..c61b908ea
--- /dev/null
+++ b/debian/apt-utils.manpages
@@ -0,0 +1,6 @@
+usr/share/man/*/*/apt-extracttemplates.*
+usr/share/man/*/*/apt-ftparchive.*
+usr/share/man/*/*/apt-sortpkgs.*
+usr/share/man/*/apt-extracttemplates.*
+usr/share/man/*/apt-ftparchive.*
+usr/share/man/*/apt-sortpkgs.*
diff --git a/debian/apt.docs b/debian/apt.docs
new file mode 100644
index 000000000..b43bf86b5
--- /dev/null
+++ b/debian/apt.docs
@@ -0,0 +1 @@
+README.md
diff --git a/debian/apt.examples b/debian/apt.examples
new file mode 100644
index 000000000..3e15bddda
--- /dev/null
+++ b/debian/apt.examples
@@ -0,0 +1 @@
+usr/share/doc/apt/examples/*
diff --git a/debian/apt.install b/debian/apt.install
index 3658bf5e6..e3a911a9f 100644
--- a/debian/apt.install
+++ b/debian/apt.install
@@ -16,32 +16,5 @@ usr/lib/apt/planners/dump
usr/lib/apt/solvers/dump
usr/lib/dpkg/methods/apt/
usr/share/bash-completion/completions/
-usr/share/doc/apt
usr/share/locale/*/*/apt.mo
-usr/share/man/*/*/apt-cache.*
-usr/share/man/*/*/apt-cdrom.*
-usr/share/man/*/*/apt-config.*
-usr/share/man/*/*/apt-get.*
-usr/share/man/*/*/apt-key.*
-usr/share/man/*/*/apt-mark.*
-usr/share/man/*/*/apt-secure.*
-usr/share/man/*/*/apt-patterns.*
-usr/share/man/*/*/apt.*
-usr/share/man/*/*/apt_preferences.*
-usr/share/man/*/*/apt_auth.*
-usr/share/man/*/*/apt-transport-*.*
-usr/share/man/*/*/sources.list.*
-usr/share/man/*/apt-cache.*
-usr/share/man/*/apt-cdrom.*
-usr/share/man/*/apt-config.*
-usr/share/man/*/apt-get.*
-usr/share/man/*/apt-key.*
-usr/share/man/*/apt-mark.*
-usr/share/man/*/apt-secure.*
-usr/share/man/*/apt-patterns.*
-usr/share/man/*/apt.*
-usr/share/man/*/apt_preferences.*
-usr/share/man/*/apt_auth.*
-usr/share/man/*/apt-transport-*.*
-usr/share/man/*/sources.list.*
var/
diff --git a/debian/apt.manpages b/debian/apt.manpages
new file mode 100644
index 000000000..80dbabd44
--- /dev/null
+++ b/debian/apt.manpages
@@ -0,0 +1,26 @@
+usr/share/man/*/*/apt-cache.*
+usr/share/man/*/*/apt-cdrom.*
+usr/share/man/*/*/apt-config.*
+usr/share/man/*/*/apt-get.*
+usr/share/man/*/*/apt-key.*
+usr/share/man/*/*/apt-mark.*
+usr/share/man/*/*/apt-secure.*
+usr/share/man/*/*/apt-patterns.*
+usr/share/man/*/*/apt.*
+usr/share/man/*/*/apt_preferences.*
+usr/share/man/*/*/apt_auth.*
+usr/share/man/*/*/apt-transport-*.*
+usr/share/man/*/*/sources.list.*
+usr/share/man/*/apt-cache.*
+usr/share/man/*/apt-cdrom.*
+usr/share/man/*/apt-config.*
+usr/share/man/*/apt-get.*
+usr/share/man/*/apt-key.*
+usr/share/man/*/apt-mark.*
+usr/share/man/*/apt-secure.*
+usr/share/man/*/apt-patterns.*
+usr/share/man/*/apt.*
+usr/share/man/*/apt_preferences.*
+usr/share/man/*/apt_auth.*
+usr/share/man/*/apt-transport-*.*
+usr/share/man/*/sources.list.*
diff --git a/debian/control b/debian/control
index 2f1d0515e..58c6be15e 100644
--- a/debian/control
+++ b/debian/control
@@ -9,8 +9,8 @@ Rules-Requires-Root: no
Standards-Version: 4.1.1
Build-Depends: cmake (>= 3.4),
debhelper-compat (= 12),
- docbook-xml,
- docbook-xsl,
+ docbook-xml <!nodoc>,
+ docbook-xsl <!nodoc>,
dpkg-dev (>= 1.20.8),
gettext (>= 0.12),
googletest <!nocheck> | libgtest-dev <!nocheck>,
@@ -27,11 +27,11 @@ Build-Depends: cmake (>= 3.4),
libzstd-dev (>= 1.0),
ninja-build,
pkg-config,
- po4a (>= 0.34-2),
+ po4a (>= 0.34-2) <!nodoc>,
triehash,
- xsltproc,
+ xsltproc <!nodoc>,
zlib1g-dev
-Build-Depends-Indep: doxygen, graphviz, w3m
+Build-Depends-Indep: doxygen <!nodoc !pkg.apt.nodoxygen>, graphviz <!nodoc !pkg.apt.nodoxygen>, w3m <!nodoc>
Vcs-Git: https://salsa.debian.org/apt-team/apt.git
Vcs-Browser: https://salsa.debian.org/apt-team/apt
@@ -101,6 +101,7 @@ Priority: optional
Depends: ${misc:Depends}
Section: doc
Multi-Arch: foreign
+Build-Profiles: <!nodoc>
Description: documentation for APT
This package contains the user guide and offline guide for various
APT tools which are provided in a html and a text-only version.
@@ -111,7 +112,6 @@ Multi-Arch: same
Priority: optional
Pre-Depends: ${misc:Pre-Depends}
Depends: libapt-pkg (= ${binary:Version}),
- zlib1g-dev,
${misc:Depends}
Section: libdevel
Description: development files for APT's libapt-pkg and libapt-inst
@@ -125,6 +125,7 @@ Priority: optional
Depends: ${misc:Depends}
Section: doc
Multi-Arch: foreign
+Build-Profiles: <!nodoc>
Description: documentation for APT development
This package contains documentation for development of the APT
Debian package manipulation program and its libraries.
diff --git a/debian/rules b/debian/rules
index 8a110f7a1..e7cbdc732 100755
--- a/debian/rules
+++ b/debian/rules
@@ -44,7 +44,18 @@ override_dh_installsystemd:
dh_installsystemd -papt --no-restart-on-upgrade --no-restart-after-upgrade --no-start apt-daily.service apt-daily-upgrade.service
dh_installsystemd --remaining-packages
-override_dh_auto_configure-arch: flags=-DWITH_DOC=OFF
-override_dh_auto_configure-indep: flags=-DWITH_DOC=ON
+ifneq ($(filter pkg.apt.nodoxygen,$(DEB_BUILD_PROFILES)),)
+override_dh_auto_configure-arch: configure_doc_flags=-DWITH_DOC=OFF -DWITH_DOC_MANPAGES=ON
+override_dh_auto_configure-indep: configure_doc_flags=-DWITH_DOC=OFF -DWITH_DOC_GUIDES=ON -DWITH_DOC_EXAMPLES=ON
+else
+ifneq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
+override_dh_auto_configure-arch: configure_doc_flags=-DWITH_DOC=OFF
+override_dh_auto_configure-indep: configure_doc_flags=-DWITH_DOC=OFF
+else
+override_dh_auto_configure-arch: configure_doc_flags=-DWITH_DOC=OFF -DWITH_DOC_MANPAGES=ON
+override_dh_auto_configure-indep: configure_doc_flags=-DWITH_DOC=ON
+endif
+endif
+
override_dh_auto_configure-arch override_dh_auto_configure-indep:
- dh_auto_configure -- $(flags) $(configure_test_flags)
+ dh_auto_configure -- -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON $(configure_doc_flags) $(configure_test_flags)
diff --git a/debian/tests/control b/debian/tests/control
index 446f0afcc..e273b737f 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,10 +1,11 @@
-Tests: run-tests, pkg-config-test
+Tests: pkg-config-test
+Restrictions: superficial
+Depends: libapt-pkg-dev, pkg-config
+
+Tests: run-tests
Restrictions: allow-stderr
Depends: @, @builddeps@, dpkg (>= 1.20.8), fakeroot, wget, stunnel4, lsof, db-util,
- gnupg (>= 2) | gnupg2,
- gnupg1 | gnupg (<< 2),
- gpgv (>= 2) | gpgv2,
- gpgv1 | gpgv (<< 2),
+ gnupg (>= 2) | gnupg2, gnupg1 | gnupg (<< 2),
+ gpgv (>= 2) | gpgv2, gpgv1 | gpgv (<< 2),
libfile-fcntllock-perl, python3-apt, aptitude,
- pkg-config,
valgrind, gdb-minimal | gdb
diff --git a/debian/tests/pkg-config-test b/debian/tests/pkg-config-test
index 1e4ec141e..e074b1603 100644
--- a/debian/tests/pkg-config-test
+++ b/debian/tests/pkg-config-test
@@ -1,23 +1,32 @@
#!/bin/sh
-
set -e
-WORKDIR=$(mktemp -d)
-trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
-cd $WORKDIR
-cat <<EOF > pkgconfigtest.c
+if [ -z "$AUTOPKGTEST_TMP" ]; then
+ WORKDIR=''
+ cleanup() {
+ if [ -n "$WORKDIR" ]; then cd /; rm -rf -- "$WORKDIR"; fi
+ WORKDIR=''
+ }
+ trap 'cleanup' 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+ WORKDIR="$(mktemp -d)"
+ cd "$WORKDIR"
+else
+ cd "$AUTOPKGTEST_TMP"
+fi
+
+cat >pkgconfigtest.cc <<EOF
#include <apt-pkg/init.h>
-#include <stdio.h>
+#include <cstdio>
int main()
{
- printf("Apt Version: %s \n", pkgVersion);
+ printf("APT Version: %s\n", pkgVersion);
return 0;
}
EOF
-g++ -o pkgconfigtest pkgconfigtest.c `pkg-config --cflags --libs apt-pkg`
-echo "build: OK"
-[ -x pkgconfigtest ]
+g++ -Wall -Wextra -o pkgconfigtest pkgconfigtest.cc `pkg-config --cflags --libs apt-pkg`
+echo 'build: OK'
+test -x pkgconfigtest
./pkgconfigtest
-echo "run: OK"
+echo 'run: OK'
diff --git a/debian/tests/run-tests b/debian/tests/run-tests
index ff3359fae..c7ca16b35 100644
--- a/debian/tests/run-tests
+++ b/debian/tests/run-tests
@@ -1,26 +1,37 @@
#!/bin/sh
-
set -e
-if [ ! -e build/CMakeCache.txt ]; then
- mkdir build || true
- ( cd build && cmake .. )
+SOURCE_DIR="$(pwd)"
+if [ -z "$AUTOPKGTEST_TMP" ]; then
+ BUILD_DIR=''
+ cleanup() {
+ if [ -n "$BUILD_DIR" ]; then cd /; rm -rf -- "$BUILD_DIR"; fi
+ BUILD_DIR=''
+ }
+ trap 'cleanup' 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+ BUILD_DIR="$(mktemp -d)"
+else
+ BUILD_DIR="$AUTOPKGTEST_TMP"
+fi
+
+if [ ! -e "${BUILD_DIR}/CMakeCache.txt" ]; then
+ cmake -S "$SOURCE_DIR" -B "$BUILD_DIR" -DUSE_SYSTEM_APTPKG=ON -DWITH_DOC=OFF -DUSE_NLS=OFF
fi
-make -C build/test/interactive-helper
+make -C "${BUILD_DIR}/test/interactive-helper"
# run tests against the installed apt, use "env -i" to ensure
# the host env does not pollute our environment
env -i \
-APT_INTEGRATION_TESTS_SOURCE_DIR=$(pwd) \
-APT_INTEGRATION_TESTS_HELPERS_BIN_DIR=$(pwd)/build/test/interactive-helper \
+APT_INTEGRATION_TESTS_SOURCE_DIR="${SOURCE_DIR}" \
+APT_INTEGRATION_TESTS_BUILD_DIR="${BUILD_DIR}" \
APT_INTEGRATION_TESTS_METHODS_DIR=/usr/lib/apt/methods \
APT_INTEGRATION_TESTS_LIBEXEC_DIR=/usr/lib/apt/ \
APT_INTEGRATION_TESTS_INTERNAL_SOLVER=/usr/lib/apt/solvers/apt \
APT_INTEGRATION_TESTS_DUMP_SOLVER=/usr/lib/apt/solvers/dump \
APT_INTEGRATION_TESTS_INTERNAL_PLANNER=/usr/lib/apt/planners/apt \
-APT_INTEGRATION_TESTS_BUILD_DIR=/usr/bin \
APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR=/usr/bin \
+APT_INTEGRATION_TESTS_CMDLINE_BIN_DIR=/usr/bin \
APT_INTEGRATION_TESTS_LIBRARY_PATH=/dev/null/does/not/exist \
APT_INTEGRATION_TESTS_ARTIFACTS_DIR="${AUTOPKGTEST_ARTIFACTS}" \
-./test/integration/run-tests -q
+"${SOURCE_DIR}/test/integration/run-tests" -q
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 3060949e5..72a1fed88 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -1,4 +1,6 @@
+if (WITH_DOC OR WITH_DOC_MANPAGES OR WITH_DOC_GUIDES)
include(Documentation)
+endif()
set(LINGUAS
de
@@ -21,7 +23,7 @@ set(ENTITIES
../vendor/${CURRENT_VENDOR}/apt-vendor.ent
)
-if(WITH_DOC)
+if(WITH_DOC OR WITH_DOC_GUIDES)
add_docbook(apt-doc HTML TEXT ALL
DOCUMENTS
guide.dbk
@@ -43,7 +45,9 @@ add_docbook(libapt-pkg-doc HTML TEXT ALL
TRANSLATED_ENTITIES ${TRANSLATED_ENTITIES}
DEPENDS ${ENTITIES}
)
+endif()
+if(WITH_DOC OR WITH_DOC_DOXYGEN)
find_package(Doxygen REQUIRED)
file(GLOB_RECURSE apt_pkg "../apt-pkg/*.h" "../apt-pkg/*.cc")
@@ -65,9 +69,9 @@ install(DIRECTORY ${PROJECT_BINARY_DIR}/doc/doxygen/html
PATTERN "*.map" EXCLUDE
PATTERN "*.md5" EXCLUDE
)
-
endif()
+if(WITH_DOC OR WITH_DOC_MANPAGES)
add_docbook(apt-man MANPAGE ALL
DOCUMENTS
apt.8.xml
@@ -93,7 +97,12 @@ add_docbook(apt-man MANPAGE ALL
TRANSLATED_ENTITIES ${TRANSLATED_ENTITIES}
LINGUAS ${LINGUAS}
)
+endif()
+if(WITH_DOC OR WITH_DOC_MANPAGES OR WITH_DOC_GUIDES)
add_update_po4a(update-po4a po/${PROJECT_NAME}-doc.pot "po/header.pot.txt")
+endif()
+if(WITH_DOC OR WITH_DOC_EXAMPLES)
add_subdirectory(examples)
+endif()
diff --git a/ftparchive/sources.cc b/ftparchive/sources.cc
index ee6efda05..a59224395 100644
--- a/ftparchive/sources.cc
+++ b/ftparchive/sources.cc
@@ -1,3 +1,5 @@
+#include <config.h>
+
#include <sstream>
#include <string>
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index c03d6d03e..73d5ddd80 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -4,12 +4,15 @@ set(languages_excluded
he ## disabled by translator request #313283
)
+if (TARGET apt-pkg)
apt_add_translation_domain(
DOMAIN libapt-pkg${APT_PKG_MAJOR}
TARGETS apt-pkg
EXCLUDE_LANGUAGES ${languages_excluded}
)
+endif()
+if (TARGET apt-private)
apt_add_translation_domain(
DOMAIN apt
TARGETS apt apt-cache apt-get apt-config apt-cdrom apt-helper apt-mark
@@ -19,6 +22,7 @@ apt_add_translation_domain(
SCRIPTS ../dselect/install ../dselect/update
EXCLUDE_LANGUAGES ${languages_excluded}
)
+endif()
apt_add_translation_domain(
DOMAIN apt-utils
diff --git a/prepare-release b/prepare-release
index 5eef65276..988ccabad 100755
--- a/prepare-release
+++ b/prepare-release
@@ -7,10 +7,10 @@ if [ -n "${GBP_BUILD_DIR}" ]; then
cd "$GBP_BUILD_DIR"
fi
-VERSION=$(dpkg-parsechangelog | sed -n -e '/^Version:/s/^Version: //p')
-DISTRIBUTION=$(dpkg-parsechangelog | sed -n -e '/^Distribution:/s/^Distribution: //p')
+VERSION=$(dpkg-parsechangelog -S 'Version')
+DISTRIBUTION=$(dpkg-parsechangelog -S 'Distribution')
-LIBAPTPKGVERSION="$(awk -v ORS='.' '/^\#define APT_PKG_M/ {print $3}' apt-pkg/contrib/macros.h | sed 's/\.$//')"
+LIBAPTPKGVERSION="$(awk -v ORS='.' '/^#define APT_PKG_M/ {print $3}' apt-pkg/contrib/macros.h | sed 's/\.$//')"
librarysymbolsfromfile() {
local MISSING="$(grep '^+#MISSING' "$1")"
@@ -25,29 +25,6 @@ librarysymbolsfromfile() {
done | sort -u
}
-test_deb_control() {
- echo "Package: apt-test-depends"
- echo "Version: 1.0"
- echo "Architecture: all"
- printf "Depends:"
- (
- for i in Build-Depends Build-Depends-Indep Build-Depends-Arch; do
- grep-dctrl -ns $i -S apt ./debian/control && echo ,
- done
- grep-dctrl -ns Depends -F Tests run-tests ./debian/tests/control
- ) | tr '\n' ' '\
- | sed -r -e 's#<[^,<>()@]*>##g' \
- -e 's#@[^,<>()@]*@##g' \
- -e 's#\[linux-any\]*##g' \
- -e 's#\[[^][]*\]*##g' \
- -e 's#dpkg-dev \([^)]*\)#dpkg-dev#g' \
- -e 's#debhelper \([^)]*\)#debhelper#g' \
- -e 's#g\+\+ \([^)]*\)#g++#g' \
- -e 's#@##g' \
- -e 's#,(\s+,)+#, #g' \
- -e 's#\s+# #g'
-}
-
if [ "$1" = 'pre-export' ]; then
libraryversioncheck() {
local LIBRARY="$1"
@@ -104,7 +81,7 @@ elif [ "$1" = 'pre-build' ]; then
echo "You probably want to run »./prepare-release pre-export« to fix this."
exit 1
fi
- NEWSDISTRIBUTION=$(dpkg-parsechangelog -l debian/NEWS | sed -n -e '/^Distribution:/s/^Distribution: //p')
+ NEWSDISTRIBUTION=$(dpkg-parsechangelog -l debian/NEWS -S 'Distribution')
if [ "$NEWSDISTRIBUTION" = 'UNRELEASED' ]; then
echo "changelog (${VERSION}) has a distribution (${DISTRIBUTION}) set, while the NEWS file hasn't!"
echo "You probably want to edit »debian/NEWS« to fix this."
@@ -112,7 +89,12 @@ elif [ "$1" = 'pre-build' ]; then
fi
fi
elif [ "$1" = 'post-build' ]; then
- if [ "$DISTRIBUTION" != "UNRELEASED" ]; then
+ FAILED=false
+ REPORT_FAILURE=false
+
+ if [ "$2" = '--report-failure' ]; then
+ REPORT_FAILURE=true
+ elif [ "$DISTRIBUTION" != "UNRELEASED" ]; then
echo >&2 "REMEMBER: Tag this release with »git tag -s ${VERSION}« if you are satisfied"
else
echo >&2 'REMEMBER: Change to a valid distribution before release'
@@ -126,6 +108,7 @@ elif [ "$1" = 'post-build' ]; then
if ! sed -n '1,/^$/p' "$FILE" | cmp "$HEADERBLUEPRINT" - >/dev/null 2>&1; then
echo >&2 "WARNING: Manpage $FILE has not the usual header! (see diff below)"
sed -n '1,/^$/p' "$FILE" | diff -u "$HEADERBLUEPRINT" - || true
+ FAILED=true
fi
done
sed -n '1,/^$/p' doc/guide.dbk > "$HEADERBLUEPRINT"
@@ -133,30 +116,40 @@ elif [ "$1" = 'post-build' ]; then
if ! sed -n '1,/^$/p' "$FILE" | cmp "$HEADERBLUEPRINT" - >/dev/null 2>&1; then
echo >&2 "WARNING: Documentation $FILE has not the usual header (see diff below)!"
sed -n '1,/^$/p' "$FILE" | diff -u "$HEADERBLUEPRINT" - || true
+ FAILED=true
fi
done
rm "$HEADERBLUEPRINT"
# check the manpages with each vendor for vendor-specific errors…
find vendor -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 2 | while read DISTRO; do
- ln -sf ../vendor/${DISTRO}/apt-vendor.ent doc
- if ! xmllint --nonet --valid --noout $(find doc/ -maxdepth 1 -name '*.xml'); then
+ if ! xmllint --path vendor/${DISTRO} --nonet --valid --noout $(find doc/ -maxdepth 1 -name '*.xml'); then
echo >&2 "WARNING: original docbook manpages have errors with vendor ${DISTRO}!"
+ FAILED=true
fi
done
# lets assume we will always have a german manpage translation
if [ -e */doc/de/ -o -e doc/de ]; then
# … but check the translations only with one vendor for translation-specific errors
- if ! xmllint --path /vendor/$(./vendor/getinfo current)/ \
+ if ! xmllint --path vendor/$(./vendor/getinfo current)/ \
--path doc/ \
--nonet --valid --noout $(find doc/ */doc/ -mindepth 2 -maxdepth 2 -name '*.xml'); then
echo >&2 "WARNING: translated docbook manpages have errors!"
+ FAILED=true
fi
else
echo >&2 "ERROR: translated manpages need to be build before they can be checked!"
+ FAILED=true
fi
- rm -f doc/apt-vendor.ent
+ if [ "$(find -name '*.cc' ! -name 'tagfile-keys.cc' -exec grep --files-without-match '^#include <config\.h>$' '{}' \+ | wc -l)" != '0' ]; then
+ echo >&2 'WARNING: C++ files not including our config.h can cause ODR violations!'
+ find -name '*.cc' ! -name 'tagfile-keys.cc' -exec grep --files-without-match '^#include <config\.h>$' '{}' \+ >&2
+ FAILED=true
+ fi
+ if $REPORT_FAILURE && $FAILED; then
+ exit 1
+ fi
elif [ "$1" = 'library' ]; then
librarysymbols() {
local libname=$(echo "${1}" | cut -c 4-)
@@ -185,11 +178,11 @@ elif [ "$1" = 'buildlog' ]; then
shift
done
elif [ "$1" = 'travis-ci' ]; then
- apt-get install -qy --no-install-recommends dctrl-tools equivs gdebi-core moreutils
-
- test_deb_control > test-control
- equivs-build test-control
- gdebi -n apt-test-depends_1.0_all.deb
+ apt-get build-dep -qy .
+ apt-get install -qy --no-install-recommends dctrl-tools
+ for t in $(grep '^Tests: ' debian/tests/control | cut -d':' -f 2- | tr ',' '\n'); do
+ apt-get satisfy -qy --no-install-recommends "base-files,$(grep-dctrl -ns Depends -F Tests $t ./debian/tests/control | sed -e 's#@[^,<>()@]*@\s*,\s*##g' -e 's#@\s*,\s*##g')"
+ done
elif [ "$1" = 'coverage' ]; then
DIR="${2:-./coverage}"
git clean -dfX # remove ignored build artifacts for a clean start
@@ -387,7 +380,7 @@ Both will format the diff properly.
\t$0 coverage [output-dir]
»travis-ci« is a shortcut to install all build- as well as test-dependencies
-used by .travis.yml.
+used in .gitlab-ci.yml and other CI infrastructure.
»coverage« does a clean build with the right flags for coverage reporting,
runs all tests and generates a html report in the end.
diff --git a/test/integration/create-test-data b/test/integration/create-test-data
index eff2ba530..0eca3998c 100755
--- a/test/integration/create-test-data
+++ b/test/integration/create-test-data
@@ -9,8 +9,6 @@ fi
CHECK_ARGS='no'
TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"
-find_project_binary_dir
-BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"${PROJECT_BINARY_DIR}/cmdline"}"
GENERATE="$1"
CODENAME="$2"
diff --git a/test/integration/framework b/test/integration/framework
index c9559a7ba..8bb8c00d6 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -175,7 +175,7 @@ runapt() {
shift
case "$CMD" in
sh|aptitude|*/*|command) ;;
- *) CMD="${BUILDDIRECTORY}/$CMD";;
+ *) CMD="${APTCMDLINEBINDIR}/$CMD";;
esac
if [ "$CMD" = 'aptitude' ]; then
MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" command "$CMD" "$@"
@@ -228,7 +228,7 @@ gdb() {
esac
shift
if [ "${CMD##*/}" = "$CMD" ]; then
- CMD="${BUILDDIRECTORY}/${CMD}"
+ CMD="${APTCMDLINEBINDIR}/${CMD}"
fi
runapt command gdb --quiet -ex "directory '$SOURCEDIRECTORY'" -ex run "$CMD" --args "$CMD" "$@"
}
@@ -248,7 +248,7 @@ valgrind() {
esac
shift
if [ "${CMD##*/}" = "$CMD" ]; then
- CMD="${BUILDDIRECTORY}/${CMD}"
+ CMD="${APTCMDLINEBINDIR}/${CMD}"
fi
runapt command valgrind "$CMD" "$@"
}
@@ -373,9 +373,6 @@ setupenvironment() {
fi
mkdir -p 'rootdir/usr/bin' 'rootdir/var/cache' 'rootdir/var/lib' 'rootdir/var/log' 'rootdir/var/crash' 'rootdir/tmp'
- # Find the newest build directory (sets PROJECT_BINARY_DIR)
- find_project_binary_dir
-
_setupprojectenvironment
# create some files in /tmp and look at user/group to get what this means
@@ -383,9 +380,6 @@ setupenvironment() {
touch "${TMPWORKINGDIRECTORY}/test-file"
TEST_DEFAULT_GROUP=$(stat --format '%G' "${TMPWORKINGDIRECTORY}/test-file")
- # prefer our apt binaries over the system apt binaries
- export PATH="${BUILDDIRECTORY}:${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
-
if [ -r "${TESTDIRECTORY}/extra-environment" ]; then
. "${TESTDIRECTORY}/extra-environment"
fi
@@ -393,19 +387,20 @@ setupenvironment() {
msgdone "info"
}
_setupprojectenvironment() {
- # allow overriding the default BUILDDIR location
+ # allow overriding the default BUILDDIR locations
SOURCEDIRECTORY="${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}"
- BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"${PROJECT_BINARY_DIR}/cmdline"}"
- LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/../apt-pkg"}"
- METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/../methods"}"
- APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}"
- APTTESTHELPERSBINDIR="${APT_INTEGRATION_TESTS_HELPERS_BIN_DIR:-"${BUILDDIRECTORY}/../test/interactive-helper"}"
- APTFTPARCHIVEBINDIR="${APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR:-"${BUILDDIRECTORY}/../ftparchive"}"
- APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${BUILDDIRECTORY}/solvers/apt"}"
- APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${BUILDDIRECTORY}/solvers/dump"}"
- APTINTERNALPLANNER="${APT_INTEGRATION_TESTS_INTERNAL_PLANNER:-"${BUILDDIRECTORY}/planners/apt"}"
+ BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"$(find_project_binary_dir; printf '%s' "$PROJECT_BINARY_DIR")"}"
+ LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/apt-pkg"}"
+ METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}"
+ APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}/cmdline"}"
+ APTTESTHELPERSBINDIR="${APT_INTEGRATION_TESTS_HELPERS_BIN_DIR:-"${BUILDDIRECTORY}/test/interactive-helper"}"
+ APTFTPARCHIVEBINDIR="${APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR:-"${BUILDDIRECTORY}/ftparchive"}"
+ APTCMDLINEBINDIR="${APT_INTEGRATION_TESTS_CMDLINE_BIN_DIR:-"${BUILDDIRECTORY}/cmdline"}"
+ APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${APTCMDLINEBINDIR}/solvers/apt"}"
+ APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${APTCMDLINEBINDIR}/solvers/dump"}"
+ APTINTERNALPLANNER="${APT_INTEGRATION_TESTS_INTERNAL_PLANNER:-"${APTCMDLINEBINDIR}/planners/apt"}"
ARTIFACTSDIR="${APT_INTEGRATION_TESTS_ARTIFACTS_DIR:-"${BUILDDIRECTORY}/artifacts"}"
- test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first"
+ test -x "${APTCMDLINEBINDIR}/apt-get" || msgdie 'You need to build tree first'
echo "#x-apt-configure-index \"${SOURCEDIRECTORY}/doc/examples/configure-index\";" > aptconfig.conf
mkdir aptarchive keys
@@ -422,8 +417,7 @@ _setupprojectenvironment() {
ln -s "${APTINTERNALPLANNER}" usr/lib/apt/planners/apt
echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" >> ../aptconfig.conf
echo "Dir::Bin::Planners \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/planners\";" >> ../aptconfig.conf
- # use the autoremove from the BUILDDIRECTORY if its there, otherwise
- # system
+ # use the autoremove from the BUILDDIRECTORY if its there, otherwise system
if [ -z "${APT_INTEGRATION_TESTS_SOURCE_DIR}" ]; then
ln -s "${SOURCEDIRECTORY}/debian/apt.conf.autoremove" etc/apt/apt.conf.d/01autoremove
else
@@ -452,11 +446,11 @@ _setupprojectenvironment() {
echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf
echo "Dir::Bin::Methods \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods\";" >> aptconfig.conf
# either store apt-key were we can access it, even if we run it as a different user
- #cp "${BUILDDIRECTORY}/apt-key" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/"
+ #cp "${APTCMDLINEBINDIR}/apt-key" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/"
#chmod o+rx "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key"
#echo "Dir::Bin::apt-key \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key\";" >> aptconfig.conf
# destroys coverage reporting though, so we disable changing user for the calling gpgv
- echo "Dir::Bin::apt-key \"${BUILDDIRECTORY}/apt-key\";" >> aptconfig.conf
+ echo "Dir::Bin::apt-key \"${APTCMDLINEBINDIR}/apt-key\";" >> aptconfig.conf
if [ "$(id -u)" = '0' ]; then
echo 'Binary::gpgv::APT::Sandbox::User "root";' >> aptconfig.conf
# same for the solver executables
@@ -542,6 +536,9 @@ EOF
# most tests just need one signed Release file, not both
export APT_DONT_SIGN='Release.gpg'
+
+ # prefer our apt binaries over the system apt binaries
+ export PATH="${APTCMDLINEBINDIR}:${PATH}:/usr/sbin:/sbin"
}
getarchitecture() {
@@ -1831,12 +1828,12 @@ msgfailoutput() {
if [ -s "$COREDUMP" ]; then
if [ -z "$COREEXE" ]; then
case "$CMD" in
- apt) COREEXE="${BUILDDIRECTORY}/${CMD}";;
+ apt) COREEXE="${APTCMDLINEBINDIR}/${CMD}";;
aptftparchive) COREEXE="${APTFTPARCHIVEBINDIR}/apt-ftparchive";;
apthelper) COREEXE="${APTHELPERBINDIR}/apt-helper";;
aptwebserver) COREEXE="${APTTESTHELPERSBINDIR}/aptwebserver";;
- apt*) COREEXE="${BUILDDIRECTORY}/apt-${CMD##*apt}";;
- *) COREEXE="${BUILDDIRECTORY}/${CMD}";;
+ apt*) COREEXE="${APTCMDLINEBINDIR}/apt-${CMD##*apt}";;
+ *) COREEXE="${APTCMDLINEBINDIR}/${CMD}";;
esac
fi
diff --git a/test/integration/run-tests b/test/integration/run-tests
index f5a39f244..c1cc780f0 100755
--- a/test/integration/run-tests
+++ b/test/integration/run-tests
@@ -80,9 +80,9 @@ if [ -n "$TESTTORUN" ]; then
fi
} >"$OUTPUT" 2>&1
# without we end up getting stepped output 'randomly'
- stty sane
+ stty sane || true
cat >&2 "$OUTPUT"
- stty sane
+ stty sane || true
if [ "$FAIL" = 'yes' ]; then
exit 1
else
diff --git a/test/integration/test-apt-helper-cat-file b/test/integration/test-apt-helper-cat-file
index a53a6b4a3..064760c9e 100755
--- a/test/integration/test-apt-helper-cat-file
+++ b/test/integration/test-apt-helper-cat-file
@@ -5,7 +5,7 @@ TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"
setupenvironment
-TESTTOOL="${BUILDDIRECTORY}/../test/interactive-helper/test_fileutl"
+TESTTOOL="${APTTESTHELPERSBINDIR}/test_fileutl"
msgtest 'Check if we have build the test tool' "$TESTTOOL"
if [ -x "$TESTTOOL" ]; then
msgpass
diff --git a/test/integration/test-no-fds-leaked-to-maintainer-scripts b/test/integration/test-no-fds-leaked-to-maintainer-scripts
index 4606408fc..2b165520e 100755
--- a/test/integration/test-no-fds-leaked-to-maintainer-scripts
+++ b/test/integration/test-no-fds-leaked-to-maintainer-scripts
@@ -159,11 +159,11 @@ else
fi
rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log
-testsuccess runapt command setsid -w "${BUILDDIRECTORY}/apt-get" install -y fdleaks -qq < /dev/null
+testsuccess runapt command setsid -w "${APTCMDLINEBINDIR}/apt-get" install -y fdleaks -qq < /dev/null
checkinstall
rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log
-testsuccess runapt command setsid -w "${BUILDDIRECTORY}/apt-get" purge -y fdleaks -qq
+testsuccess runapt command setsid -w "${APTCMDLINEBINDIR}/apt-get" purge -y fdleaks -qq
checkpurge
touch rootdir/tmp/read_stdin
@@ -174,6 +174,6 @@ checkinstall
testequal '2' grep -c '^STDIN: ' rootdir/var/log/apt/term.log
rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log
-yes '' | testsuccess runapt command setsid -w "${BUILDDIRECTORY}/apt-get" purge -y fdleaks -qq
+yes '' | testsuccess runapt command setsid -w "${APTCMDLINEBINDIR}/apt-get" purge -y fdleaks -qq
checkpurge
testequal '3' grep -c '^STDIN: ' rootdir/var/log/apt/term.log
diff --git a/test/interactive-helper/CMakeLists.txt b/test/interactive-helper/CMakeLists.txt
index fff47300b..8e8764353 100644
--- a/test/interactive-helper/CMakeLists.txt
+++ b/test/interactive-helper/CMakeLists.txt
@@ -1,18 +1,31 @@
+if(USE_SYSTEM_APTPKG)
+ find_library(aptpkg NAMES apt-pkg NO_PACKAGE_ROOT_PATH REQUIRED)
+ set(APTPKG_LIB "${aptpkg}")
+ # it isn't easy to link against -private, but that is by design
+ set(APTPRIVATE_LIB "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/libapt-private.so.0.0")
+ set(APTPRIVATE_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}")
+else()
+ set(APTPKG_LIB "apt-pkg")
+ set(APTPRIVATE_LIB "apt-private")
+ set(APTPRIVATE_INCLUDE_DIRS "")
+endif()
+
add_executable(mthdcat mthdcat.cc)
-target_link_libraries(mthdcat apt-pkg)
+target_link_libraries(mthdcat ${APTPKG_LIB})
add_executable(testdeb testdeb.cc)
-target_link_libraries(testdeb apt-pkg)
+target_link_libraries(testdeb ${APTPKG_LIB})
add_executable(extract-control extract-control.cc)
-target_link_libraries(extract-control apt-pkg)
+target_link_libraries(extract-control ${APTPKG_LIB})
add_executable(aptwebserver aptwebserver.cc)
-target_link_libraries(aptwebserver apt-pkg ${CMAKE_THREAD_LIBS_INIT})
+target_link_libraries(aptwebserver ${APTPKG_LIB} ${CMAKE_THREAD_LIBS_INIT})
add_executable(aptdropprivs aptdropprivs.cc)
-target_link_libraries(aptdropprivs apt-pkg)
+target_link_libraries(aptdropprivs ${APTPKG_LIB})
add_executable(test_fileutl test_fileutl.cc)
-target_link_libraries(test_fileutl apt-pkg)
+target_link_libraries(test_fileutl ${APTPKG_LIB})
add_executable(createdeb-cve-2020-27350 createdeb-cve-2020-27350.cc)
add_executable(longest-dependency-chain longest-dependency-chain.cc)
-target_link_libraries(longest-dependency-chain apt-pkg apt-private)
+target_link_libraries(longest-dependency-chain ${APTPKG_LIB} ${APTPRIVATE_LIB})
+target_include_directories(longest-dependency-chain PRIVATE ${APTPRIVATE_INCLUDE_DIRS})
add_library(noprofile SHARED libnoprofile.c)
target_link_libraries(noprofile ${CMAKE_DL_LIBS})
diff --git a/test/interactive-helper/createdeb-cve-2020-27350.cc b/test/interactive-helper/createdeb-cve-2020-27350.cc
index 7fc9b0e55..57c53ae91 100644
--- a/test/interactive-helper/createdeb-cve-2020-27350.cc
+++ b/test/interactive-helper/createdeb-cve-2020-27350.cc
@@ -1,3 +1,5 @@
+#include <config.h>
+
#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
diff --git a/test/interactive-helper/test_fileutl.cc b/test/interactive-helper/test_fileutl.cc
index 6c29b748f..5569af1bf 100644
--- a/test/interactive-helper/test_fileutl.cc
+++ b/test/interactive-helper/test_fileutl.cc
@@ -1,3 +1,5 @@
+#include <config.h>
+
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/strutl.h>
diff --git a/test/libapt/extracttar_test.cc b/test/libapt/extracttar_test.cc
index ae74341e6..c945a0c68 100644
--- a/test/libapt/extracttar_test.cc
+++ b/test/libapt/extracttar_test.cc
@@ -1,3 +1,5 @@
+#include <config.h>
+
#include <apt-pkg/error.h>
#include <apt-pkg/dirstream.h>
#include <apt-pkg/extracttar.h>
diff --git a/test/libapt/file-helpers.cc b/test/libapt/file-helpers.cc
index 85fc6838e..bb7052b2a 100644
--- a/test/libapt/file-helpers.cc
+++ b/test/libapt/file-helpers.cc
@@ -1,3 +1,5 @@
+#include <config.h>
+
#include <apt-pkg/fileutl.h>
#include <string>
diff --git a/test/libapt/gtest_runner.cc b/test/libapt/gtest_runner.cc
index 5620aa0bd..09fc55d92 100644
--- a/test/libapt/gtest_runner.cc
+++ b/test/libapt/gtest_runner.cc
@@ -1,10 +1,12 @@
-#include <gtest/gtest.h>
+#include <config.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/error.h>
#include <apt-pkg/init.h>
#include <apt-pkg/pkgsystem.h>
+#include <gtest/gtest.h>
+
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
if (pkgInitSystem(*_config, _system) == false)
diff --git a/vendor/CMakeLists.txt b/vendor/CMakeLists.txt
index 8246c725a..f6d88690a 100644
--- a/vendor/CMakeLists.txt
+++ b/vendor/CMakeLists.txt
@@ -10,6 +10,7 @@ else()
endif()
# Handle sources.list example
+if (WITH_DOC OR WITH_DOC_EXAMPLES)
add_vendor_file(OUTPUT sources.list
INPUT "${CURRENT_VENDOR}/sources.list.in"
MODE 644
@@ -21,6 +22,7 @@ add_vendor_file(OUTPUT sources.list
current-codename)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/sources.list
DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
+endif()
# Handle apt.conf snippets
file(GLOB conffiles ${CURRENT_VENDOR}/apt.conf-*)