Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 1 | SUMMARY = "Advanced front-end for dpkg" |
| 2 | DESCRIPTION = "APT is the Advanced Package Tool, an advanced interface to the Debian packaging system which provides the apt-get program." |
| 3 | HOMEPAGE = "https://packages.debian.org/jessie/apt" |
| 4 | LICENSE = "GPL-2.0-or-later" |
| 5 | SECTION = "base" |
| 6 | |
| 7 | # Triehash script taken from https://github.com/julian-klode/triehash |
| 8 | SRC_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 Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 16 | file://0001-Remove-using-std-binary_function.patch \ |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 17 | file://0001-typecast-time_t-and-suseconds_t-from-std-chrono.patch \ |
| 18 | file://0002-interactive-helper-Undefine-_FORTIFY_SOURCE.patch \ |
Andrew Geissler | c5535c9 | 2023-01-27 16:10:19 -0600 | [diff] [blame] | 19 | file://0001-add-missing-cstdint-for-uint16_t.patch \ |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 20 | " |
| 21 | |
| 22 | SRC_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 | |
| 27 | SRC_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 Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 32 | SRC_URI[sha256sum] = "5552f175c3a3924f5cda0c079b821b30f68a2521959f2c30ab164d2ec7993ecf" |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 33 | LIC_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 |
| 37 | UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/a/apt/" |
Andrew Geissler | 78b7279 | 2022-06-14 06:47:25 -0500 | [diff] [blame] | 38 | # 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. |
| 41 | UPSTREAM_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 |
| 43 | UPSTREAM_VERSION_UNKNOWN = "1" |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 44 | |
Andrew Geissler | 78b7279 | 2022-06-14 06:47:25 -0500 | [diff] [blame] | 45 | inherit cmake perlnative bash-completion useradd |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 46 | |
| 47 | # User is added to allow apt to drop privs, will runtime warn without |
| 48 | USERADD_PACKAGES = "${PN}" |
| 49 | USERADD_PARAM:${PN} = "--system --home /nonexistent --no-create-home _apt" |
| 50 | |
| 51 | BBCLASSEXTEND = "native nativesdk" |
| 52 | |
| 53 | DEPENDS += "db gnutls lz4 zlib bzip2 xz libgcrypt xxhash" |
| 54 | |
| 55 | EXTRA_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 | |
| 63 | do_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 |
| 68 | FILES:${PN} += "${prefix}/lib/dpkg ${prefix}/lib/apt" |
| 69 | RDEPENDS:${PN} += "bash perl dpkg" |
| 70 | |
| 71 | customize_apt_conf_sample() { |
| 72 | cat > ${D}${sysconfdir}/apt/apt.conf.sample << EOF |
| 73 | Dir "${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 | |
| 103 | APT |
| 104 | { |
| 105 | Install-Recommends "true"; |
| 106 | Immediate-Configure "false"; |
| 107 | Architecture "i586"; |
| 108 | Get |
| 109 | { |
| 110 | Assume-Yes "true"; |
| 111 | }; |
| 112 | }; |
| 113 | |
| 114 | Acquire |
| 115 | { |
| 116 | AllowInsecureRepositories "true"; |
| 117 | }; |
| 118 | |
| 119 | DPkg::Options {"--root=#ROOTFS#";"--admindir=#ROOTFS#/var/lib/dpkg";"--force-all";"--no-debsig"}; |
| 120 | DPkg::Path ""; |
| 121 | EOF |
| 122 | } |
| 123 | |
| 124 | do_install:append:class-native() { |
| 125 | customize_apt_conf_sample |
| 126 | } |
| 127 | |
| 128 | do_install:append:class-nativesdk() { |
| 129 | customize_apt_conf_sample |
Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame] | 130 | rm -rf ${D}${localstatedir}/log |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | do_install:append:class-target() { |
| 134 | # Write the correct apt-architecture to apt.conf |
| 135 | APT_CONF=${D}${sysconfdir}/apt/apt.conf |
| 136 | echo 'APT::Architecture "${DPKG_ARCH}";' > ${APT_CONF} |
| 137 | |
| 138 | # Remove /var/log/apt. /var/log is normally a link to /var/volatile/log |
| 139 | # and /var/volatile is a tmpfs mount. So anything created in /var/log |
| 140 | # will not be available when the tmpfs is mounted. |
| 141 | rm -rf ${D}${localstatedir}/log |
| 142 | } |
| 143 | |
| 144 | do_install:append() { |
| 145 | # Avoid non-reproducible -src package |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 146 | sed -i -e "s,${B}/include/,,g" ${B}/apt-pkg/tagfile-keys.cc |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 147 | } |