blob: 4b9f8040392bd73931e2e0bf97d91b7a6776c475 [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 Geissler9aee5002022-03-30 16:27:02 +000019 "
20
21SRC_URI:append:class-native = " \
22 file://0001-Do-not-init-tables-from-dpkg-configuration.patch \
23 file://0001-Revert-always-run-dpkg-configure-a-at-the-end-of-our.patch \
24 "
25
26SRC_URI:append:class-nativesdk = " \
27 file://0001-Do-not-init-tables-from-dpkg-configuration.patch \
28 file://0001-Revert-always-run-dpkg-configure-a-at-the-end-of-our.patch \
29 "
30
Patrick Williams03907ee2022-05-01 06:28:52 -050031SRC_URI[sha256sum] = "5552f175c3a3924f5cda0c079b821b30f68a2521959f2c30ab164d2ec7993ecf"
Andrew Geissler9aee5002022-03-30 16:27:02 +000032LIC_FILES_CHKSUM = "file://COPYING.GPL;md5=b234ee4d69f5fce4486a80fdaf4a4263"
33
34# the package is taken from snapshots.debian.org; that source is static and goes stale
35# so we check the latest upstream from a directory that does get updated
36UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/a/apt/"
Andrew Geissler78b72792022-06-14 06:47:25 -050037# apt seems to follow a peculiar version policy, where every *other* even version
38# is considered stable, e.g. 1.0, 1.4, 1.8, 2.2, 2.6, etc. As there is no way
39# to express 'divisible by 4 plus 2' in regex (that I know of), let's hardcode a few.
40UPSTREAM_CHECK_REGEX = "[^\d\.](?P<pver>((2\.2)|(2\.6)|(3\.0)|(3\.4)|(3\.8)|(4\.2))(\.\d+)+)\.tar"
41# needs be marked as unknown until 2.6 is out
42UPSTREAM_VERSION_UNKNOWN = "1"
Andrew Geissler9aee5002022-03-30 16:27:02 +000043
Andrew Geissler78b72792022-06-14 06:47:25 -050044inherit cmake perlnative bash-completion useradd
Andrew Geissler9aee5002022-03-30 16:27:02 +000045
46# User is added to allow apt to drop privs, will runtime warn without
47USERADD_PACKAGES = "${PN}"
48USERADD_PARAM:${PN} = "--system --home /nonexistent --no-create-home _apt"
49
50BBCLASSEXTEND = "native nativesdk"
51
52DEPENDS += "db gnutls lz4 zlib bzip2 xz libgcrypt xxhash"
53
54EXTRA_OECMAKE:append = " -DCURRENT_VENDOR=debian -DWITH_DOC=False \
55 -DDPKG_DATADIR=${datadir}/dpkg \
56 -DTRIEHASH_EXECUTABLE=${WORKDIR}/triehash \
57 -DCMAKE_DISABLE_FIND_PACKAGE_ZSTD=True \
58 -DCMAKE_DISABLE_FIND_PACKAGE_SECCOMP=True \
59 -DWITH_TESTS=False \
60"
61
62do_configure:prepend() {
63 echo "set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH )" >> ${WORKDIR}/toolchain.cmake
64}
65
66# Unfortunately apt hardcodes this all over the place
67FILES:${PN} += "${prefix}/lib/dpkg ${prefix}/lib/apt"
68RDEPENDS:${PN} += "bash perl dpkg"
69
70customize_apt_conf_sample() {
71 cat > ${D}${sysconfdir}/apt/apt.conf.sample << EOF
72Dir "${STAGING_DIR_NATIVE}/"
73{
74 State "var/lib/apt/"
75 {
76 Lists "#APTCONF#/lists/";
77 status "#ROOTFS#/var/lib/dpkg/status";
78 };
79 Cache "var/cache/apt/"
80 {
81 Archives "archives/";
82 pkgcache "";
83 srcpkgcache "";
84 };
85 Bin "${STAGING_BINDIR_NATIVE}/"
86 {
87 methods "${STAGING_LIBDIR}/apt/methods/";
88 gzip "/bin/gzip";
89 dpkg "dpkg";
90 dpkg-source "dpkg-source";
91 dpkg-buildpackage "dpkg-buildpackage";
92 apt-get "apt-get";
93 apt-cache "apt-cache";
94 };
95 Etc "#APTCONF#"
96 {
97 Preferences "preferences";
98 };
99 Log "var/log/apt";
100};
101
102APT
103{
104 Install-Recommends "true";
105 Immediate-Configure "false";
106 Architecture "i586";
107 Get
108 {
109 Assume-Yes "true";
110 };
111};
112
113Acquire
114{
115 AllowInsecureRepositories "true";
116};
117
118DPkg::Options {"--root=#ROOTFS#";"--admindir=#ROOTFS#/var/lib/dpkg";"--force-all";"--no-debsig"};
119DPkg::Path "";
120EOF
121}
122
123do_install:append:class-native() {
124 customize_apt_conf_sample
125}
126
127do_install:append:class-nativesdk() {
128 customize_apt_conf_sample
129}
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}