Bug 5113 - archive*.bbclass: need refactor
Summary: archive*.bbclass: need refactor
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 1.5
Hardware: x86 Multiple
: Medium enhancement
Target Milestone: 1.6 M4
Assignee: Robert Yang
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks: 5730 5740
  Show dependency tree
 
Reported: 2013-09-04 09:07 UTC by Robert Yang
Modified: 2014-03-24 01:30 UTC (History)
6 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.