apt_2.6.1.bb 4.5 KB

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