diff mbox series

ti-img-rogue-umlibs: use image path to avoid local path expansion

Message ID 20230629012145.407276-1-ricardo@foundries.io
State Rejected
Delegated to: Ryan Eatmon
Headers show
Series ti-img-rogue-umlibs: use image path to avoid local path expansion | expand

Commit Message

Ricardo Salveti June 29, 2023, 1:21 a.m. UTC
Provide a package file list based on the image path to avoid it later be
expanded by using the host system path.

Fixes a package QA error when files named similarly are provided by the
host system (e.g. /usr/bin/oclock is a match for /usr/bin/ocl*).

Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
---
 .../ti-img-rogue-umlibs_23.1.6404501.bb       | 21 ++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

Comments

Randolph Sapp June 29, 2023, 1:48 a.m. UTC | #1
On 6/28/23 20:21, Ricardo Salveti wrote:
> Provide a package file list based on the image path to avoid it later be
> expanded by using the host system path.
> 
> Fixes a package QA error when files named similarly are provided by the
> host system (e.g. /usr/bin/oclock is a match for /usr/bin/ocl*).
> 
> Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
> ---
>   .../ti-img-rogue-umlibs_23.1.6404501.bb       | 21 ++++++++++++-------
>   1 file changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/meta-ti-bsp/recipes-graphics/powervr-umlibs/ti-img-rogue-umlibs_23.1.6404501.bb b/meta-ti-bsp/recipes-graphics/powervr-umlibs/ti-img-rogue-umlibs_23.1.6404501.bb
> index c012859f..229fc081 100644
> --- a/meta-ti-bsp/recipes-graphics/powervr-umlibs/ti-img-rogue-umlibs_23.1.6404501.bb
> +++ b/meta-ti-bsp/recipes-graphics/powervr-umlibs/ti-img-rogue-umlibs_23.1.6404501.bb
> @@ -38,32 +38,39 @@ PACKAGECONFIG[vulkan] = ",,,${VULKAN_LIB_PACKAGES}"
>   PACKAGECONFIG[opencl] = ",,,${OPENCL_LIB_PACKAGES},libopencl-rogue-tools"
>   
>   def get_file_list(package_list_var, d):
> +    import os
> +    image_dir = d.getVar("D")
>       file_list = []
>       package_list = d.getVar(package_list_var)
>       if package_list:
>           for package in package_list.split():
>               package_files = d.getVar(f"FILES:{package}")
>               if package_files:
> -                file_list.append(package_files)
> +                for f in package_files.split():
> +                    if os.path.isabs(f):
> +                        f = '.' + f
> +                    if not f.startswith("./"):
> +                        f = './' + f
> +                    file_list.append(os.path.join(image_dir, f))
>       return " ".join(file_list)
>   
>   do_install:append() {
>       if ${@bb.utils.contains('PACKAGECONFIG', 'opengl', 'false', 'true', d)}; then
>           for file in ${@get_file_list('GLES_PACKAGES', d)}; do
> -            rm -rf ${D}/${file}
> -            rmdir --ignore-fail-on-non-empty $(dirname ${D}/${file})
> +            rm -rf ${file}
> +            rmdir --ignore-fail-on-non-empty $(dirname ${file})
>           done
>       fi
>       if ${@bb.utils.contains('PACKAGECONFIG', 'vulkan', 'false', 'true', d)}; then
>           for file in ${@get_file_list('VULKAN_PACKAGES', d)}; do
> -            rm -rf ${D}/${file}
> -            rmdir --ignore-fail-on-non-empty $(dirname ${D}/${file})
> +            rm -rf ${file}
> +            rmdir --ignore-fail-on-non-empty $(dirname ${file})
>           done
>       fi
>       if ${@bb.utils.contains('PACKAGECONFIG', 'opencl', 'false', 'true', d)}; then
>           for file in ${@get_file_list('OPENCL_PACKAGES', d)}; do
> -            rm -rf ${D}/${file}
> -            rmdir --ignore-fail-on-non-empty $(dirname ${D}/${file})
> +            rm -rf ${file}
> +            rmdir --ignore-fail-on-non-empty $(dirname ${file})
>           done
>       fi
>       if ${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'true', 'false', d)}; then


Hey, thanks for the patch. I believe this patch I submitted earlier 
should also solve the issue you were facing. It's still in the -next 
branches though.

https://lists.yoctoproject.org/g/meta-ti/message/16790

Randolph
Ricardo Salveti June 29, 2023, 2:42 a.m. UTC | #2
On Wed, Jun 28, 2023 at 10:48 PM Randolph Sapp <rs@ti.com> wrote:
>
> On 6/28/23 20:21, Ricardo Salveti wrote:
> > Provide a package file list based on the image path to avoid it later be
> > expanded by using the host system path.
> >
> > Fixes a package QA error when files named similarly are provided by the
> > host system (e.g. /usr/bin/oclock is a match for /usr/bin/ocl*).
> >
> > Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
> > ---
> >   .../ti-img-rogue-umlibs_23.1.6404501.bb       | 21 ++++++++++++-------
> >   1 file changed, 14 insertions(+), 7 deletions(-)
> >
> > diff --git a/meta-ti-bsp/recipes-graphics/powervr-umlibs/ti-img-rogue-umlibs_23.1.6404501.bb b/meta-ti-bsp/recipes-graphics/powervr-umlibs/ti-img-rogue-umlibs_23.1.6404501.bb
> > index c012859f..229fc081 100644
> > --- a/meta-ti-bsp/recipes-graphics/powervr-umlibs/ti-img-rogue-umlibs_23.1.6404501.bb
> > +++ b/meta-ti-bsp/recipes-graphics/powervr-umlibs/ti-img-rogue-umlibs_23.1.6404501.bb
> > @@ -38,32 +38,39 @@ PACKAGECONFIG[vulkan] = ",,,${VULKAN_LIB_PACKAGES}"
> >   PACKAGECONFIG[opencl] = ",,,${OPENCL_LIB_PACKAGES},libopencl-rogue-tools"
> >
> >   def get_file_list(package_list_var, d):
> > +    import os
> > +    image_dir = d.getVar("D")
> >       file_list = []
> >       package_list = d.getVar(package_list_var)
> >       if package_list:
> >           for package in package_list.split():
> >               package_files = d.getVar(f"FILES:{package}")
> >               if package_files:
> > -                file_list.append(package_files)
> > +                for f in package_files.split():
> > +                    if os.path.isabs(f):
> > +                        f = '.' + f
> > +                    if not f.startswith("./"):
> > +                        f = './' + f
> > +                    file_list.append(os.path.join(image_dir, f))
> >       return " ".join(file_list)
> >
> >   do_install:append() {
> >       if ${@bb.utils.contains('PACKAGECONFIG', 'opengl', 'false', 'true', d)}; then
> >           for file in ${@get_file_list('GLES_PACKAGES', d)}; do
> > -            rm -rf ${D}/${file}
> > -            rmdir --ignore-fail-on-non-empty $(dirname ${D}/${file})
> > +            rm -rf ${file}
> > +            rmdir --ignore-fail-on-non-empty $(dirname ${file})
> >           done
> >       fi
> >       if ${@bb.utils.contains('PACKAGECONFIG', 'vulkan', 'false', 'true', d)}; then
> >           for file in ${@get_file_list('VULKAN_PACKAGES', d)}; do
> > -            rm -rf ${D}/${file}
> > -            rmdir --ignore-fail-on-non-empty $(dirname ${D}/${file})
> > +            rm -rf ${file}
> > +            rmdir --ignore-fail-on-non-empty $(dirname ${file})
> >           done
> >       fi
> >       if ${@bb.utils.contains('PACKAGECONFIG', 'opencl', 'false', 'true', d)}; then
> >           for file in ${@get_file_list('OPENCL_PACKAGES', d)}; do
> > -            rm -rf ${D}/${file}
> > -            rmdir --ignore-fail-on-non-empty $(dirname ${D}/${file})
> > +            rm -rf ${file}
> > +            rmdir --ignore-fail-on-non-empty $(dirname ${file})
> >           done
> >       fi
> >       if ${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'true', 'false', d)}; then
>
> Hey, thanks for the patch. I believe this patch I submitted earlier
> should also solve the issue you were facing. It's still in the -next
> branches though.
>
> https://lists.yoctoproject.org/g/meta-ti/message/16790

Cool, didn't notice this one, and yeah, should also solve the same issue.

Thanks!
--
Ricardo Salveti
diff mbox series

Patch

diff --git a/meta-ti-bsp/recipes-graphics/powervr-umlibs/ti-img-rogue-umlibs_23.1.6404501.bb b/meta-ti-bsp/recipes-graphics/powervr-umlibs/ti-img-rogue-umlibs_23.1.6404501.bb
index c012859f..229fc081 100644
--- a/meta-ti-bsp/recipes-graphics/powervr-umlibs/ti-img-rogue-umlibs_23.1.6404501.bb
+++ b/meta-ti-bsp/recipes-graphics/powervr-umlibs/ti-img-rogue-umlibs_23.1.6404501.bb
@@ -38,32 +38,39 @@  PACKAGECONFIG[vulkan] = ",,,${VULKAN_LIB_PACKAGES}"
 PACKAGECONFIG[opencl] = ",,,${OPENCL_LIB_PACKAGES},libopencl-rogue-tools"
 
 def get_file_list(package_list_var, d):
+    import os
+    image_dir = d.getVar("D")
     file_list = []
     package_list = d.getVar(package_list_var)
     if package_list:
         for package in package_list.split():
             package_files = d.getVar(f"FILES:{package}")
             if package_files:
-                file_list.append(package_files)
+                for f in package_files.split():
+                    if os.path.isabs(f):
+                        f = '.' + f
+                    if not f.startswith("./"):
+                        f = './' + f
+                    file_list.append(os.path.join(image_dir, f))
     return " ".join(file_list)
 
 do_install:append() {
     if ${@bb.utils.contains('PACKAGECONFIG', 'opengl', 'false', 'true', d)}; then
         for file in ${@get_file_list('GLES_PACKAGES', d)}; do
-            rm -rf ${D}/${file}
-            rmdir --ignore-fail-on-non-empty $(dirname ${D}/${file})
+            rm -rf ${file}
+            rmdir --ignore-fail-on-non-empty $(dirname ${file})
         done
     fi
     if ${@bb.utils.contains('PACKAGECONFIG', 'vulkan', 'false', 'true', d)}; then
         for file in ${@get_file_list('VULKAN_PACKAGES', d)}; do
-            rm -rf ${D}/${file}
-            rmdir --ignore-fail-on-non-empty $(dirname ${D}/${file})
+            rm -rf ${file}
+            rmdir --ignore-fail-on-non-empty $(dirname ${file})
         done
     fi
     if ${@bb.utils.contains('PACKAGECONFIG', 'opencl', 'false', 'true', d)}; then
         for file in ${@get_file_list('OPENCL_PACKAGES', d)}; do
-            rm -rf ${D}/${file}
-            rmdir --ignore-fail-on-non-empty $(dirname ${D}/${file})
+            rm -rf ${file}
+            rmdir --ignore-fail-on-non-empty $(dirname ${file})
         done
     fi
     if ${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'true', 'false', d)}; then