Bug 13864

Summary: archiver class incompatible with dos2unix class
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Ahmed Hossam <Ahmed.Hossam>
Component: coreAssignee: Unassigned <unassigned>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: meta.mr.watcher, meta.watcher, randy.macleod, richard.purdie
Version: 2.6.4   
Target Milestone: 5.99   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know
Attachments:
Description Flags
Test files none

Description Ahmed Hossam 2020-04-08 23:25:30 UTC
The archiver class is incompatible with the dos2unix class as it tries applying patches without converting the line endings, this causes a failure in do_patch due to incorrect line endings, because archiver uses it's own unpack_and_patch task it doesn't pick up the task dependencies set by the dos2unix class.

A quick and dirty fix is to insert the dependency if the dos2unix class is included:
diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index e321a0e362..8d07ba71fa 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -374,6 +374,9 @@ python do_unpack_and_patch() {
 
     # Make sure gcc and kernel sources are patched only once
     if not (d.getVar('SRC_URI') == "" or is_work_shared(d)):
+        body = d.getVar('do_convert_crlf_to_lf', False)
+        if body:
+            bb.build.exec_func('do_convert_crlf_to_lf', d)
         bb.build.exec_func('do_patch', d)
 
     # Create the patches
Comment 1 Randy MacLeod 2020-04-09 14:57:38 UTC
The archiver class needs a re-write so we don't really want to work-around the issue. Could you add a test case to this defect so that when (if!) the re-write happens we can test your situation.
Comment 2 Ahmed Hossam 2020-04-30 13:55:10 UTC
Created attachment 4671 [details]
Test files

Test files, to run the test:
# Download the test zip
unzip test.zip 
git clone git://git.yoctoproject.org/poky -b thud --depth=1
source poky/oe-init-build-env 
bitbake-layers add-layer ../meta-bugTest/
bitbake example # Builds successfully
echo 'INHERIT+="archiver"' >>conf/local.conf # Enable archiver
bitbake example # Error in do_unpack_and_patch
Comment 3 Randy MacLeod 2023-10-30 15:37:31 UTC
Build move to 5.0 -- ../Randy
Comment 4 Randy MacLeod 2024-04-25 01:13:57 UTC
Bulk move of 5.0 medium importance issues to 5.99.
Move to 5.1 if you want to actively work on an issue.
Comment 5 Randy MacLeod 2024-04-25 01:23:14 UTC
Move to 5.99 since no one is actively working on this issue.
Move to 5.x if you start on a task, please.