2007-08-07 14:34:33 +00:00
|
|
|
#
|
2008-05-20 14:58:34 +00:00
|
|
|
# Copyright 2006-2008 OpenedHand Ltd.
|
2007-08-07 14:34:33 +00:00
|
|
|
#
|
|
|
|
|
2006-09-19 09:04:09 +00:00
|
|
|
inherit package
|
2007-04-03 11:31:02 +00:00
|
|
|
|
2006-09-19 09:04:09 +00:00
|
|
|
IMAGE_PKGTYPE ?= "deb"
|
|
|
|
|
2007-09-27 20:26:26 +00:00
|
|
|
DPKG_ARCH ?= "${TARGET_ARCH}"
|
|
|
|
|
2010-08-05 09:52:10 +00:00
|
|
|
PKGWRITEDIRDEB = "${WORKDIR}/deploy-debs"
|
|
|
|
|
2006-09-19 09:04:09 +00:00
|
|
|
python package_deb_fn () {
|
2011-11-25 14:25:16 +00:00
|
|
|
d.setVar('PKGFN', d.getVar('PKG'))
|
2006-09-19 09:04:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
addtask package_deb_install
|
|
|
|
python do_package_deb_install () {
|
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
|
|
|
pkg = d.getVar('PKG', True)
|
|
|
|
pkgfn = d.getVar('PKGFN', True)
|
|
|
|
rootfs = d.getVar('IMAGE_ROOTFS', True)
|
|
|
|
debdir = d.getVar('DEPLOY_DIR_DEB', True)
|
2012-03-03 11:21:22 +00:00
|
|
|
apt_config = d.expand('${STAGING_ETCDIR_NATIVE}/apt/apt.conf')
|
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
|
|
|
stagingbindir = d.getVar('STAGING_BINDIR_NATIVE', True)
|
|
|
|
tmpdir = d.getVar('TMPDIR', True)
|
2006-09-19 09:04:09 +00:00
|
|
|
|
|
|
|
if None in (pkg,pkgfn,rootfs):
|
|
|
|
raise bb.build.FuncFailed("missing variables (one or more of PKG, PKGFN, IMAGE_ROOTFS)")
|
|
|
|
try:
|
|
|
|
if not os.exists(rootfs):
|
|
|
|
os.makedirs(rootfs)
|
|
|
|
os.chdir(rootfs)
|
|
|
|
except OSError:
|
2009-11-08 22:32:43 +00:00
|
|
|
import sys
|
2006-09-19 09:04:09 +00:00
|
|
|
raise bb.build.FuncFailed(str(sys.exc_value))
|
|
|
|
|
|
|
|
# update packages file
|
|
|
|
(exitstatus, output) = commands.getstatusoutput('dpkg-scanpackages %s > %s/Packages' % (debdir, debdir))
|
|
|
|
if (exitstatus != 0 ):
|
|
|
|
raise bb.build.FuncFailed(output)
|
|
|
|
|
2007-09-27 11:48:36 +00:00
|
|
|
f = open(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"), "w")
|
2006-09-19 09:04:09 +00:00
|
|
|
f.close()
|
|
|
|
|
|
|
|
# NOTE: this env stuff is racy at best, we need something more capable
|
|
|
|
# than 'commands' for command execution, which includes manipulating the
|
|
|
|
# env of the fork+execve'd processs
|
|
|
|
|
|
|
|
# Set up environment
|
2007-11-12 11:11:48 +00:00
|
|
|
apt_config_backup = os.getenv('APT_CONFIG')
|
|
|
|
os.putenv('APT_CONFIG', apt_config)
|
2006-09-19 09:04:09 +00:00
|
|
|
path = os.getenv('PATH')
|
|
|
|
os.putenv('PATH', '%s:%s' % (stagingbindir, os.getenv('PATH')))
|
|
|
|
|
|
|
|
# install package
|
|
|
|
commands.getstatusoutput('apt-get update')
|
|
|
|
commands.getstatusoutput('apt-get install -y %s' % pkgfn)
|
|
|
|
|
|
|
|
# revert environment
|
2007-11-12 11:11:48 +00:00
|
|
|
os.putenv('APT_CONFIG', apt_config_backup)
|
2006-09-19 09:04:09 +00:00
|
|
|
os.putenv('PATH', path)
|
|
|
|
}
|
|
|
|
|
2011-01-30 04:26:14 +00:00
|
|
|
#
|
|
|
|
# Update the Packages index files in ${DEPLOY_DIR_DEB}
|
|
|
|
#
|
|
|
|
package_update_index_deb () {
|
|
|
|
|
|
|
|
local debarchs=""
|
|
|
|
|
|
|
|
if [ ! -z "${DEPLOY_KEEP_PACKAGES}" ]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2011-08-01 17:11:22 +00:00
|
|
|
for arch in ${PACKAGE_ARCHS} ${SDK_PACKAGE_ARCHS}; do
|
2011-01-30 04:26:14 +00:00
|
|
|
if [ -e ${DEPLOY_DIR_DEB}/$arch ]; then
|
|
|
|
debarchs="$debarchs $arch"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
for arch in $debarchs; do
|
|
|
|
if [ ! -d ${DEPLOY_DIR_DEB}/$arch ]; then
|
|
|
|
continue;
|
|
|
|
fi
|
|
|
|
cd ${DEPLOY_DIR_DEB}/$arch
|
2012-04-10 22:52:23 +00:00
|
|
|
dpkg-scanpackages . | gzip > Packages.gz
|
2011-01-30 04:26:14 +00:00
|
|
|
echo "Label: $arch" > Release
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# install a bunch of packages using apt
|
|
|
|
# the following shell variables needs to be set before calling this func:
|
|
|
|
# INSTALL_ROOTFS_DEB - install root dir
|
|
|
|
# INSTALL_BASEARCH_DEB - install base architecutre
|
|
|
|
# INSTALL_ARCHS_DEB - list of available archs
|
|
|
|
# INSTALL_PACKAGES_NORMAL_DEB - packages to be installed
|
|
|
|
# INSTALL_PACKAGES_ATTEMPTONLY_DEB - packages attemped to be installed only
|
|
|
|
# INSTALL_PACKAGES_LINGUAS_DEB - additional packages for uclibc
|
|
|
|
# INSTALL_TASK_DEB - task name
|
|
|
|
|
|
|
|
package_install_internal_deb () {
|
|
|
|
|
|
|
|
local target_rootfs="${INSTALL_ROOTFS_DEB}"
|
|
|
|
local dpkg_arch="${INSTALL_BASEARCH_DEB}"
|
|
|
|
local archs="${INSTALL_ARCHS_DEB}"
|
|
|
|
local package_to_install="${INSTALL_PACKAGES_NORMAL_DEB}"
|
|
|
|
local package_attemptonly="${INSTALL_PACKAGES_ATTEMPTONLY_DEB}"
|
2011-07-30 12:46:40 +00:00
|
|
|
local package_linguas="${INSTALL_PACKAGES_LINGUAS_DEB}"
|
2011-01-30 04:26:14 +00:00
|
|
|
local task="${INSTALL_TASK_DEB}"
|
|
|
|
|
|
|
|
rm -f ${STAGING_ETCDIR_NATIVE}/apt/sources.list.rev
|
|
|
|
rm -f ${STAGING_ETCDIR_NATIVE}/apt/preferences
|
|
|
|
|
|
|
|
priority=1
|
|
|
|
for arch in $archs; do
|
|
|
|
if [ ! -d ${DEPLOY_DIR_DEB}/$arch ]; then
|
|
|
|
continue;
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "deb file:${DEPLOY_DIR_DEB}/$arch/ ./" >> ${STAGING_ETCDIR_NATIVE}/apt/sources.list.rev
|
|
|
|
(echo "Package: *"
|
|
|
|
echo "Pin: release l=$arch"
|
|
|
|
echo "Pin-Priority: $(expr 800 + $priority)"
|
|
|
|
echo) >> ${STAGING_ETCDIR_NATIVE}/apt/preferences
|
|
|
|
priority=$(expr $priority + 5)
|
|
|
|
done
|
|
|
|
|
|
|
|
tac ${STAGING_ETCDIR_NATIVE}/apt/sources.list.rev > ${STAGING_ETCDIR_NATIVE}/apt/sources.list
|
|
|
|
|
|
|
|
cat "${STAGING_ETCDIR_NATIVE}/apt/apt.conf.sample" \
|
|
|
|
| sed -e "s#Architecture \".*\";#Architecture \"${dpkg_arch}\";#" \
|
|
|
|
| sed -e "s:#ROOTFS#:${target_rootfs}:g" \
|
|
|
|
> "${STAGING_ETCDIR_NATIVE}/apt/apt-${task}.conf"
|
|
|
|
|
|
|
|
export APT_CONFIG="${STAGING_ETCDIR_NATIVE}/apt/apt-${task}.conf"
|
|
|
|
|
2011-09-19 08:00:38 +00:00
|
|
|
mkdir -p ${target_rootfs}/var/lib/dpkg/info
|
|
|
|
mkdir -p ${target_rootfs}/var/lib/dpkg/updates
|
2011-01-30 04:26:14 +00:00
|
|
|
|
2011-09-19 08:00:38 +00:00
|
|
|
> ${target_rootfs}/var/lib/dpkg/status
|
|
|
|
> ${target_rootfs}/var/lib/dpkg/available
|
2011-01-30 04:26:14 +00:00
|
|
|
|
|
|
|
apt-get update
|
|
|
|
|
|
|
|
# Uclibc builds don't provide this stuff..
|
|
|
|
if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then
|
2011-07-30 12:46:40 +00:00
|
|
|
if [ ! -z "${package_linguas}" ]; then
|
2011-01-30 04:26:14 +00:00
|
|
|
apt-get install glibc-localedata-i18n --force-yes --allow-unauthenticated
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
2011-07-30 12:46:40 +00:00
|
|
|
for i in ${package_linguas}; do
|
2011-01-30 04:26:14 +00:00
|
|
|
apt-get install $i --force-yes --allow-unauthenticated
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# normal install
|
|
|
|
for i in ${package_to_install}; do
|
|
|
|
apt-get install $i --force-yes --allow-unauthenticated
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2012-06-18 21:42:45 +00:00
|
|
|
rm -f `dirname ${BB_LOGFILE}`/log.do_${task}-attemptonly.${PID}
|
2011-01-30 04:26:14 +00:00
|
|
|
if [ ! -z "${package_attemptonly}" ]; then
|
|
|
|
for i in ${package_attemptonly}; do
|
2012-06-18 21:42:45 +00:00
|
|
|
apt-get install $i --force-yes --allow-unauthenticated >> `dirname ${BB_LOGFILE}`/log.do_${task}-attemptonly.${PID} 2>&1 || true
|
2011-01-30 04:26:14 +00:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
find ${target_rootfs} -name \*.dpkg-new | for i in `cat`; do
|
|
|
|
mv $i `echo $i | sed -e's,\.dpkg-new$,,'`
|
|
|
|
done
|
|
|
|
|
|
|
|
# Mark all packages installed
|
2011-09-19 08:00:38 +00:00
|
|
|
sed -i -e "s/Status: install ok unpacked/Status: install ok installed/;" ${target_rootfs}/var/lib/dpkg/status
|
2011-01-30 04:26:14 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 04:04:46 +00:00
|
|
|
deb_log_check() {
|
|
|
|
target="$1"
|
|
|
|
lf_path="$2"
|
|
|
|
|
|
|
|
lf_txt="`cat $lf_path`"
|
2012-06-29 15:51:22 +00:00
|
|
|
for keyword_die in "^E:"
|
2011-01-30 04:04:46 +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"
|
2011-01-30 04:04:46 +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
|
|
|
|
}
|
|
|
|
|
2006-09-19 09:04:09 +00:00
|
|
|
python do_package_deb () {
|
2009-11-08 22:32:43 +00:00
|
|
|
import re, copy
|
2010-09-29 15:11:24 +00:00
|
|
|
import textwrap
|
2012-05-29 14:53:06 +00:00
|
|
|
import subprocess
|
2006-09-19 09:04:09 +00:00
|
|
|
|
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
|
|
|
workdir = d.getVar('WORKDIR', True)
|
2006-09-19 09:04:09 +00:00
|
|
|
if not workdir:
|
|
|
|
bb.error("WORKDIR not defined, unable to package")
|
|
|
|
return
|
|
|
|
|
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
|
|
|
outdir = d.getVar('PKGWRITEDIRDEB', True)
|
2006-09-19 09:04:09 +00:00
|
|
|
if not outdir:
|
2010-08-05 09:52:10 +00:00
|
|
|
bb.error("PKGWRITEDIRDEB not defined, unable to package")
|
2006-09-19 09:04:09 +00:00
|
|
|
return
|
|
|
|
|
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
|
|
|
packages = d.getVar('PACKAGES', True)
|
2006-09-19 09:04:09 +00:00
|
|
|
if not packages:
|
|
|
|
bb.debug(1, "PACKAGES not defined, nothing to package")
|
|
|
|
return
|
|
|
|
|
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
|
|
|
tmpdir = d.getVar('TMPDIR', True)
|
2007-09-27 11:48:36 +00:00
|
|
|
|
|
|
|
if os.access(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"),os.R_OK):
|
|
|
|
os.unlink(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"))
|
2006-09-19 09:04:09 +00:00
|
|
|
|
|
|
|
if packages == []:
|
|
|
|
bb.debug(1, "No packages; nothing to do")
|
|
|
|
return
|
|
|
|
|
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
|
|
|
pkgdest = d.getVar('PKGDEST', True)
|
2011-01-21 16:47:01 +00:00
|
|
|
|
2006-09-19 09:04:09 +00:00
|
|
|
for pkg in packages.split():
|
|
|
|
localdata = bb.data.createCopy(d)
|
2007-11-24 23:05:05 +00:00
|
|
|
root = "%s/%s" % (pkgdest, pkg)
|
2006-09-19 09:04:09 +00:00
|
|
|
|
2007-11-24 14:55:57 +00:00
|
|
|
lf = bb.utils.lockfile(root + ".lock")
|
2007-08-24 16:50:56 +00:00
|
|
|
|
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
|
|
|
localdata.setVar('ROOT', '')
|
|
|
|
localdata.setVar('ROOT_%s' % pkg, root)
|
|
|
|
pkgname = localdata.getVar('PKG_%s' % pkg, True)
|
2006-09-19 09:04:09 +00:00
|
|
|
if not pkgname:
|
|
|
|
pkgname = pkg
|
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
|
|
|
localdata.setVar('PKG', pkgname)
|
2006-09-19 09:04:09 +00:00
|
|
|
|
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
|
|
|
localdata.setVar('OVERRIDES', pkg)
|
2006-09-19 09:04:09 +00:00
|
|
|
|
|
|
|
bb.data.update_data(localdata)
|
|
|
|
basedir = os.path.join(os.path.dirname(root))
|
|
|
|
|
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
|
|
|
pkgoutdir = os.path.join(outdir, localdata.getVar('PACKAGE_ARCH', True))
|
2006-09-19 09:04:09 +00:00
|
|
|
bb.mkdirhier(pkgoutdir)
|
|
|
|
|
|
|
|
os.chdir(root)
|
|
|
|
from glob import glob
|
|
|
|
g = glob('*')
|
|
|
|
try:
|
|
|
|
del g[g.index('DEBIAN')]
|
|
|
|
del g[g.index('./DEBIAN')]
|
|
|
|
except ValueError:
|
|
|
|
pass
|
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 not g and localdata.getVar('ALLOW_EMPTY') != "1":
|
|
|
|
bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV', True), localdata.getVar('PKGR', True)))
|
2007-11-24 14:55:57 +00:00
|
|
|
bb.utils.unlockfile(lf)
|
2006-09-19 09:04:09 +00:00
|
|
|
continue
|
2007-09-27 11:48:36 +00:00
|
|
|
|
2006-09-19 09:04:09 +00:00
|
|
|
controldir = os.path.join(root, 'DEBIAN')
|
|
|
|
bb.mkdirhier(controldir)
|
2007-03-31 14:04:49 +00:00
|
|
|
os.chmod(controldir, 0755)
|
2006-09-19 09:04:09 +00:00
|
|
|
try:
|
|
|
|
ctrlfile = file(os.path.join(controldir, 'control'), 'wb')
|
|
|
|
# import codecs
|
|
|
|
# ctrlfile = codecs.open("someFile", "w", "utf-8")
|
|
|
|
except OSError:
|
2007-11-24 14:55:57 +00:00
|
|
|
bb.utils.unlockfile(lf)
|
2006-09-19 09:04:09 +00:00
|
|
|
raise bb.build.FuncFailed("unable to open control file for writing.")
|
|
|
|
|
|
|
|
fields = []
|
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
|
|
|
pe = d.getVar('PKGE', True)
|
2007-05-31 22:51:19 +00:00
|
|
|
if pe and int(pe) > 0:
|
2011-05-19 02:17:43 +00:00
|
|
|
fields.append(["Version: %s:%s-%s\n", ['PKGE', 'PKGV', 'PKGR']])
|
2007-05-31 22:51:19 +00:00
|
|
|
else:
|
2011-05-19 02:17:43 +00:00
|
|
|
fields.append(["Version: %s-%s\n", ['PKGV', 'PKGR']])
|
2006-09-19 09:04:09 +00:00
|
|
|
fields.append(["Description: %s\n", ['DESCRIPTION']])
|
|
|
|
fields.append(["Section: %s\n", ['SECTION']])
|
|
|
|
fields.append(["Priority: %s\n", ['PRIORITY']])
|
|
|
|
fields.append(["Maintainer: %s\n", ['MAINTAINER']])
|
2007-09-27 20:26:26 +00:00
|
|
|
fields.append(["Architecture: %s\n", ['DPKG_ARCH']])
|
2007-05-31 22:51:19 +00:00
|
|
|
fields.append(["OE: %s\n", ['PN']])
|
2012-07-23 21:42:26 +00:00
|
|
|
fields.append(["PackageArch: %s\n", ['PACKAGE_ARCH']])
|
2006-09-19 09:04:09 +00:00
|
|
|
fields.append(["Homepage: %s\n", ['HOMEPAGE']])
|
|
|
|
|
2010-08-25 14:40:34 +00:00
|
|
|
# Package, Version, Maintainer, Description - mandatory
|
|
|
|
# Section, Priority, Essential, Architecture, Source, Depends, Pre-Depends, Recommends, Suggests, Conflicts, Replaces, Provides - Optional
|
2006-09-19 09:04:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
def pullData(l, d):
|
|
|
|
l2 = []
|
|
|
|
for i in l:
|
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
|
|
|
data = d.getVar(i, True)
|
2006-11-24 17:23:05 +00:00
|
|
|
if data is None:
|
|
|
|
raise KeyError(f)
|
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 i == 'DPKG_ARCH' and d.getVar('PACKAGE_ARCH', True) == 'all':
|
2006-11-24 17:23:05 +00:00
|
|
|
data = 'all'
|
|
|
|
l2.append(data)
|
2006-09-19 09:04:09 +00:00
|
|
|
return l2
|
|
|
|
|
|
|
|
ctrlfile.write("Package: %s\n" % pkgname)
|
|
|
|
# check for required fields
|
|
|
|
try:
|
|
|
|
for (c, fs) in fields:
|
2010-09-29 15:11:24 +00:00
|
|
|
for f in fs:
|
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 localdata.getVar(f) is None:
|
2010-09-29 15:11:24 +00:00
|
|
|
raise KeyError(f)
|
|
|
|
# Special behavior for description...
|
|
|
|
if 'DESCRIPTION' in fs:
|
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
|
|
|
summary = localdata.getVar('SUMMARY', True) or localdata.getVar('DESCRIPTION', True) or "."
|
|
|
|
description = localdata.getVar('DESCRIPTION', True) or "."
|
2010-09-29 15:11:24 +00:00
|
|
|
description = textwrap.dedent(description).strip()
|
|
|
|
ctrlfile.write('Description: %s\n' % unicode(summary))
|
|
|
|
ctrlfile.write('%s\n' % unicode(textwrap.fill(description, width=74, initial_indent=' ', subsequent_indent=' ')))
|
|
|
|
else:
|
|
|
|
ctrlfile.write(unicode(c % tuple(pullData(fs, localdata))))
|
2006-09-19 09:04:09 +00:00
|
|
|
except KeyError:
|
2009-11-08 22:32:43 +00:00
|
|
|
import sys
|
2006-09-19 09:04:09 +00:00
|
|
|
(type, value, traceback) = sys.exc_info()
|
2007-11-24 14:55:57 +00:00
|
|
|
bb.utils.unlockfile(lf)
|
2006-09-19 09:04:09 +00:00
|
|
|
ctrlfile.close()
|
|
|
|
raise bb.build.FuncFailed("Missing field for deb generation: %s" % value)
|
|
|
|
# more fields
|
|
|
|
|
2012-05-10 08:24:22 +00:00
|
|
|
mapping_rename_hook(localdata)
|
2006-09-19 09:04:09 +00:00
|
|
|
|
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
|
|
|
rdepends = bb.utils.explode_dep_versions(localdata.getVar("RDEPENDS", True) or "")
|
2010-08-25 14:40:34 +00:00
|
|
|
for dep in rdepends:
|
|
|
|
if '*' in dep:
|
|
|
|
del rdepends[dep]
|
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
|
|
|
rrecommends = bb.utils.explode_dep_versions(localdata.getVar("RRECOMMENDS", True) or "")
|
2010-08-25 14:40:34 +00:00
|
|
|
for dep in rrecommends:
|
|
|
|
if '*' in dep:
|
|
|
|
del rrecommends[dep]
|
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
|
|
|
rsuggests = bb.utils.explode_dep_versions(localdata.getVar("RSUGGESTS", True) or "")
|
|
|
|
rprovides = bb.utils.explode_dep_versions(localdata.getVar("RPROVIDES", True) or "")
|
|
|
|
rreplaces = bb.utils.explode_dep_versions(localdata.getVar("RREPLACES", True) or "")
|
|
|
|
rconflicts = bb.utils.explode_dep_versions(localdata.getVar("RCONFLICTS", True) or "")
|
2006-09-19 09:04:09 +00:00
|
|
|
if rdepends:
|
2010-07-01 23:05:38 +00:00
|
|
|
ctrlfile.write("Depends: %s\n" % unicode(bb.utils.join_deps(rdepends)))
|
2006-09-19 09:04:09 +00:00
|
|
|
if rsuggests:
|
2010-07-01 23:05:38 +00:00
|
|
|
ctrlfile.write("Suggests: %s\n" % unicode(bb.utils.join_deps(rsuggests)))
|
2006-09-19 09:04:09 +00:00
|
|
|
if rrecommends:
|
2010-07-01 23:05:38 +00:00
|
|
|
ctrlfile.write("Recommends: %s\n" % unicode(bb.utils.join_deps(rrecommends)))
|
2006-09-19 09:04:09 +00:00
|
|
|
if rprovides:
|
2010-07-01 23:05:38 +00:00
|
|
|
ctrlfile.write("Provides: %s\n" % unicode(bb.utils.join_deps(rprovides)))
|
2006-09-19 09:04:09 +00:00
|
|
|
if rreplaces:
|
2010-07-01 23:05:38 +00:00
|
|
|
ctrlfile.write("Replaces: %s\n" % unicode(bb.utils.join_deps(rreplaces)))
|
2006-09-19 09:04:09 +00:00
|
|
|
if rconflicts:
|
2010-07-01 23:05:38 +00:00
|
|
|
ctrlfile.write("Conflicts: %s\n" % unicode(bb.utils.join_deps(rconflicts)))
|
2006-09-19 09:04:09 +00:00
|
|
|
ctrlfile.close()
|
|
|
|
|
|
|
|
for script in ["preinst", "postinst", "prerm", "postrm"]:
|
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
|
|
|
scriptvar = localdata.getVar('pkg_%s' % script, True)
|
2006-09-19 09:04:09 +00:00
|
|
|
if not scriptvar:
|
|
|
|
continue
|
|
|
|
try:
|
|
|
|
scriptfile = file(os.path.join(controldir, script), 'w')
|
|
|
|
except OSError:
|
2007-11-24 14:55:57 +00:00
|
|
|
bb.utils.unlockfile(lf)
|
2006-09-19 09:04:09 +00:00
|
|
|
raise bb.build.FuncFailed("unable to open %s script file for writing." % script)
|
2007-08-07 14:34:33 +00:00
|
|
|
scriptfile.write("#!/bin/sh\n")
|
2006-09-19 09:04:09 +00:00
|
|
|
scriptfile.write(scriptvar)
|
|
|
|
scriptfile.close()
|
|
|
|
os.chmod(os.path.join(controldir, script), 0755)
|
|
|
|
|
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
|
|
|
conffiles_str = localdata.getVar("CONFFILES", True)
|
2006-09-19 09:04:09 +00:00
|
|
|
if conffiles_str:
|
|
|
|
try:
|
|
|
|
conffiles = file(os.path.join(controldir, 'conffiles'), 'w')
|
|
|
|
except OSError:
|
2007-11-24 14:55:57 +00:00
|
|
|
bb.utils.unlockfile(lf)
|
2006-09-19 09:04:09 +00:00
|
|
|
raise bb.build.FuncFailed("unable to open conffiles for writing.")
|
|
|
|
for f in conffiles_str.split():
|
|
|
|
conffiles.write('%s\n' % f)
|
|
|
|
conffiles.close()
|
|
|
|
|
|
|
|
os.chdir(basedir)
|
2012-05-29 14:53:06 +00:00
|
|
|
ret = subprocess.call("PATH=\"%s\" dpkg-deb -b %s %s" % (localdata.getVar("PATH", True), root, pkgoutdir), shell=True)
|
2006-09-19 09:04:09 +00:00
|
|
|
if ret != 0:
|
2010-07-22 17:26:07 +00:00
|
|
|
bb.utils.prunedir(controldir)
|
2007-11-24 14:55:57 +00:00
|
|
|
bb.utils.unlockfile(lf)
|
2006-09-19 09:04:09 +00:00
|
|
|
raise bb.build.FuncFailed("dpkg-deb execution failed")
|
|
|
|
|
2008-08-18 07:58:39 +00:00
|
|
|
bb.utils.prunedir(controldir)
|
2007-11-24 14:55:57 +00:00
|
|
|
bb.utils.unlockfile(lf)
|
2006-09-19 09:04:09 +00:00
|
|
|
}
|
2007-08-21 09:37:30 +00:00
|
|
|
|
2010-08-05 09:52:10 +00:00
|
|
|
SSTATETASKS += "do_package_write_deb"
|
|
|
|
do_package_write_deb[sstate-name] = "deploy-deb"
|
|
|
|
do_package_write_deb[sstate-inputdirs] = "${PKGWRITEDIRDEB}"
|
|
|
|
do_package_write_deb[sstate-outputdirs] = "${DEPLOY_DIR_DEB}"
|
|
|
|
|
|
|
|
python do_package_write_deb_setscene () {
|
|
|
|
sstate_setscene(d)
|
|
|
|
}
|
2010-09-16 05:55:21 +00:00
|
|
|
addtask do_package_write_deb_setscene
|
2010-08-05 09:52:10 +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 = ' dpkg-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot'
|
|
|
|
d.appendVarFlag('do_package_write_deb', '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_deb', 'fakeroot', "1")
|
|
|
|
d.setVarFlag('do_package_write_deb_setscene', 'fakeroot', "1")
|
package_deb.bbclass, populate_sdk_deb.bbclass: fix meta-toolchain-gmae build
[YOCTO #1070]
Currently with deb packaging, we have 2 issues when running
"bitbake meta-toolchain-gmae".
1) when MACHINE="qemux86", SDKMACHINE="i686", INSTALL_BASEARCH_DEB is "i686",
too. This causes the following ERROR:
| E: Couldn't find package task-sdk-host-nativesdk
NOTE: package meta-toolchain-gmae-1.0-r6: task do_populate_sdk: Failed
This is becasue: due to the DPKG_ARCH mapping, we create such a deb package
tmp/deploy/deb/i686-nativesdk/task-sdk-host-nativesdk_1.0-r10_i386.deb; dpkg
can't recoginze the package. We need to map INSTALL_BASEARCH_DEB in the same
way.
2) when MACHINE="qemux86", SDKMACHINE="x86_64", INSTALL_BASEARCH_DEB is
"x86_64", too.
We get such an ERROR:
| E: Couldn't find package task-cross-canadian-i586
NOTE: package meta-toolchain-gmae-1.0-r6: task do_populate_sdk: Failed
This is because: dpkg can't recognize the generated package
tmp/deploy/deb/x86_64-nativesdk/task-cross-canadian-i586_1.0-r0_i386.deb
Here the "i386" suffix is incorrect and should be "x86_64" -- the i386
comes from the line
DPKG_ARCH_i586 ?= "i386" in package_deb.bbclass.
However, for canadian package, actually here the overriding of DPKG (from
"x86-64" to "i386") should not happen -- it accidently happens just because
TARGET_ARCH exists in OVERRIDES. We can move the overriding logic to the
anonymous python function to work this around.
(From OE-Core rev: 63010b9ee89643c8e83656783231f0a7848d9e45)
Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-09-14 14:30:14 +00:00
|
|
|
|
|
|
|
# Map TARGET_ARCH to Debian's ideas about architectures
|
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('DPKG_ARCH', True) in ["x86", "i486", "i586", "i686", "pentium"]:
|
|
|
|
d.setVar('DPKG_ARCH', 'i386')
|
2007-08-21 09:37:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
python do_package_write_deb () {
|
2012-07-11 17:33:43 +00:00
|
|
|
bb.build.exec_func("read_subpackage_metadata", d)
|
|
|
|
bb.build.exec_func("do_package_deb", d)
|
2007-08-21 09:37:30 +00:00
|
|
|
}
|
2010-08-05 09:52:10 +00:00
|
|
|
do_package_write_deb[dirs] = "${PKGWRITEDIRDEB}"
|
2012-03-10 02:11:57 +00:00
|
|
|
do_package_write_deb[umask] = "022"
|
2007-08-21 22:39:57 +00:00
|
|
|
addtask package_write_deb before do_package_write after do_package
|
2007-08-21 09:37:30 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
PACKAGEINDEXES += "package_update_index_deb;"
|
|
|
|
PACKAGEINDEXDEPS += "dpkg-native:do_populate_sysroot"
|
|
|
|
PACKAGEINDEXDEPS += "apt-native:do_populate_sysroot"
|