Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/5] Misc fixes about hardcoding of paths
@ 2014-12-19  9:17 Chen Qi
  2014-12-19  9:17 ` [PATCH 1/5] busybox: fix " Chen Qi
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Chen Qi @ 2014-12-19  9:17 UTC (permalink / raw)
  To: openembedded-core

This patchset mainly fixes several hardcoding problems.

There's a bug in Yocto's bugzilla:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=7040
Bug 7040 - Support for /usr merge (à la systemd and Fedora)

I did some investigation and made it work for core-image-sato-sdk.

The solution is divided into two parts. One part is a custom layer which
has a custom distro file and a few bbappend files for base-files, busybox, etc.
I think the bbappend files are a little hacky and not suitable for OE.
The other part is this patchset. It fixes several hardcoding problems in OE.
I think this part is suitable for OE. That's why I sent it out.

//Chen Qi

The following changes since commit 8d0e56a850579f9a6d501266deeef9b257ce4780:

  serf: readded md5sum (2014-12-11 11:34:22 +0000)

are available in the git repository at:

  git://git.openembedded.org/openembedded-core-contrib ChenQi/hardcoding
  http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=ChenQi/hardcoding

Chen Qi (5):
  busybox: fix hardcoding of paths
  systemd: fix hardcoding of paths
  sed: test bindir and base_bindir before moving and removing things
  alsa-utils: fix FILES of alsa-utils-alsactl
  glibc-package.inc: fix order in PACKAGES

 meta/recipes-core/busybox/busybox.inc             | 66 +++++++++++++----------
 meta/recipes-core/glibc/glibc-package.inc         |  2 +-
 meta/recipes-core/systemd/systemd_216.bb          | 12 ++---
 meta/recipes-extended/sed/sed_4.1.2.bb            |  6 ++-
 meta/recipes-extended/sed/sed_4.2.2.bb            |  6 ++-
 meta/recipes-multimedia/alsa/alsa-utils_1.0.28.bb |  2 +-
 6 files changed, 55 insertions(+), 39 deletions(-)

-- 
1.9.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/5] busybox: fix hardcoding of paths
  2014-12-19  9:17 [PATCH 0/5] Misc fixes about hardcoding of paths Chen Qi
@ 2014-12-19  9:17 ` Chen Qi
  2014-12-19  9:17 ` [PATCH 2/5] systemd: " Chen Qi
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Chen Qi @ 2014-12-19  9:17 UTC (permalink / raw)
  To: openembedded-core

Instead of using paths like '/etc' and '/bin', we should use ${sysconfdir}
and ${base_bindir}.

Otherwise, when ${base_bindir} is not '/bin', there would be errors.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/recipes-core/busybox/busybox.inc | 66 +++++++++++++++++++++--------------
 1 file changed, 39 insertions(+), 27 deletions(-)

diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index bd66e4f..b853adc 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -178,6 +178,9 @@ do_install () {
 	if [ "${base_sbindir}" != "/sbin" ]; then
 		sed -i "s:^/sbin/:${base_sbindir}/:" busybox.links*
 	fi
+	if [ "${base_bindir}" != "/bin" ]; then
+		sed -i "s:^/bin/:${base_bindir}/:" busybox.links*
+	fi
 
 	install -d ${D}${sysconfdir}/init.d
 
@@ -319,6 +322,8 @@ python do_package_prepend () {
 
     dvar = d.getVar('D', True)
     pn = d.getVar('PN', True)
+    sysconfdir = d.getVar('sysconfdir', True)
+    base_bindir = d.getVar('base_bindir', True)
     def set_alternative_vars(links, target):
         f = open('%s%s' % (dvar, links), 'r')
         for alt_link_name in f:
@@ -334,11 +339,11 @@ python do_package_prepend () {
         f.close()
         return
 
-    if os.path.exists('%s/etc/busybox.links' % (dvar)):
-        set_alternative_vars("/etc/busybox.links", "/bin/busybox")
+    if os.path.exists('%s%s/busybox.links' % (dvar, sysconfdir)):
+        set_alternative_vars("%s/busybox.links" % sysconfdir, "%s/busybox" % base_bindir)
     else:
-        set_alternative_vars("/etc/busybox.links.nosuid", "/bin/busybox.nosuid")
-        set_alternative_vars("/etc/busybox.links.suid", "/bin/busybox.suid")
+        set_alternative_vars("%s/busybox.links.nosuid" % sysconfdir, "%s/busybox.nosuid" % base_bindir)
+        set_alternative_vars("%s/busybox.links.suid" % sysconfdir, "%s/busybox.suid" % base_bindir)
 }
 
 pkg_postinst_${PN} () {
@@ -350,22 +355,29 @@ pkg_postinst_${PN} () {
 	if test "x$D" = "x"; then
 		# Remove busybox.nosuid if it's a symlink, because this situation indicates
 		# that we're installing or upgrading to a one-binary busybox.
-		if test -h /bin/busybox.nosuid; then
-			rm -f /bin/busybox.nosuid
+		if test -h ${base_bindir}/busybox.nosuid; then
+			rm -f ${base_bindir}/busybox.nosuid
 		fi
 		for suffix in "" ".nosuid" ".suid"; do
-			if test -e /etc/busybox.links$suffix; then
+			if test -e ${sysconfdir}/busybox.links$suffix; then
 				while read link; do
 					if test ! -e "$link"; then
 						case "$link" in
-							/*/*/*)
-								to="../../bin/busybox$suffix"
+							${bindir}/*)
+								to="${@os.path.relpath('%s/busybox' % base_bindir, bindir)}"
+								to="$to$suffix"
+								;;
+							${sbindir}/*)
+								to="${@os.path.relpath('%s/busybox' % base_bindir, sbindir)}"
+								to="$to$suffix"
 								;;
-							/bin/*)
-								to="busybox$suffix"
+							${base_bindir}/*)
+								to="${@os.path.relpath('%s/busybox' % base_bindir, base_bindir)}"
+								to="$to$suffix"
 								;;
-							/*/*)
-								to="../bin/busybox$suffix"
+							${base_sbindir}/*)
+								to="${@os.path.relpath('%s/busybox' % base_bindir, base_sbindir)}"
+								to="$to$suffix"
 								;;
 						esac
 						# we can use busybox here because even if we are using splitted busybox
@@ -373,7 +385,7 @@ pkg_postinst_${PN} () {
 						busybox rm -f $link
 						busybox ln -s $to $link
 					fi
-				done < /etc/busybox.links$suffix
+				done < ${sysconfdir}/busybox.links$suffix
 			fi
 		done
 	fi
@@ -384,19 +396,19 @@ pkg_prerm_${PN} () {
 	# providing its files, this will make update-alternatives work, but the update-rc.d part
 	# for syslog, httpd and/or udhcpd will fail if there is no other package providing sh
 	tmpdir=`mktemp -d /tmp/busyboxrm-XXXXXX`
-	ln -s /bin/busybox $tmpdir/[
-	ln -s /bin/busybox $tmpdir/test
-	ln -s /bin/busybox $tmpdir/head
-	ln -s /bin/busybox $tmpdir/sh
-	ln -s /bin/busybox $tmpdir/basename
-	ln -s /bin/busybox $tmpdir/echo
-	ln -s /bin/busybox $tmpdir/mv
-	ln -s /bin/busybox $tmpdir/ln
-	ln -s /bin/busybox $tmpdir/dirname
-	ln -s /bin/busybox $tmpdir/rm
-	ln -s /bin/busybox $tmpdir/sed
-	ln -s /bin/busybox $tmpdir/sort
-	ln -s /bin/busybox $tmpdir/grep
+	ln -s ${base_bindir}/busybox $tmpdir/[
+	ln -s ${base_bindir}/busybox $tmpdir/test
+	ln -s ${base_bindir}/busybox $tmpdir/head
+	ln -s ${base_bindir}/busybox $tmpdir/sh
+	ln -s ${base_bindir}/busybox $tmpdir/basename
+	ln -s ${base_bindir}/busybox $tmpdir/echo
+	ln -s ${base_bindir}/busybox $tmpdir/mv
+	ln -s ${base_bindir}/busybox $tmpdir/ln
+	ln -s ${base_bindir}/busybox $tmpdir/dirname
+	ln -s ${base_bindir}/busybox $tmpdir/rm
+	ln -s ${base_bindir}/busybox $tmpdir/sed
+	ln -s ${base_bindir}/busybox $tmpdir/sort
+	ln -s ${base_bindir}/busybox $tmpdir/grep
 	export PATH=$PATH:$tmpdir
 }
 
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/5] systemd: fix hardcoding of paths
  2014-12-19  9:17 [PATCH 0/5] Misc fixes about hardcoding of paths Chen Qi
  2014-12-19  9:17 ` [PATCH 1/5] busybox: fix " Chen Qi
@ 2014-12-19  9:17 ` Chen Qi
  2014-12-19  9:17 ` [PATCH 3/5] sed: test bindir and base_bindir before moving and removing things Chen Qi
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Chen Qi @ 2014-12-19  9:17 UTC (permalink / raw)
  To: openembedded-core

Instead of using '/lib', we should use ${nonarch_lib_dir}.
Otherwise, when ${nonarch_lib_dir} is not /lib, there would be errors.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/recipes-core/systemd/systemd_216.bb | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/meta/recipes-core/systemd/systemd_216.bb b/meta/recipes-core/systemd/systemd_216.bb
index 536b7be..b90e739 100644
--- a/meta/recipes-core/systemd/systemd_216.bb
+++ b/meta/recipes-core/systemd/systemd_216.bb
@@ -87,7 +87,7 @@ EXTRA_OECONF = " --with-rootprefix=${rootprefix} \
                  --enable-split-usr \
                  --without-python \
                  --with-sysvrcnd-path=${sysconfdir} \
-                 --with-firmware-path=/lib/firmware \
+                 --with-firmware-path=${nonarch_base_libdir}/firmware \
                  ac_cv_path_KILL=${base_bindir}/kill \
                "
 # uclibc does not have NSS
@@ -260,10 +260,10 @@ FILES_${PN} = " ${base_bindir}/* \
                 ${exec_prefix}/lib/sysctl.d \
                 ${exec_prefix}/lib/sysusers.d \
                 ${localstatedir} \
-                /lib/udev/rules.d/70-uaccess.rules \
-                /lib/udev/rules.d/71-seat.rules \
-                /lib/udev/rules.d/73-seat-late.rules \
-                /lib/udev/rules.d/99-systemd.rules \
+                ${nonarch_base_libdir}/udev/rules.d/70-uaccess.rules \
+                ${nonarch_base_libdir}/udev/rules.d/71-seat.rules \
+                ${nonarch_base_libdir}/udev/rules.d/73-seat-late.rules \
+                ${nonarch_base_libdir}/udev/rules.d/99-systemd.rules \
                 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${sysconfdir}/pam.d', '', d)} \
                "
 
@@ -281,7 +281,7 @@ RRECOMMENDS_${PN} += "systemd-serialgetty systemd-compat-units udev-hwdb\
 
 PACKAGES =+ "udev-dbg udev udev-hwdb"
 
-FILES_udev-dbg += "/lib/udev/.debug"
+FILES_udev-dbg += "${nonarch_base_libdir}/udev/.debug"
 
 RPROVIDES_udev = "hotplug"
 
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/5] sed: test bindir and base_bindir before moving and removing things
  2014-12-19  9:17 [PATCH 0/5] Misc fixes about hardcoding of paths Chen Qi
  2014-12-19  9:17 ` [PATCH 1/5] busybox: fix " Chen Qi
  2014-12-19  9:17 ` [PATCH 2/5] systemd: " Chen Qi
@ 2014-12-19  9:17 ` Chen Qi
  2014-12-19  9:17 ` [PATCH 4/5] alsa-utils: fix FILES of alsa-utils-alsactl Chen Qi
  2014-12-19  9:17 ` [PATCH 5/5] glibc-package.inc: fix order in PACKAGES Chen Qi
  4 siblings, 0 replies; 6+ messages in thread
From: Chen Qi @ 2014-12-19  9:17 UTC (permalink / raw)
  To: openembedded-core

It's possible that ${base_bindir} and ${bindir} point to the same directory.
So we need to test it before moving things around or removing things.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/recipes-extended/sed/sed_4.1.2.bb | 6 ++++--
 meta/recipes-extended/sed/sed_4.2.2.bb | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/meta/recipes-extended/sed/sed_4.1.2.bb b/meta/recipes-extended/sed/sed_4.1.2.bb
index fe242e1..a2bcb7d 100644
--- a/meta/recipes-extended/sed/sed_4.1.2.bb
+++ b/meta/recipes-extended/sed/sed_4.1.2.bb
@@ -23,8 +23,10 @@ do_configure_prepend () {
 do_install () {
 	autotools_do_install
 	install -d ${D}${base_bindir}
-	mv ${D}${bindir}/sed ${D}${base_bindir}/sed
-	rmdir ${D}${bindir}/
+	if [ "${bindir}" != "${base_bindir}" ]; then
+	    mv ${D}${bindir}/sed ${D}${base_bindir}/sed
+	    rmdir ${D}${bindir}/
+	fi
 }
 
 ALTERNATIVE_${PN} = "sed"
diff --git a/meta/recipes-extended/sed/sed_4.2.2.bb b/meta/recipes-extended/sed/sed_4.2.2.bb
index ea39dae..1c49c12 100644
--- a/meta/recipes-extended/sed/sed_4.2.2.bb
+++ b/meta/recipes-extended/sed/sed_4.2.2.bb
@@ -22,8 +22,10 @@ EXTRA_OECONF = "--disable-acl \
 do_install () {
 	autotools_do_install
 	install -d ${D}${base_bindir}
-	mv ${D}${bindir}/sed ${D}${base_bindir}/sed
-	rmdir ${D}${bindir}/
+	if [ "${bindir}" != "${base_bindir}" ]; then
+	    mv ${D}${bindir}/sed ${D}${base_bindir}/sed
+	    rmdir ${D}${bindir}/
+	fi
 }
 
 ALTERNATIVE_${PN} = "sed"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/5] alsa-utils: fix FILES of alsa-utils-alsactl
  2014-12-19  9:17 [PATCH 0/5] Misc fixes about hardcoding of paths Chen Qi
                   ` (2 preceding siblings ...)
  2014-12-19  9:17 ` [PATCH 3/5] sed: test bindir and base_bindir before moving and removing things Chen Qi
@ 2014-12-19  9:17 ` Chen Qi
  2014-12-19  9:17 ` [PATCH 5/5] glibc-package.inc: fix order in PACKAGES Chen Qi
  4 siblings, 0 replies; 6+ messages in thread
From: Chen Qi @ 2014-12-19  9:17 UTC (permalink / raw)
  To: openembedded-core

Fix to use ${nonarch_base_libdir}/udev/rules.d instead of */udev/rules.d
to avoid the following QA warning.

ERROR: QA Issue: alsa-utils: Files/directories were installed but not shipped
  /usr/lib/udev
  /usr/lib/udev/rules.d
  /usr/lib/udev/rules.d/90-alsa-restore.rules [installed-vs-shipped]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/recipes-multimedia/alsa/alsa-utils_1.0.28.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-multimedia/alsa/alsa-utils_1.0.28.bb b/meta/recipes-multimedia/alsa/alsa-utils_1.0.28.bb
index 5f35d76..ecddd05 100644
--- a/meta/recipes-multimedia/alsa/alsa-utils_1.0.28.bb
+++ b/meta/recipes-multimedia/alsa/alsa-utils_1.0.28.bb
@@ -57,7 +57,7 @@ FILES_alsa-utils-midi        = "${bindir}/aplaymidi ${bindir}/arecordmidi ${bind
 FILES_alsa-utils-aconnect    = "${bindir}/aconnect"
 FILES_alsa-utils-aseqnet     = "${bindir}/aseqnet"
 FILES_alsa-utils-iecset      = "${bindir}/iecset"
-FILES_alsa-utils-alsactl     = "${sbindir}/alsactl */udev/rules.d ${systemd_unitdir} ${localstatedir}/lib/alsa ${datadir}/alsa/init/"
+FILES_alsa-utils-alsactl     = "${sbindir}/alsactl ${nonarch_base_libdir}/udev/rules.d ${systemd_unitdir} ${localstatedir}/lib/alsa ${datadir}/alsa/init/"
 FILES_alsa-utils-aseqdump    = "${bindir}/aseqdump"
 FILES_alsa-utils-alsaloop    = "${bindir}/alsaloop"
 FILES_alsa-utils-alsaucm     = "${bindir}/alsaucm"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5/5] glibc-package.inc: fix order in PACKAGES
  2014-12-19  9:17 [PATCH 0/5] Misc fixes about hardcoding of paths Chen Qi
                   ` (3 preceding siblings ...)
  2014-12-19  9:17 ` [PATCH 4/5] alsa-utils: fix FILES of alsa-utils-alsactl Chen Qi
@ 2014-12-19  9:17 ` Chen Qi
  4 siblings, 0 replies; 6+ messages in thread
From: Chen Qi @ 2014-12-19  9:17 UTC (permalink / raw)
  To: openembedded-core

FILES_${PN}-utils = "${bindir}/* ${sbindir}/*"
FILES_${PN} = "${libc_baselibs} ${libexecdir}/* ${@base_conditional('USE_LDCONFIG', '1', '${base_sbindir}/ldconfig ${sysconfdir}/ld.so.conf', '', d)}"

From the above two assignments, we can see that ${PN}-utils needs to be ordered
after ${PN} in the PACKAGES variable. Otherwise, ldconfig would be packaged into
${PN}-utils if ${base_sbindir} and ${sbindir} point to the same location.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/recipes-core/glibc/glibc-package.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-core/glibc/glibc-package.inc b/meta/recipes-core/glibc/glibc-package.inc
index 6212e5b..2a7a292 100644
--- a/meta/recipes-core/glibc/glibc-package.inc
+++ b/meta/recipes-core/glibc/glibc-package.inc
@@ -17,7 +17,7 @@ python __anonymous () {
 # Set this to zero if you don't want ldconfig in the output package
 USE_LDCONFIG ?= "1"
 
-PACKAGES = "${PN}-dbg catchsegv sln nscd ldd tzcode ${PN}-utils glibc-thread-db ${PN}-pic libcidn libmemusage libsegfault ${PN}-pcprofile libsotruss ${PN} glibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc"
+PACKAGES = "${PN}-dbg catchsegv sln nscd ldd tzcode glibc-thread-db ${PN}-pic libcidn libmemusage libsegfault ${PN}-pcprofile libsotruss ${PN} ${PN}-utils glibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc"
 
 # The ld.so in this glibc supports the GNU_HASH
 RPROVIDES_${PN} = "eglibc rtld(GNU_HASH)"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-12-19  9:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-19  9:17 [PATCH 0/5] Misc fixes about hardcoding of paths Chen Qi
2014-12-19  9:17 ` [PATCH 1/5] busybox: fix " Chen Qi
2014-12-19  9:17 ` [PATCH 2/5] systemd: " Chen Qi
2014-12-19  9:17 ` [PATCH 3/5] sed: test bindir and base_bindir before moving and removing things Chen Qi
2014-12-19  9:17 ` [PATCH 4/5] alsa-utils: fix FILES of alsa-utils-alsactl Chen Qi
2014-12-19  9:17 ` [PATCH 5/5] glibc-package.inc: fix order in PACKAGES Chen Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox