2005-08-31 10:45:47 +00:00
|
|
|
inherit package
|
2008-08-18 08:01:41 +00:00
|
|
|
|
2006-09-19 09:04:09 +00:00
|
|
|
IMAGE_PKGTYPE ?= "rpm"
|
2005-08-31 10:45:47 +00:00
|
|
|
|
2010-09-03 17:43:41 +00:00
|
|
|
RPM="rpm"
|
|
|
|
RPMBUILD="rpmbuild"
|
2005-08-31 10:45:47 +00:00
|
|
|
|
2010-08-20 16:52:39 +00:00
|
|
|
PKGWRITEDIRRPM = "${WORKDIR}/deploy-rpms"
|
2012-03-26 10:49:23 +00:00
|
|
|
PKGWRITEDIRSRPM = "${DEPLOY_DIR}/sources/deploy-srpm"
|
2008-08-18 08:01:41 +00:00
|
|
|
|
2012-02-09 09:51:10 +00:00
|
|
|
# Maintaining the perfile dependencies has singificant overhead when writing the
|
|
|
|
# packages. When set, this value merges them for efficiency.
|
|
|
|
MERGEPERFILEDEPS = "1"
|
|
|
|
|
2010-08-22 05:44:21 +00:00
|
|
|
#
|
2012-11-29 15:43:16 +00:00
|
|
|
# Update the packages indexes ${DEPLOY_DIR_RPM}
|
2010-08-22 05:44:21 +00:00
|
|
|
#
|
|
|
|
package_update_index_rpm () {
|
2013-02-17 08:57:17 +00:00
|
|
|
if [ ! -z "${DEPLOY_KEEP_PACKAGES}" ]; then
|
2010-08-22 05:44:21 +00:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2012-11-30 22:11:37 +00:00
|
|
|
sdk_archs=`echo "${SDK_PACKAGE_ARCHS}" | tr - _`
|
|
|
|
|
|
|
|
target_archs=""
|
|
|
|
for i in ${MULTILIB_PREFIX_LIST} ; do
|
|
|
|
old_IFS="$IFS"
|
|
|
|
IFS=":"
|
|
|
|
set $i
|
|
|
|
IFS="$old_IFS"
|
|
|
|
shift # remove mlib
|
|
|
|
while [ -n "$1" ]; do
|
|
|
|
target_archs="$target_archs $1"
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
done
|
2011-08-01 16:56:37 +00:00
|
|
|
|
2012-11-30 22:11:37 +00:00
|
|
|
target_archs=`echo "$target_archs" | tr - _`
|
|
|
|
|
|
|
|
archs=`for arch in $target_archs $sdk_archs ; do
|
2012-11-29 15:43:16 +00:00
|
|
|
echo $arch
|
|
|
|
done | sort | uniq`
|
2011-08-01 16:56:37 +00:00
|
|
|
|
2013-02-17 08:57:17 +00:00
|
|
|
found=0
|
2012-11-29 15:43:16 +00:00
|
|
|
for arch in $archs; do
|
|
|
|
if [ -d ${DEPLOY_DIR_RPM}/$arch ] ; then
|
|
|
|
createrepo --update -q ${DEPLOY_DIR_RPM}/$arch
|
2013-02-17 08:57:17 +00:00
|
|
|
found=1
|
2012-11-29 15:43:16 +00:00
|
|
|
fi
|
2011-01-30 06:07:50 +00:00
|
|
|
done
|
2013-02-17 08:57:17 +00:00
|
|
|
if [ "$found" != "1" ]; then
|
|
|
|
bbfatal "There are no packages in ${DEPLOY_DIR_RPM}!"
|
|
|
|
fi
|
2010-08-22 05:44:21 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 04:04:46 +00:00
|
|
|
rpm_log_check() {
|
2012-08-20 16:52:21 +00:00
|
|
|
target="$1"
|
|
|
|
lf_path="$2"
|
|
|
|
|
|
|
|
lf_txt="`cat $lf_path`"
|
2012-12-10 16:55:03 +00:00
|
|
|
for keyword_die in "unpacking of archive failed" "Cannot find package" "exit 1" ERR Fail
|
2012-08-20 16:52:21 +00:00
|
|
|
do
|
|
|
|
if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
|
|
|
|
then
|
|
|
|
echo "log_check: There were error messages in the logfile"
|
2012-09-20 09:56:59 +00:00
|
|
|
printf "log_check: Matched keyword: [$keyword_die]\n\n"
|
2012-08-20 16:52:21 +00:00
|
|
|
echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die"
|
|
|
|
echo ""
|
|
|
|
do_exit=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
test "$do_exit" = 1 && exit 1
|
|
|
|
true
|
2011-01-30 04:04:46 +00:00
|
|
|
}
|
|
|
|
|
2012-11-30 22:11:37 +00:00
|
|
|
# Translate the RPM/Smart format names to the OE multilib format names
|
|
|
|
# Input via stdin (only the first item per line is converted!)
|
|
|
|
# Output via stdout
|
|
|
|
translate_smart_to_oe() {
|
|
|
|
arg1="$1"
|
|
|
|
|
|
|
|
# Dump installed packages
|
|
|
|
while read pkg arch other ; do
|
2012-12-11 22:05:49 +00:00
|
|
|
found=0
|
2012-11-30 22:11:37 +00:00
|
|
|
if [ -z "$pkg" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
new_pkg=$pkg
|
|
|
|
fixed_arch=`echo "$arch" | tr _ -`
|
|
|
|
for i in ${MULTILIB_PREFIX_LIST} ; do
|
|
|
|
old_IFS="$IFS"
|
|
|
|
IFS=":"
|
|
|
|
set $i
|
|
|
|
IFS="$old_IFS"
|
|
|
|
mlib="$1"
|
|
|
|
shift
|
|
|
|
while [ -n "$1" ]; do
|
|
|
|
cmp_arch=$1
|
|
|
|
shift
|
2013-03-02 01:14:57 +00:00
|
|
|
fixed_cmp_arch=`echo "$cmp_arch" | tr _ -`
|
|
|
|
if [ "$fixed_arch" = "$fixed_cmp_arch" ]; then
|
2012-11-30 22:11:37 +00:00
|
|
|
if [ "$mlib" = "default" ]; then
|
|
|
|
new_pkg="$pkg"
|
2012-12-14 22:40:33 +00:00
|
|
|
new_arch=$cmp_arch
|
2012-11-30 22:11:37 +00:00
|
|
|
else
|
|
|
|
new_pkg="$mlib-$pkg"
|
2012-12-14 22:40:33 +00:00
|
|
|
# We need to strip off the ${mlib}_ prefix on the arch
|
|
|
|
new_arch=${cmp_arch#${mlib}_}
|
2012-11-30 22:11:37 +00:00
|
|
|
fi
|
2012-12-11 22:05:49 +00:00
|
|
|
# Workaround for bug 3565
|
|
|
|
# Simply look to see if we know of a package with that name, if not try again!
|
|
|
|
filename=`ls ${TMPDIR}/pkgdata/*/runtime-reverse/$new_pkg 2>/dev/null | head -n 1`
|
|
|
|
if [ -n "$filename" ] ; then
|
|
|
|
found=1
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
# 'real' code
|
|
|
|
# found=1
|
|
|
|
# break
|
2012-11-30 22:11:37 +00:00
|
|
|
fi
|
|
|
|
done
|
2013-03-02 01:14:57 +00:00
|
|
|
if [ "$found" = "1" ] && [ "$fixed_arch" = "$fixed_cmp_arch" ]; then
|
2012-11-30 22:11:37 +00:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
#echo "$pkg -> $new_pkg" >&2
|
|
|
|
if [ "$arg1" = "arch" ]; then
|
2012-12-14 22:40:33 +00:00
|
|
|
echo $new_pkg $new_arch $other
|
2012-11-30 22:11:37 +00:00
|
|
|
else
|
|
|
|
echo $new_pkg $other
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
# Translate the OE multilib format names to the RPM/Smart format names
|
|
|
|
# Input via arguments
|
|
|
|
# Ouput via pkgs_to_install
|
|
|
|
translate_oe_to_smart() {
|
|
|
|
default_archs=""
|
|
|
|
sdk_mode=""
|
|
|
|
if [ "$1" = "--sdk" ]; then
|
|
|
|
shift
|
|
|
|
sdk_mode="true"
|
|
|
|
# Need to reverse the order of the SDK_ARCHS highest -> lowest priority
|
|
|
|
archs=`echo "${SDK_PACKAGE_ARCHS}" | tr - _`
|
|
|
|
for arch in $archs ; do
|
|
|
|
default_archs="$arch $default_archs"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
attemptonly="Error"
|
|
|
|
if [ "$1" = "--attemptonly" ]; then
|
|
|
|
attemptonly="Warning"
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Dump a list of all available packages
|
|
|
|
[ ! -e ${target_rootfs}/install/tmp/fullpkglist.query ] && smart --data-dir=${target_rootfs}/var/lib/smart query --output ${target_rootfs}/install/tmp/fullpkglist.query
|
|
|
|
|
|
|
|
pkgs_to_install=""
|
|
|
|
for pkg in "$@" ; do
|
|
|
|
new_pkg="$pkg"
|
|
|
|
if [ -z "$sdk_mode" ]; then
|
|
|
|
for i in ${MULTILIB_PREFIX_LIST} ; do
|
|
|
|
old_IFS="$IFS"
|
|
|
|
IFS=":"
|
|
|
|
set $i
|
|
|
|
IFS="$old_IFS"
|
|
|
|
mlib="$1"
|
|
|
|
shift
|
|
|
|
if [ "$mlib" = "default" ]; then
|
|
|
|
if [ -z "$default_archs" ]; then
|
|
|
|
default_archs=$@
|
|
|
|
fi
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
subst=${pkg#${mlib}-}
|
|
|
|
if [ "$subst" != "$pkg" ]; then
|
|
|
|
feeds=$@
|
|
|
|
while [ -n "$1" ]; do
|
|
|
|
arch="$1"
|
|
|
|
arch=`echo "$arch" | tr - _`
|
|
|
|
shift
|
|
|
|
if grep -q '^'$subst'-[^-]*-[^-]*@'$arch'$' ${target_rootfs}/install/tmp/fullpkglist.query ; then
|
|
|
|
new_pkg="$subst@$arch"
|
|
|
|
# First found is best match
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ "$pkg" = "$new_pkg" ]; then
|
|
|
|
# Failed to translate, package not found!
|
|
|
|
echo "$attemptonly: $pkg not found in the $mlib feeds ($feeds)." >&2
|
|
|
|
if [ "$attemptonly" = "Error" ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
# Apparently not a multilib package...
|
|
|
|
if [ "$pkg" = "$new_pkg" ]; then
|
|
|
|
default_archs_fixed=`echo "$default_archs" | tr - _`
|
|
|
|
for arch in $default_archs_fixed ; do
|
|
|
|
if grep -q '^'$pkg'-[^-]*-[^-]*@'$arch'$' ${target_rootfs}/install/tmp/fullpkglist.query ; then
|
|
|
|
new_pkg="$pkg@$arch"
|
|
|
|
# First found is best match
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ "$pkg" = "$new_pkg" ]; then
|
|
|
|
# Failed to translate, package not found!
|
|
|
|
echo "$attemptonly: $pkg not found in the base feeds ($default_archs)." >&2
|
|
|
|
if [ "$attemptonly" = "Error" ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
#echo "$pkg -> $new_pkg" >&2
|
|
|
|
pkgs_to_install="${pkgs_to_install} ${new_pkg}"
|
|
|
|
done
|
|
|
|
export pkgs_to_install
|
|
|
|
}
|
|
|
|
|
2011-01-30 06:07:50 +00:00
|
|
|
|
|
|
|
#
|
2012-08-21 06:48:48 +00:00
|
|
|
# Install a bunch of packages using rpm.
|
2012-11-29 15:43:16 +00:00
|
|
|
# There are two solutions in an image's FRESH generation:
|
|
|
|
# 1) main package solution
|
|
|
|
# 2) complementary solution
|
2012-08-21 06:48:48 +00:00
|
|
|
#
|
2012-11-29 15:43:16 +00:00
|
|
|
# It is different when incremental image generation is enabled:
|
|
|
|
# 1) The incremental image generation takes action during the main package
|
|
|
|
# installation, the previous installed complementary packages would
|
|
|
|
# usually be removed here, and the new complementary ones would be
|
|
|
|
# installed in the next step.
|
|
|
|
# 2) The complementary would always be installed since it is
|
|
|
|
# generated based on the first step's image.
|
2012-08-21 06:48:48 +00:00
|
|
|
#
|
2011-01-30 06:07:50 +00:00
|
|
|
# the following shell variables needs to be set before calling this func:
|
|
|
|
# INSTALL_ROOTFS_RPM - install root dir
|
2011-02-25 23:31:50 +00:00
|
|
|
# INSTALL_PLATFORM_RPM - main platform
|
|
|
|
# INSTALL_PLATFORM_EXTRA_RPM - extra platform
|
2011-11-08 06:19:37 +00:00
|
|
|
# INSTALL_PACKAGES_RPM - packages to be installed
|
2011-01-30 06:07:50 +00:00
|
|
|
# INSTALL_PACKAGES_ATTEMPTONLY_RPM - packages attemped to be installed only
|
|
|
|
# INSTALL_PACKAGES_LINGUAS_RPM - additional packages for uclibc
|
|
|
|
# INSTALL_PROVIDENAME_RPM - content for provide name
|
|
|
|
# INSTALL_TASK_RPM - task name
|
Rework installation of dev, dbg, doc, and locale packages
Use a similar mechanism that was previously used to install locales at
rootfs generation time to install other "complementary" packages (e.g.
*-dev packages) - i.e. install all of the explicitly requested packages
and their dependencies, then get a list of the packages that were
installed, and use that list to install the complementary packages. This
has been implemented by using a list of globs which should make it
easier to extend in future.
The previous locale package installation code assumed that the locale
packages did not have any dependencies that were not already installed;
now that we are installing non-locale packages this is no longer
correct. In practice only the rpm backend actually made use of this
assumption, so it needed to be changed to call into the existing package
backend code to do the complementary package installation rather than
calling rpm directly.
This fixes the doc-pkgs IMAGE_FEATURES feature to work correctly, and
also ensures that all dev/dbg packages get installed for
dev-pkgs/dbg-pkgs respectively even if the dependency chains between
those packages was not ensuring that already.
The code has also been adapted to work correctly with the new
SDK-from-image functionality. To that end, an SDKIMAGE_FEATURES variable
has been added to allow specifying what extra image features should go
into the SDK (extra, because by virtue of installing all of the packages
in the image into the target part of the SDK, we already include all of
IMAGE_FEATURES) with a default value of "dev-pkgs dbg-pkgs".
Fixes [YOCTO #2614].
(From OE-Core rev: 72d1048a8381fa4a8c4c0d082047536727b4be47)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-09 13:15:08 +00:00
|
|
|
# INSTALL_COMPLEMENTARY_RPM - 1 to enable complementary package install mode
|
2011-01-30 06:07:50 +00:00
|
|
|
|
|
|
|
package_install_internal_rpm () {
|
|
|
|
|
2012-11-29 15:43:16 +00:00
|
|
|
local target_rootfs="$INSTALL_ROOTFS_RPM"
|
|
|
|
local package_to_install="$INSTALL_PACKAGES_RPM"
|
|
|
|
local package_attemptonly="$INSTALL_PACKAGES_ATTEMPTONLY_RPM"
|
|
|
|
local package_linguas="$INSTALL_PACKAGES_LINGUAS_RPM"
|
|
|
|
local providename="$INSTALL_PROVIDENAME_RPM"
|
|
|
|
local task="$INSTALL_TASK_RPM"
|
|
|
|
|
2012-11-30 22:11:37 +00:00
|
|
|
local sdk_mode=""
|
|
|
|
if [ "$1" = "--sdk" ]; then
|
|
|
|
sdk_mode="--sdk"
|
|
|
|
fi
|
|
|
|
|
2012-11-29 15:43:16 +00:00
|
|
|
# Configure internal RPM environment when using Smart
|
|
|
|
export RPM_ETCRPM=${target_rootfs}/etc/rpm
|
|
|
|
|
|
|
|
# Setup temporary directory -- install...
|
2012-11-30 22:11:37 +00:00
|
|
|
rm -rf ${target_rootfs}/install
|
|
|
|
mkdir -p ${target_rootfs}/install/tmp
|
2011-01-30 06:07:50 +00:00
|
|
|
|
2012-11-30 22:11:37 +00:00
|
|
|
channel_priority=5
|
Rework installation of dev, dbg, doc, and locale packages
Use a similar mechanism that was previously used to install locales at
rootfs generation time to install other "complementary" packages (e.g.
*-dev packages) - i.e. install all of the explicitly requested packages
and their dependencies, then get a list of the packages that were
installed, and use that list to install the complementary packages. This
has been implemented by using a list of globs which should make it
easier to extend in future.
The previous locale package installation code assumed that the locale
packages did not have any dependencies that were not already installed;
now that we are installing non-locale packages this is no longer
correct. In practice only the rpm backend actually made use of this
assumption, so it needed to be changed to call into the existing package
backend code to do the complementary package installation rather than
calling rpm directly.
This fixes the doc-pkgs IMAGE_FEATURES feature to work correctly, and
also ensures that all dev/dbg packages get installed for
dev-pkgs/dbg-pkgs respectively even if the dependency chains between
those packages was not ensuring that already.
The code has also been adapted to work correctly with the new
SDK-from-image functionality. To that end, an SDKIMAGE_FEATURES variable
has been added to allow specifying what extra image features should go
into the SDK (extra, because by virtue of installing all of the packages
in the image into the target part of the SDK, we already include all of
IMAGE_FEATURES) with a default value of "dev-pkgs dbg-pkgs".
Fixes [YOCTO #2614].
(From OE-Core rev: 72d1048a8381fa4a8c4c0d082047536727b4be47)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-09 13:15:08 +00:00
|
|
|
if [ "${INSTALL_COMPLEMENTARY_RPM}" != "1" ] ; then
|
|
|
|
# Setup base system configuration
|
2012-12-01 18:51:06 +00:00
|
|
|
echo "Note: configuring RPM platform settings"
|
Rework installation of dev, dbg, doc, and locale packages
Use a similar mechanism that was previously used to install locales at
rootfs generation time to install other "complementary" packages (e.g.
*-dev packages) - i.e. install all of the explicitly requested packages
and their dependencies, then get a list of the packages that were
installed, and use that list to install the complementary packages. This
has been implemented by using a list of globs which should make it
easier to extend in future.
The previous locale package installation code assumed that the locale
packages did not have any dependencies that were not already installed;
now that we are installing non-locale packages this is no longer
correct. In practice only the rpm backend actually made use of this
assumption, so it needed to be changed to call into the existing package
backend code to do the complementary package installation rather than
calling rpm directly.
This fixes the doc-pkgs IMAGE_FEATURES feature to work correctly, and
also ensures that all dev/dbg packages get installed for
dev-pkgs/dbg-pkgs respectively even if the dependency chains between
those packages was not ensuring that already.
The code has also been adapted to work correctly with the new
SDK-from-image functionality. To that end, an SDKIMAGE_FEATURES variable
has been added to allow specifying what extra image features should go
into the SDK (extra, because by virtue of installing all of the packages
in the image into the target part of the SDK, we already include all of
IMAGE_FEATURES) with a default value of "dev-pkgs dbg-pkgs".
Fixes [YOCTO #2614].
(From OE-Core rev: 72d1048a8381fa4a8c4c0d082047536727b4be47)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-09 13:15:08 +00:00
|
|
|
mkdir -p ${target_rootfs}/etc/rpm/
|
2013-02-21 23:18:29 +00:00
|
|
|
echo "$INSTALL_PLATFORM_RPM" > ${target_rootfs}/etc/rpm/platform
|
2012-12-11 17:57:21 +00:00
|
|
|
|
2013-02-21 23:18:29 +00:00
|
|
|
if [ ! -z "$INSTALL_PLATFORM_EXTRA_RPM" ]; then
|
|
|
|
for pt in $INSTALL_PLATFORM_EXTRA_RPM ; do
|
2012-11-30 22:11:37 +00:00
|
|
|
channel_priority=$(expr $channel_priority + 5)
|
Rework installation of dev, dbg, doc, and locale packages
Use a similar mechanism that was previously used to install locales at
rootfs generation time to install other "complementary" packages (e.g.
*-dev packages) - i.e. install all of the explicitly requested packages
and their dependencies, then get a list of the packages that were
installed, and use that list to install the complementary packages. This
has been implemented by using a list of globs which should make it
easier to extend in future.
The previous locale package installation code assumed that the locale
packages did not have any dependencies that were not already installed;
now that we are installing non-locale packages this is no longer
correct. In practice only the rpm backend actually made use of this
assumption, so it needed to be changed to call into the existing package
backend code to do the complementary package installation rather than
calling rpm directly.
This fixes the doc-pkgs IMAGE_FEATURES feature to work correctly, and
also ensures that all dev/dbg packages get installed for
dev-pkgs/dbg-pkgs respectively even if the dependency chains between
those packages was not ensuring that already.
The code has also been adapted to work correctly with the new
SDK-from-image functionality. To that end, an SDKIMAGE_FEATURES variable
has been added to allow specifying what extra image features should go
into the SDK (extra, because by virtue of installing all of the packages
in the image into the target part of the SDK, we already include all of
IMAGE_FEATURES) with a default value of "dev-pkgs dbg-pkgs".
Fixes [YOCTO #2614].
(From OE-Core rev: 72d1048a8381fa4a8c4c0d082047536727b4be47)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-09 13:15:08 +00:00
|
|
|
case $pt in
|
2013-02-21 23:18:29 +00:00
|
|
|
noarch-* | any-* | all-*)
|
|
|
|
pt=$(echo $pt | sed "s,-linux.*$,-linux\.*,")
|
Rework installation of dev, dbg, doc, and locale packages
Use a similar mechanism that was previously used to install locales at
rootfs generation time to install other "complementary" packages (e.g.
*-dev packages) - i.e. install all of the explicitly requested packages
and their dependencies, then get a list of the packages that were
installed, and use that list to install the complementary packages. This
has been implemented by using a list of globs which should make it
easier to extend in future.
The previous locale package installation code assumed that the locale
packages did not have any dependencies that were not already installed;
now that we are installing non-locale packages this is no longer
correct. In practice only the rpm backend actually made use of this
assumption, so it needed to be changed to call into the existing package
backend code to do the complementary package installation rather than
calling rpm directly.
This fixes the doc-pkgs IMAGE_FEATURES feature to work correctly, and
also ensures that all dev/dbg packages get installed for
dev-pkgs/dbg-pkgs respectively even if the dependency chains between
those packages was not ensuring that already.
The code has also been adapted to work correctly with the new
SDK-from-image functionality. To that end, an SDKIMAGE_FEATURES variable
has been added to allow specifying what extra image features should go
into the SDK (extra, because by virtue of installing all of the packages
in the image into the target part of the SDK, we already include all of
IMAGE_FEATURES) with a default value of "dev-pkgs dbg-pkgs".
Fixes [YOCTO #2614].
(From OE-Core rev: 72d1048a8381fa4a8c4c0d082047536727b4be47)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-09 13:15:08 +00:00
|
|
|
;;
|
|
|
|
esac
|
2013-02-21 23:18:29 +00:00
|
|
|
echo "$pt" >> ${target_rootfs}/etc/rpm/platform
|
Rework installation of dev, dbg, doc, and locale packages
Use a similar mechanism that was previously used to install locales at
rootfs generation time to install other "complementary" packages (e.g.
*-dev packages) - i.e. install all of the explicitly requested packages
and their dependencies, then get a list of the packages that were
installed, and use that list to install the complementary packages. This
has been implemented by using a list of globs which should make it
easier to extend in future.
The previous locale package installation code assumed that the locale
packages did not have any dependencies that were not already installed;
now that we are installing non-locale packages this is no longer
correct. In practice only the rpm backend actually made use of this
assumption, so it needed to be changed to call into the existing package
backend code to do the complementary package installation rather than
calling rpm directly.
This fixes the doc-pkgs IMAGE_FEATURES feature to work correctly, and
also ensures that all dev/dbg packages get installed for
dev-pkgs/dbg-pkgs respectively even if the dependency chains between
those packages was not ensuring that already.
The code has also been adapted to work correctly with the new
SDK-from-image functionality. To that end, an SDKIMAGE_FEATURES variable
has been added to allow specifying what extra image features should go
into the SDK (extra, because by virtue of installing all of the packages
in the image into the target part of the SDK, we already include all of
IMAGE_FEATURES) with a default value of "dev-pkgs dbg-pkgs".
Fixes [YOCTO #2614].
(From OE-Core rev: 72d1048a8381fa4a8c4c0d082047536727b4be47)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-09 13:15:08 +00:00
|
|
|
done
|
|
|
|
fi
|
2011-01-30 06:07:50 +00:00
|
|
|
|
Rework installation of dev, dbg, doc, and locale packages
Use a similar mechanism that was previously used to install locales at
rootfs generation time to install other "complementary" packages (e.g.
*-dev packages) - i.e. install all of the explicitly requested packages
and their dependencies, then get a list of the packages that were
installed, and use that list to install the complementary packages. This
has been implemented by using a list of globs which should make it
easier to extend in future.
The previous locale package installation code assumed that the locale
packages did not have any dependencies that were not already installed;
now that we are installing non-locale packages this is no longer
correct. In practice only the rpm backend actually made use of this
assumption, so it needed to be changed to call into the existing package
backend code to do the complementary package installation rather than
calling rpm directly.
This fixes the doc-pkgs IMAGE_FEATURES feature to work correctly, and
also ensures that all dev/dbg packages get installed for
dev-pkgs/dbg-pkgs respectively even if the dependency chains between
those packages was not ensuring that already.
The code has also been adapted to work correctly with the new
SDK-from-image functionality. To that end, an SDKIMAGE_FEATURES variable
has been added to allow specifying what extra image features should go
into the SDK (extra, because by virtue of installing all of the packages
in the image into the target part of the SDK, we already include all of
IMAGE_FEATURES) with a default value of "dev-pkgs dbg-pkgs".
Fixes [YOCTO #2614].
(From OE-Core rev: 72d1048a8381fa4a8c4c0d082047536727b4be47)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-09 13:15:08 +00:00
|
|
|
# Tell RPM that the "/" directory exist and is available
|
2012-12-01 18:51:06 +00:00
|
|
|
echo "Note: configuring RPM system provides"
|
Rework installation of dev, dbg, doc, and locale packages
Use a similar mechanism that was previously used to install locales at
rootfs generation time to install other "complementary" packages (e.g.
*-dev packages) - i.e. install all of the explicitly requested packages
and their dependencies, then get a list of the packages that were
installed, and use that list to install the complementary packages. This
has been implemented by using a list of globs which should make it
easier to extend in future.
The previous locale package installation code assumed that the locale
packages did not have any dependencies that were not already installed;
now that we are installing non-locale packages this is no longer
correct. In practice only the rpm backend actually made use of this
assumption, so it needed to be changed to call into the existing package
backend code to do the complementary package installation rather than
calling rpm directly.
This fixes the doc-pkgs IMAGE_FEATURES feature to work correctly, and
also ensures that all dev/dbg packages get installed for
dev-pkgs/dbg-pkgs respectively even if the dependency chains between
those packages was not ensuring that already.
The code has also been adapted to work correctly with the new
SDK-from-image functionality. To that end, an SDKIMAGE_FEATURES variable
has been added to allow specifying what extra image features should go
into the SDK (extra, because by virtue of installing all of the packages
in the image into the target part of the SDK, we already include all of
IMAGE_FEATURES) with a default value of "dev-pkgs dbg-pkgs".
Fixes [YOCTO #2614].
(From OE-Core rev: 72d1048a8381fa4a8c4c0d082047536727b4be47)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-09 13:15:08 +00:00
|
|
|
mkdir -p ${target_rootfs}/etc/rpm/sysinfo
|
|
|
|
echo "/" >${target_rootfs}/etc/rpm/sysinfo/Dirnames
|
2012-11-29 15:43:16 +00:00
|
|
|
|
Rework installation of dev, dbg, doc, and locale packages
Use a similar mechanism that was previously used to install locales at
rootfs generation time to install other "complementary" packages (e.g.
*-dev packages) - i.e. install all of the explicitly requested packages
and their dependencies, then get a list of the packages that were
installed, and use that list to install the complementary packages. This
has been implemented by using a list of globs which should make it
easier to extend in future.
The previous locale package installation code assumed that the locale
packages did not have any dependencies that were not already installed;
now that we are installing non-locale packages this is no longer
correct. In practice only the rpm backend actually made use of this
assumption, so it needed to be changed to call into the existing package
backend code to do the complementary package installation rather than
calling rpm directly.
This fixes the doc-pkgs IMAGE_FEATURES feature to work correctly, and
also ensures that all dev/dbg packages get installed for
dev-pkgs/dbg-pkgs respectively even if the dependency chains between
those packages was not ensuring that already.
The code has also been adapted to work correctly with the new
SDK-from-image functionality. To that end, an SDKIMAGE_FEATURES variable
has been added to allow specifying what extra image features should go
into the SDK (extra, because by virtue of installing all of the packages
in the image into the target part of the SDK, we already include all of
IMAGE_FEATURES) with a default value of "dev-pkgs dbg-pkgs".
Fixes [YOCTO #2614].
(From OE-Core rev: 72d1048a8381fa4a8c4c0d082047536727b4be47)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-09 13:15:08 +00:00
|
|
|
if [ ! -z "$providename" ]; then
|
|
|
|
cat /dev/null > ${target_rootfs}/etc/rpm/sysinfo/Providename
|
|
|
|
for provide in $providename ; do
|
|
|
|
echo $provide >> ${target_rootfs}/etc/rpm/sysinfo/Providename
|
|
|
|
done
|
|
|
|
fi
|
2011-01-30 06:07:50 +00:00
|
|
|
|
2012-11-29 15:43:16 +00:00
|
|
|
# Configure RPM... we enforce these settings!
|
2012-12-01 18:51:06 +00:00
|
|
|
echo "Note: configuring RPM DB settings"
|
2012-11-29 15:43:16 +00:00
|
|
|
mkdir -p ${target_rootfs}${rpmlibdir}
|
|
|
|
mkdir -p ${target_rootfs}${rpmlibdir}/log
|
|
|
|
# After change the __db.* cache size, log file will not be generated automatically,
|
|
|
|
# that will raise some warnings, so touch a bare log for rpm write into it.
|
|
|
|
touch ${target_rootfs}${rpmlibdir}/log/log.0000000001
|
|
|
|
if [ ! -e ${target_rootfs}${rpmlibdir}/DB_CONFIG ]; then
|
|
|
|
cat > ${target_rootfs}${rpmlibdir}/DB_CONFIG << EOF
|
|
|
|
# ================ Environment
|
|
|
|
set_data_dir .
|
|
|
|
set_create_dir .
|
|
|
|
set_lg_dir ./log
|
|
|
|
set_tmp_dir ./tmp
|
|
|
|
set_flags db_log_autoremove on
|
2011-01-30 06:07:50 +00:00
|
|
|
|
2012-11-29 15:43:16 +00:00
|
|
|
# -- thread_count must be >= 8
|
|
|
|
set_thread_count 64
|
2011-07-18 20:55:28 +00:00
|
|
|
|
2012-11-29 15:43:16 +00:00
|
|
|
# ================ Logging
|
2011-01-30 06:07:50 +00:00
|
|
|
|
2012-11-29 15:43:16 +00:00
|
|
|
# ================ Memory Pool
|
|
|
|
set_cachesize 0 1048576 0
|
|
|
|
set_mp_mmapsize 268435456
|
2011-01-30 06:07:50 +00:00
|
|
|
|
2012-11-29 15:43:16 +00:00
|
|
|
# ================ Locking
|
|
|
|
set_lk_max_locks 16384
|
|
|
|
set_lk_max_lockers 16384
|
|
|
|
set_lk_max_objects 16384
|
|
|
|
mutex_set_max 163840
|
2011-01-30 06:07:50 +00:00
|
|
|
|
2012-11-29 15:43:16 +00:00
|
|
|
# ================ Replication
|
|
|
|
EOF
|
|
|
|
fi
|
2011-08-12 00:23:48 +00:00
|
|
|
|
2012-11-29 15:43:16 +00:00
|
|
|
# Create database so that smart doesn't complain (lazy init)
|
|
|
|
rpm --root $target_rootfs --dbpath /var/lib/rpm -qa > /dev/null
|
|
|
|
|
|
|
|
# Configure smart
|
2012-12-01 18:51:06 +00:00
|
|
|
echo "Note: configuring Smart settings"
|
2012-11-29 15:43:16 +00:00
|
|
|
rm -rf ${target_rootfs}/var/lib/smart
|
|
|
|
smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-root=${target_rootfs}
|
|
|
|
smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-dbpath=${rpmlibdir}
|
|
|
|
smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-nolinktos=1
|
|
|
|
smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-noparentdirs=1
|
|
|
|
smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-extra-macros._var=${localstatedir}
|
|
|
|
smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-extra-macros._tmppath=/install/tmp
|
2012-12-11 17:59:04 +00:00
|
|
|
# Optional debugging
|
|
|
|
#smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-log-level=debug
|
2013-02-21 23:18:29 +00:00
|
|
|
#smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-log-file=/tmp/smart-debug-logfile
|
2012-12-11 17:59:04 +00:00
|
|
|
|
2012-12-01 18:51:41 +00:00
|
|
|
# Delay this until later...
|
|
|
|
#smart --data-dir=${target_rootfs}/var/lib/smart channel --add rpmsys type=rpm-sys -y
|
2012-11-29 15:43:16 +00:00
|
|
|
|
2013-02-21 23:18:29 +00:00
|
|
|
for canonical_arch in $INSTALL_PLATFORM_EXTRA_RPM; do
|
|
|
|
arch=$(echo $canonical_arch | sed "s,\([^-]*\)-.*,\1,")
|
2012-11-29 15:43:16 +00:00
|
|
|
if [ -d ${DEPLOY_DIR_RPM}/$arch -a ! -e ${target_rootfs}/install/channel.$arch.stamp ] ; then
|
2012-12-01 18:51:06 +00:00
|
|
|
echo "Note: adding Smart channel $arch ($channel_priority)"
|
2012-11-29 15:43:16 +00:00
|
|
|
smart --data-dir=${target_rootfs}/var/lib/smart channel --add $arch type=rpm-md type=rpm-md baseurl=${DEPLOY_DIR_RPM}/$arch -y
|
2012-11-30 22:11:37 +00:00
|
|
|
smart --data-dir=${target_rootfs}/var/lib/smart channel --set $arch priority=$channel_priority
|
2012-11-29 15:43:16 +00:00
|
|
|
touch ${target_rootfs}/install/channel.$arch.stamp
|
2011-01-30 06:07:50 +00:00
|
|
|
fi
|
2012-11-30 22:11:37 +00:00
|
|
|
channel_priority=$(expr $channel_priority - 5)
|
2011-01-30 06:07:50 +00:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2011-11-10 16:30:21 +00:00
|
|
|
# Construct install scriptlet wrapper
|
|
|
|
cat << EOF > ${WORKDIR}/scriptlet_wrapper
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
export PATH="${PATH}"
|
|
|
|
export D="${target_rootfs}"
|
|
|
|
export OFFLINE_ROOT="\$D"
|
|
|
|
export IPKG_OFFLINE_ROOT="\$D"
|
|
|
|
export OPKG_OFFLINE_ROOT="\$D"
|
2012-09-18 15:47:59 +00:00
|
|
|
export INTERCEPT_DIR="${WORKDIR}/intercept_scripts"
|
|
|
|
export NATIVE_ROOT=${STAGING_DIR_NATIVE}
|
2011-11-10 16:30:21 +00:00
|
|
|
|
|
|
|
\$2 \$1/\$3 \$4
|
|
|
|
if [ \$? -ne 0 ]; then
|
|
|
|
mkdir -p \$1/etc/rpm-postinsts
|
2013-03-01 10:02:14 +00:00
|
|
|
name=\`head -1 \$1/\$3 | cut -d' ' -f 2\`
|
|
|
|
echo "#!\$2" > \$1/etc/rpm-postinsts/\${name}
|
|
|
|
echo "# Arg: \$4" >> \$1/etc/rpm-postinsts/\${name}
|
|
|
|
cat \$1/\$3 >> \$1/etc/rpm-postinsts/\${name}
|
|
|
|
chmod +x \$1/etc/rpm-postinsts/\${name}
|
2011-11-10 16:30:21 +00:00
|
|
|
fi
|
|
|
|
EOF
|
|
|
|
|
2012-12-01 18:51:06 +00:00
|
|
|
echo "Note: configuring RPM cross-install scriptlet_wrapper"
|
2011-11-10 16:30:21 +00:00
|
|
|
chmod 0755 ${WORKDIR}/scriptlet_wrapper
|
2012-11-29 15:43:16 +00:00
|
|
|
smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-extra-macros._cross_scriptlet_wrapper=${WORKDIR}/scriptlet_wrapper
|
2011-11-10 16:30:21 +00:00
|
|
|
|
2012-11-30 22:11:37 +00:00
|
|
|
# Determine what to install
|
|
|
|
translate_oe_to_smart ${sdk_mode} ${package_to_install} ${package_linguas}
|
2012-06-11 18:18:57 +00:00
|
|
|
|
2012-12-01 18:51:41 +00:00
|
|
|
# If incremental install, we need to determine what we've got,
|
|
|
|
# what we need to add, and what to remove...
|
|
|
|
if [ "${INC_RPM_IMAGE_GEN}" = "1" -a "${INSTALL_COMPLEMENTARY_RPM}" != "1" ]; then
|
|
|
|
# Dump the new solution
|
|
|
|
echo "Note: creating install solution for incremental install"
|
|
|
|
smart --data-dir=${target_rootfs}/var/lib/smart install -y --dump ${pkgs_to_install} 2> ${target_rootfs}/../solution.manifest
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${INSTALL_COMPLEMENTARY_RPM}" != "1" ]; then
|
|
|
|
echo "Note: adding Smart RPM DB channel"
|
|
|
|
smart --data-dir=${target_rootfs}/var/lib/smart channel --add rpmsys type=rpm-sys -y
|
|
|
|
fi
|
|
|
|
|
|
|
|
# If incremental install, we need to determine what we've got,
|
|
|
|
# what we need to add, and what to remove...
|
|
|
|
if [ "${INC_RPM_IMAGE_GEN}" = "1" -a "${INSTALL_COMPLEMENTARY_RPM}" != "1" ]; then
|
|
|
|
# First upgrade everything that was previously installed to the latest version
|
|
|
|
echo "Note: incremental update -- upgrade packages in place"
|
|
|
|
smart --data-dir=${target_rootfs}/var/lib/smart upgrade
|
|
|
|
|
|
|
|
# Dump what is already installed
|
|
|
|
echo "Note: dump installed packages for incremental update"
|
|
|
|
smart --data-dir=${target_rootfs}/var/lib/smart query --installed --output ${target_rootfs}/../installed.manifest
|
|
|
|
|
|
|
|
sort ${target_rootfs}/../installed.manifest > ${target_rootfs}/../installed.manifest.sorted
|
|
|
|
sort ${target_rootfs}/../solution.manifest > ${target_rootfs}/../solution.manifest.sorted
|
|
|
|
|
|
|
|
comm -1 -3 ${target_rootfs}/../solution.manifest.sorted ${target_rootfs}/../installed.manifest.sorted \
|
|
|
|
> ${target_rootfs}/../remove.list
|
|
|
|
comm -2 -3 ${target_rootfs}/../solution.manifest.sorted ${target_rootfs}/../installed.manifest.sorted \
|
|
|
|
> ${target_rootfs}/../install.list
|
|
|
|
|
|
|
|
pkgs_to_remove=`cat ${target_rootfs}/../remove.list | xargs echo`
|
|
|
|
pkgs_to_install=`cat ${target_rootfs}/../install.list | xargs echo`
|
|
|
|
|
|
|
|
echo "Note: to be removed: ${pkgs_to_remove}"
|
|
|
|
|
|
|
|
for pkg in ${pkgs_to_remove}; do
|
|
|
|
echo "Debug: What required: $pkg"
|
|
|
|
smart --data-dir=${target_rootfs}/var/lib/smart query $pkg --show-requiredby
|
|
|
|
done
|
|
|
|
|
|
|
|
[ -n "$pkgs_to_remove" ] && smart --data-dir=${target_rootfs}/var/lib/smart remove -y ${pkgs_to_remove}
|
|
|
|
fi
|
|
|
|
|
2012-12-01 18:51:06 +00:00
|
|
|
echo "Note: to be installed: ${pkgs_to_install}"
|
2012-11-30 22:11:37 +00:00
|
|
|
[ -n "$pkgs_to_install" ] && smart --data-dir=${target_rootfs}/var/lib/smart install -y ${pkgs_to_install}
|
|
|
|
|
|
|
|
if [ -n "${package_attemptonly}" ]; then
|
2012-12-01 18:51:06 +00:00
|
|
|
echo "Note: installing attempt only packages..."
|
2012-12-14 22:40:34 +00:00
|
|
|
echo "Attempting $pkgs_to_install"
|
2012-12-01 18:51:06 +00:00
|
|
|
echo "Note: see `dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}"
|
2012-11-30 22:11:37 +00:00
|
|
|
translate_oe_to_smart ${sdk_mode} --attemptonly $package_attemptonly
|
2012-12-14 22:40:34 +00:00
|
|
|
for each_pkg in $pkgs_to_install ; do
|
|
|
|
# We need to try each package individually as a single dependency failure
|
|
|
|
# will break the whole set otherwise.
|
|
|
|
smart --data-dir=${target_rootfs}/var/lib/smart install -y $each_pkg >> "`dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}" 2>&1 || true
|
|
|
|
done
|
2012-04-11 21:31:20 +00:00
|
|
|
fi
|
2011-01-30 06:07:50 +00:00
|
|
|
}
|
|
|
|
|
2012-02-09 09:51:10 +00:00
|
|
|
# Construct per file dependencies file
|
|
|
|
def write_rpm_perfiledata(srcname, d):
|
|
|
|
workdir = d.getVar('WORKDIR', True)
|
|
|
|
packages = d.getVar('PACKAGES', True)
|
|
|
|
pkgd = d.getVar('PKGD', True)
|
|
|
|
|
|
|
|
def dump_filerdeps(varname, outfile, d):
|
|
|
|
outfile.write("#!/usr/bin/env python\n\n")
|
|
|
|
outfile.write("# Dependency table\n")
|
|
|
|
outfile.write('deps = {\n')
|
|
|
|
for pkg in packages.split():
|
|
|
|
dependsflist_key = 'FILE' + varname + 'FLIST' + "_" + pkg
|
|
|
|
dependsflist = (d.getVar(dependsflist_key, True) or "")
|
|
|
|
for dfile in dependsflist.split():
|
|
|
|
key = "FILE" + varname + "_" + dfile + "_" + pkg
|
|
|
|
depends_dict = bb.utils.explode_dep_versions(d.getVar(key, True) or "")
|
|
|
|
file = dfile.replace("@underscore@", "_")
|
|
|
|
file = file.replace("@closebrace@", "]")
|
|
|
|
file = file.replace("@openbrace@", "[")
|
|
|
|
file = file.replace("@tab@", "\t")
|
|
|
|
file = file.replace("@space@", " ")
|
|
|
|
file = file.replace("@at@", "@")
|
|
|
|
outfile.write('"' + pkgd + file + '" : "')
|
|
|
|
for dep in depends_dict:
|
|
|
|
ver = depends_dict[dep]
|
|
|
|
if dep and ver:
|
|
|
|
ver = ver.replace("(","")
|
|
|
|
ver = ver.replace(")","")
|
|
|
|
outfile.write(dep + " " + ver + " ")
|
|
|
|
else:
|
|
|
|
outfile.write(dep + " ")
|
|
|
|
outfile.write('",\n')
|
|
|
|
outfile.write('}\n\n')
|
|
|
|
outfile.write("import sys\n")
|
|
|
|
outfile.write("while 1:\n")
|
|
|
|
outfile.write("\tline = sys.stdin.readline().strip()\n")
|
|
|
|
outfile.write("\tif not line:\n")
|
|
|
|
outfile.write("\t\tsys.exit(0)\n")
|
|
|
|
outfile.write("\tif line in deps:\n")
|
|
|
|
outfile.write("\t\tprint(deps[line] + '\\n')\n")
|
|
|
|
|
|
|
|
# OE-core dependencies a.k.a. RPM requires
|
|
|
|
outdepends = workdir + "/" + srcname + ".requires"
|
|
|
|
|
|
|
|
try:
|
2013-05-09 16:05:58 +00:00
|
|
|
dependsfile = open(outdepends, 'w')
|
2012-02-09 09:51:10 +00:00
|
|
|
except OSError:
|
|
|
|
raise bb.build.FuncFailed("unable to open spec file for writing.")
|
|
|
|
|
|
|
|
dump_filerdeps('RDEPENDS', dependsfile, d)
|
|
|
|
|
|
|
|
dependsfile.close()
|
|
|
|
os.chmod(outdepends, 0755)
|
|
|
|
|
|
|
|
# OE-core / RPM Provides
|
|
|
|
outprovides = workdir + "/" + srcname + ".provides"
|
|
|
|
|
|
|
|
try:
|
2013-05-09 16:05:58 +00:00
|
|
|
providesfile = open(outprovides, 'w')
|
2012-02-09 09:51:10 +00:00
|
|
|
except OSError:
|
|
|
|
raise bb.build.FuncFailed("unable to open spec file for writing.")
|
|
|
|
|
|
|
|
dump_filerdeps('RPROVIDES', providesfile, d)
|
|
|
|
|
|
|
|
providesfile.close()
|
|
|
|
os.chmod(outprovides, 0755)
|
|
|
|
|
|
|
|
return (outdepends, outprovides)
|
|
|
|
|
|
|
|
|
2010-08-20 16:52:39 +00:00
|
|
|
python write_specfile () {
|
2012-07-11 17:33:43 +00:00
|
|
|
import textwrap
|
|
|
|
import oe.packagedata
|
|
|
|
|
|
|
|
# append information for logs and patches to %prep
|
|
|
|
def add_prep(d,spec_files_bottom):
|
2012-08-23 15:13:25 +00:00
|
|
|
if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) == 'srpm':
|
2012-07-11 17:33:43 +00:00
|
|
|
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('')
|
|
|
|
|
|
|
|
# append the name of tarball to key word 'SOURCE' in xxx.spec.
|
2012-08-24 06:06:59 +00:00
|
|
|
def tail_source(d):
|
2012-08-23 15:13:25 +00:00
|
|
|
if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) == 'srpm':
|
2012-08-24 06:06:59 +00:00
|
|
|
source_list = get_package(d)
|
2012-07-11 17:33:43 +00:00
|
|
|
source_number = 0
|
archiver.bbclass: fix the fakeroot and other issues
* Fix the fakeroot issue
The archiver.bbclass is used for archiving sources, patches, and logs,
it uses the "rpmbuild -bs" from the package_rpm.bbclass to generate the
.src.rpm, but it didn't work (it's not easy to explain it clearly):
Reason:
- It directly used the "fakeroot" command, we don't have such a
command in native tools, so it would use the fakeroot from the host,
and it would fail when there is no fakeroot on the host.
- The "rpmbuild -bs" doesn't need to work under root, but it is in the
function do_package_write_rpm which is running under fakeroot, and
"rpmbuild" needs to know the source file's user/group name, the source
file is the tarball which is created by the postfuncs of do_unpack
or do_patch which doesn't use the fakeroot, so the created file's
owner would be the real user, e.g.: robert, but there is no such a
user under our native tools' fakeroot(pseudo), then the rpmbuild would
fail. It worked when use the host's fakeroot in the past was because
that the host's fakeroot knows the users on the host.
Fix:
- Remove the incorrect "fakeroot".
- Change the source file's owner to root.root under fakeroot will fix the
problem.
* Other fixes:
- The typo: "do_remove_taball -> do_remove_tarball" which will cause the
tarball is not removed.
- Add the _sourcedir defination to the rpmbuild command since the the
SOURCES would be added to the specfile when archiver.bbclass is
inherited, otherwise there would be errors when "rpmbuild -bb", though
the build is OK. It only added the defination to "rpmbuild -bs",
didn't add to "rpmbuild -bb".
[YOCTO #2619]
(From OE-Core rev: ac152f277fdff256def01af4268215a05685a0f7)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-22 07:34:34 +00:00
|
|
|
workdir = d.getVar('WORKDIR', True)
|
2012-07-11 17:33:43 +00:00
|
|
|
for source in source_list:
|
archiver.bbclass: fix the fakeroot and other issues
* Fix the fakeroot issue
The archiver.bbclass is used for archiving sources, patches, and logs,
it uses the "rpmbuild -bs" from the package_rpm.bbclass to generate the
.src.rpm, but it didn't work (it's not easy to explain it clearly):
Reason:
- It directly used the "fakeroot" command, we don't have such a
command in native tools, so it would use the fakeroot from the host,
and it would fail when there is no fakeroot on the host.
- The "rpmbuild -bs" doesn't need to work under root, but it is in the
function do_package_write_rpm which is running under fakeroot, and
"rpmbuild" needs to know the source file's user/group name, the source
file is the tarball which is created by the postfuncs of do_unpack
or do_patch which doesn't use the fakeroot, so the created file's
owner would be the real user, e.g.: robert, but there is no such a
user under our native tools' fakeroot(pseudo), then the rpmbuild would
fail. It worked when use the host's fakeroot in the past was because
that the host's fakeroot knows the users on the host.
Fix:
- Remove the incorrect "fakeroot".
- Change the source file's owner to root.root under fakeroot will fix the
problem.
* Other fixes:
- The typo: "do_remove_taball -> do_remove_tarball" which will cause the
tarball is not removed.
- Add the _sourcedir defination to the rpmbuild command since the the
SOURCES would be added to the specfile when archiver.bbclass is
inherited, otherwise there would be errors when "rpmbuild -bb", though
the build is OK. It only added the defination to "rpmbuild -bs",
didn't add to "rpmbuild -bb".
[YOCTO #2619]
(From OE-Core rev: ac152f277fdff256def01af4268215a05685a0f7)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-22 07:34:34 +00:00
|
|
|
# The rpmbuild doesn't need the root permission, but it needs
|
|
|
|
# to know the file's user and group name, the only user and
|
|
|
|
# group in fakeroot is "root" when working in fakeroot.
|
|
|
|
os.chown("%s/%s" % (workdir, source), 0, 0)
|
2012-07-11 17:33:43 +00:00
|
|
|
spec_preamble_top.append('Source' + str(source_number) + ': %s' % source)
|
|
|
|
source_number += 1
|
|
|
|
# We need a simple way to remove the MLPREFIX from the package name,
|
|
|
|
# and dependency information...
|
|
|
|
def strip_multilib(name, d):
|
|
|
|
multilibs = d.getVar('MULTILIBS', True) or ""
|
|
|
|
for ext in multilibs.split():
|
|
|
|
eext = ext.split(':')
|
|
|
|
if len(eext) > 1 and eext[0] == 'multilib' and name and name.find(eext[1] + '-') >= 0:
|
|
|
|
name = "".join(name.split(eext[1] + '-'))
|
|
|
|
return name
|
|
|
|
|
2012-10-02 10:37:07 +00:00
|
|
|
def strip_multilib_deps(deps, d):
|
|
|
|
depends = bb.utils.explode_dep_versions2(deps or "")
|
|
|
|
newdeps = {}
|
|
|
|
for dep in depends:
|
|
|
|
newdeps[strip_multilib(dep, d)] = depends[dep]
|
|
|
|
return bb.utils.join_deps(newdeps)
|
|
|
|
|
2012-07-11 17:33:43 +00:00
|
|
|
# ml = d.getVar("MLPREFIX", True)
|
|
|
|
# if ml and name and len(ml) != 0 and name.find(ml) == 0:
|
|
|
|
# return ml.join(name.split(ml, 1)[1:])
|
|
|
|
# return name
|
|
|
|
|
|
|
|
# In RPM, dependencies are of the format: pkg <>= Epoch:Version-Release
|
|
|
|
# This format is similar to OE, however there are restrictions on the
|
|
|
|
# characters that can be in a field. In the Version field, "-"
|
|
|
|
# characters are not allowed. "-" is allowed in the Release field.
|
|
|
|
#
|
|
|
|
# We translate the "-" in the version to a "+", by loading the PKGV
|
|
|
|
# from the dependent recipe, replacing the - with a +, and then using
|
|
|
|
# that value to do a replace inside of this recipe's dependencies.
|
|
|
|
# This preserves the "-" separator between the version and release, as
|
|
|
|
# well as any "-" characters inside of the release field.
|
|
|
|
#
|
|
|
|
# All of this has to happen BEFORE the mapping_rename_hook as
|
|
|
|
# after renaming we cannot look up the dependencies in the packagedata
|
|
|
|
# store.
|
|
|
|
def translate_vers(varname, d):
|
|
|
|
depends = d.getVar(varname, True)
|
|
|
|
if depends:
|
2012-10-02 10:37:07 +00:00
|
|
|
depends_dict = bb.utils.explode_dep_versions2(depends)
|
2012-07-11 17:33:43 +00:00
|
|
|
newdeps_dict = {}
|
|
|
|
for dep in depends_dict:
|
2012-10-02 10:37:07 +00:00
|
|
|
verlist = []
|
|
|
|
for ver in depends_dict[dep]:
|
2012-07-11 17:33:43 +00:00
|
|
|
if '-' in ver:
|
|
|
|
subd = oe.packagedata.read_subpkgdata_dict(dep, d)
|
|
|
|
if 'PKGV' in subd:
|
2013-03-14 00:15:10 +00:00
|
|
|
pv = subd['PV']
|
|
|
|
pkgv = subd['PKGV']
|
|
|
|
reppv = pkgv.replace('-', '+')
|
2013-03-20 00:29:22 +00:00
|
|
|
ver = ver.replace(pv, reppv).replace(pkgv, reppv)
|
|
|
|
if 'PKGR' in subd:
|
|
|
|
# Make sure PKGR rather than PR in ver
|
|
|
|
pr = '-' + subd['PR']
|
|
|
|
pkgr = '-' + subd['PKGR']
|
|
|
|
if pkgr not in ver:
|
|
|
|
ver = ver.replace(pr, pkgr)
|
|
|
|
verlist.append(ver)
|
2012-10-02 10:37:07 +00:00
|
|
|
else:
|
|
|
|
verlist.append(ver)
|
|
|
|
newdeps_dict[dep] = verlist
|
2012-07-11 17:33:43 +00:00
|
|
|
depends = bb.utils.join_deps(newdeps_dict)
|
|
|
|
d.setVar(varname, depends.strip())
|
|
|
|
|
|
|
|
# We need to change the style the dependency from BB to RPM
|
|
|
|
# This needs to happen AFTER the mapping_rename_hook
|
|
|
|
def print_deps(variable, tag, array, d):
|
|
|
|
depends = variable
|
|
|
|
if depends:
|
2012-10-02 10:37:07 +00:00
|
|
|
depends_dict = bb.utils.explode_dep_versions2(depends)
|
2012-07-11 17:33:43 +00:00
|
|
|
for dep in depends_dict:
|
2012-10-02 10:37:07 +00:00
|
|
|
for ver in depends_dict[dep]:
|
2012-07-11 17:33:43 +00:00
|
|
|
ver = ver.replace('(', '')
|
|
|
|
ver = ver.replace(')', '')
|
|
|
|
array.append("%s: %s %s" % (tag, dep, ver))
|
2012-10-02 10:37:07 +00:00
|
|
|
if not len(depends_dict[dep]):
|
2012-07-11 17:33:43 +00:00
|
|
|
array.append("%s: %s" % (tag, dep))
|
|
|
|
|
|
|
|
def walk_files(walkpath, target, conffiles):
|
|
|
|
for rootpath, dirs, files in os.walk(walkpath):
|
|
|
|
path = rootpath.replace(walkpath, "")
|
|
|
|
for dir in dirs:
|
|
|
|
# All packages own the directories their files are in...
|
|
|
|
target.append('%dir "' + path + '/' + dir + '"')
|
|
|
|
for file in files:
|
|
|
|
if conffiles.count(path + '/' + file):
|
|
|
|
target.append('%config "' + path + '/' + file + '"')
|
|
|
|
else:
|
|
|
|
target.append('"' + path + '/' + file + '"')
|
|
|
|
|
|
|
|
# Prevent the prerm/postrm scripts from being run during an upgrade
|
|
|
|
def wrap_uninstall(scriptvar):
|
|
|
|
scr = scriptvar.strip()
|
|
|
|
if scr.startswith("#!"):
|
|
|
|
pos = scr.find("\n") + 1
|
|
|
|
else:
|
|
|
|
pos = 0
|
|
|
|
scr = scr[:pos] + 'if [ "$1" = "0" ] ; then\n' + scr[pos:] + '\nfi'
|
|
|
|
return scr
|
|
|
|
|
2012-02-09 09:51:10 +00:00
|
|
|
def get_perfile(varname, pkg, d):
|
|
|
|
deps = []
|
|
|
|
dependsflist_key = 'FILE' + varname + 'FLIST' + "_" + pkg
|
|
|
|
dependsflist = (d.getVar(dependsflist_key, True) or "")
|
|
|
|
for dfile in dependsflist.split():
|
|
|
|
key = "FILE" + varname + "_" + dfile + "_" + pkg
|
|
|
|
depends = d.getVar(key, True)
|
|
|
|
if depends:
|
|
|
|
deps.append(depends)
|
|
|
|
return " ".join(deps)
|
|
|
|
|
2012-07-11 17:33:43 +00:00
|
|
|
packages = d.getVar('PACKAGES', True)
|
|
|
|
if not packages or packages == '':
|
|
|
|
bb.debug(1, "No packages; nothing to do")
|
|
|
|
return
|
|
|
|
|
|
|
|
pkgdest = d.getVar('PKGDEST', True)
|
|
|
|
if not pkgdest:
|
|
|
|
bb.fatal("No PKGDEST")
|
|
|
|
|
|
|
|
outspecfile = d.getVar('OUTSPECFILE', True)
|
|
|
|
if not outspecfile:
|
|
|
|
bb.fatal("No OUTSPECFILE")
|
|
|
|
|
|
|
|
# Construct the SPEC file...
|
|
|
|
srcname = strip_multilib(d.getVar('PN', True), d)
|
|
|
|
srcsummary = (d.getVar('SUMMARY', True) or d.getVar('DESCRIPTION', True) or ".")
|
|
|
|
srcversion = d.getVar('PKGV', True).replace('-', '+')
|
|
|
|
srcrelease = d.getVar('PKGR', True)
|
|
|
|
srcepoch = (d.getVar('PKGE', True) or "")
|
|
|
|
srclicense = d.getVar('LICENSE', True)
|
|
|
|
srcsection = d.getVar('SECTION', True)
|
|
|
|
srcmaintainer = d.getVar('MAINTAINER', True)
|
|
|
|
srchomepage = d.getVar('HOMEPAGE', True)
|
|
|
|
srcdescription = d.getVar('DESCRIPTION', True) or "."
|
|
|
|
|
2012-10-02 10:37:07 +00:00
|
|
|
srcdepends = strip_multilib_deps(d.getVar('DEPENDS', True), d)
|
2012-07-11 17:33:43 +00:00
|
|
|
srcrdepends = []
|
|
|
|
srcrrecommends = []
|
|
|
|
srcrsuggests = []
|
|
|
|
srcrprovides = []
|
|
|
|
srcrreplaces = []
|
|
|
|
srcrconflicts = []
|
|
|
|
srcrobsoletes = []
|
|
|
|
|
2012-11-15 21:31:11 +00:00
|
|
|
srcrpreinst = []
|
|
|
|
srcrpostinst = []
|
|
|
|
srcrprerm = []
|
|
|
|
srcrpostrm = []
|
2012-07-11 17:33:43 +00:00
|
|
|
|
|
|
|
spec_preamble_top = []
|
|
|
|
spec_preamble_bottom = []
|
|
|
|
|
|
|
|
spec_scriptlets_top = []
|
|
|
|
spec_scriptlets_bottom = []
|
|
|
|
|
|
|
|
spec_files_top = []
|
|
|
|
spec_files_bottom = []
|
|
|
|
|
2012-02-09 09:51:10 +00:00
|
|
|
perfiledeps = (d.getVar("MERGEPERFILEDEPS", True) or "0") == "0"
|
|
|
|
|
2012-07-11 17:33:43 +00:00
|
|
|
for pkg in packages.split():
|
|
|
|
localdata = bb.data.createCopy(d)
|
|
|
|
|
|
|
|
root = "%s/%s" % (pkgdest, pkg)
|
|
|
|
|
|
|
|
lf = bb.utils.lockfile(root + ".lock")
|
|
|
|
|
|
|
|
localdata.setVar('ROOT', '')
|
|
|
|
localdata.setVar('ROOT_%s' % pkg, root)
|
|
|
|
pkgname = localdata.getVar('PKG_%s' % pkg, True)
|
|
|
|
if not pkgname:
|
|
|
|
pkgname = pkg
|
|
|
|
localdata.setVar('PKG', pkgname)
|
|
|
|
|
|
|
|
localdata.setVar('OVERRIDES', pkg)
|
|
|
|
|
|
|
|
bb.data.update_data(localdata)
|
|
|
|
|
|
|
|
conffiles = (localdata.getVar('CONFFILES', True) or "").split()
|
|
|
|
|
|
|
|
splitname = strip_multilib(pkgname, d)
|
|
|
|
|
|
|
|
splitsummary = (localdata.getVar('SUMMARY', True) or localdata.getVar('DESCRIPTION', True) or ".")
|
|
|
|
splitversion = (localdata.getVar('PKGV', True) or "").replace('-', '+')
|
|
|
|
splitrelease = (localdata.getVar('PKGR', True) or "")
|
|
|
|
splitepoch = (localdata.getVar('PKGE', True) or "")
|
|
|
|
splitlicense = (localdata.getVar('LICENSE', True) or "")
|
|
|
|
splitsection = (localdata.getVar('SECTION', True) or "")
|
|
|
|
splitdescription = (localdata.getVar('DESCRIPTION', True) or ".")
|
|
|
|
|
|
|
|
translate_vers('RDEPENDS', localdata)
|
|
|
|
translate_vers('RRECOMMENDS', localdata)
|
|
|
|
translate_vers('RSUGGESTS', localdata)
|
|
|
|
translate_vers('RPROVIDES', localdata)
|
|
|
|
translate_vers('RREPLACES', localdata)
|
|
|
|
translate_vers('RCONFLICTS', localdata)
|
|
|
|
|
|
|
|
# Map the dependencies into their final form
|
|
|
|
mapping_rename_hook(localdata)
|
|
|
|
|
2012-10-02 10:37:07 +00:00
|
|
|
splitrdepends = strip_multilib_deps(localdata.getVar('RDEPENDS', True), d)
|
|
|
|
splitrrecommends = strip_multilib_deps(localdata.getVar('RRECOMMENDS', True), d)
|
|
|
|
splitrsuggests = strip_multilib_deps(localdata.getVar('RSUGGESTS', True), d)
|
|
|
|
splitrprovides = strip_multilib_deps(localdata.getVar('RPROVIDES', True), d)
|
|
|
|
splitrreplaces = strip_multilib_deps(localdata.getVar('RREPLACES', True), d)
|
|
|
|
splitrconflicts = strip_multilib_deps(localdata.getVar('RCONFLICTS', True), d)
|
2012-07-11 17:33:43 +00:00
|
|
|
splitrobsoletes = []
|
|
|
|
|
2012-11-15 21:31:11 +00:00
|
|
|
splitrpreinst = localdata.getVar('pkg_preinst', True)
|
|
|
|
splitrpostinst = localdata.getVar('pkg_postinst', True)
|
|
|
|
splitrprerm = localdata.getVar('pkg_prerm', True)
|
|
|
|
splitrpostrm = localdata.getVar('pkg_postrm', True)
|
|
|
|
|
2012-02-09 09:51:10 +00:00
|
|
|
|
|
|
|
if not perfiledeps:
|
|
|
|
# Add in summary of per file dependencies
|
|
|
|
splitrdepends = splitrdepends + " " + get_perfile('RDEPENDS', pkg, d)
|
|
|
|
splitrprovides = splitrprovides + " " + get_perfile('RPROVIDES', pkg, d)
|
|
|
|
|
2012-07-11 17:33:43 +00:00
|
|
|
# Gather special src/first package data
|
|
|
|
if srcname == splitname:
|
|
|
|
srcrdepends = splitrdepends
|
|
|
|
srcrrecommends = splitrrecommends
|
|
|
|
srcrsuggests = splitrsuggests
|
|
|
|
srcrprovides = splitrprovides
|
|
|
|
srcrreplaces = splitrreplaces
|
|
|
|
srcrconflicts = splitrconflicts
|
|
|
|
|
2012-11-15 21:31:11 +00:00
|
|
|
srcrpreinst = splitrpreinst
|
|
|
|
srcrpostinst = splitrpostinst
|
|
|
|
srcrprerm = splitrprerm
|
|
|
|
srcrpostrm = splitrpostrm
|
2012-07-11 17:33:43 +00:00
|
|
|
|
|
|
|
file_list = []
|
|
|
|
walk_files(root, file_list, conffiles)
|
|
|
|
if not file_list and localdata.getVar('ALLOW_EMPTY') != "1":
|
|
|
|
bb.note("Not creating empty RPM package for %s" % splitname)
|
|
|
|
else:
|
|
|
|
bb.note("Creating RPM package for %s" % splitname)
|
|
|
|
spec_files_top.append('%files')
|
|
|
|
spec_files_top.append('%defattr(-,-,-,-)')
|
|
|
|
if file_list:
|
|
|
|
bb.note("Creating RPM package for %s" % splitname)
|
|
|
|
spec_files_top.extend(file_list)
|
|
|
|
else:
|
|
|
|
bb.note("Creating EMPTY RPM Package for %s" % splitname)
|
|
|
|
spec_files_top.append('')
|
|
|
|
|
|
|
|
bb.utils.unlockfile(lf)
|
|
|
|
continue
|
|
|
|
|
|
|
|
# Process subpackage data
|
|
|
|
spec_preamble_bottom.append('%%package -n %s' % splitname)
|
|
|
|
spec_preamble_bottom.append('Summary: %s' % splitsummary)
|
|
|
|
if srcversion != splitversion:
|
|
|
|
spec_preamble_bottom.append('Version: %s' % splitversion)
|
|
|
|
if srcrelease != splitrelease:
|
|
|
|
spec_preamble_bottom.append('Release: %s' % splitrelease)
|
|
|
|
if srcepoch != splitepoch:
|
|
|
|
spec_preamble_bottom.append('Epoch: %s' % splitepoch)
|
|
|
|
if srclicense != splitlicense:
|
|
|
|
spec_preamble_bottom.append('License: %s' % splitlicense)
|
|
|
|
spec_preamble_bottom.append('Group: %s' % splitsection)
|
|
|
|
|
|
|
|
# Replaces == Obsoletes && Provides
|
2012-10-02 10:37:07 +00:00
|
|
|
robsoletes = bb.utils.explode_dep_versions2(splitrobsoletes or "")
|
|
|
|
rprovides = bb.utils.explode_dep_versions2(splitrprovides or "")
|
|
|
|
rreplaces = bb.utils.explode_dep_versions2(splitrreplaces or "")
|
|
|
|
for dep in rreplaces:
|
|
|
|
if not dep in robsoletes:
|
|
|
|
robsoletes[dep] = rreplaces[dep]
|
|
|
|
if not dep in rprovides:
|
|
|
|
rprovides[dep] = rreplaces[dep]
|
|
|
|
splitrobsoletes = bb.utils.join_deps(robsoletes, commasep=False)
|
|
|
|
splitrprovides = bb.utils.join_deps(rprovides, commasep=False)
|
2012-07-11 17:33:43 +00:00
|
|
|
|
|
|
|
print_deps(splitrdepends, "Requires", spec_preamble_bottom, d)
|
2012-11-15 21:31:11 +00:00
|
|
|
if splitrpreinst:
|
|
|
|
print_deps(splitrdepends, "Requires(pre)", spec_preamble_bottom, d)
|
|
|
|
if splitrpostinst:
|
|
|
|
print_deps(splitrdepends, "Requires(post)", spec_preamble_bottom, d)
|
|
|
|
if splitrprerm:
|
|
|
|
print_deps(splitrdepends, "Requires(preun)", spec_preamble_bottom, d)
|
|
|
|
if splitrpostrm:
|
|
|
|
print_deps(splitrdepends, "Requires(postun)", spec_preamble_bottom, d)
|
|
|
|
|
2012-07-11 17:33:43 +00:00
|
|
|
# Suggests in RPM are like recommends in OE-core!
|
|
|
|
print_deps(splitrrecommends, "Suggests", spec_preamble_bottom, d)
|
|
|
|
# While there is no analog for suggests... (So call them recommends for now)
|
|
|
|
print_deps(splitrsuggests, "Recommends", spec_preamble_bottom, d)
|
|
|
|
print_deps(splitrprovides, "Provides", spec_preamble_bottom, d)
|
|
|
|
print_deps(splitrobsoletes, "Obsoletes", spec_preamble_bottom, d)
|
|
|
|
|
|
|
|
# conflicts can not be in a provide! We will need to filter it.
|
|
|
|
if splitrconflicts:
|
2012-10-02 10:37:07 +00:00
|
|
|
depends_dict = bb.utils.explode_dep_versions2(splitrconflicts)
|
2012-07-11 17:33:43 +00:00
|
|
|
newdeps_dict = {}
|
|
|
|
for dep in depends_dict:
|
|
|
|
if dep not in splitrprovides:
|
|
|
|
newdeps_dict[dep] = depends_dict[dep]
|
|
|
|
if newdeps_dict:
|
|
|
|
splitrconflicts = bb.utils.join_deps(newdeps_dict)
|
|
|
|
else:
|
|
|
|
splitrconflicts = ""
|
|
|
|
|
|
|
|
print_deps(splitrconflicts, "Conflicts", spec_preamble_bottom, d)
|
|
|
|
|
|
|
|
spec_preamble_bottom.append('')
|
|
|
|
|
|
|
|
spec_preamble_bottom.append('%%description -n %s' % splitname)
|
|
|
|
dedent_text = textwrap.dedent(splitdescription).strip()
|
|
|
|
spec_preamble_bottom.append('%s' % textwrap.fill(dedent_text, width=75))
|
|
|
|
|
|
|
|
spec_preamble_bottom.append('')
|
|
|
|
|
|
|
|
# Now process scriptlets
|
2012-11-15 21:31:11 +00:00
|
|
|
if splitrpreinst:
|
|
|
|
spec_scriptlets_bottom.append('%%pre -n %s' % splitname)
|
2013-03-01 10:02:13 +00:00
|
|
|
spec_scriptlets_bottom.append('# %s - preinst' % splitname)
|
2012-11-15 21:31:11 +00:00
|
|
|
spec_scriptlets_bottom.append(splitrpreinst)
|
|
|
|
spec_scriptlets_bottom.append('')
|
|
|
|
if splitrpostinst:
|
|
|
|
spec_scriptlets_bottom.append('%%post -n %s' % splitname)
|
2013-03-01 10:02:13 +00:00
|
|
|
spec_scriptlets_bottom.append('# %s - postinst' % splitname)
|
2012-11-15 21:31:11 +00:00
|
|
|
spec_scriptlets_bottom.append(splitrpostinst)
|
|
|
|
spec_scriptlets_bottom.append('')
|
|
|
|
if splitrprerm:
|
|
|
|
spec_scriptlets_bottom.append('%%preun -n %s' % splitname)
|
2013-03-01 10:02:13 +00:00
|
|
|
spec_scriptlets_bottom.append('# %s - prerm' % splitname)
|
2012-11-15 21:31:11 +00:00
|
|
|
scriptvar = wrap_uninstall(splitrprerm)
|
|
|
|
spec_scriptlets_bottom.append(scriptvar)
|
|
|
|
spec_scriptlets_bottom.append('')
|
|
|
|
if splitrpostrm:
|
|
|
|
spec_scriptlets_bottom.append('%%postun -n %s' % splitname)
|
2013-03-01 10:02:13 +00:00
|
|
|
spec_scriptlets_bottom.append('# %s - postrm' % splitname)
|
2012-11-15 21:31:11 +00:00
|
|
|
scriptvar = wrap_uninstall(splitrpostrm)
|
2012-07-11 17:33:43 +00:00
|
|
|
spec_scriptlets_bottom.append(scriptvar)
|
|
|
|
spec_scriptlets_bottom.append('')
|
|
|
|
|
|
|
|
# Now process files
|
|
|
|
file_list = []
|
|
|
|
walk_files(root, file_list, conffiles)
|
|
|
|
if not file_list and localdata.getVar('ALLOW_EMPTY') != "1":
|
|
|
|
bb.note("Not creating empty RPM package for %s" % splitname)
|
|
|
|
else:
|
|
|
|
spec_files_bottom.append('%%files -n %s' % splitname)
|
|
|
|
spec_files_bottom.append('%defattr(-,-,-,-)')
|
|
|
|
if file_list:
|
|
|
|
bb.note("Creating RPM package for %s" % splitname)
|
|
|
|
spec_files_bottom.extend(file_list)
|
|
|
|
else:
|
|
|
|
bb.note("Creating EMPTY RPM Package for %s" % splitname)
|
|
|
|
spec_files_bottom.append('')
|
|
|
|
|
|
|
|
del localdata
|
|
|
|
bb.utils.unlockfile(lf)
|
2012-03-26 10:49:23 +00:00
|
|
|
|
2012-07-11 17:33:43 +00:00
|
|
|
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)
|
|
|
|
spec_preamble_top.append('Release: %s' % srcrelease)
|
|
|
|
if srcepoch and srcepoch.strip() != "":
|
|
|
|
spec_preamble_top.append('Epoch: %s' % srcepoch)
|
|
|
|
spec_preamble_top.append('License: %s' % srclicense)
|
|
|
|
spec_preamble_top.append('Group: %s' % srcsection)
|
|
|
|
spec_preamble_top.append('Packager: %s' % srcmaintainer)
|
|
|
|
spec_preamble_top.append('URL: %s' % srchomepage)
|
2012-08-24 06:06:59 +00:00
|
|
|
tail_source(d)
|
2012-07-11 17:33:43 +00:00
|
|
|
|
|
|
|
# Replaces == Obsoletes && Provides
|
2012-10-02 10:37:07 +00:00
|
|
|
robsoletes = bb.utils.explode_dep_versions2(srcrobsoletes or "")
|
|
|
|
rprovides = bb.utils.explode_dep_versions2(srcrprovides or "")
|
|
|
|
rreplaces = bb.utils.explode_dep_versions2(srcrreplaces or "")
|
|
|
|
for dep in rreplaces:
|
|
|
|
if not dep in robsoletes:
|
|
|
|
robsoletes[dep] = rreplaces[dep]
|
|
|
|
if not dep in rprovides:
|
|
|
|
rprovides[dep] = rreplaces[dep]
|
|
|
|
srcrobsoletes = bb.utils.join_deps(robsoletes, commasep=False)
|
|
|
|
srcrprovides = bb.utils.join_deps(rprovides, commasep=False)
|
2012-07-11 17:33:43 +00:00
|
|
|
|
|
|
|
print_deps(srcdepends, "BuildRequires", spec_preamble_top, d)
|
|
|
|
print_deps(srcrdepends, "Requires", spec_preamble_top, d)
|
2012-11-15 21:31:11 +00:00
|
|
|
if srcrpreinst:
|
|
|
|
print_deps(srcrdepends, "Requires(pre)", spec_preamble_top, d)
|
|
|
|
if srcrpostinst:
|
|
|
|
print_deps(srcrdepends, "Requires(post)", spec_preamble_top, d)
|
|
|
|
if srcrprerm:
|
|
|
|
print_deps(srcrdepends, "Requires(preun)", spec_preamble_top, d)
|
|
|
|
if srcrpostrm:
|
|
|
|
print_deps(srcrdepends, "Requires(postun)", spec_preamble_top, d)
|
|
|
|
|
2012-07-11 17:33:43 +00:00
|
|
|
# Suggests in RPM are like recommends in OE-core!
|
|
|
|
print_deps(srcrrecommends, "Suggests", spec_preamble_top, d)
|
|
|
|
# While there is no analog for suggests... (So call them recommends for now)
|
|
|
|
print_deps(srcrsuggests, "Recommends", spec_preamble_top, d)
|
|
|
|
print_deps(srcrprovides, "Provides", spec_preamble_top, d)
|
|
|
|
print_deps(srcrobsoletes, "Obsoletes", spec_preamble_top, d)
|
|
|
|
|
|
|
|
# conflicts can not be in a provide! We will need to filter it.
|
|
|
|
if srcrconflicts:
|
2012-10-02 10:37:07 +00:00
|
|
|
depends_dict = bb.utils.explode_dep_versions2(srcrconflicts)
|
2012-07-11 17:33:43 +00:00
|
|
|
newdeps_dict = {}
|
|
|
|
for dep in depends_dict:
|
|
|
|
if dep not in srcrprovides:
|
|
|
|
newdeps_dict[dep] = depends_dict[dep]
|
|
|
|
if newdeps_dict:
|
|
|
|
srcrconflicts = bb.utils.join_deps(newdeps_dict)
|
|
|
|
else:
|
|
|
|
srcrconflicts = ""
|
|
|
|
|
|
|
|
print_deps(srcrconflicts, "Conflicts", spec_preamble_top, d)
|
|
|
|
|
|
|
|
spec_preamble_top.append('')
|
|
|
|
|
|
|
|
spec_preamble_top.append('%description')
|
|
|
|
dedent_text = textwrap.dedent(srcdescription).strip()
|
|
|
|
spec_preamble_top.append('%s' % textwrap.fill(dedent_text, width=75))
|
|
|
|
|
|
|
|
spec_preamble_top.append('')
|
|
|
|
|
2012-11-15 21:31:11 +00:00
|
|
|
if srcrpreinst:
|
2012-07-11 17:33:43 +00:00
|
|
|
spec_scriptlets_top.append('%pre')
|
|
|
|
spec_scriptlets_top.append('# %s - preinst' % srcname)
|
2012-11-15 21:31:11 +00:00
|
|
|
spec_scriptlets_top.append(srcrpreinst)
|
2012-07-11 17:33:43 +00:00
|
|
|
spec_scriptlets_top.append('')
|
2012-11-15 21:31:11 +00:00
|
|
|
if srcrpostinst:
|
2012-07-11 17:33:43 +00:00
|
|
|
spec_scriptlets_top.append('%post')
|
|
|
|
spec_scriptlets_top.append('# %s - postinst' % srcname)
|
2012-11-15 21:31:11 +00:00
|
|
|
spec_scriptlets_top.append(srcrpostinst)
|
2012-07-11 17:33:43 +00:00
|
|
|
spec_scriptlets_top.append('')
|
2012-11-15 21:31:11 +00:00
|
|
|
if srcrprerm:
|
2012-07-11 17:33:43 +00:00
|
|
|
spec_scriptlets_top.append('%preun')
|
|
|
|
spec_scriptlets_top.append('# %s - prerm' % srcname)
|
2012-11-15 21:31:11 +00:00
|
|
|
scriptvar = wrap_uninstall(srcrprerm)
|
2012-07-11 17:33:43 +00:00
|
|
|
spec_scriptlets_top.append(scriptvar)
|
|
|
|
spec_scriptlets_top.append('')
|
2012-11-15 21:31:11 +00:00
|
|
|
if srcrpostrm:
|
2012-07-11 17:33:43 +00:00
|
|
|
spec_scriptlets_top.append('%postun')
|
|
|
|
spec_scriptlets_top.append('# %s - postrm' % srcname)
|
2012-11-15 21:31:11 +00:00
|
|
|
scriptvar = wrap_uninstall(srcrpostrm)
|
2012-07-11 17:33:43 +00:00
|
|
|
spec_scriptlets_top.append(scriptvar)
|
|
|
|
spec_scriptlets_top.append('')
|
|
|
|
|
|
|
|
# Write the SPEC file
|
|
|
|
try:
|
2013-05-09 16:05:58 +00:00
|
|
|
specfile = open(outspecfile, 'w')
|
2012-07-11 17:33:43 +00:00
|
|
|
except OSError:
|
|
|
|
raise bb.build.FuncFailed("unable to open spec file for writing.")
|
|
|
|
|
|
|
|
# RPMSPEC_PREAMBLE is a way to add arbitrary text to the top
|
|
|
|
# of the generated spec file
|
|
|
|
external_preamble = d.getVar("RPMSPEC_PREAMBLE", True)
|
|
|
|
if external_preamble:
|
|
|
|
specfile.write(external_preamble + "\n")
|
|
|
|
|
|
|
|
for line in spec_preamble_top:
|
|
|
|
specfile.write(line + "\n")
|
|
|
|
|
|
|
|
for line in spec_preamble_bottom:
|
|
|
|
specfile.write(line + "\n")
|
|
|
|
|
|
|
|
for line in spec_scriptlets_top:
|
|
|
|
specfile.write(line + "\n")
|
|
|
|
|
|
|
|
for line in spec_scriptlets_bottom:
|
|
|
|
specfile.write(line + "\n")
|
|
|
|
|
|
|
|
for line in spec_files_top:
|
|
|
|
specfile.write(line + "\n")
|
|
|
|
|
|
|
|
for line in spec_files_bottom:
|
|
|
|
specfile.write(line + "\n")
|
|
|
|
|
|
|
|
specfile.close()
|
2010-08-20 16:52:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
python do_package_rpm () {
|
2012-07-11 17:33:43 +00:00
|
|
|
def creat_srpm_dir(d):
|
2012-08-23 15:13:25 +00:00
|
|
|
if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) == 'srpm':
|
2012-07-11 17:33:43 +00:00
|
|
|
clean_licenses = get_licenses(d)
|
|
|
|
pkgwritesrpmdir = bb.data.expand('${PKGWRITEDIRSRPM}/${PACKAGE_ARCH_EXTEND}', d)
|
|
|
|
pkgwritesrpmdir = pkgwritesrpmdir + '/' + clean_licenses
|
|
|
|
bb.mkdirhier(pkgwritesrpmdir)
|
|
|
|
os.chmod(pkgwritesrpmdir, 0755)
|
|
|
|
return pkgwritesrpmdir
|
2012-03-26 10:49:23 +00:00
|
|
|
|
2012-07-11 17:33:43 +00:00
|
|
|
# We need a simple way to remove the MLPREFIX from the package name,
|
|
|
|
# and dependency information...
|
|
|
|
def strip_multilib(name, d):
|
|
|
|
ml = d.getVar("MLPREFIX", True)
|
|
|
|
if ml and name and len(ml) != 0 and name.find(ml) >= 0:
|
|
|
|
return "".join(name.split(ml))
|
|
|
|
return name
|
|
|
|
|
|
|
|
workdir = d.getVar('WORKDIR', True)
|
|
|
|
outdir = d.getVar('DEPLOY_DIR_IPK', True)
|
|
|
|
tmpdir = d.getVar('TMPDIR', True)
|
|
|
|
pkgd = d.getVar('PKGD', True)
|
|
|
|
pkgdest = d.getVar('PKGDEST', True)
|
|
|
|
if not workdir or not outdir or not pkgd or not tmpdir:
|
|
|
|
bb.error("Variables incorrectly set, unable to package")
|
|
|
|
return
|
|
|
|
|
|
|
|
packages = d.getVar('PACKAGES', True)
|
|
|
|
if not packages or packages == '':
|
|
|
|
bb.debug(1, "No packages; nothing to do")
|
|
|
|
return
|
|
|
|
|
|
|
|
# Construct the spec file...
|
|
|
|
srcname = strip_multilib(d.getVar('PN', True), d)
|
|
|
|
outspecfile = workdir + "/" + srcname + ".spec"
|
|
|
|
d.setVar('OUTSPECFILE', outspecfile)
|
|
|
|
bb.build.exec_func('write_specfile', d)
|
|
|
|
|
2012-02-09 09:51:10 +00:00
|
|
|
perfiledeps = (d.getVar("MERGEPERFILEDEPS", True) or "0") == "0"
|
|
|
|
if perfiledeps:
|
|
|
|
outdepends, outprovides = write_rpm_perfiledata(srcname, d)
|
2012-07-11 17:33:43 +00:00
|
|
|
|
|
|
|
# Setup the rpmbuild arguments...
|
|
|
|
rpmbuild = d.getVar('RPMBUILD', True)
|
|
|
|
targetsys = d.getVar('TARGET_SYS', True)
|
|
|
|
targetvendor = d.getVar('TARGET_VENDOR', True)
|
package_rpm.bbclass: fix the arch (replace "-" with "_")
rpm can't use the "-" as the arch, which causes problem, e.g., when
MACHINE = "beagleboard":
* The arch should be armv7a-vfp-neon, but rpm only takes the armv7a,
this is incorrect since it is mixed with real arch armv7a.
* The nativesdk's arch should be i686-nativesdk (or x86_64-nativesdk),
but rpm only takes the i686 (or x86_64), this in incorrect since it is
mixed with the arch i686 (or x86_64).
Replace "-" with "_" when rpm package and the rootfs generation would
fix the problem, I think this is fine since it doesn't change the tune's
arch, the package manager doesn't care about the arch's name, but it
needs a unify arch system to avoid confusing. This is similar to what we
have done on the deb which fixed the arch i486, i586 and so on to i386.
[YOCTO #2328]
(From OE-Core rev: fc985f511da86400e4fa7d17555216c12eb51666)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-10 07:58:52 +00:00
|
|
|
package_arch = (d.getVar('PACKAGE_ARCH', True) or "").replace("-", "_")
|
|
|
|
if package_arch not in "all any noarch".split() and not package_arch.endswith("_nativesdk"):
|
2012-07-11 17:33:43 +00:00
|
|
|
ml_prefix = (d.getVar('MLPREFIX', True) or "").replace("-", "_")
|
|
|
|
d.setVar('PACKAGE_ARCH_EXTEND', ml_prefix + package_arch)
|
|
|
|
else:
|
|
|
|
d.setVar('PACKAGE_ARCH_EXTEND', package_arch)
|
|
|
|
pkgwritedir = d.expand('${PKGWRITEDIRRPM}/${PACKAGE_ARCH_EXTEND}')
|
|
|
|
pkgarch = d.expand('${PACKAGE_ARCH_EXTEND}${TARGET_VENDOR}-${TARGET_OS}')
|
|
|
|
magicfile = d.expand('${STAGING_DIR_NATIVE}${datadir_native}/misc/magic.mgc')
|
|
|
|
bb.mkdirhier(pkgwritedir)
|
|
|
|
os.chmod(pkgwritedir, 0755)
|
|
|
|
|
|
|
|
cmd = rpmbuild
|
|
|
|
cmd = cmd + " --nodeps --short-circuit --target " + pkgarch + " --buildroot " + pkgd
|
|
|
|
cmd = cmd + " --define '_topdir " + workdir + "' --define '_rpmdir " + pkgwritedir + "'"
|
|
|
|
cmd = cmd + " --define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm'"
|
|
|
|
cmd = cmd + " --define '_use_internal_dependency_generator 0'"
|
2012-02-09 09:51:10 +00:00
|
|
|
if perfiledeps:
|
|
|
|
cmd = cmd + " --define '__find_requires " + outdepends + "'"
|
|
|
|
cmd = cmd + " --define '__find_provides " + outprovides + "'"
|
|
|
|
else:
|
|
|
|
cmd = cmd + " --define '__find_requires %{nil}'"
|
|
|
|
cmd = cmd + " --define '__find_provides %{nil}'"
|
2012-07-11 17:33:43 +00:00
|
|
|
cmd = cmd + " --define '_unpackaged_files_terminate_build 0'"
|
|
|
|
cmd = cmd + " --define 'debug_package %{nil}'"
|
|
|
|
cmd = cmd + " --define '_rpmfc_magic_path " + magicfile + "'"
|
|
|
|
cmd = cmd + " --define '_tmppath " + workdir + "'"
|
2012-08-23 15:13:25 +00:00
|
|
|
if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) == 'srpm':
|
archiver.bbclass: fix the fakeroot and other issues
* Fix the fakeroot issue
The archiver.bbclass is used for archiving sources, patches, and logs,
it uses the "rpmbuild -bs" from the package_rpm.bbclass to generate the
.src.rpm, but it didn't work (it's not easy to explain it clearly):
Reason:
- It directly used the "fakeroot" command, we don't have such a
command in native tools, so it would use the fakeroot from the host,
and it would fail when there is no fakeroot on the host.
- The "rpmbuild -bs" doesn't need to work under root, but it is in the
function do_package_write_rpm which is running under fakeroot, and
"rpmbuild" needs to know the source file's user/group name, the source
file is the tarball which is created by the postfuncs of do_unpack
or do_patch which doesn't use the fakeroot, so the created file's
owner would be the real user, e.g.: robert, but there is no such a
user under our native tools' fakeroot(pseudo), then the rpmbuild would
fail. It worked when use the host's fakeroot in the past was because
that the host's fakeroot knows the users on the host.
Fix:
- Remove the incorrect "fakeroot".
- Change the source file's owner to root.root under fakeroot will fix the
problem.
* Other fixes:
- The typo: "do_remove_taball -> do_remove_tarball" which will cause the
tarball is not removed.
- Add the _sourcedir defination to the rpmbuild command since the the
SOURCES would be added to the specfile when archiver.bbclass is
inherited, otherwise there would be errors when "rpmbuild -bb", though
the build is OK. It only added the defination to "rpmbuild -bs",
didn't add to "rpmbuild -bb".
[YOCTO #2619]
(From OE-Core rev: ac152f277fdff256def01af4268215a05685a0f7)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-22 07:34:34 +00:00
|
|
|
cmd = cmd + " --define '_sourcedir " + workdir + "'"
|
|
|
|
cmdsrpm = cmd + " --define '_srcrpmdir " + creat_srpm_dir(d) + "'"
|
|
|
|
cmdsrpm = cmdsrpm + " -bs " + outspecfile
|
2012-08-24 06:06:59 +00:00
|
|
|
# Build the .src.rpm
|
2012-07-11 17:33:43 +00:00
|
|
|
d.setVar('SBUILDSPEC', cmdsrpm + "\n")
|
|
|
|
d.setVarFlag('SBUILDSPEC', 'func', '1')
|
|
|
|
bb.build.exec_func('SBUILDSPEC', d)
|
2012-08-24 06:06:59 +00:00
|
|
|
# Remove the source (SOURCE0, SOURCE1 ...)
|
|
|
|
cmd = cmd + " --rmsource "
|
|
|
|
cmd = cmd + " -bb " + outspecfile
|
2012-03-26 10:49:23 +00:00
|
|
|
|
2012-07-11 17:33:43 +00:00
|
|
|
# Build the rpm package!
|
|
|
|
d.setVar('BUILDSPEC', cmd + "\n")
|
|
|
|
d.setVarFlag('BUILDSPEC', 'func', '1')
|
|
|
|
bb.build.exec_func('BUILDSPEC', d)
|
2005-08-31 10:45:47 +00:00
|
|
|
}
|
2007-08-21 09:37:30 +00:00
|
|
|
|
|
|
|
python () {
|
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
|
|
|
if d.getVar('PACKAGES', True) != '':
|
2012-03-03 10:41:41 +00:00
|
|
|
deps = ' rpm-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot'
|
|
|
|
d.appendVarFlag('do_package_write_rpm', 'depends', deps)
|
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
|
|
|
d.setVarFlag('do_package_write_rpm', 'fakeroot', 1)
|
2007-08-21 09:37:30 +00:00
|
|
|
}
|
|
|
|
|
2010-08-05 09:52:10 +00:00
|
|
|
SSTATETASKS += "do_package_write_rpm"
|
|
|
|
do_package_write_rpm[sstate-name] = "deploy-rpm"
|
|
|
|
do_package_write_rpm[sstate-inputdirs] = "${PKGWRITEDIRRPM}"
|
|
|
|
do_package_write_rpm[sstate-outputdirs] = "${DEPLOY_DIR_RPM}"
|
2011-03-29 10:58:01 +00:00
|
|
|
# Take a shared lock, we can write multiple packages at the same time...
|
|
|
|
# but we need to stop the rootfs/solver from running while we do...
|
|
|
|
do_package_write_rpm[sstate-lockfile-shared] += "${DEPLOY_DIR_RPM}/rpm.lock"
|
2010-08-05 09:52:10 +00:00
|
|
|
|
|
|
|
python do_package_write_rpm_setscene () {
|
2012-07-11 17:33:43 +00:00
|
|
|
sstate_setscene(d)
|
2010-08-05 09:52:10 +00:00
|
|
|
}
|
2010-09-16 05:55:21 +00:00
|
|
|
addtask do_package_write_rpm_setscene
|
2007-08-21 09:37:30 +00:00
|
|
|
|
|
|
|
python do_package_write_rpm () {
|
2012-07-11 17:33:43 +00:00
|
|
|
bb.build.exec_func("read_subpackage_metadata", d)
|
|
|
|
bb.build.exec_func("do_package_rpm", d)
|
2007-08-21 09:37:30 +00:00
|
|
|
}
|
2010-08-20 16:52:39 +00:00
|
|
|
|
2010-08-05 09:52:10 +00:00
|
|
|
do_package_write_rpm[dirs] = "${PKGWRITEDIRRPM}"
|
2013-01-29 22:04:35 +00:00
|
|
|
do_package_write_rpm[cleandirs] = "${PKGWRITEDIRRPM}"
|
2012-03-10 02:11:57 +00:00
|
|
|
do_package_write_rpm[umask] = "022"
|
2013-01-23 14:27:33 +00:00
|
|
|
addtask package_write_rpm before do_package_write after do_packagedata do_package
|
2008-08-18 08:01:41 +00:00
|
|
|
|
2013-02-17 08:57:17 +00:00
|
|
|
PACKAGEINDEXES += "[ ! -e ${DEPLOY_DIR_RPM} ] || package_update_index_rpm;"
|
package-index.bb: add support for deb and rpm.
[YOCTO #1024]
Currently package-index.bb only supports ipk. This commit adds the support
for rpm and deb, too.
------------------------------
How to generate and use repos:
1) run "bitbake package-index" after building some target,
e.g., core-image-sato-sdk;
2) export ${DEPLOY_DIR_RPM}, ${DEPLOY_DIR_IPK} and ${DEPLOY_DIR_DEB} by a
webserver on the host, assuming the host IP is 192.168.7.1, at
http://192.168.7.1/rpm
http://192.168.7.1/ipk
http://192.168.7.1/deb
3) inside the target, according to the packaging system (rpm, ipk or deb) used
when we generate the target image, we can use different ways to manage
packages:
3.1) RPM
run "zypper addrepo http://192.168.7.1/rpm main; zypper refresh"
to retrieve info about the repo; next, we can use "zypper install/remove"
to manage packages.
3.2) IPK
add the repo info into opkg config file, i.e., in
/etc/opkg/arch.conf, we can add something like
"src i586 http://192.168.7.1/ipk/i586", and next, we run "opkg update" to
make opkg update the list of available packages. And later, we can use
"opkg install/remove" to manage packages.
3.3) DEB
Currently in target, some important config files, like
/var/lib/dpkg/status and /etc/apt/sources.list, for deb/apt are missing. So
we can't install/remove package in target at present.
(From OE-Core rev: 01e34bdb43e0cc27c1cfffd6730c384f40c404c1)
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-05-18 04:09:01 +00:00
|
|
|
PACKAGEINDEXDEPS += "rpm-native:do_populate_sysroot"
|
|
|
|
PACKAGEINDEXDEPS += "createrepo-native:do_populate_sysroot"
|