blob: aef309840b497eb16bc3bde91f457f818d7d0cf1 [file] [log] [blame]
Andrew Geissler4ed12e12020-06-05 18:00:41 -05001SUMMARY = "Advanced front-end for dpkg"
Andrew Geissler90fd73c2021-03-05 15:25:55 -06002DESCRIPTION = "APT is the Advanced Package Tool, an advanced interface to the Debian packaging system which provides the apt-get program."
3HOMEPAGE = "https://packages.debian.org/jessie/apt"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00004LICENSE = "GPL-2.0-or-later"
Andrew Geissler4ed12e12020-06-05 18:00:41 -05005SECTION = "base"
6
7# Triehash script taken from https://github.com/julian-klode/triehash
8SRC_URI = "${DEBIAN_MIRROR}/main/a/apt/${BPN}_${PV}.tar.xz \
9 file://triehash \
10 file://0001-Disable-documentation-directory-altogether.patch \
11 file://0001-Fix-musl-build.patch \
12 file://0001-CMakeLists.txt-avoid-changing-install-paths-based-on.patch \
Andrew Geissler95ac1b82021-03-31 14:34:31 -050013 file://0001-srvrec-Keep-support-for-older-resolver.patch \
14 file://0001-cmake-Do-not-build-po-files.patch \
Andrew Geisslerc926e172021-05-07 16:11:35 -050015 file://0001-Hide-fstatat64-and-prlimit64-defines-on-musl.patch \
William A. Kennington IIIac69b482021-06-02 12:28:27 -070016 file://0001-aptwebserver.cc-Include-array.patch \
Andrew Geissler4ed12e12020-06-05 18:00:41 -050017 "
Andrew Geissler95ac1b82021-03-31 14:34:31 -050018
Patrick Williams213cb262021-08-07 19:21:33 -050019SRC_URI:append:class-native = " \
Andrew Geissler4ed12e12020-06-05 18:00:41 -050020 file://0001-Do-not-init-tables-from-dpkg-configuration.patch \
21 file://0001-Revert-always-run-dpkg-configure-a-at-the-end-of-our.patch \
Andrew Geissler4ed12e12020-06-05 18:00:41 -050022 "
23
Patrick Williams213cb262021-08-07 19:21:33 -050024SRC_URI:append:class-nativesdk = " \
Andrew Geisslerd1e89492021-02-12 15:35:20 -060025 file://0001-Do-not-init-tables-from-dpkg-configuration.patch \
26 file://0001-Revert-always-run-dpkg-configure-a-at-the-end-of-our.patch \
Andrew Geisslerd1e89492021-02-12 15:35:20 -060027 "
28
Andrew Geissler09036742021-06-25 14:25:14 -050029SRC_URI[sha256sum] = "6eecd04a4979bd2040b22a14571c15d342c4e1802b2023acb5aa19649b1f64ea"
Andrew Geissler4ed12e12020-06-05 18:00:41 -050030LIC_FILES_CHKSUM = "file://COPYING.GPL;md5=b234ee4d69f5fce4486a80fdaf4a4263"
31
32# the package is taken from snapshots.debian.org; that source is static and goes stale
33# so we check the latest upstream from a directory that does get updated
34UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/a/apt/"
35
Andrew Geisslerd1e89492021-02-12 15:35:20 -060036inherit cmake perlnative bash-completion upstream-version-is-even useradd
Andrew Geissler4ed12e12020-06-05 18:00:41 -050037
Andrew Geisslerd1e89492021-02-12 15:35:20 -060038# User is added to allow apt to drop privs, will runtime warn without
39USERADD_PACKAGES = "${PN}"
Patrick Williams213cb262021-08-07 19:21:33 -050040USERADD_PARAM:${PN} = "--system --home /nonexistent --no-create-home _apt"
Andrew Geisslerd1e89492021-02-12 15:35:20 -060041
42BBCLASSEXTEND = "native nativesdk"
Andrew Geissler4ed12e12020-06-05 18:00:41 -050043
Andrew Geissler95ac1b82021-03-31 14:34:31 -050044DEPENDS += "db gnutls lz4 zlib bzip2 xz libgcrypt xxhash"
Andrew Geissler4ed12e12020-06-05 18:00:41 -050045
Patrick Williams213cb262021-08-07 19:21:33 -050046EXTRA_OECMAKE:append = " -DCURRENT_VENDOR=debian -DWITH_DOC=False \
Andrew Geissler95ac1b82021-03-31 14:34:31 -050047 -DDPKG_DATADIR=${datadir}/dpkg \
Andrew Geisslerd1e89492021-02-12 15:35:20 -060048 -DTRIEHASH_EXECUTABLE=${WORKDIR}/triehash \
Andrew Geissler3b8a17c2021-04-15 15:55:55 -050049 -DCMAKE_DISABLE_FIND_PACKAGE_ZSTD=True \
Andrew Geisslerc926e172021-05-07 16:11:35 -050050 -DCMAKE_DISABLE_FIND_PACKAGE_SECCOMP=True \
Andrew Geissler95ac1b82021-03-31 14:34:31 -050051 -DWITH_TESTS=False \
Andrew Geisslerd1e89492021-02-12 15:35:20 -060052"
Andrew Geissler4ed12e12020-06-05 18:00:41 -050053
Andrew Geissler595f6302022-01-24 19:11:47 +000054do_configure:prepend() {
55 echo "set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH )" >> ${WORKDIR}/toolchain.cmake
Andrew Geissler4ed12e12020-06-05 18:00:41 -050056}
57
58# Unfortunately apt hardcodes this all over the place
Patrick Williams213cb262021-08-07 19:21:33 -050059FILES:${PN} += "${prefix}/lib/dpkg ${prefix}/lib/apt"
60RDEPENDS:${PN} += "bash perl dpkg"
Andrew Geissler4ed12e12020-06-05 18:00:41 -050061
Andrew Geisslerd1e89492021-02-12 15:35:20 -060062customize_apt_conf_sample() {
Andrew Geissler595f6302022-01-24 19:11:47 +000063 cat > ${D}${sysconfdir}/apt/apt.conf.sample << EOF
Andrew Geissler4ed12e12020-06-05 18:00:41 -050064Dir "${STAGING_DIR_NATIVE}/"
65{
66 State "var/lib/apt/"
67 {
68 Lists "#APTCONF#/lists/";
69 status "#ROOTFS#/var/lib/dpkg/status";
70 };
71 Cache "var/cache/apt/"
72 {
73 Archives "archives/";
74 pkgcache "";
75 srcpkgcache "";
76 };
77 Bin "${STAGING_BINDIR_NATIVE}/"
78 {
79 methods "${STAGING_LIBDIR}/apt/methods/";
80 gzip "/bin/gzip";
81 dpkg "dpkg";
82 dpkg-source "dpkg-source";
83 dpkg-buildpackage "dpkg-buildpackage";
84 apt-get "apt-get";
85 apt-cache "apt-cache";
86 };
87 Etc "#APTCONF#"
88 {
89 Preferences "preferences";
90 };
91 Log "var/log/apt";
92};
93
94APT
95{
96 Install-Recommends "true";
97 Immediate-Configure "false";
98 Architecture "i586";
99 Get
100 {
101 Assume-Yes "true";
102 };
103};
104
105Acquire
106{
107 AllowInsecureRepositories "true";
108};
109
110DPkg::Options {"--root=#ROOTFS#";"--admindir=#ROOTFS#/var/lib/dpkg";"--force-all";"--no-debsig"};
111DPkg::Path "";
112EOF
113}
114
Patrick Williams213cb262021-08-07 19:21:33 -0500115do_install:append:class-native() {
Andrew Geissler595f6302022-01-24 19:11:47 +0000116 customize_apt_conf_sample
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600117}
118
Patrick Williams213cb262021-08-07 19:21:33 -0500119do_install:append:class-nativesdk() {
Andrew Geissler595f6302022-01-24 19:11:47 +0000120 customize_apt_conf_sample
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600121}
122
Patrick Williams213cb262021-08-07 19:21:33 -0500123do_install:append:class-target() {
Andrew Geissler595f6302022-01-24 19:11:47 +0000124 # Write the correct apt-architecture to apt.conf
125 APT_CONF=${D}${sysconfdir}/apt/apt.conf
126 echo 'APT::Architecture "${DPKG_ARCH}";' > ${APT_CONF}
127
128 # Remove /var/log/apt. /var/log is normally a link to /var/volatile/log
129 # and /var/volatile is a tmpfs mount. So anything created in /var/log
130 # will not be available when the tmpfs is mounted.
131 rm -rf ${D}${localstatedir}/log
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500132}
133
Andrew Geissler595f6302022-01-24 19:11:47 +0000134do_install:append() {
135 # Avoid non-reproducible -src package
136 sed -i -e "s,${B},,g" ${B}/apt-pkg/tagfile-keys.cc
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500137}