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