Skip to contentSkip to conversation

image-prelink: remove hardcoded reference to /usr/sbin

PATCH Applied Phil Blundell 3 participants 10 messages May 17, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 image-prelink: remove hardcoded reference to /usr/sbin

---
 meta/classes/image-prelink.bbclass |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
meta/classes/image-prelink.bbclass +1 -1
index ee0951c..cefd983 100644
@@ -21,7 +21,7 @@ prelink_image () {
 	fi
 
 	# prelink!
-	${STAGING_DIR_NATIVE}/usr/sbin/prelink --root ${IMAGE_ROOTFS} -amR
+	${STAGING_DIR_NATIVE}${sbindir}/prelink --root ${IMAGE_ROOTFS} -amR
 
 	# Remove the prelink.conf if we had to add it.
 	if [ "$dummy_prelink_conf" == "true" ]; then
Signature · 1 line
1.7.1
#1 lore raw
Quoted 9 lines · Phil Blundell
---
 meta/classes/image-prelink.bbclass |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
meta/classes/image-prelink.bbclass +0 -0
index ee0951c..cefd983 100644

meta/classes/image-prelink.bbclass prelink_image () { · line 27

Quoted 8 lines
meta/classes/image-prelink.bbclass +1 -1
@@ -21,7 +21,7 @@ prelink_image () {
 	fi
 
 	# prelink!
-	${STAGING_DIR_NATIVE}/usr/sbin/prelink --root ${IMAGE_ROOTFS} -amR
+	${STAGING_DIR_NATIVE}${sbindir}/prelink --root ${IMAGE_ROOTFS} -amR
 
 	# Remove the prelink.conf if we had to add it.
 	if [ "$dummy_prelink_conf" == "true" ]; then

I suspect this should be ${sbindir_native} there?

Cheers,

Richard

#2 lore raw
Quoted 12 lines · Richard Purdie
Quoted 11 lines · Phil Blundell
---
 meta/classes/image-prelink.bbclass |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
meta/classes/image-prelink.bbclass +0 -0
index ee0951c..cefd983 100644
@@ -21,7 +21,7 @@ prelink_image () {
 	fi
 
Quoted 8 lines

meta/classes/image-prelink.bbclass prelink_image () { · line 27

Quoted 6 lines
meta/classes/image-prelink.bbclass +1 -1
 	# prelink!
-	${STAGING_DIR_NATIVE}/usr/sbin/prelink --root ${IMAGE_ROOTFS} -amR
+	${STAGING_DIR_NATIVE}${sbindir}/prelink --root ${IMAGE_ROOTFS} -amR
 
 	# Remove the prelink.conf if we had to add it.
 	if [ "$dummy_prelink_conf" == "true" ]; then

I suspect this should be ${sbindir_native} there?

Ah yes, I guess it should. I'll verify that that works and send a new patch later.

On a similar subject, image-prelink also seems to assume that ${sysconfdir} == ${sysconfdir_native} == "/etc". That isn't actually causing me a problem at the moment, because the assumption does happen to hold for my configuration, but I guess it could do with fixing at some point.

p.

#3 lore raw

Re: [PATCH v2] image-prelink: remove hardcoded path assumptions

---
 meta/classes/image-prelink.bbclass |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)
meta/classes/image-prelink.bbclass +5 -8
index ee0951c..350c29d 100644
@@ -12,25 +12,22 @@ prelink_image () {
 	echo "Size before prelinking $pre_prelink_size."
 
 	# We need a prelink conf on the filesystem, add one if it's missing
-	if [ ! -e ${IMAGE_ROOTFS}/etc/prelink.conf ]; then
-		cp ${STAGING_DIR_NATIVE}/etc/prelink.conf \
-			${IMAGE_ROOTFS}/etc/prelink.conf
+	if [ ! -e ${IMAGE_ROOTFS}${sysconfdir}/prelink.conf ]; then
+		cp ${STAGING_DIR_NATIVE}${sysconfdir_native}/prelink.conf \
+			${IMAGE_ROOTFS}${sysconfdir}/prelink.conf
 		dummy_prelink_conf=true;
 	else
 		dummy_prelink_conf=false;
 	fi
 
 	# prelink!
-	${STAGING_DIR_NATIVE}/usr/sbin/prelink --root ${IMAGE_ROOTFS} -amR
+	${STAGING_DIR_NATIVE}${sbindir_native}/prelink --root ${IMAGE_ROOTFS} -amR -N -c ${sysconfdir}/prelink.conf
 
 	# Remove the prelink.conf if we had to add it.
 	if [ "$dummy_prelink_conf" == "true" ]; then
-		rm -f ${IMAGE_ROOTFS}/etc/prelink.conf
+		rm -f ${IMAGE_ROOTFS}${sysconfdir}/prelink.conf
 	fi
 
-	# Cleanup temporary file, it's not needed...
-	rm -f ${IMAGE_ROOTFS}/etc/prelink.cache
-
 	pre_prelink_size=`du -ks ${IMAGE_ROOTFS} | awk '{size = $1 ; print size }'`
 	echo "Size after prelinking $pre_prelink_size."
 }
Signature · 1 line
1.7.1
#4 lore raw

Re: [PATCH v2] image-prelink: remove hardcoded path assumptions

Quoted 27 lines · Phil Blundell
---
 meta/classes/image-prelink.bbclass |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)
meta/classes/image-prelink.bbclass +4 -4
index ee0951c..350c29d 100644
@@ -12,25 +12,22 @@ prelink_image () {
 	echo "Size before prelinking $pre_prelink_size."
 
 	# We need a prelink conf on the filesystem, add one if it's missing
-	if [ ! -e ${IMAGE_ROOTFS}/etc/prelink.conf ]; then
-		cp ${STAGING_DIR_NATIVE}/etc/prelink.conf \
-			${IMAGE_ROOTFS}/etc/prelink.conf
+	if [ ! -e ${IMAGE_ROOTFS}${sysconfdir}/prelink.conf ]; then
+		cp ${STAGING_DIR_NATIVE}${sysconfdir_native}/prelink.conf \
+			${IMAGE_ROOTFS}${sysconfdir}/prelink.conf
 		dummy_prelink_conf=true;
 	else
 		dummy_prelink_conf=false;
 	fi
 
 	# prelink!
-	${STAGING_DIR_NATIVE}/usr/sbin/prelink --root ${IMAGE_ROOTFS} -amR
+	${STAGING_DIR_NATIVE}${sbindir_native}/prelink --root ${IMAGE_ROOTFS} -amR -N -c ${sysconfdir}/prelink.conf

meta/classes/image-prelink.bbclass prelink_image () { · line 33

Quoted 10 lines
meta/classes/image-prelink.bbclass +1 -4
 
 	# Remove the prelink.conf if we had to add it.
 	if [ "$dummy_prelink_conf" == "true" ]; then
-		rm -f ${IMAGE_ROOTFS}/etc/prelink.conf
+		rm -f ${IMAGE_ROOTFS}${sysconfdir}/prelink.conf
 	fi
 
-	# Cleanup temporary file, it's not needed...
-	rm -f ${IMAGE_ROOTFS}/etc/prelink.cache
-

The patch description and what it does don't quite match (the rm is removed and options are added to prelink).

Cheers,

Richard

#5 lore raw

Re: [PATCH v2] image-prelink: remove hardcoded path assumptions

Quoted 10 lines · Richard Purdie
Quoted 9 lines · Phil Blundell
---
 meta/classes/image-prelink.bbclass |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)
meta/classes/image-prelink.bbclass +0 -0
index ee0951c..350c29d 100644

...

Quoted 3 lines
Quoted 3 lines
meta/classes/image-prelink.bbclass +1 -1
 	# prelink!
-	${STAGING_DIR_NATIVE}/usr/sbin/prelink --root ${IMAGE_ROOTFS} -amR
+	${STAGING_DIR_NATIVE}${sbindir_native}/prelink --root ${IMAGE_ROOTFS} -amR -N -c ${sysconfdir}/prelink.conf

...

Quoted 7 lines

meta/classes/image-prelink.bbclass prelink_image () { · line 33

Quoted 4 lines
meta/classes/image-prelink.bbclass +0 -3
-	# Cleanup temporary file, it's not needed...
-	rm -f ${IMAGE_ROOTFS}/etc/prelink.cache
-

The patch description and what it does don't quite match (the rm is removed and options are added to prelink).

I agree the commit message needs some more description. Just as an FYI. The -N option causes the prelinker to not generate/save the cache file. While the -c tells it to read a specific .conf file.

So the actual code changes are good, the description is the only thing that needs to be improved, so someone not familiar with the prelinker can understand the change.

--Mark

Quoted 9 lines

Cheers,

Richard

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

#6 lore raw

Re: [PATCH v2] image-prelink: remove hardcoded path assumptions

In reply to Richard Purdie
Quoted 2 lines · Richard Purdie

The patch description and what it does don't quite match (the rm is removed and options are added to prelink).

The added "-c ..." option is necessary in case ${sysconfdir_native} and ${sysconfdir} are not the same thing.

The "-N" tells prelink to not generate a cache file, which seems a better plan than having it generate one which we then have to delete. But I can drop that change, and/or send it as a separate patch if you prefer.

p.

#7 lore raw

Re: [PATCH v2] image-prelink: remove hardcoded path assumptions

Quoted 11 lines · Phil Blundell
Quoted 2 lines · Richard Purdie

The patch description and what it does don't quite match (the rm is removed and options are added to prelink).

The added "-c ..." option is necessary in case ${sysconfdir_native} and ${sysconfdir} are not the same thing.

The "-N" tells prelink to not generate a cache file, which seems a better plan than having it generate one which we then have to delete. But I can drop that change, and/or send it as a separate patch if you prefer.

I'm fine with the change, I'd just like the commit message to match :)

Cheers,

Richard

#8 lore raw

Re: [PATCH v3] image-prelink: remove hardcoded path assumptions, don't generate cache file

In reply to Phil Blundell

Pass -N option to prelink so that no cache file is generated (obviates need for deleting it afterwards). Use symbolic names, ${sysconfdir} et al., rather than hardcoded paths.
Pass explicit -c option to prelink in case ${sysconfdir} and ${sysconfdir_native} are different.

---
 meta/classes/image-prelink.bbclass |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)
meta/classes/image-prelink.bbclass +5 -8
index ee0951c..350c29d 100644
@@ -12,25 +12,22 @@ prelink_image () {
 	echo "Size before prelinking $pre_prelink_size."
 
 	# We need a prelink conf on the filesystem, add one if it's missing
-	if [ ! -e ${IMAGE_ROOTFS}/etc/prelink.conf ]; then
-		cp ${STAGING_DIR_NATIVE}/etc/prelink.conf \
-			${IMAGE_ROOTFS}/etc/prelink.conf
+	if [ ! -e ${IMAGE_ROOTFS}${sysconfdir}/prelink.conf ]; then
+		cp ${STAGING_DIR_NATIVE}${sysconfdir_native}/prelink.conf \
+			${IMAGE_ROOTFS}${sysconfdir}/prelink.conf
 		dummy_prelink_conf=true;
 	else
 		dummy_prelink_conf=false;
 	fi
 
 	# prelink!
-	${STAGING_DIR_NATIVE}/usr/sbin/prelink --root ${IMAGE_ROOTFS} -amR
+	${STAGING_DIR_NATIVE}${sbindir_native}/prelink --root ${IMAGE_ROOTFS} -amR -N -c ${sysconfdir}/prelink.conf
 
 	# Remove the prelink.conf if we had to add it.
 	if [ "$dummy_prelink_conf" == "true" ]; then
-		rm -f ${IMAGE_ROOTFS}/etc/prelink.conf
+		rm -f ${IMAGE_ROOTFS}${sysconfdir}/prelink.conf
 	fi
 
-	# Cleanup temporary file, it's not needed...
-	rm -f ${IMAGE_ROOTFS}/etc/prelink.cache
-
 	pre_prelink_size=`du -ks ${IMAGE_ROOTFS} | awk '{size = $1 ; print size }'`
 	echo "Size after prelinking $pre_prelink_size."
 }
Signature · 1 line
1.7.1
#9 lore raw

Re: [PATCH v3] image-prelink: remove hardcoded path assumptions, don't generate cache file

Quoted 8 lines · Phil Blundell

Pass -N option to prelink so that no cache file is generated (obviates need for deleting it afterwards). Use symbolic names, ${sysconfdir} et al., rather than hardcoded paths.
Pass explicit -c option to prelink in case ${sysconfdir} and ${sysconfdir_native} are different.

---
 meta/classes/image-prelink.bbclass |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

Merged to master (will be when it becomes accessible again), thanks.

Richard