blob: 4ecbf98554b7b74f64318abca91423c140f789f0 [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"
42# needs be marked as unknown until 2.6 is out
43UPSTREAM_VERSION_UNKNOWN = "1"
Andrew Geissler9aee5002022-03-30 16:27:02 +000044
Andrew Geissler78b72792022-06-14 06:47:25 -050045inherit cmake perlnative bash-completion useradd
Andrew Geissler9aee5002022-03-30 16:27:02 +000046
47# User is added to allow apt to drop privs, will runtime warn without
48USERADD_PACKAGES = "${PN}"
49USERADD_PARAM:${PN} = "--system --home /nonexistent --no-create-home _apt"
50
51BBCLASSEXTEND = "native nativesdk"
52
53DEPENDS += "db gnutls lz4 zlib bzip2 xz libgcrypt xxhash"
54
55EXTRA_OECMAKE:append = " -DCURRENT_VENDOR=debian -DWITH_DOC=False \
56 -DDPKG_DATADIR=${datadir}/dpkg \
57 -DTRIEHASH_EXECUTABLE=${WORKDIR}/triehash \
58 -DCMAKE_DISABLE_FIND_PACKAGE_ZSTD=True \
59 -DCMAKE_DISABLE_FIND_PACKAGE_SECCOMP=True \
60 -DWITH_TESTS=False \
61"
62
63do_configure:prepend() {
64 echo "set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH )" >> ${WORKDIR}/toolchain.cmake
65}
66
67# Unfortunately apt hardcodes this all over the place
68FILES:${PN} += "${prefix}/lib/dpkg ${prefix}/lib/apt"
69RDEPENDS:${PN} += "bash perl dpkg"
70
71customize_apt_conf_sample() {
72 cat > ${D}${sysconfdir}/apt/apt.conf.sample << EOF
73Dir "${STAGING_DIR_NATIVE}/"
74{
75 State "var/lib/apt/"
76 {
77 Lists "#APTCONF#/lists/";
78 status "#ROOTFS#/var/lib/dpkg/status";
79 };
80 Cache "var/cache/apt/"
81 {
82 Archives "archives/";
83 pkgcache "";
84 srcpkgcache "";
85 };
86 Bin "${STAGING_BINDIR_NATIVE}/"
87 {
88 methods "${STAGING_LIBDIR}/apt/methods/";
89 gzip "/bin/gzip";
90 dpkg "dpkg";
91 dpkg-source "dpkg-source";
92 dpkg-buildpackage "dpkg-buildpackage";
93 apt-get "apt-get";
94 apt-cache "apt-cache";
95 };
96 Etc "#APTCONF#"
97 {
98 Preferences "preferences";
99 };
100 Log "var/log/apt";
101};
102
103APT
104{
105 Install-Recommends "true";
106 Immediate-Configure "false";
107 Architecture "i586";
108 Get
109 {
110 Assume-Yes "true";
111 };
112};
113
114Acquire
115{
116 AllowInsecureRepositories "true";
117};
118
119DPkg::Options {"--root=#ROOTFS#";"--admindir=#ROOTFS#/var/lib/dpkg";"--force-all";"--no-debsig"};
120DPkg::Path "";
121EOF
122}
123
124do_install:append:class-native() {
125 customize_apt_conf_sample
126}
127
128do_install:append:class-nativesdk() {
129 customize_apt_conf_sample
130}
131
132do_install:append:class-target() {
133 # Write the correct apt-architecture to apt.conf
134 APT_CONF=${D}${sysconfdir}/apt/apt.conf
135 echo 'APT::Architecture "${DPKG_ARCH}";' > ${APT_CONF}
136
137 # Remove /var/log/apt. /var/log is normally a link to /var/volatile/log
138 # and /var/volatile is a tmpfs mount. So anything created in /var/log
139 # will not be available when the tmpfs is mounted.
140 rm -rf ${D}${localstatedir}/log
141}
142
143do_install:append() {
144 # Avoid non-reproducible -src package
Patrick Williams92b42cb2022-09-03 06:53:57 -0500145 sed -i -e "s,${B}/include/,,g" ${B}/apt-pkg/tagfile-keys.cc
Andrew Geissler9aee5002022-03-30 16:27:02 +0000146}