1SUMMARY = "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 \ 16 " 17 18SRC_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 23SRC_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 28SRC_URI[sha256sum] = "5552f175c3a3924f5cda0c079b821b30f68a2521959f2c30ab164d2ec7993ecf" 29LIC_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 33UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/a/apt/" 34 35inherit cmake perlnative bash-completion upstream-version-is-even useradd 36 37# User is added to allow apt to drop privs, will runtime warn without 38USERADD_PACKAGES = "${PN}" 39USERADD_PARAM:${PN} = "--system --home /nonexistent --no-create-home _apt" 40 41BBCLASSEXTEND = "native nativesdk" 42 43DEPENDS += "db gnutls lz4 zlib bzip2 xz libgcrypt xxhash" 44 45EXTRA_OECMAKE:append = " -DCURRENT_VENDOR=debian -DWITH_DOC=False \ 46 -DDPKG_DATADIR=${datadir}/dpkg \ 47 -DTRIEHASH_EXECUTABLE=${WORKDIR}/triehash \ 48 -DCMAKE_DISABLE_FIND_PACKAGE_ZSTD=True \ 49 -DCMAKE_DISABLE_FIND_PACKAGE_SECCOMP=True \ 50 -DWITH_TESTS=False \ 51" 52 53do_configure:prepend() { 54 echo "set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH )" >> ${WORKDIR}/toolchain.cmake 55} 56 57# Unfortunately apt hardcodes this all over the place 58FILES:${PN} += "${prefix}/lib/dpkg ${prefix}/lib/apt" 59RDEPENDS:${PN} += "bash perl dpkg" 60 61customize_apt_conf_sample() { 62 cat > ${D}${sysconfdir}/apt/apt.conf.sample << EOF 63Dir "${STAGING_DIR_NATIVE}/" 64{ 65 State "var/lib/apt/" 66 { 67 Lists "#APTCONF#/lists/"; 68 status "#ROOTFS#/var/lib/dpkg/status"; 69 }; 70 Cache "var/cache/apt/" 71 { 72 Archives "archives/"; 73 pkgcache ""; 74 srcpkgcache ""; 75 }; 76 Bin "${STAGING_BINDIR_NATIVE}/" 77 { 78 methods "${STAGING_LIBDIR}/apt/methods/"; 79 gzip "/bin/gzip"; 80 dpkg "dpkg"; 81 dpkg-source "dpkg-source"; 82 dpkg-buildpackage "dpkg-buildpackage"; 83 apt-get "apt-get"; 84 apt-cache "apt-cache"; 85 }; 86 Etc "#APTCONF#" 87 { 88 Preferences "preferences"; 89 }; 90 Log "var/log/apt"; 91}; 92 93APT 94{ 95 Install-Recommends "true"; 96 Immediate-Configure "false"; 97 Architecture "i586"; 98 Get 99 { 100 Assume-Yes "true"; 101 }; 102}; 103 104Acquire 105{ 106 AllowInsecureRepositories "true"; 107}; 108 109DPkg::Options {"--root=#ROOTFS#";"--admindir=#ROOTFS#/var/lib/dpkg";"--force-all";"--no-debsig"}; 110DPkg::Path ""; 111EOF 112} 113 114do_install:append:class-native() { 115 customize_apt_conf_sample 116} 117 118do_install:append:class-nativesdk() { 119 customize_apt_conf_sample 120 rm -rf ${D}${localstatedir}/log 121} 122 123do_install:append:class-target() { 124 # Write the correct apt-architecture to apt.conf 125 APT_CONF=${D}${sysconfdir}/apt/apt.conf 126 echo 'APT::Architecture "${DPKG_ARCH}";' > ${APT_CONF} 127 128 # Remove /var/log/apt. /var/log is normally a link to /var/volatile/log 129 # and /var/volatile is a tmpfs mount. So anything created in /var/log 130 # will not be available when the tmpfs is mounted. 131 rm -rf ${D}${localstatedir}/log 132} 133 134do_install:append() { 135 # Avoid non-reproducible -src package 136 sed -i -e "s,${B}/include/,,g" ${B}/apt-pkg/tagfile-keys.cc 137} 138