]> code.ossystems Code Review - openembedded-core.git/commitdiff
apt: add nativesdk support
authorhongxu <hongxu.jia@windriver.com>
Fri, 15 Jan 2021 09:45:35 +0000 (17:45 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 16 Jan 2021 22:39:17 +0000 (22:39 +0000)
1. Add nativesdk support
- Apply the same patches of native
- Generate the same apt.conf.sample of native

2. Create user '_apt' to fix apt runtime warning
[snip]
$ apt update
...
W: No sandbox user '_apt' on the system, can not drop privileges
[snip]

RP: Add comment about need to user
RP: Add user to selftest static-passwd
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta-selftest/files/static-group
meta-selftest/files/static-passwd
meta/recipes-devtools/apt/apt_1.8.2.1.bb

index 892231b6e03efebd41d87397c0fe40cfbd17d025..5487ed6e322dd7ffa1d2c07d26bac6381e1ede02 100644 (file)
@@ -19,3 +19,4 @@ tracing:x:519:
 pulse:x:520:
 bind:x:521:
 builder:x:522:
+_apt:x:523:
\ No newline at end of file
index babbfbc9de194a06c078c8706fa55e98fda4f354..f663361f4a9073210bc8e1de3d678ff14069fda3 100644 (file)
@@ -15,3 +15,4 @@ sshd:x:516:516::/:/bin/nologin
 pulse:x:520:520::/:/bin/nologin
 bind:x:521:521::/:/bin/nologin
 builder:x:522:522::/:/bin/nologin
+_apt:x:523:523::/:/bin/nologin
\ No newline at end of file
index de0e150a2e3f40e61a0a0634f32552ea4b0404ac..9fc6e54a292b26abeda97e780cf2dc3f8bb3a28d 100644 (file)
@@ -17,6 +17,12 @@ SRC_URI_append_class-native = " \
            file://0001-Do-not-configure-packages-on-installation.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 \
+           file://0001-Do-not-configure-packages-on-installation.patch \
+           "
+
 SRC_URI[sha256sum] = "6d447f2e9437ec24e78350b63bb0592bee1f050811d51990b0c783183b0983f8"
 LIC_FILES_CHKSUM = "file://COPYING.GPL;md5=b234ee4d69f5fce4486a80fdaf4a4263"
 
@@ -24,9 +30,13 @@ LIC_FILES_CHKSUM = "file://COPYING.GPL;md5=b234ee4d69f5fce4486a80fdaf4a4263"
 # 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
+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"
+BBCLASSEXTEND = "native nativesdk"
 
 DEPENDS += "virtual/libiconv virtual/libintl db gnutls lz4 zlib bzip2 xz"
 
@@ -41,7 +51,7 @@ do_configure_prepend () {
 FILES_${PN} += "${prefix}/lib/dpkg ${prefix}/lib/apt"
 RDEPENDS_${PN} += "bash perl dpkg"
 
-do_install_append_class-native() {
+customize_apt_conf_sample() {
     cat > ${D}${sysconfdir}/apt/apt.conf.sample << EOF
 Dir "${STAGING_DIR_NATIVE}/"
 {
@@ -94,6 +104,15 @@ 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