blob: 0e10f9ba1d7689e378df4d146813355a6707b847 [file] [log] [blame]
Andrew Geissler4ed12e12020-06-05 18:00:41 -05001SUMMARY = "Advanced front-end for dpkg"
2LICENSE = "GPLv2.0+"
3SECTION = "base"
4
5# Triehash script taken from https://github.com/julian-klode/triehash
6SRC_URI = "${DEBIAN_MIRROR}/main/a/apt/${BPN}_${PV}.tar.xz \
7 file://triehash \
8 file://0001-Disable-documentation-directory-altogether.patch \
9 file://0001-Fix-musl-build.patch \
10 file://0001-CMakeLists.txt-avoid-changing-install-paths-based-on.patch \
Andrew Geissler6ce62a22020-11-30 19:58:47 -060011 file://0001-test-libapt-do-not-use-gtest-from-the-host.patch \
Andrew Geissler4ed12e12020-06-05 18:00:41 -050012 "
13
14SRC_URI_append_class-native = " \
15 file://0001-Do-not-init-tables-from-dpkg-configuration.patch \
16 file://0001-Revert-always-run-dpkg-configure-a-at-the-end-of-our.patch \
17 file://0001-Do-not-configure-packages-on-installation.patch \
18 "
19
Andrew Geisslerd1e89492021-02-12 15:35:20 -060020SRC_URI_append_class-nativesdk = " \
21 file://0001-Do-not-init-tables-from-dpkg-configuration.patch \
22 file://0001-Revert-always-run-dpkg-configure-a-at-the-end-of-our.patch \
23 file://0001-Do-not-configure-packages-on-installation.patch \
24 "
25
Andrew Geissler4ed12e12020-06-05 18:00:41 -050026SRC_URI[sha256sum] = "6d447f2e9437ec24e78350b63bb0592bee1f050811d51990b0c783183b0983f8"
27LIC_FILES_CHKSUM = "file://COPYING.GPL;md5=b234ee4d69f5fce4486a80fdaf4a4263"
28
29# the package is taken from snapshots.debian.org; that source is static and goes stale
30# so we check the latest upstream from a directory that does get updated
31UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/a/apt/"
32
Andrew Geisslerd1e89492021-02-12 15:35:20 -060033inherit cmake perlnative bash-completion upstream-version-is-even useradd
Andrew Geissler4ed12e12020-06-05 18:00:41 -050034
Andrew Geisslerd1e89492021-02-12 15:35:20 -060035# User is added to allow apt to drop privs, will runtime warn without
36USERADD_PACKAGES = "${PN}"
37USERADD_PARAM_${PN} = "--system --home /nonexistent --no-create-home _apt"
38
39BBCLASSEXTEND = "native nativesdk"
Andrew Geissler4ed12e12020-06-05 18:00:41 -050040
41DEPENDS += "virtual/libiconv virtual/libintl db gnutls lz4 zlib bzip2 xz"
42
Andrew Geisslerd1e89492021-02-12 15:35:20 -060043EXTRA_OECMAKE_append = " -DCURRENT_VENDOR=debian -DWITH_DOC=False \
44 -DUSE_NLS=False -DDPKG_DATADIR=${datadir}/dpkg \
45 -DTRIEHASH_EXECUTABLE=${WORKDIR}/triehash \
46 -DCMAKE_DISABLE_FIND_PACKAGE_Zstd=True \
47"
Andrew Geissler4ed12e12020-06-05 18:00:41 -050048
49do_configure_prepend () {
50 echo "set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH )" >> ${WORKDIR}/toolchain.cmake
51
52}
53
54# Unfortunately apt hardcodes this all over the place
55FILES_${PN} += "${prefix}/lib/dpkg ${prefix}/lib/apt"
56RDEPENDS_${PN} += "bash perl dpkg"
57
Andrew Geisslerd1e89492021-02-12 15:35:20 -060058customize_apt_conf_sample() {
Andrew Geissler4ed12e12020-06-05 18:00:41 -050059 cat > ${D}${sysconfdir}/apt/apt.conf.sample << EOF
60Dir "${STAGING_DIR_NATIVE}/"
61{
62 State "var/lib/apt/"
63 {
64 Lists "#APTCONF#/lists/";
65 status "#ROOTFS#/var/lib/dpkg/status";
66 };
67 Cache "var/cache/apt/"
68 {
69 Archives "archives/";
70 pkgcache "";
71 srcpkgcache "";
72 };
73 Bin "${STAGING_BINDIR_NATIVE}/"
74 {
75 methods "${STAGING_LIBDIR}/apt/methods/";
76 gzip "/bin/gzip";
77 dpkg "dpkg";
78 dpkg-source "dpkg-source";
79 dpkg-buildpackage "dpkg-buildpackage";
80 apt-get "apt-get";
81 apt-cache "apt-cache";
82 };
83 Etc "#APTCONF#"
84 {
85 Preferences "preferences";
86 };
87 Log "var/log/apt";
88};
89
90APT
91{
92 Install-Recommends "true";
93 Immediate-Configure "false";
94 Architecture "i586";
95 Get
96 {
97 Assume-Yes "true";
98 };
99};
100
101Acquire
102{
103 AllowInsecureRepositories "true";
104};
105
106DPkg::Options {"--root=#ROOTFS#";"--admindir=#ROOTFS#/var/lib/dpkg";"--force-all";"--no-debsig"};
107DPkg::Path "";
108EOF
109}
110
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600111do_install_append_class-native() {
112 customize_apt_conf_sample
113}
114
115do_install_append_class-nativesdk() {
116 customize_apt_conf_sample
117}
118
119
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500120do_install_append_class-target() {
121 #Write the correct apt-architecture to apt.conf
122 APT_CONF=${D}/etc/apt/apt.conf
123 echo 'APT::Architecture "${DPKG_ARCH}";' > ${APT_CONF}
124}
125
126# Avoid non-reproducible -src package
127do_install_append () {
128 sed -i -e "s,${B},,g" \
129 ${B}/apt-pkg/tagfile-keys.cc
130}