Bug 9169

Summary: add fix_buildpaths.bbclass to fix build path
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Hongxu Jia <hongxu.jia>
Component: coreAssignee: Hongxu Jia <hongxu.jia>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: Medium CC: liezhi.yang, meta.mr.watcher, meta.watcher, richard.purdie, sgw
Version: 2.2   
Target Milestone: 2.2 M3   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Yes (doc changes required)
Bug Depends on: 7058    
Bug Blocks:    

Description Hongxu Jia 2016-02-25 02:43:17 UTC
Description:
While do buildpaths QA checking, some files (such as Makefile) has
build path is reasonable, and we do not want the QA warning/error
output fot this file, so provide a way to ignore the checking.

Design:
Add variable QA_BUILDPATHS_SKIP_PATTERN to ignore buildpaths QA
while filename (do not include directory) matches patterns,
the patterns are Unix shell style and separated by space.

    Patterns are Unix shell style:
    
    *       matches everything
    ?       matches any single character
    [seq]   matches any character in seq
    [!seq]  matches any char not in seq
Comment 1 Richard Purdie 2016-02-25 15:44:04 UTC
I'm not convinced this is a good idea, we shouldn't ever be installing build paths into the target? The Makefile should be being processed to translate these to target paths?
Comment 2 Hongxu Jia 2016-03-03 03:04:29 UTC
Hi Richard,

Yes, I once tried to analyse 10+ recipes' Makefile which has build
path in it, and hope to find one way/solution to process these
Makefiles to remove build path, but it's hard to do it, always has
Makefile exceptional.

If we choose to fix each Makefile manually, it costs a lot of time.
And the Makefile usually installed to ptest package, the influence
is not big, that's why the buildpaths QA ignore pattern with Makefile
by default.

I once tried to ignore ptest package, but dropped by myself, it
has potential risk in ptest package if build paths exist in .a/.so

If you decide to process Makefile rather than ignore it, I will
work on it when other build path issues fixed. But I suggest
we keep the ignore pattern, because I found some build path
could not be remove (I will file another bug to trace the issue)

Suggestions?

Thanks
Hongxu
Comment 3 Hongxu Jia 2016-03-07 07:18:23 UTC
As Richard suggested, we do not add buildpaths QA ignore pattern.
In order to process the Makefile file with common solution, add
a bbclass to do that.

In fix_buildpaths.bbclass
1. It define variable PACKAGE_BUILDPATH_FILES which lists files that have
   --sysroot and -fdebug-prefix-map.

   If package has files need to remove --sysroot and -fdebug-prefix-map,
   inherit the bbclass and assign variable PACKAGE_BUILDPATH_FILES.
   These options will be removed at do_package time.

2. TODO
Comment 4 Hongxu Jia 2016-03-07 08:42:10 UTC
Update description:

1. Define variable PACKAGE_BUILDPATH_FILES to list files that have
build paths and need to remove.

2. Define variable PACKAGE_BUILDPATH_PATTERNS to list build path
patterns, which used by sed, it removes --sysroot and 
-fdebug-prefix-map in files listed in PACKAGE_BUILDPATH_FILES
by default.

3. Define python function to remove --sysroot and -fdebug-prefix-map
in variable.
Comment 5 Hongxu Jia 2016-07-29 02:16:03 UTC
Rejected by community, I think it is not a good idea.

So directly close it with won't fix