From: Mark Hatle <mark.hatle@windriver.com>
To: Xiaofeng Yan <xiaofeng.yan@windriver.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 2/2] tar_archive.bbclass: Package source codes and log files to tar package
Date: Mon, 9 Jan 2012 10:20:25 -0600 [thread overview]
Message-ID: <4F0B13C9.6090703@windriver.com> (raw)
In-Reply-To: <6161b957ee773a9a5b293ac9373ca0be07bb5665.1326003199.git.xiaofeng.yan@windriver.com>
On 1/8/12 1:11 AM, Xiaofeng Yan wrote:
> From: Xiaofeng Yan<xiaofeng.yan@windriver.com>
>
> Source rpm package needs tar package as its source codes. log files \
> are required as a part of source (description in bug 1655).
> So log files need be packaged as tar package too.
> User can select two types of package, the first is tar package and the second is src.rpm package.
> The option item is defined in conf/local.conf.(ARCHIVE_TYPE ?= "SRPM"(default) or ARCHIVE_TYPE ?= "TARGZ")
> if the option is the first type, then tar_archive.bbclass should be inherited in an suitable position.
> The tar packages(sources.tar.gz and log.tar.gz) will be created in workdir.
> if the option is the second type, then tar_archive.bbclass shoud be inherited in package_rpm.bbclass.
> The sources rpm packages will be created in workdir/deploy-srpm when building.
> The following command can ship all of source packages(src.rpm or tar.gz) to build/tmp/deploy/sources
> $bitbake core-image-sato -c copysources
>
> [YOCTO #1655]
>
> Signed-off-by: Xiaofeng Yan<xiaofeng.yan@windriver.com>
> ---
> meta/classes/tar_archive.bbclass | 216 ++++++++++++++++++++++++++++++++++++++
> 1 files changed, 216 insertions(+), 0 deletions(-)
> create mode 100644 meta/classes/tar_archive.bbclass
>
...
> +addtask do_logarchive after do_install before do_package
> +
> +# This is used for fixing the "Bad owner/group: ..."
> +# Set owner and group for patches, log.tar.gz and ${PF}.tar.gz to "root"
> +do_setowngroup[dirs] = "${WORKDIR}"
> +fakeroot python do_setowngroup(){
> + import os
> +
> + if not d.getVar('ARCHIVE_TYPE', True):
> + return
> + bb.build.exec_func('not_srpm', d)
> + if d.getVar('NOTSRPM', True):
> + return
> + bb.build.exec_func('get_patches', d)
> + srcpatches = d.getVar('PLIST',True)
> + for patch in srcpatches:
> + os.system('chown root.root' + ' ' + patch)
> + os.system('chown root.root' + ' ' + "log.tar.gz")
> + os.system('chown root.root' + ' ' + d.getVar('PF', True) + ".tar.gz")
> +}
Instead of the above during the creation of the tar archive, you should be able
to pass in --owner=root --group=root and tar will ignore the on-disk
permissions and set it based on the arguments.
> +addtask do_setowngroup after do_logarchive before do_package
> +
> +# Copy source package to build/tmp/deploy/sources
> +do_copysources[dirs] = "${PWD}/tmp/work"
> +python do_copysources (){
> + import os
> +
> + archive_type = d.getVar('ARCHIVE_TYPE', True)
> + pwd = d.getVar('PWD', True)
> + machine = d.getVar('MACHINE', True)
> + target_sys = d.getVar('TARGET_SYS', True)
> + target_os = d.getVar('TARGET_OS', True)
> + target_vendor = d.getVar('TARGET_VENDOR', True)
> + tune_pkgarch = d.getVar('TUNE_PKGARCH', True)
> + multimach_host_sys = d.getVar('MULTIMACH_HOST_SYS', True)
> + all = 'all' + target_vendor + '-' + 'linux'
> + target = tune_pkgarch + target_vendor + '-' + target_os
> + srpmdir=pwd + '/tmp/deploy/' + 'sources' + '/' + machine
> +
> + if not os.path.exists(srpmdir):
> + os.makedirs(srpmdir)
> + global_work = pwd + '/tmp' + '/work'
> + os.chdir(global_work)
> + for dirs in multimach_host_sys, all, target:
> + localdir = srpmdir + '/' + dirs
> + if not os.path.exists(localdir):
> + os.mkdir(localdir)
> + os.chdir(dirs)
> + if archive_type == 'SRPM':
> + os.system('cp */deploy-srpm/*/*.src.rpm ' + localdir)
> + elif archive_type == 'TARGZ':
> + for dir in os.listdir('.'):
> + if os.path.isdir(dir):
> + os.chdir(dir)
> + if not os.path.exists(dir):
> + os.mkdir(localdir + '/' + dir)
> + os.system('cp *.gz ' + localdir + '/' + dir)
> + os.chdir('../')
> + else:
> + return
> + os.chdir(global_work)
> +}
> +addtask do_copysources after do_rootfs
> +
> +EXPORT_FUNCTIONS do_archive do_logarchive do_setowngroup do_copysources
next prev parent reply other threads:[~2012-01-09 16:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-08 7:11 [PATCH 0/2] Add function to package source codes tree to source rpm and tar packages Xiaofeng Yan
2012-01-08 7:11 ` [PATCH 1/2] package_rpm.bbclass: add srpm function in spec file Xiaofeng Yan
2012-01-09 16:17 ` Mark Hatle
2012-01-10 8:02 ` Xiaofeng Yan
2012-01-08 7:11 ` [PATCH 2/2] tar_archive.bbclass: Package source codes and log files to tar package Xiaofeng Yan
2012-01-09 16:20 ` Mark Hatle [this message]
2012-01-12 20:04 ` [PATCH 0/2] Add function to package source codes tree to source rpm and tar packages Saul Wold
2012-01-13 10:01 ` Xiaofeng Yan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F0B13C9.6090703@windriver.com \
--to=mark.hatle@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=xiaofeng.yan@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox