Bug 5113

Summary: archive*.bbclass: need refactor
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Robert Yang <liezhi.yang>
Component: coreAssignee: Robert Yang <liezhi.yang>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: Medium CC: jessica.zhang, meta.mr.watcher, meta.watcher, richard.purdie, sgw, valentin.cobelea
Version: 1.5   
Target Milestone: 1.6 M4   
Hardware: x86   
OS: Multiple   
See Also: https://bugzilla.yoctoproject.org/show_bug.cgi?id=4986
https://bugzilla.yoctoproject.org/show_bug.cgi?id=5740
https://bugzilla.yoctoproject.org/show_bug.cgi?id=5730
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Bug Depends on:    
Bug Blocks: 5730, 5740    

Description Robert Yang 2013-09-04 09:07:32 UTC
We have this command in archiver.bbclass:

diff -Naur src_dir.org src_dir > files.diff

But there is no src_dir.org, the org should be a typo, it should be orig, but there is also no src_dir.orig.

This command is originally from sourcepkg.bbclass, but we had used it wrongly so we missed the src_dir.orig, as a result is that we put all the files in the files.diff now, this is incorrect.

Another thing which confuses me is the following code:

    distro = d.getVar('DISTRO',True) or ""
    dest = current_wd + '/' + distro + '/files'
    if not os.path.exists(dest):
        bb.utils.mkdirhier(dest)
    for i in os.listdir(current_wd):
        if os.path.isfile(i):
            try:
                shutil.copy(i, dest)
            except IOError:
                subprocess.call('fakeroot cp -rf ' + i + " " + dest, shell=True)

We copy the regular files from the top dir of ${S} to ${S}/poky/files/ directory, this is also from the sourcepkg.bbclass, I don't understand what is it used for, and I can't find its history from the git log, I'd like to remove it if you are fine with it.
Comment 1 Robert Yang 2013-09-11 06:10:48 UTC
After more investigations, a lot of problems are found int the following 4 classes:

archive-configured-source.bbclass
archive-original-source.bbclass
archive-patched-source.bbclass
archiver.bbclass

1) As said in the first comment, there is no src_dir.org, the org should be a typo, it should be orig, but there is also no src_dir.orig, it's not easy to fix it if we won't change a lot of the code.

2) As said in the first commit, the subprocess.call('fakeroot cp -rf ' + i + " " + dest, shell=True) is useless should be removed

3) There are a lot of duplicated code in the following 4 classes.

4) The task do_dumpdata_create_diff_gz is unreasonable, we should divide
   them into 2 tasks, do_dumpdata and do_create_diff_gz

5) It doesn't archive the native or gcc recipe, I think that we should.

6) The configuration isn't clear enough.

7) I think that the 3 archive-*-source.bbclass are not needed, we can put
   them into archiver.bbclass, and control the actions through the 
   configurations.

8) The work flow isn't reasonable

Generally speaking, it needs re-factor, but I don't think that it's a
good idea to re-work it at the moment, I'd like to do it in the next
release, so move it 1.6.