summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/apt/apt_2.2.2.bb
blob: 326f691ec0333665ecf013ec8b92674528961cb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
SUMMARY = "Advanced front-end for dpkg"
DESCRIPTION = "APT is the Advanced Package Tool, an advanced interface to the Debian packaging system which provides the apt-get program."
HOMEPAGE = "https://packages.debian.org/jessie/apt"
LICENSE = "GPLv2.0+"
SECTION = "base"

# Triehash script taken from https://github.com/julian-klode/triehash
SRC_URI = "${DEBIAN_MIRROR}/main/a/apt/${BPN}_${PV}.tar.xz \
           file://triehash \
           file://0001-Disable-documentation-directory-altogether.patch \
           file://0001-Fix-musl-build.patch \
           file://0001-CMakeLists.txt-avoid-changing-install-paths-based-on.patch \
           file://0001-srvrec-Keep-support-for-older-resolver.patch \
           file://0001-cmake-Do-not-build-po-files.patch \
           "

SRC_URI_append_class-native = " \
           file://0001-Do-not-init-tables-from-dpkg-configuration.patch \
           file://0001-Revert-always-run-dpkg-configure-a-at-the-end-of-our.patch \
           "

SRC_URI_append_class-nativesdk = " \
           file://0001-Do-not-init-tables-from-dpkg-configuration.patch \
           file://0001-Revert-always-run-dpkg-configure-a-at-the-end-of-our.patch \
           "

SRC_URI[sha256sum] = "c5449a4c2126a12497a9949cd10209926005d329f6ce7942a3781fa2fcf50487"
LIC_FILES_CHKSUM = "file://COPYING.GPL;md5=b234ee4d69f5fce4486a80fdaf4a4263"

# the package is taken from snapshots.debian.org; that source is static and goes stale
# so we check the latest upstream from a directory that does get updated
UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/a/apt/"

inherit cmake perlnative bash-completion upstream-version-is-even useradd

# User is added to allow apt to drop privs, will runtime warn without
USERADD_PACKAGES = "${PN}"
USERADD_PARAM_${PN} = "--system --home /nonexistent --no-create-home _apt"

BBCLASSEXTEND = "native nativesdk"

DEPENDS += "db gnutls lz4 zlib bzip2 xz libgcrypt xxhash"

EXTRA_OECMAKE_append = " -DCURRENT_VENDOR=debian -DWITH_DOC=False \
    -DDPKG_DATADIR=${datadir}/dpkg \
    -DTRIEHASH_EXECUTABLE=${WORKDIR}/triehash \
    -DCMAKE_DISABLE_FIND_PACKAGE_ZSTD=True \
    -DCMAKE_DISABLE_FIND_PACKAGE_SECCOMP=True \
    -DWITH_TESTS=False \
"

do_configure_prepend () {
    echo "set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH )" >>  ${WORKDIR}/toolchain.cmake

}

# Unfortunately apt hardcodes this all over the place
FILES_${PN} += "${prefix}/lib/dpkg ${prefix}/lib/apt"
RDEPENDS_${PN} += "bash perl dpkg"

customize_apt_conf_sample() {
    cat > ${D}${sysconfdir}/apt/apt.conf.sample << EOF
Dir "${STAGING_DIR_NATIVE}/"
{
   State "var/lib/apt/"
   {
      Lists "#APTCONF#/lists/";
      status "#ROOTFS#/var/lib/dpkg/status";
   };
   Cache "var/cache/apt/"
   {
      Archives "archives/";
      pkgcache "";
      srcpkgcache "";
   };
   Bin "${STAGING_BINDIR_NATIVE}/"
   {
      methods "${STAGING_LIBDIR}/apt/methods/";
      gzip "/bin/gzip";
      dpkg "dpkg";
      dpkg-source "dpkg-source";
      dpkg-buildpackage "dpkg-buildpackage";
      apt-get "apt-get";
      apt-cache "apt-cache";
   };
   Etc "#APTCONF#"
   {
      Preferences "preferences";
   };
   Log "var/log/apt";
};

APT
{
  Install-Recommends "true";
  Immediate-Configure "false";
  Architecture "i586";
  Get
  {
     Assume-Yes "true";
  };
};

Acquire
{
  AllowInsecureRepositories "true";
};

DPkg::Options {"--root=#ROOTFS#";"--admindir=#ROOTFS#/var/lib/dpkg";"--force-all";"--no-debsig"};
DPkg::Path "";
EOF
}

do_install_append_class-native() {
    customize_apt_conf_sample
}

do_install_append_class-nativesdk() {
    customize_apt_conf_sample
}


do_install_append_class-target() {
    #Write the correct apt-architecture to apt.conf
    APT_CONF=${D}/etc/apt/apt.conf
    echo 'APT::Architecture "${DPKG_ARCH}";' > ${APT_CONF}
}

# Avoid non-reproducible -src package
do_install_append () {
        sed -i -e "s,${B},,g" \
            ${B}/apt-pkg/tagfile-keys.cc
}