apt_2.6.1.bb 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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/sid/apt"
  4. LICENSE = "GPL-2.0-or-later"
  5. SECTION = "base"
  6. # Triehash script taken from https://github.com/julian-klode/triehash
  7. SRC_URI = "${DEBIAN_MIRROR}/main/a/apt/${BPN}_${PV}.tar.xz \
  8. file://triehash \
  9. file://0001-Disable-documentation-directory-altogether.patch \
  10. file://0001-Fix-musl-build.patch \
  11. file://0001-CMakeLists.txt-avoid-changing-install-paths-based-on.patch \
  12. file://0001-cmake-Do-not-build-po-files.patch \
  13. file://0001-Hide-fstatat64-and-prlimit64-defines-on-musl.patch \
  14. file://0001-aptwebserver.cc-Include-array.patch \
  15. file://0001-Remove-using-std-binary_function.patch \
  16. file://0001-strutl-Add-missing-include-cstdint-gcc-15.patch \
  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. SRC_URI:append:class-nativesdk = " \
  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. SRC_URI[sha256sum] = "86b888c901fa2e78f1bf52a2aaa2f400ff82a472b94ff0ac6631939ee68fa6fd"
  27. LIC_FILES_CHKSUM = "file://COPYING.GPL;md5=b234ee4d69f5fce4486a80fdaf4a4263"
  28. # the package is taken from snapshots.debian.org; that source is static and goes stale
  29. # so we check the latest upstream from a directory that does get updated
  30. UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/a/apt/"
  31. # apt seems to follow a peculiar version policy, where every *other* even version
  32. # is considered stable, e.g. 1.0, 1.4, 1.8, 2.2, 2.6, etc. As there is no way
  33. # to express 'divisible by 4 plus 2' in regex (that I know of), let's hardcode a few.
  34. UPSTREAM_CHECK_REGEX = "[^\d\.](?P<pver>((2\.2)|(2\.6)|(3\.0)|(3\.4)|(3\.8)|(4\.2))(\.\d+)+)\.tar"
  35. inherit cmake perlnative bash-completion useradd
  36. # User is added to allow apt to drop privs, will runtime warn without
  37. USERADD_PACKAGES = "${PN}"
  38. USERADD_PARAM:${PN} = "--system --home /nonexistent --no-create-home _apt"
  39. BBCLASSEXTEND = "native nativesdk"
  40. DEPENDS += "db gnutls lz4 zlib bzip2 xz libgcrypt xxhash"
  41. EXTRA_OECMAKE:append = " -DCURRENT_VENDOR=debian -DWITH_DOC=False \
  42. -DDPKG_DATADIR=${datadir}/dpkg \
  43. -DTRIEHASH_EXECUTABLE=${UNPACKDIR}/triehash \
  44. -DCMAKE_DISABLE_FIND_PACKAGE_ZSTD=True \
  45. -DCMAKE_DISABLE_FIND_PACKAGE_SECCOMP=True \
  46. -DWITH_TESTS=False \
  47. "
  48. do_configure:prepend() {
  49. echo "set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH )" >> ${WORKDIR}/toolchain.cmake
  50. }
  51. # Unfortunately apt hardcodes this all over the place
  52. FILES:${PN} += "${prefix}/lib/dpkg ${prefix}/lib/apt"
  53. RDEPENDS:${PN} += "bash perl dpkg"
  54. customize_apt_conf_sample() {
  55. cat > ${D}${sysconfdir}/apt/apt.conf.sample << EOF
  56. Dir "${STAGING_DIR_NATIVE}/"
  57. {
  58. State "var/lib/apt/"
  59. {
  60. Lists "#APTCONF#/lists/";
  61. status "#ROOTFS#/var/lib/dpkg/status";
  62. };
  63. Cache "var/cache/apt/"
  64. {
  65. Archives "archives/";
  66. pkgcache "";
  67. srcpkgcache "";
  68. };
  69. Bin "${STAGING_BINDIR_NATIVE}/"
  70. {
  71. methods "${STAGING_LIBDIR}/apt/methods/";
  72. gzip "/bin/gzip";
  73. dpkg "dpkg";
  74. dpkg-source "dpkg-source";
  75. dpkg-buildpackage "dpkg-buildpackage";
  76. apt-get "apt-get";
  77. apt-cache "apt-cache";
  78. };
  79. Etc "#APTCONF#"
  80. {
  81. Preferences "preferences";
  82. };
  83. Log "var/log/apt";
  84. };
  85. APT
  86. {
  87. Install-Recommends "true";
  88. Immediate-Configure "false";
  89. Architecture "i586";
  90. Get
  91. {
  92. Assume-Yes "true";
  93. };
  94. };
  95. Acquire
  96. {
  97. AllowInsecureRepositories "true";
  98. };
  99. DPkg::Options {"--root=#ROOTFS#";"--admindir=#ROOTFS#/var/lib/dpkg";"--force-all";"--no-force-overwrite";"--no-debsig"};
  100. DPkg::Path "";
  101. EOF
  102. }
  103. do_install:append:class-native() {
  104. customize_apt_conf_sample
  105. }
  106. do_install:append:class-nativesdk() {
  107. customize_apt_conf_sample
  108. rm -rf ${D}${localstatedir}/log
  109. }
  110. do_install:append:class-target() {
  111. # Write the correct apt-architecture to apt.conf
  112. APT_CONF=${D}${sysconfdir}/apt/apt.conf
  113. echo 'APT::Architecture "${DPKG_ARCH}";' > ${APT_CONF}
  114. # Remove /var/log/apt. /var/log is normally a link to /var/volatile/log
  115. # and /var/volatile is a tmpfs mount. So anything created in /var/log
  116. # will not be available when the tmpfs is mounted.
  117. rm -rf ${D}${localstatedir}/log
  118. }
  119. do_install:append() {
  120. # Avoid non-reproducible -src package
  121. sed -i -e "s,${B}/include/,,g" ${B}/apt-pkg/tagfile-keys.cc
  122. }