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