Patchwork [4/4] scripts/postinst-intercepts: create separete hooks for multilib

login
register
mail settings
Submitter Laurentiu Palcu
Date April 25, 2013, 12:24 p.m.
Message ID <f0a9ef998eba08dce22e9a931e34f89c6c2c34e7.1366892003.git.laurentiu.palcu@intel.com>
Download mbox | patch
Permalink /patch/48881/
State New
Headers show

Comments

Laurentiu Palcu - April 25, 2013, 12:24 p.m.
When using multilib, the hooks for lib32/lib64 must be different because
the libdir/base_libdir point to different locations. Nothing has to be
done in the postinstalls for this. When a hook is installed, it will be
detected automatically if this is a ML package (from the libXX- package
prefix) and a separate hook will be created.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 scripts/postinst-intercepts/postinst_intercept |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
Mark Hatle - April 25, 2013, 1:51 p.m.
On 4/25/13 7:24 AM, Laurentiu Palcu wrote:
> When using multilib, the hooks for lib32/lib64 must be different because
> the libdir/base_libdir point to different locations. Nothing has to be
> done in the postinstalls for this. When a hook is installed, it will be
> detected automatically if this is a ML package (from the libXX- package
> prefix) and a separate hook will be created.
>
> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
> ---
>   scripts/postinst-intercepts/postinst_intercept |   18 ++++++++++++++++++
>   1 file changed, 18 insertions(+)
>
> diff --git a/scripts/postinst-intercepts/postinst_intercept b/scripts/postinst-intercepts/postinst_intercept
> index ed32f27..5969eba 100755
> --- a/scripts/postinst-intercepts/postinst_intercept
> +++ b/scripts/postinst-intercepts/postinst_intercept
> @@ -17,9 +17,27 @@
>
>   intercept_script=$INTERCEPT_DIR/$1 && shift
>   package_name=$1 && shift
> +mlprefix=$(echo $package_name|sed -rn 's/^(lib32|lib64|libx32)-.*/\1/p')

The mlprefix is theoretically arbitrary.  It would be better to base the parse 
list off of a given machines available multilibs.  If you can dump the multilib 
list from bitbake, that would be best.

> +# if the hook we want to install does not exist, then there's nothing we can do
>   [ -f "$intercept_script" ] || exit 1
>
> +# if the postinstall wanting to install the hook belongs to a multilib package,
> +# then we'd better have a separate hook for this because the default ${libdir} and
> +# ${base_libdir} will point to the wrong locations
> +if [ -n "$mlprefix" ]; then
> +	ml_intercept_script=$intercept_script-$mlprefix
> +	# if the multilib hook does not exist, create it from the default one
> +	if [ ! -f "$ml_intercept_script" ]; then
> +		cp $intercept_script $ml_intercept_script
> +
> +		# clear the ##PKGS: line and the already set variables
> +		[ -x "$ml_intercept_script" ] && sed -i -e "2,$(($#+1)) {/.*/d}" -e "/^##PKGS: .*/d" $ml_intercept_script
> +	fi
> +
> +	intercept_script=$ml_intercept_script
> +fi
> +
>   chmod +x "$intercept_script"
>
>   pkgs_line="$(cat $intercept_script|grep "##PKGS:")"
>
Laurentiu Palcu - April 25, 2013, 2:32 p.m.
On 04/25/2013 04:51 PM, Mark Hatle wrote:
> On 4/25/13 7:24 AM, Laurentiu Palcu wrote:
>> When using multilib, the hooks for lib32/lib64 must be different because
>> the libdir/base_libdir point to different locations. Nothing has to be
>> done in the postinstalls for this. When a hook is installed, it will be
>> detected automatically if this is a ML package (from the libXX- package
>> prefix) and a separate hook will be created.
>>
>> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
>> ---
>>   scripts/postinst-intercepts/postinst_intercept |   18 ++++++++++++++++++
>>   1 file changed, 18 insertions(+)
>>
>> diff --git a/scripts/postinst-intercepts/postinst_intercept b/scripts/postinst-intercepts/postinst_intercept
>> index ed32f27..5969eba 100755
>> --- a/scripts/postinst-intercepts/postinst_intercept
>> +++ b/scripts/postinst-intercepts/postinst_intercept
>> @@ -17,9 +17,27 @@
>>
>>   intercept_script=$INTERCEPT_DIR/$1 && shift
>>   package_name=$1 && shift
>> +mlprefix=$(echo $package_name|sed -rn 's/^(lib32|lib64|libx32)-.*/\1/p')
> 
> The mlprefix is theoretically arbitrary.  It would be better to base the parse 
> list off of a given machines available multilibs.  If you can dump the multilib 
> list from bitbake, that would be best.
OK, I understand your concern... I could probably pass
mlprefix=${MLPREFIX} as a third argument to all calls to
postinst_intercept script instead. I'll rework it and send a v2.

Thanks,
Laurentiu

Patch

diff --git a/scripts/postinst-intercepts/postinst_intercept b/scripts/postinst-intercepts/postinst_intercept
index ed32f27..5969eba 100755
--- a/scripts/postinst-intercepts/postinst_intercept
+++ b/scripts/postinst-intercepts/postinst_intercept
@@ -17,9 +17,27 @@ 
 
 intercept_script=$INTERCEPT_DIR/$1 && shift
 package_name=$1 && shift
+mlprefix=$(echo $package_name|sed -rn 's/^(lib32|lib64|libx32)-.*/\1/p')
 
+# if the hook we want to install does not exist, then there's nothing we can do
 [ -f "$intercept_script" ] || exit 1
 
+# if the postinstall wanting to install the hook belongs to a multilib package,
+# then we'd better have a separate hook for this because the default ${libdir} and
+# ${base_libdir} will point to the wrong locations
+if [ -n "$mlprefix" ]; then
+	ml_intercept_script=$intercept_script-$mlprefix
+	# if the multilib hook does not exist, create it from the default one
+	if [ ! -f "$ml_intercept_script" ]; then
+		cp $intercept_script $ml_intercept_script
+
+		# clear the ##PKGS: line and the already set variables
+		[ -x "$ml_intercept_script" ] && sed -i -e "2,$(($#+1)) {/.*/d}" -e "/^##PKGS: .*/d" $ml_intercept_script
+	fi
+
+	intercept_script=$ml_intercept_script
+fi
+
 chmod +x "$intercept_script"
 
 pkgs_line="$(cat $intercept_script|grep "##PKGS:")"