blob: 429cf6e65954abdb35880de273ff43ba52235ca8 [file] [log] [blame]
Andrew Geissler9aee5002022-03-30 16:27:02 +00001SUMMARY = "Advanced front-end for dpkg"
2DESCRIPTION = "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"
4LICENSE = "GPL-2.0-or-later"
5SECTION = "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 \
13 file://0001-cmake-Do-not-build-po-files.patch \
14 file://0001-Hide-fstatat64-and-prlimit64-defines-on-musl.patch \
15 file://0001-aptwebserver.cc-Include-array.patch \
Patrick Williams92b42cb2022-09-03 06:53:57 -050016 file://0001-Remove-using-std-binary_function.patch \
Andrew Geissler87f5cff2022-09-30 13:13:31 -050017 file://0001-typecast-time_t-and-suseconds_t-from-std-chrono.patch \
18 file://0002-interactive-helper-Undefine-_FORTIFY_SOURCE.patch \
Andrew Geisslerc5535c92023-01-27 16:10:19 -060019 file://0001-add-missing-cstdint-for-uint16_t.patch \
Andrew Geissler9aee5002022-03-30 16:27:02 +000020 "
21
22SRC_URI:append:class-native = " \
23 file://0001-Do-not-init-tables-from-dpkg-configuration.patch \
24 file://0001-Revert-always-run-dpkg-configure-a-at-the-end-of-our.patch \
25 "
26
27SRC_URI:append:class-nativesdk = " \
28 file://0001-Do-not-init-tables-from-dpkg-configuration.patch \
29 file://0001-Revert-always-run-dpkg-configure-a-at-the-end-of-our.patch \
30 "
31
Patrick Williams03907ee2022-05-01 06:28:52 -050032SRC_URI[sha256sum] = "5552f175c3a3924f5cda0c079b821b30f68a2521959f2c30ab164d2ec7993ecf"
Andrew Geissler9aee5002022-03-30 16:27:02 +000033LIC_FILES_CHKSUM = "file://COPYING.GPL;md5=b234ee4d69f5fce4486a80fdaf4a4263"
34
35# the package is taken from snapshots.debian.org; that source is static and goes stale
36# so we check the latest upstream from a directory that does get updated
37UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/a/apt/"
Andrew Geissler78b72792022-06-14 06:47:25 -050038# apt seems to follow a peculiar version policy, where every *other* even version
39# is considered stable, e.g. 1.0, 1.4, 1.8, 2.2, 2.6, etc. As there is no way
40# to express 'divisible by 4 plus 2' in regex (that I know of), let's hardcode a few.
41UPSTREAM_CHECK_REGEX = "[^\d\.](?P<pver>((2\.2)|(2\.6)|(3\.0)|(3\.4)|(3\.8)|(4\.2))(\.\d+)+)\.tar"
Andrew Geissler9aee5002022-03-30 16:27:02 +000042
Andrew Geissler78b72792022-06-14 06:47:25 -050043inherit cmake perlnative bash-completion useradd
Andrew Geissler9aee5002022-03-30 16:27:02 +000044
45# User is added to allow apt to drop privs, will runtime warn without
46USERADD_PACKAGES = "${PN}"
47USERADD_PARAM:${PN} = "--system --home /nonexistent --no-create-home _apt"
48
49BBCLASSEXTEND = "native nativesdk"
50
51DEPENDS += "db gnutls lz4 zlib bzip2 xz libgcrypt xxhash"
52
53EXTRA_OECMAKE:append = " -DCURRENT_VENDOR=debian -DWITH_DOC=False \
54 -DDPKG_DATADIR=${datadir}/dpkg \
55 -DTRIEHASH_EXECUTABLE=${WORKDIR}/triehash \
56 -DCMAKE_DISABLE_FIND_PACKAGE_ZSTD=True \
57 -DCMAKE_DISABLE_FIND_PACKAGE_SECCOMP=True \
58 -DWITH_TESTS=False \
59"
60
61do_configure:prepend() {
62 echo "set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH )" >> ${WORKDIR}/toolchain.cmake
63}
64
65# Unfortunately apt hardcodes this all over the place
66FILES:${PN} += "${prefix}/lib/dpkg ${prefix}/lib/apt"
67RDEPENDS:${PN} += "bash perl dpkg"
68
69customize_apt_conf_sample() {
70 cat > ${D}${sysconfdir}/apt/apt.conf.sample << EOF
71Dir "${STAGING_DIR_NATIVE}/"
72{
73 State "var/lib/apt/"
74 {
75 Lists "#APTCONF#/lists/";
76 status "#ROOTFS#/var/lib/dpkg/status";
77 };
78 Cache "var/cache/apt/"
79 {
80 Archives "archives/";
81 pkgcache "";
82 srcpkgcache "";
83 };
84 Bin "${STAGING_BINDIR_NATIVE}/"
85 {
86 methods "${STAGING_LIBDIR}/apt/methods/";
87 gzip "/bin/gzip";
88 dpkg "dpkg";
89 dpkg-source "dpkg-source";
90 dpkg-buildpackage "dpkg-buildpackage";
91 apt-get "apt-get";
92 apt-cache "apt-cache";
93 };
94 Etc "#APTCONF#"
95 {
96 Preferences "preferences";
97 };
98 Log "var/log/apt";
99};
100
101APT
102{
103 Install-Recommends "true";
104 Immediate-Configure "false";
105 Architecture "i586";
106 Get
107 {
108 Assume-Yes "true";
109 };
110};
111
112Acquire
113{
114 AllowInsecureRepositories "true";
115};
116
117DPkg::Options {"--root=#ROOTFS#";"--admindir=#ROOTFS#/var/lib/dpkg";"--force-all";"--no-debsig"};
118DPkg::Path "";
119EOF
120}
121
122do_install:append:class-native() {
123 customize_apt_conf_sample
124}
125
126do_install:append:class-nativesdk() {
127 customize_apt_conf_sample
Patrick Williams864cc432023-02-09 14:54:44 -0600128 rm -rf ${D}${localstatedir}/log
Andrew Geissler9aee5002022-03-30 16:27:02 +0000129}
130
131do_install:append:class-target() {
132 # Write the correct apt-architecture to apt.conf
133 APT_CONF=${D}${sysconfdir}/apt/apt.conf
134 echo 'APT::Architecture "${DPKG_ARCH}";' > ${APT_CONF}
135
136 # Remove /var/log/apt. /var/log is normally a link to /var/volatile/log
137 # and /var/volatile is a tmpfs mount. So anything created in /var/log
138 # will not be available when the tmpfs is mounted.
139 rm -rf ${D}${localstatedir}/log
140}
141
142do_install:append() {
143 # Avoid non-reproducible -src package
Patrick Williams92b42cb2022-09-03 06:53:57 -0500144 sed -i -e "s,${B}/include/,,g" ${B}/apt-pkg/tagfile-keys.cc
Andrew Geissler9aee5002022-03-30 16:27:02 +0000145}