Bug 1977

Summary: Realize source archiver class
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Xiaofeng Yan <Xiaofeng.yan>
Component: coreAssignee: Xiaofeng Yan <Xiaofeng.yan>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: Medium CC: david.nystrom, dvhart, liang.li2, liezhi.yang, mark.hatle, meta.mr.watcher, meta.watcher, richard.purdie, sgw, song.liu, wenzong.fan, yi.zhao
Version: 1.2   
Target Milestone: 1.2 M4   
Hardware: All   
OS: Multiple   
Whiteboard: (P2)(QA testing completed) Done
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Xiaofeng Yan 2012-02-09 21:55:07 UTC
We recently had the 2 different implementation (bug 1590 and 1655) suggested on the list to accomplish WORKDIR archiving along with the existing sourcepkg, distribute_src,copyleft_compliance and other possibly others.
There are two classes (src_distribute.bbclass and sourcepkg.bbclass) which have similar function as bug 1590 and 1655. So for avoiding repetition, We should use a new bb class (archiver.class) to merge same function in the above description instead of four or more bb class.
 
We are trying to tackle include a variety of legal and policy requirements.

This is a progression list of what the source archives should include:

1 - Original Upstream Archive & Patches
    - 2 archives (tarballs)
2 - Original Source code & Patches
    - could include additional code
    - post unpack
    - 1 archive
3 - Original Source code & Patches & temp (scripts & logs)
    - Could possibly include the .bb and .inc files
    - 2 archives (from #2 & temp tarball)
4 - Patched source code
    - original source code could be removed
    - post do_patch
5 - Patched source code & temp
    - 2 archives (from #4 & temp tarball)
6 - Configured Source
    - post do_configure
7 - SRPM format of Original Source & Patches
  - rpm will apply the patches
  - internally contains #2 above
8 - SRPM various of #3 above
Comment 1 Saul Wold 2012-02-21 14:04:19 UTC
*** Bug 1655 has been marked as a duplicate of this bug. ***
Comment 2 Saul Wold 2012-02-21 14:05:12 UTC
*** Bug 1590 has been marked as a duplicate of this bug. ***
Comment 3 Saul Wold 2012-03-14 18:53:16 UTC
*** Bug 2084 has been marked as a duplicate of this bug. ***
Comment 4 Xiaofeng Yan 2012-03-27 07:53:36 UTC
How to test archiver.bbclass

#Archiving packages configuration#

The following variables lists which files to archive and the package type to archive.
One bbclass of them (archive-original-source.bbclass,archive-configured-source.bbclass) should be inherited in a global bbclass, for example, inherit archive-original-source in packages_rpm.bbclass

Please copy the following parts to local.conf

# SOURCE_ARCHIVE_PACKAGE_TYPE = {'tar','srpm'}
SOURCE_ARCHIVE_PACKAGE_TYPE ?= 'tar'(or 'srpm')
#
# SOURCE_ARCHIVE_LOG_WITH_SCRIPTS = {'logs_with_scripts', 'logs'}
# String 'logs_with_scripts' include temp directory and .bb and .inc files
# String 'logs' only include temp 
SOURCE_ARCHIVE_LOG_WITH_SCRIPTS ?= 'logs_with_scripts'(or 'logs')
Comment 6 liang li 2012-03-28 03:09:46 UTC
verified on :
git info :  d3e0beed9eef53018158c9f999cd20b44629aa61 
git branch :poky/master

test env:
host os: ubuntu 11.10 x86_64
kernel : 
3.0.0-16-generic #29-Ubuntu SMP

test steps:
1. add following line to  path_to_git/meta/classes/package_rpm.bbclass
inherit archive-original-source
2. set build env,run "soruce ./oe-init-build-env builddir".
3. add following lines to conf/local.conf of builddir:
SOURCE_ARCHIVE_PACKAGE_TYPE ?= 'srpm'
SOURCE_ARCHIVE_LOG_WITH_SCRIPTS ?= 'logs_with_scripts'
4. run "bitbake core-image-sato" (MACHINE ?= "qemuppc" in conf/local.conf).

results below:
1. new subdir "tmp/deploy/sources" be found in builddir.
2. "gzip-1.4-r1.src.rpm" be found in "tmp/deploy/sources/deploy-srpm/ppc603e/GPLv3+/" subdir of builddir.
3. run "rpm -i gzip-1.4-r1.src.rpm" on a qemuppc sato-sdk target,following packages found in dir "/usr/src/rpm/SOURCES":
gzip-1.4-r1-script-logs.tar.gz
gzip-1.4.tar.gz 
4. extract "gzip-1.4-r1-script-logs.tar.gz" , logs (log.* and run.*) in temp subdir of gzip package in builddir be found,"gzip.inc" and "gzip_1.4.bb" be found.
5. extract "gzip-1.4.tar.gz" ,gzip source code be found.

next test will change status to verified.
Comment 7 liang li 2012-03-29 01:49:33 UTC
verified on :
git info :  d3e0beed9eef53018158c9f999cd20b44629aa61 
git branch :poky/master

I also have tried add following lines to path_to_git/meta/classes/package_rpm.bbclass just like discribed in Comment 4:
inherit archive-configured-source.bbclass

and tried add follwing choice in conf/local.conf just like discribed in Comment 4:
SOURCE_ARCHIVE_PACKAGE_TYPE ?= 'tar'
SOURCE_ARCHIVE_LOG_WITH_SCRIPTS ?= 'logs'

since no error found ,so verify it.