From: Saul Wold <sgw@linux.intel.com>
To: Patches and discussions about the oe-core layer
<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 1/7] package_rpm: Add srpm function to this bbclass
Date: Tue, 13 Mar 2012 16:24:32 -0700 [thread overview]
Message-ID: <4F5FD730.6060705@linux.intel.com> (raw)
In-Reply-To: <de0b611934064b68e5eccec92a8e76eba7bb30ba.1331642569.git.xiaofeng.yan@windriver.com>
On 03/13/2012 05:52 AM, Xiaofeng Yan wrote:
> From: Xiaofeng Yan<xiaofeng.yan@windriver.com>
>
> Add a new function to archive source, patches and logs to a source rpm
> package. Every source rpm package will be deployed to
> ${DEPLOY_DIR}/sources/deploy-srpm.
>
> [YOCTO #1977]
>
> Signed-off-by: Xiaofeng Yan<xiaofeng.yan@windriver.com>
> ---
> meta/classes/package_rpm.bbclass | 63 ++++++++++++++++++++++++++++++++++++++
> 1 files changed, 63 insertions(+), 0 deletions(-)
>
> diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
> index 68313ec..b261a0e 100644
> --- a/meta/classes/package_rpm.bbclass
> +++ b/meta/classes/package_rpm.bbclass
> @@ -6,6 +6,7 @@ RPM="rpm"
> RPMBUILD="rpmbuild"
>
> PKGWRITEDIRRPM = "${WORKDIR}/deploy-rpms"
> +PKGWRITEDIRSRPM = "${DEPLOY_DIR}/sources/deploy-srpm"
>
> python package_rpm_fn () {
> d.setVar('PKGFN', d.getVar('PKG'))
> @@ -475,6 +476,37 @@ python write_specfile () {
> import textwrap
> import oe.packagedata
>
> + # append information for logs and patches to %prep
> + def add_prep(d,spec_files_bottom):
> + if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM':
> + spec_files_bottom.append('%%prep -n %s' % d.getVar('PN', True) )
> + spec_files_bottom.append('%s' % "echo \"include logs and patches, Please check them in SOURCES\"")
> + spec_files_bottom.append('')
> +
> + # get the name of tarball for sources, patches and logs
> + def get_tarballs(d):
> + if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM':
> + sourcelist=[]
> + workdir = d.getVar('WORKDIR',True)
> + print os.listdir(workdir)
> + for source in os.listdir(workdir):
> + if 'tar.gz' in source:
> + sourcelist.append(source)
> + return sourcelist
What happens here is there are some other tar.gz file in the WORKDIR?
Is there a way to ensure you just get the tarballs you are looking for?
> +
> + # append the name of tarball to key word 'SOURCE' in xxx.spec.
> + def tail_source(d,source_list=[],patch_list=None):
> + if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM':
> + source_number = 0
> + patch_number = 0
> + for source in source_list:
> + spec_preamble_top.append('Source' + str(source_number) + ': %s' % source)
> + source_number += 1
> + if patch_list:
> + for patch in patch_list:
> + print_deps(patch, "Patch" + str(patch_number), spec_preamble_top, d)
> + patch_number += 1
> +
> # We need a simple way to remove the MLPREFIX from the package name,
> # and dependency information...
> def strip_multilib(name, d):
> @@ -707,6 +739,8 @@ python write_specfile () {
> spec_preamble_bottom.append('License: %s' % splitlicense)
> spec_preamble_bottom.append('Group: %s' % splitsection)
>
> + source_list = get_tarballs(d)
> + tail_source(d,source_list,None)
> # Replaces == Obsoletes&& Provides
> if splitrreplaces and splitrreplaces.strip() != "":
> for dep in splitrreplaces.split(','):
> @@ -786,6 +820,7 @@ python write_specfile () {
> del localdata
> bb.utils.unlockfile(lf)
>
> + add_prep(d,spec_files_bottom)
> spec_preamble_top.append('Summary: %s' % srcsummary)
> spec_preamble_top.append('Name: %s' % srcname)
> spec_preamble_top.append('Version: %s' % srcversion)
> @@ -900,6 +935,25 @@ python write_specfile () {
> python do_package_rpm () {
> import os
>
> + def creat_srpm_dir(d):
> + if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM':
> + licenses = d.getVar('LICENSE', 1).replace('&', '|')
> + licenses = licenses.replace('(', '').replace(')', '')
> + clean_licenses = ""
> + for x in licenses.split():
> + if x.strip() == '' or x == 'CLOSED':
What about "Proprietary"
> + continue
> + if x != "|":
> + clean_licenses += x
> + if '|' in clean_licenses:
> + clean_licenses = clean_licenses.replace('|','')
> +
Maybe this spinet should be a function in license.bbclass? Maybe it's
there already, or is this too RPM specific?
> + pkgwritesrpmdir = bb.data.expand('${PKGWRITEDIRSRPM}/${PACKAGE_ARCH_EXTEND}', d)
> + pkgwritesrpmdir = pkgwritesrpmdir + '/' + clean_licenses
> + bb.mkdirhier(pkgwritesrpmdir)
> + os.chmod(pkgwritesrpmdir, 0755)
> + return pkgwritesrpmdir
> +
> # We need a simple way to remove the MLPREFIX from the package name,
> # and dependency information...
> def strip_multilib(name, d):
> @@ -1015,8 +1069,17 @@ python do_package_rpm () {
> cmd = cmd + " --define 'debug_package %{nil}'"
> cmd = cmd + " --define '_rpmfc_magic_path " + magicfile + "'"
> cmd = cmd + " --define '_tmppath " + workdir + "'"
> + if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM':
> + cmdsrpm = cmd + " --define '_sourcedir " + workdir + "' --define '_srcrpmdir " + creat_srpm_dir(d) + "'"
> + cmdsrpm = 'fakeroot ' + cmdsrpm + " -bs " + outspecfile
> cmd = cmd + " -bb " + outspecfile
>
> + # Build the source rpm package !
> + if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM':
> + d.setVar('SBUILDSPEC', cmdsrpm + "\n")
> + d.setVarFlag('SBUILDSPEC', 'func', '1')
> + bb.build.exec_func('SBUILDSPEC', d)
> +
> # Build the rpm package!
> d.setVar('BUILDSPEC', cmd + "\n")
> d.setVarFlag('BUILDSPEC', 'func', '1')
next prev parent reply other threads:[~2012-03-13 23:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-13 12:52 [PATCH 0/7] Realize archiving functions Xiaofeng Yan
2012-03-13 12:52 ` [PATCH 1/7] package_rpm: Add srpm function to this bbclass Xiaofeng Yan
2012-03-13 23:24 ` Saul Wold [this message]
2012-03-14 12:27 ` Xiaofeng Yan
2012-03-13 12:52 ` [PATCH 2/7] archiver.bbclass: New bbclass for archiving sources, patches, logs and scripts Xiaofeng Yan
2012-03-14 2:57 ` Saul Wold
2012-03-14 12:30 ` Xiaofeng Yan
2012-03-13 12:52 ` [PATCH 3/7] archive-patched-source.bbclass: Archive patched source Xiaofeng Yan
2012-03-13 12:52 ` [PATCH 4/7] archive-configured-source.bbclass: Archive configured source Xiaofeng Yan
2012-03-13 12:52 ` [PATCH 5/7] archive-original-source.bbclass: Archive original source Xiaofeng Yan
2012-03-13 12:52 ` [PATCH 6/7] local.conf.sample: Add set for archiving packages Xiaofeng Yan
2012-03-14 2:57 ` Saul Wold
2012-03-14 5:37 ` Xiaofeng Yan
2012-03-13 12:52 ` [PATCH 7/7] sourcepkg, src_distribute, src_distribute_local: remove three bbclass Xiaofeng Yan
-- strict thread matches above, loose matches on Subject: below --
2012-03-16 6:23 [PATCH 0/7] Realize archiving functions Xiaofeng Yan
2012-03-16 6:23 ` [PATCH 1/7] package_rpm: Add srpm function to this bbclass 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=4F5FD730.6060705@linux.intel.com \
--to=sgw@linux.intel.com \
--cc=openembedded-core@lists.openembedded.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.