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" |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 42 | |
Andrew Geissler | 78b7279 | 2022-06-14 06:47:25 -0500 | [diff] [blame] | 43 | inherit cmake perlnative bash-completion useradd |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 44 | |
| 45 | # User is added to allow apt to drop privs, will runtime warn without |
| 46 | USERADD_PACKAGES = "${PN}" |
| 47 | USERADD_PARAM:${PN} = "--system --home /nonexistent --no-create-home _apt" |
| 48 | |
| 49 | BBCLASSEXTEND = "native nativesdk" |
| 50 | |
| 51 | DEPENDS += "db gnutls lz4 zlib bzip2 xz libgcrypt xxhash" |
| 52 | |
| 53 | EXTRA_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 | |
| 61 | do_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 |
| 66 | FILES:${PN} += "${prefix}/lib/dpkg ${prefix}/lib/apt" |
| 67 | RDEPENDS:${PN} += "bash perl dpkg" |
| 68 | |
| 69 | customize_apt_conf_sample() { |
| 70 | cat > ${D}${sysconfdir}/apt/apt.conf.sample << EOF |
| 71 | Dir "${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 | |
| 101 | APT |
| 102 | { |
| 103 | Install-Recommends "true"; |
| 104 | Immediate-Configure "false"; |
| 105 | Architecture "i586"; |
| 106 | Get |
| 107 | { |
| 108 | Assume-Yes "true"; |
| 109 | }; |
| 110 | }; |
| 111 | |
| 112 | Acquire |
| 113 | { |
| 114 | AllowInsecureRepositories "true"; |
| 115 | }; |
| 116 | |
| 117 | DPkg::Options {"--root=#ROOTFS#";"--admindir=#ROOTFS#/var/lib/dpkg";"--force-all";"--no-debsig"}; |
| 118 | DPkg::Path ""; |
| 119 | EOF |
| 120 | } |
| 121 | |
| 122 | do_install:append:class-native() { |
| 123 | customize_apt_conf_sample |
| 124 | } |
| 125 | |
| 126 | do_install:append:class-nativesdk() { |
| 127 | customize_apt_conf_sample |
Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame] | 128 | rm -rf ${D}${localstatedir}/log |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 129 | } |
| 130 | |
| 131 | do_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 | |
| 142 | do_install:append() { |
| 143 | # Avoid non-reproducible -src package |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 144 | 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] | 145 | } |