Skip to contentSkip to conversation

netbase/base-files: move /etc/hosts from netbase to base-files

PATCH In review Chen Qi 5 participants 10 messages Jan 8, 2019 – Jan 9, 2019

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

cover netbase/base-files: move /etc/hosts from netbase to base-files

The following changes since commit fd045373e01409e273479c9e0e2e69bd1b7815f9:

python-native: fix one do_populate_sysroot warning (2019-01-07 14:38:39 +0000)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib ChenQi/etc-hosts
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/etc-hosts

Chen Qi (1):
netbase/base-files: move /etc/hosts from netbase to base-files

 meta/recipes-core/{netbase/netbase => base-files/base-files}/hosts | 0
 meta/recipes-core/base-files/base-files_3.0.14.bb                  | 5 ++++-
 meta/recipes-core/netbase/netbase_5.5.bb                           | 6 +-----
 3 files changed, 5 insertions(+), 6 deletions(-)
 rename meta/recipes-core/{netbase/netbase => base-files/base-files}/hosts (100%)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/1 netbase/base-files: move /etc/hosts from netbase to base-files

Move /etc/hosts to base-files, and also add entry to it according to hostname setting. This fixes the problem of commands like `hostname -f' failing due to lack of such entry.

---
 meta/recipes-core/{netbase/netbase => base-files/base-files}/hosts | 0
 meta/recipes-core/base-files/base-files_3.0.14.bb                  | 5 ++++-
 meta/recipes-core/netbase/netbase_5.5.bb                           | 6 +-----
 3 files changed, 5 insertions(+), 6 deletions(-)
 rename meta/recipes-core/{netbase/netbase => base-files/base-files}/hosts (100%)
meta/recipes-core/base-files/base-files/hosts renamed from meta/recipes-core/netbase/netbase/hosts +0 -0
similarity index 100%
rename from meta/recipes-core/netbase/netbase/hosts
rename to meta/recipes-core/base-files/base-files/hosts
meta/recipes-core/base-files/base-files_3.0.14.bb +4 -1
index 6e75652..6e30c14 100644
@@ -13,6 +13,7 @@ LIC_FILES_CHKSUM = "file://licenses/GPL-2;md5=94d55d512a9ba36caa9b7df079bae19f"
 SRC_URI = "file://rotation \
            file://nsswitch.conf \
            file://motd \
+           file://hosts \
            file://host.conf \
            file://profile \
            file://shells \
@@ -113,6 +114,7 @@ do_install () {
 	ln -snf ../run ${D}${localstatedir}/run
 	ln -snf ../run/lock ${D}${localstatedir}/lock
 
+	install -m 0644 ${WORKDIR}/hosts ${D}${sysconfdir}/hosts
 	${BASEFILESISSUEINSTALL}
 
 	rotation=`cat ${WORKDIR}/rotation`
@@ -140,6 +142,7 @@ DISTRO_VERSION[vardepsexclude] += "DATE"
 do_install_basefilesissue () {
 	if [ "${hostname}" ]; then
 		echo ${hostname} > ${D}${sysconfdir}/hostname
+		echo "127.0.1.1 ${hostname}" >> ${D}${sysconfdir}/hosts
 	fi
 
 	install -m 644 ${WORKDIR}/issue*  ${D}${sysconfdir}
@@ -177,5 +180,5 @@ FILES_${PN}-doc = "${docdir} ${datadir}/common-licenses"
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
-CONFFILES_${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname'][(d.getVar('hostname') != '')]} ${sysconfdir}/shells"
+CONFFILES_${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname ${sysconfdir}/hosts'][(d.getVar('hostname') != '')]} ${sysconfdir}/shells"
 CONFFILES_${PN} += "${sysconfdir}/motd ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile"
meta/recipes-core/netbase/netbase_5.5.bb +1 -5
index 2061f86..eb53add 100644
@@ -7,8 +7,7 @@ LIC_FILES_CHKSUM = "file://debian/copyright;md5=3dd6192d306f582dee7687da3d8748ab
 PE = "1"
 
 SRC_URI = "${DEBIAN_MIRROR}/main/n/${BPN}/${BPN}_${PV}.tar.xz \
-           file://netbase-add-rpcbind-as-an-alias-to-sunrpc.patch \
-           file://hosts"
+           file://netbase-add-rpcbind-as-an-alias-to-sunrpc.patch"
 
 SRC_URI[md5sum] = "15f2d9b3783802f7f48f6734b6540ac4"
 SRC_URI[sha256sum] = "309bddc69a43b98e5a450992b70cdfc0e3d1afb9107bc631d04b0714be98f88b"
@@ -16,10 +15,7 @@ SRC_URI[sha256sum] = "309bddc69a43b98e5a450992b70cdfc0e3d1afb9107bc631d04b0714be
 UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/n/netbase/"
 do_install () {
 	install -d ${D}/${mandir}/man8 ${D}${sysconfdir}
-	install -m 0644 ${WORKDIR}/hosts ${D}${sysconfdir}/hosts
 	install -m 0644 etc-rpc ${D}${sysconfdir}/rpc
 	install -m 0644 etc-protocols ${D}${sysconfdir}/protocols
 	install -m 0644 etc-services ${D}${sysconfdir}/services
 }
-
-CONFFILES_${PN} = "${sysconfdir}/hosts"
Signature · 1 line
1.9.1
#2 lore raw
Quoted 4 lines · Chen Qi
        if [ "${hostname}" ]; then
                echo ${hostname} > ${D}${sysconfdir}/hostname

+ echo "127.0.1.1 ${hostname}" >> ${D}${sysconfdir}/hosts
fi

Instead of appending to the file, can you put a marker on the 127.0.0.1 line and replace it inline?

Ross

#3 lore raw
Quoted 9 lines · Ross
Quoted 5 lines · Chen Qi
        if [ "${hostname}" ]; then
                echo ${hostname} > ${D}${sysconfdir}/hostname

+ echo "127.0.1.1 ${hostname}" >>
${D}${sysconfdir}/hosts
fi

Instead of appending to the file, can you put a marker on the 127.0.0.1 line and replace it inline?

Not so good if hostname isn't set?

Cheers,

Richard

#4 lore raw
Quoted 8 lines · Richard Purdie
Quoted 7 lines · Ross
Quoted 5 lines · Chen Qi
        if [ "${hostname}" ]; then
                echo ${hostname} > ${D}${sysconfdir}/hostname

+ echo "127.0.1.1 ${hostname}" >>
${D}${sysconfdir}/hosts
fi

Quoted 4 lines
Quoted 2 lines

Instead of appending to the file, can you put a marker on the 127.0.0.1 line and replace it inline?

Not so good if hostname isn't set?

hostname = "${MACHINE}"

Hostname is always set. :)

Ross

#5 lore raw
Quoted 11 lines · Ross
Quoted 9 lines · Richard Purdie
Quoted 8 lines · Ross
Quoted 5 lines · Chen Qi
        if [ "${hostname}" ]; then
                echo ${hostname} > ${D}${sysconfdir}/hostname

+ echo "127.0.1.1 ${hostname}" >>
${D}${sysconfdir}/hosts
fi

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Instead of appending to the file, can you put a marker on the 127.0.0.1 line and replace it inline?

Not so good if hostname isn't set?

hostname = "${MACHINE}"

Hostname is always set. :)

Its the kind of thing people likely bbappend and change, or set from overrides. Which was one of the reasons I'm nervous about moving hosts to a different package in the first place...

Cheers,

RIchard

#6 lore raw
Quoted 9 lines · On Tue, 8 Jan 2019 at 12:47, <[email protected]> wrote:
Quoted 5 lines
Quoted 1 line

Not so good if hostname isn't set?

hostname = "${MACHINE}"

Hostname is always set. :)

Its the kind of thing people likely bbappend and change, or set from overrides. Which was one of the reasons I'm nervous about moving hosts to a different package in the first place...

In all those situation the hostname will be set, right? Is anyone actually going to bbappend/override the value to ""?

Ross

author
#7 lore raw
Quoted 4 lines · Ross
Quoted 3 lines · On Tue, 8 Jan 2019 at 12:47, <[email protected]> wrote:
Quoted 3 lines
Quoted 1 line

Not so good if hostname isn't set?

hostname = "${MACHINE}"

Quoted 9 lines
Quoted 4 lines
Quoted 1 line

Hostname is always set. :)

Its the kind of thing people likely bbappend and change, or set from overrides. Which was one of the reasons I'm nervous about moving hosts to a different package in the first place...

In all those situation the hostname will be set, right? Is anyone actually going to bbappend/override the value to ""?

Ross

We did so maybe two or three years ago, via a distro configuration file. We later removed this override. Also, the original codes in base-files are:

        if [ "${hostname}" ]; then
                echo ${hostname} > ${D}${sysconfdir}/hostname
        fi

So I just put the line in the check.

Best Regards,
Chen Qi

#8 lore raw
In reply to Chen Qi
Quoted 46 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Chen Qi
Sent: den 8 januari 2019 10:13
To: [email protected]
Subject: [OE-core] [PATCH 1/1] netbase/base-files: move /etc/hosts from netbase to base-files

Move /etc/hosts to base-files, and also add entry to it according to hostname setting. This fixes the problem of commands like `hostname -f' failing due to lack of such entry.

---
 meta/recipes-core/{netbase/netbase => base-files/base-files}/hosts | 0
 meta/recipes-core/base-files/base-files_3.0.14.bb                  | 5 ++++-
 meta/recipes-core/netbase/netbase_5.5.bb                           | 6 +-----
 3 files changed, 5 insertions(+), 6 deletions(-)
 rename meta/recipes-core/{netbase/netbase => base-files/base-files}/hosts (100%)
meta/recipes-core/base-files/base-files/hosts renamed from meta/recipes-core/netbase/netbase/hosts +0 -0
similarity index 100%
rename from meta/recipes-core/netbase/netbase/hosts
rename to meta/recipes-core/base-files/base-files/hosts
meta/recipes-core/base-files/base-files_3.0.14.bb +0 -0
index 6e75652..6e30c14 100644
@@ -13,6 +13,7 @@ LIC_FILES_CHKSUM = "file://licenses/GPL-

2;md5=94d55d512a9ba36caa9b7df079bae19f"

 SRC_URI = "file://rotation \
            file://nsswitch.conf \
            file://motd \
meta/recipes-core/base-files/base-files_3.0.14.bb +2 -0
+           file://hosts \
            file://host.conf \
            file://profile \
            file://shells \
@@ -113,6 +114,7 @@ do_install () {
 	ln -snf ../run ${D}${localstatedir}/run
 	ln -snf ../run/lock ${D}${localstatedir}/lock
 
+	install -m 0644 ${WORKDIR}/hosts ${D}${sysconfdir}/hosts
 	${BASEFILESISSUEINSTALL}
 
 	rotation=`cat ${WORKDIR}/rotation`

meta/recipes-core/base-files/base-files_3.0.14.bb DISTRO_VERSION[vardepsexclude] += "DATE" · line 145

Quoted 4 lines
meta/recipes-core/base-files/base-files_3.0.14.bb +1 -0
@@ -140,6 +142,7 @@ DISTRO_VERSION[vardepsexclude] += "DATE"
 do_install_basefilesissue () {
 	if [ "${hostname}" ]; then
 		echo ${hostname} > ${D}${sysconfdir}/hostname
+		echo "127.0.1.1 ${hostname}" >> ${D}${sysconfdir}/hosts

Should this check the ipv4 DISTRO_FEATURE?
What about IPv6?

meta/recipes-core/base-files/base-files_3.0.14.bb FILES_${PN}-doc = "${docdir} ${datadir}/common-licenses" · line 183

Quoted 9 lines
meta/recipes-core/base-files/base-files_3.0.14.bb +1 -1
 	fi
 
 	install -m 644 ${WORKDIR}/issue*  ${D}${sysconfdir}
@@ -177,5 +180,5 @@ FILES_${PN}-doc = "${docdir} ${datadir}/common-licenses"
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
-CONFFILES_${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname'][(d.getVar('hostname') != '')]} ${sysconfdir}/shells"
+CONFFILES_${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname ${sysconfdir}/hosts'][(d.getVar('hostname') != '')]} ${sysconfdir}/shells"

A bit more readable:

CONFFILES_${PN} = "${sysconfdir}/fstab ${@'${sysconfdir}/hostname ${sysconfdir}/hosts' if d.getVar('hostname') else ''} ${sysconfdir}/shells"

Quoted 29 lines
meta/recipes-core/base-files/base-files_3.0.14.bb +0 -0
 CONFFILES_${PN} += "${sysconfdir}/motd ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile"
meta/recipes- renamed from meta/recipes-core/netbase/netbase_5.5.bb +0 -0

core/netbase/netbase_5.5.bb
index 2061f86..eb53add 100644

meta/recipes-core/netbase/netbase_5.5.bb +0 -0
@@ -7,8 +7,7 @@ LIC_FILES_CHKSUM =

"file://debian/copyright;md5=3dd6192d306f582dee7687da3d8748ab
PE = "1"

SRC_URI = "${DEBIAN_MIRROR}/main/n/${BPN}/${BPN}_${PV}.tar.xz \

meta/recipes-core/netbase/netbase_5.5.bb +1 -6
-           file://netbase-add-rpcbind-as-an-alias-to-sunrpc.patch \
-           file://hosts"
+           file://netbase-add-rpcbind-as-an-alias-to-sunrpc.patch"
 
 SRC_URI[md5sum] = "15f2d9b3783802f7f48f6734b6540ac4"
 SRC_URI[sha256sum] = "309bddc69a43b98e5a450992b70cdfc0e3d1afb9107bc631d04b0714be98f88b"
@@ -16,10 +15,7 @@ SRC_URI[sha256sum] = "309bddc69a43b98e5a450992b70cdfc0e3d1afb9107bc631d04b0714be
 UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/n/netbase/"
 do_install () {
 	install -d ${D}/${mandir}/man8 ${D}${sysconfdir}
-	install -m 0644 ${WORKDIR}/hosts ${D}${sysconfdir}/hosts
 	install -m 0644 etc-rpc ${D}${sysconfdir}/rpc
 	install -m 0644 etc-protocols ${D}${sysconfdir}/protocols
 	install -m 0644 etc-services ${D}${sysconfdir}/services
 }
-
-CONFFILES_${PN} = "${sysconfdir}/hosts"
--
Quoted 1 line

1.9.1

//Peter

#9 lore raw

✗ patchtest: failure for netbase/base-files: move /etc/hosts from netbase to base-files

In reply to Chen Qi

== Series Details ==

Series: netbase/base-files: move /etc/hosts from netbase to base-files
Revision: 1
URL : https://patchwork.openembedded.org/series/15565/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue Series does not apply on top of target branch [test_series_merge_on_head]
Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at 65c419b8c4)

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe