All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Yang <liezhi.yang@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 1/3] rpm: install external binary packages
Date: Mon, 20 Aug 2012 10:06:51 +0800	[thread overview]
Message-ID: <50319BBB.8090907@windriver.com> (raw)
In-Reply-To: <1345308918.27428.63.camel@ted>



On 08/19/2012 12:55 AM, Richard Purdie wrote:
> On Thu, 2012-08-16 at 16:27 +0800, Robert Yang wrote:
>> It's been suggested that it would be a useful feature to be able to
>> easily take a binary from a 3rd party software vendor and integrate
>> it into an image created by the build system.
>>
>> * The user can easily use this by:
>>    # Specify where is the external binary pkg dir
>>    #EXTERNAL_PACKAGE_DIR = "<path1> <path2> ..."
>>    # Specify which pkg will be installed
>>    #EXTERNAL_INSTALL_PACKAGE = "<pkg1> <pkg2> ..."
>>
>>    Then the pkg1, pkg2 ... would be installed.
>>
>>    Add an "EXTERNAL_INSTALL_PACKAGE"here since we can't use the existence
>>    variable (for example, IMAGE_INSTALL), if we add the pkg to the IMAGE_INSTALL,
>>    it would check whether the pkg is in the PROVIDES, and this is an external
>>    pkg, it is not in the PROVIDES.
>>
>> * Main changes:
>>    - Add external_package.bbclass:
>>      Add the external package to the repo, the package would be copied
>>      to deploy/rpm/external/<arch>.
>>
>>      Use an "external" directory since we don't want the "internal" pkgs
>>      to be mixed, and it would be easy to remove them.
>>
>>    - package_rpm.bbclass:
>>      Create repo for deploy/rpm/external
>>
>>    - rootfs_rpm.bbclass
>>      Add the package that would be installed to INSTALL_PACKAGES_RPM, so
>>      that it would be installed.
>>
>> [YOCTO #1592]
>>
>> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
>> ---
>>   meta/classes/external_package.bbclass | 42 +++++++++++++++++++++++++++++++++++
>>   meta/classes/image.bbclass            |  2 ++
>>   meta/classes/package_rpm.bbclass      | 12 +++++++---
>>   meta/classes/rootfs_rpm.bbclass       |  2 +-
>>   4 files changed, 54 insertions(+), 4 deletions(-)
>>   create mode 100644 meta/classes/external_package.bbclass
>
> This breaks on the autobuilder:
>
> http://autobuilder.yoctoproject.org:8010/builders/nightly/builds/634/steps/shell_42/logs/stdio
>

I'm sorry, this is because I just added the "inherit external_package"
to the image.bbclass and populate_sdk_base.bbclass, so the
"bitbake package-index" failed, I will send a V3 to add the "inherit
external_package" to each package_rpm/deb/ipk.bbclass rather than the
image.class and populate_sdk_base.bbclass.

// Robert



> Cheers,
>
> Richard
>
>
>> diff --git a/meta/classes/external_package.bbclass b/meta/classes/external_package.bbclass
>> new file mode 100644
>> index 0000000..e032bec
>> --- /dev/null
>> +++ b/meta/classes/external_package.bbclass
>> @@ -0,0 +1,42 @@
>> +#
>> +# ex:ts=4:sw=4:sts=4:et
>> +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
>> +#
>> +# Add external binary pkg to the repo and install them:
>> +#
>> +# Specify where are the external binary pkg dir
>> +#EXTERNAL_PACKAGE_DIR = "<path1> <path2> ..."
>> +# Specify which pkg will be installed
>> +#EXTERNAL_INSTALL_PACKAGE = "<pkg1> <pkg2> ..."
>> +
>> +#
>> +# Add the external binary rpm into the repo, copy the binary rpm files
>> +# from EXTERNAL_PACKAGE_DIR to ${DEPLOY_DIR_RPM}/external, and put them
>> +# to the relevant arch dir.
>> +#
>> +add_external_rpm () {
>> +    local supported_archs
>> +    supported_archs="$@"
>> +
>> +    # Clean the EXTERNAL_DIR_RPM dir and re-copy
>> +    [ ! -d "${EXTERNAL_DIR_RPM}" ] || rm -fr ${EXTERNAL_DIR_RPM}
>> +
>> +    if [ -n "${EXTERNAL_PACKAGE_DIR}" -a -n "${EXTERNAL_INSTALL_PACKAGE}" ]; then
>> +        echo "Adding external binary rpms to the repo ..."
>> +        for f in `find ${EXTERNAL_PACKAGE_DIR} -type f  -name '*.rpm'`; do
>> +            arch="`echo $f | awk -F\. '{print $(NF-1)}'`"
>> +            found=""
>> +            for archvar in $supported_archs; do
>> +                # Only pick up the supported arch's rpm
>> +                if [ "$arch" == "$archvar" ]; then
>> +                    [ -d "${EXTERNAL_DIR_RPM}/$arch" ] || mkdir -p ${EXTERNAL_DIR_RPM}/$arch
>> +                    cp -f $f ${EXTERNAL_DIR_RPM}/$arch/
>> +                    found="1"
>> +                    break
>> +                fi
>> +            done
>> +            [ -n "$found" ] || echo "Uknown arch $arch"
>> +        done
>> +    fi
>> +}
>> +
>> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
>> index 72720f1..283688a 100644
>> --- a/meta/classes/image.bbclass
>> +++ b/meta/classes/image.bbclass
>> @@ -5,6 +5,8 @@ inherit imagetest-${IMAGETEST}
>>
>>   inherit populate_sdk_base
>>
>> +inherit external_package
>> +
>>   TOOLCHAIN_TARGET_TASK += "${PACKAGE_INSTALL}"
>>   TOOLCHAIN_TARGET_TASK_ATTEMPTONLY += "${PACKAGE_INSTALL_ATTEMPTONLY}"
>>   POPULATE_SDK_POST_TARGET_COMMAND += "rootfs_install_complementary populate_sdk; "
>> diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
>> index b58ae85..bd2c9a2 100644
>> --- a/meta/classes/package_rpm.bbclass
>> +++ b/meta/classes/package_rpm.bbclass
>> @@ -7,6 +7,7 @@ RPMBUILD="rpmbuild"
>>
>>   PKGWRITEDIRRPM = "${WORKDIR}/deploy-rpms"
>>   PKGWRITEDIRSRPM = "${DEPLOY_DIR}/sources/deploy-srpm"
>> +EXTERNAL_DIR_RPM = "${DEPLOY_DIR_RPM}/external"
>>
>>   python package_rpm_fn () {
>>       d.setVar('PKGFN', d.getVar('PKG'))
>> @@ -26,6 +27,9 @@ package_update_index_rpm () {
>>   		return
>>   	fi
>>
>> +	# Add external binary pkgs
>> +	add_external_rpm ${PACKAGE_ARCHS} ${MULTILIB_PACKAGE_ARCHS} ${SDK_PACKAGE_ARCHS}
>> +
>>   	# Update target packages
>>   	base_archs="${PACKAGE_ARCHS}"
>>   	ml_archs="${MULTILIB_PACKAGE_ARCHS}"
>> @@ -44,9 +48,11 @@ package_update_index_rpm_common () {
>>   	for archvar in "$@"; do
>>   		eval archs=\${${archvar}}
>>   		packagedirs=""
>> -		for arch in $archs; do
>> -			packagedirs="${DEPLOY_DIR_RPM}/$arch $packagedirs"
>> -			rm -rf ${DEPLOY_DIR_RPM}/$arch/solvedb.done
>> +		for d in ${DEPLOY_DIR_RPM} ${EXTERNAL_DIR_RPM}; do
>> +			for arch in $archs; do
>> +				packagedirs="$d/$arch $packagedirs"
>> +				rm -rf $d/$arch/solvedb.done
>> +			done
>>   		done
>>
>>   		cat /dev/null > ${rpmconf_base}-${archvar}.conf
>> diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass
>> index c0207d8..7ce694c 100644
>> --- a/meta/classes/rootfs_rpm.bbclass
>> +++ b/meta/classes/rootfs_rpm.bbclass
>> @@ -51,7 +51,7 @@ fakeroot rootfs_rpm_do_rootfs () {
>>   	export INSTALL_ROOTFS_RPM="${IMAGE_ROOTFS}"
>>   	export INSTALL_PLATFORM_RPM="${TARGET_ARCH}"
>>   	export INSTALL_CONFBASE_RPM="${RPMCONF_TARGET_BASE}"
>> -	export INSTALL_PACKAGES_RPM="${PACKAGE_INSTALL}"
>> +	export INSTALL_PACKAGES_RPM="${PACKAGE_INSTALL} ${EXTERNAL_INSTALL_PACKAGE}"
>>   	export INSTALL_PACKAGES_ATTEMPTONLY_RPM="${PACKAGE_INSTALL_ATTEMPTONLY}"
>>   	export INSTALL_PACKAGES_LINGUAS_RPM="${LINGUAS_INSTALL}"
>>   	export INSTALL_PROVIDENAME_RPM=""
>
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
>



  reply	other threads:[~2012-08-20  2:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-16  8:27 [PATCH 0/3 V2] Install external binary packages Robert Yang
2012-08-16  8:27 ` [PATCH 1/3] rpm: install " Robert Yang
2012-08-18 16:55   ` Richard Purdie
2012-08-20  2:06     ` Robert Yang [this message]
2012-08-16  8:27 ` [PATCH 2/3] ipk: " Robert Yang
2012-08-16  9:40   ` Koen Kooi
2012-08-16 11:18     ` Robert Yang
2012-08-16  8:27 ` [PATCH 3/3] deb: " Robert Yang
2012-08-16 13:35 ` [PATCH 0/3 V2] Install " Robert Yang
  -- strict thread matches above, loose matches on Subject: below --
2012-08-15 15:32 [PATCH 0/3] " Robert Yang
2012-08-15 15:32 ` [PATCH 1/3] rpm: install " Robert Yang
2012-08-16  6:48   ` Robert Yang

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=50319BBB.8090907@windriver.com \
    --to=liezhi.yang@windriver.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.