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"
|
|
|
|
|
2016-12-14 21:13:04 +00:00
|
|
|
DPKG_ARCH ?= "${@debian_arch_map(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'))}"
|
2016-02-07 17:09:08 +00:00
|
|
|
DPKG_ARCH[vardepvalue] = "${DPKG_ARCH}"
|
2007-09-27 20:26:26 +00:00
|
|
|
|
2010-08-05 09:52:10 +00:00
|
|
|
PKGWRITEDIRDEB = "${WORKDIR}/deploy-debs"
|
|
|
|
|
2013-08-13 15:50:55 +00:00
|
|
|
APTCONF_TARGET = "${WORKDIR}"
|
|
|
|
|
2016-12-14 21:13:04 +00:00
|
|
|
APT_ARGS = "${@['', '--no-install-recommends'][d.getVar("NO_RECOMMENDATIONS") == "1"]}"
|
2013-08-13 00:47:11 +00:00
|
|
|
|
2016-01-06 12:21:33 +00:00
|
|
|
def debian_arch_map(arch, tune):
|
|
|
|
tune_features = tune.split()
|
2017-01-25 17:13:40 +00:00
|
|
|
if arch == "allarch":
|
|
|
|
return "all"
|
2016-01-06 12:21:33 +00:00
|
|
|
if arch in ["i586", "i686"]:
|
|
|
|
return "i386"
|
|
|
|
if arch == "x86_64":
|
|
|
|
if "mx32" in tune_features:
|
|
|
|
return "x32"
|
|
|
|
return "amd64"
|
|
|
|
if arch.startswith("mips"):
|
|
|
|
endian = ["el", ""]["bigendian" in tune_features]
|
|
|
|
if "n64" in tune_features:
|
|
|
|
return "mips64" + endian
|
|
|
|
if "n32" in tune_features:
|
|
|
|
return "mipsn32" + endian
|
|
|
|
return "mips" + endian
|
|
|
|
if arch == "powerpc":
|
|
|
|
return arch + ["", "spe"]["spe" in tune_features]
|
|
|
|
if arch == "aarch64":
|
|
|
|
return "arm64"
|
|
|
|
if arch == "arm":
|
|
|
|
return arch + ["el", "hf"]["callconvention-hard" in tune_features]
|
|
|
|
return arch
|
2011-01-30 04:26:14 +00:00
|
|
|
#
|
|
|
|
# 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
|
2015-11-05 15:48:18 +00:00
|
|
|
# INSTALL_PACKAGES_ATTEMPTONLY_DEB - packages attempted to be installed only
|
2011-01-30 04:26:14 +00:00
|
|
|
# INSTALL_PACKAGES_LINGUAS_DEB - additional packages for uclibc
|
|
|
|
# INSTALL_TASK_DEB - task name
|
|
|
|
|
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
|
2016-07-18 03:32:46 +00:00
|
|
|
import collections
|
2017-01-21 14:08:07 +00:00
|
|
|
import codecs
|
2006-09-19 09:04:09 +00:00
|
|
|
|
2016-06-16 15:36:27 +00:00
|
|
|
oldcwd = os.getcwd()
|
|
|
|
|
2016-12-14 21:13:04 +00:00
|
|
|
workdir = d.getVar('WORKDIR')
|
2006-09-19 09:04:09 +00:00
|
|
|
if not workdir:
|
|
|
|
bb.error("WORKDIR not defined, unable to package")
|
|
|
|
return
|
|
|
|
|
2016-12-14 21:13:04 +00:00
|
|
|
outdir = d.getVar('PKGWRITEDIRDEB')
|
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
|
|
|
|
|
2016-12-14 21:13:04 +00:00
|
|
|
packages = d.getVar('PACKAGES')
|
2006-09-19 09:04:09 +00:00
|
|
|
if not packages:
|
|
|
|
bb.debug(1, "PACKAGES not defined, nothing to package")
|
|
|
|
return
|
|
|
|
|
2016-12-14 21:13:04 +00:00
|
|
|
tmpdir = d.getVar('TMPDIR')
|
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
|
|
|
|
|
2016-12-14 21:13:04 +00:00
|
|
|
pkgdest = d.getVar('PKGDEST')
|
2011-01-21 16:47:01 +00:00
|
|
|
|
2013-11-05 22:08:56 +00:00
|
|
|
def cleanupcontrol(root):
|
|
|
|
for p in ['CONTROL', 'DEBIAN']:
|
|
|
|
p = os.path.join(root, p)
|
|
|
|
if os.path.exists(p):
|
|
|
|
bb.utils.prunedir(p)
|
|
|
|
|
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)
|
2016-12-14 21:13:04 +00:00
|
|
|
pkgname = localdata.getVar('PKG_%s' % pkg)
|
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
|
|
|
|
2015-06-02 14:06:13 +00:00
|
|
|
localdata.setVar('OVERRIDES', d.getVar("OVERRIDES", False) + ":" + pkg)
|
2006-09-19 09:04:09 +00:00
|
|
|
|
|
|
|
basedir = os.path.join(os.path.dirname(root))
|
|
|
|
|
2016-12-14 21:13:04 +00:00
|
|
|
pkgoutdir = os.path.join(outdir, localdata.getVar('PACKAGE_ARCH'))
|
2013-09-01 07:52:40 +00:00
|
|
|
bb.utils.mkdirhier(pkgoutdir)
|
2006-09-19 09:04:09 +00:00
|
|
|
|
|
|
|
os.chdir(root)
|
2013-11-05 22:08:56 +00:00
|
|
|
cleanupcontrol(root)
|
2006-09-19 09:04:09 +00:00
|
|
|
from glob import glob
|
|
|
|
g = glob('*')
|
2015-06-18 14:14:16 +00:00
|
|
|
if not g and localdata.getVar('ALLOW_EMPTY', False) != "1":
|
2016-12-14 21:13:04 +00:00
|
|
|
bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV'), localdata.getVar('PKGR')))
|
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')
|
2013-09-01 07:52:40 +00:00
|
|
|
bb.utils.mkdirhier(controldir)
|
2013-05-07 10:23:40 +00:00
|
|
|
os.chmod(controldir, 0o755)
|
2017-01-21 14:08:07 +00:00
|
|
|
|
|
|
|
ctrlfile = codecs.open(os.path.join(controldir, 'control'), 'w', 'utf-8')
|
2006-09-19 09:04:09 +00:00
|
|
|
|
|
|
|
fields = []
|
2016-12-14 21:13:04 +00:00
|
|
|
pe = d.getVar('PKGE')
|
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']])
|
2016-12-14 21:13:04 +00:00
|
|
|
if d.getVar('HOMEPAGE'):
|
2014-02-06 13:33:45 +00:00
|
|
|
fields.append(["Homepage: %s\n", ['HOMEPAGE']])
|
2006-09-19 09:04:09 +00:00
|
|
|
|
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:
|
2016-12-14 21:13:04 +00:00
|
|
|
data = d.getVar(i)
|
2006-11-24 17:23:05 +00:00
|
|
|
if data is None:
|
2017-01-21 14:08:07 +00:00
|
|
|
raise KeyError(i)
|
2016-12-14 21:13:04 +00:00
|
|
|
if i == 'DPKG_ARCH' and d.getVar('PACKAGE_ARCH') == 'all':
|
2006-11-24 17:23:05 +00:00
|
|
|
data = 'all'
|
2013-03-02 09:12:58 +00:00
|
|
|
elif i == 'PACKAGE_ARCH' or i == 'DPKG_ARCH':
|
|
|
|
# The params in deb package control don't allow character
|
|
|
|
# `_', so change the arch's `_' to `-'. Such as `x86_64'
|
|
|
|
# -->`x86-64'
|
|
|
|
data = data.replace('_', '-')
|
2006-11-24 17:23:05 +00:00
|
|
|
l2.append(data)
|
2006-09-19 09:04:09 +00:00
|
|
|
return l2
|
|
|
|
|
|
|
|
ctrlfile.write("Package: %s\n" % pkgname)
|
2016-12-14 21:13:04 +00:00
|
|
|
if d.getVar('PACKAGE_ARCH') == "all":
|
2016-01-06 12:21:35 +00:00
|
|
|
ctrlfile.write("Multi-Arch: foreign\n")
|
2006-09-19 09:04:09 +00:00
|
|
|
# check for required fields
|
2017-01-21 14:08:07 +00:00
|
|
|
for (c, fs) in fields:
|
|
|
|
# Special behavior for description...
|
|
|
|
if 'DESCRIPTION' in fs:
|
|
|
|
summary = localdata.getVar('SUMMARY') or localdata.getVar('DESCRIPTION') or "."
|
|
|
|
ctrlfile.write('Description: %s\n' % summary)
|
|
|
|
description = localdata.getVar('DESCRIPTION') or "."
|
|
|
|
description = textwrap.dedent(description).strip()
|
|
|
|
if '\\n' in description:
|
|
|
|
# Manually indent
|
|
|
|
for t in description.split('\\n'):
|
2017-04-28 18:38:21 +00:00
|
|
|
ctrlfile.write(' %s\n' % (t.strip() or '.'))
|
2017-01-21 14:08:07 +00:00
|
|
|
else:
|
|
|
|
# Auto indent
|
|
|
|
ctrlfile.write('%s\n' % textwrap.fill(description.strip(), width=74, initial_indent=' ', subsequent_indent=' '))
|
|
|
|
|
|
|
|
else:
|
|
|
|
ctrlfile.write(c % tuple(pullData(fs, localdata)))
|
2015-08-17 07:10:13 +00:00
|
|
|
|
2006-09-19 09:04:09 +00:00
|
|
|
# more fields
|
|
|
|
|
2012-11-16 18:29:26 +00:00
|
|
|
custom_fields_chunk = get_package_additional_metadata("deb", localdata)
|
|
|
|
if custom_fields_chunk is not None:
|
2016-05-20 10:17:05 +00:00
|
|
|
ctrlfile.write(custom_fields_chunk)
|
2012-11-16 18:29:26 +00:00
|
|
|
ctrlfile.write("\n")
|
|
|
|
|
2012-05-10 08:24:22 +00:00
|
|
|
mapping_rename_hook(localdata)
|
2006-09-19 09:04:09 +00:00
|
|
|
|
2012-09-30 00:19:11 +00:00
|
|
|
def debian_cmp_remap(var):
|
2012-11-30 02:53:29 +00:00
|
|
|
# dpkg does not allow for '(' or ')' in a dependency name
|
|
|
|
# replace these instances with '__' and '__'
|
|
|
|
#
|
2012-09-30 00:19:11 +00:00
|
|
|
# In debian '>' and '<' do not mean what it appears they mean
|
|
|
|
# '<' = less or equal
|
|
|
|
# '>' = greater or equal
|
|
|
|
# adjust these to the '<<' and '>>' equivalents
|
|
|
|
#
|
2012-11-30 02:53:29 +00:00
|
|
|
for dep in var:
|
|
|
|
if '(' in dep:
|
|
|
|
newdep = dep.replace('(', '__')
|
|
|
|
newdep = newdep.replace(')', '__')
|
|
|
|
if newdep != dep:
|
|
|
|
var[newdep] = var[dep]
|
|
|
|
del var[dep]
|
2012-09-30 00:19:11 +00:00
|
|
|
for dep in var:
|
2012-10-02 10:37:07 +00:00
|
|
|
for i, v in enumerate(var[dep]):
|
|
|
|
if (v or "").startswith("< "):
|
|
|
|
var[dep][i] = var[dep][i].replace("< ", "<< ")
|
|
|
|
elif (v or "").startswith("> "):
|
|
|
|
var[dep][i] = var[dep][i].replace("> ", ">> ")
|
2012-09-30 00:19:11 +00:00
|
|
|
|
2016-12-14 21:13:04 +00:00
|
|
|
rdepends = bb.utils.explode_dep_versions2(localdata.getVar("RDEPENDS") or "")
|
2012-09-30 00:19:11 +00:00
|
|
|
debian_cmp_remap(rdepends)
|
2016-07-20 12:16:36 +00:00
|
|
|
for dep in list(rdepends.keys()):
|
2016-03-10 13:47:09 +00:00
|
|
|
if dep == pkg:
|
|
|
|
del rdepends[dep]
|
|
|
|
continue
|
2010-08-25 14:40:34 +00:00
|
|
|
if '*' in dep:
|
|
|
|
del rdepends[dep]
|
2016-12-14 21:13:04 +00:00
|
|
|
rrecommends = bb.utils.explode_dep_versions2(localdata.getVar("RRECOMMENDS") or "")
|
2012-09-30 00:19:11 +00:00
|
|
|
debian_cmp_remap(rrecommends)
|
2016-07-20 12:16:36 +00:00
|
|
|
for dep in list(rrecommends.keys()):
|
2010-08-25 14:40:34 +00:00
|
|
|
if '*' in dep:
|
|
|
|
del rrecommends[dep]
|
2016-12-14 21:13:04 +00:00
|
|
|
rsuggests = bb.utils.explode_dep_versions2(localdata.getVar("RSUGGESTS") or "")
|
2012-09-30 00:19:11 +00:00
|
|
|
debian_cmp_remap(rsuggests)
|
2015-07-16 22:47:30 +00:00
|
|
|
# Deliberately drop version information here, not wanted/supported by deb
|
2016-12-14 21:13:04 +00:00
|
|
|
rprovides = dict.fromkeys(bb.utils.explode_dep_versions2(localdata.getVar("RPROVIDES") or ""), [])
|
2017-02-10 13:42:17 +00:00
|
|
|
# Remove file paths if any from rprovides, debian does not support custom providers
|
|
|
|
for key in list(rprovides.keys()):
|
|
|
|
if key.startswith('/'):
|
|
|
|
del rprovides[key]
|
2016-07-18 03:32:46 +00:00
|
|
|
rprovides = collections.OrderedDict(sorted(rprovides.items(), key=lambda x: x[0]))
|
2012-09-30 00:19:11 +00:00
|
|
|
debian_cmp_remap(rprovides)
|
2016-12-14 21:13:04 +00:00
|
|
|
rreplaces = bb.utils.explode_dep_versions2(localdata.getVar("RREPLACES") or "")
|
2012-09-30 00:19:11 +00:00
|
|
|
debian_cmp_remap(rreplaces)
|
2016-12-14 21:13:04 +00:00
|
|
|
rconflicts = bb.utils.explode_dep_versions2(localdata.getVar("RCONFLICTS") or "")
|
2012-09-30 00:19:11 +00:00
|
|
|
debian_cmp_remap(rconflicts)
|
2006-09-19 09:04:09 +00:00
|
|
|
if rdepends:
|
2016-05-20 10:17:05 +00:00
|
|
|
ctrlfile.write("Depends: %s\n" % bb.utils.join_deps(rdepends))
|
2006-09-19 09:04:09 +00:00
|
|
|
if rsuggests:
|
2016-05-20 10:17:05 +00:00
|
|
|
ctrlfile.write("Suggests: %s\n" % bb.utils.join_deps(rsuggests))
|
2006-09-19 09:04:09 +00:00
|
|
|
if rrecommends:
|
2016-05-20 10:17:05 +00:00
|
|
|
ctrlfile.write("Recommends: %s\n" % bb.utils.join_deps(rrecommends))
|
2006-09-19 09:04:09 +00:00
|
|
|
if rprovides:
|
2016-05-20 10:17:05 +00:00
|
|
|
ctrlfile.write("Provides: %s\n" % bb.utils.join_deps(rprovides))
|
2006-09-19 09:04:09 +00:00
|
|
|
if rreplaces:
|
2016-05-20 10:17:05 +00:00
|
|
|
ctrlfile.write("Replaces: %s\n" % bb.utils.join_deps(rreplaces))
|
2006-09-19 09:04:09 +00:00
|
|
|
if rconflicts:
|
2016-05-20 10:17:05 +00:00
|
|
|
ctrlfile.write("Conflicts: %s\n" % bb.utils.join_deps(rconflicts))
|
2006-09-19 09:04:09 +00:00
|
|
|
ctrlfile.close()
|
|
|
|
|
|
|
|
for script in ["preinst", "postinst", "prerm", "postrm"]:
|
2016-12-14 21:13:04 +00:00
|
|
|
scriptvar = localdata.getVar('pkg_%s' % script)
|
2006-09-19 09:04:09 +00:00
|
|
|
if not scriptvar:
|
|
|
|
continue
|
2014-10-10 23:36:42 +00:00
|
|
|
scriptvar = scriptvar.strip()
|
2017-01-21 14:08:07 +00:00
|
|
|
scriptfile = open(os.path.join(controldir, script), 'w')
|
2014-10-10 23:36:42 +00:00
|
|
|
|
|
|
|
if scriptvar.startswith("#!"):
|
|
|
|
pos = scriptvar.find("\n") + 1
|
|
|
|
scriptfile.write(scriptvar[:pos])
|
|
|
|
else:
|
|
|
|
pos = 0
|
|
|
|
scriptfile.write("#!/bin/sh\n")
|
|
|
|
|
|
|
|
# Prevent the prerm/postrm scripts from being run during an upgrade
|
|
|
|
if script in ('prerm', 'postrm'):
|
|
|
|
scriptfile.write('[ "$1" != "upgrade" ] || exit 0\n')
|
|
|
|
|
|
|
|
scriptfile.write(scriptvar[pos:])
|
|
|
|
scriptfile.write('\n')
|
2006-09-19 09:04:09 +00:00
|
|
|
scriptfile.close()
|
2013-05-07 10:23:40 +00:00
|
|
|
os.chmod(os.path.join(controldir, script), 0o755)
|
2006-09-19 09:04:09 +00:00
|
|
|
|
2015-02-17 02:08:12 +00:00
|
|
|
conffiles_str = ' '.join(get_conffiles(pkg, d))
|
2006-09-19 09:04:09 +00:00
|
|
|
if conffiles_str:
|
2017-01-21 14:08:07 +00:00
|
|
|
conffiles = open(os.path.join(controldir, 'conffiles'), 'w')
|
2006-09-19 09:04:09 +00:00
|
|
|
for f in conffiles_str.split():
|
2013-02-15 13:03:51 +00:00
|
|
|
if os.path.exists(oe.path.join(root, f)):
|
|
|
|
conffiles.write('%s\n' % f)
|
2006-09-19 09:04:09 +00:00
|
|
|
conffiles.close()
|
|
|
|
|
|
|
|
os.chdir(basedir)
|
2017-01-21 13:55:36 +00:00
|
|
|
subprocess.check_output("PATH=\"%s\" dpkg-deb -b %s %s" % (localdata.getVar("PATH"), root, pkgoutdir), shell=True)
|
2006-09-19 09:04:09 +00:00
|
|
|
|
2013-11-05 22:08:56 +00:00
|
|
|
cleanupcontrol(root)
|
2007-11-24 14:55:57 +00:00
|
|
|
bb.utils.unlockfile(lf)
|
2016-06-16 15:36:27 +00:00
|
|
|
os.chdir(oldcwd)
|
2006-09-19 09:04:09 +00:00
|
|
|
}
|
2016-01-06 12:21:33 +00:00
|
|
|
# Indirect references to these vars
|
|
|
|
do_package_write_deb[vardeps] += "PKGV PKGR PKGV DESCRIPTION SECTION PRIORITY MAINTAINER DPKG_ARCH PN HOMEPAGE"
|
2015-08-25 16:57:37 +00:00
|
|
|
# Otherwise allarch packages may change depending on override configuration
|
|
|
|
do_package_deb[vardepsexclude] = "OVERRIDES"
|
|
|
|
|
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-inputdirs] = "${PKGWRITEDIRDEB}"
|
|
|
|
do_package_write_deb[sstate-outputdirs] = "${DEPLOY_DIR_DEB}"
|
|
|
|
|
|
|
|
python do_package_write_deb_setscene () {
|
2016-12-14 21:13:04 +00:00
|
|
|
tmpdir = d.getVar('TMPDIR')
|
2014-01-10 16:33:01 +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"))
|
|
|
|
|
2010-08-05 09:52:10 +00:00
|
|
|
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 () {
|
2016-12-14 21:13:04 +00:00
|
|
|
if d.getVar('PACKAGES') != '':
|
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")
|
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}"
|
2013-01-29 22:04:35 +00:00
|
|
|
do_package_write_deb[cleandirs] = "${PKGWRITEDIRDEB}"
|
2012-03-10 02:11:57 +00:00
|
|
|
do_package_write_deb[umask] = "022"
|
2017-01-19 16:49:00 +00:00
|
|
|
do_package_write_deb[depends] += "${@oe.utils.build_depends_string(d.getVar('PACKAGE_WRITE_DEPS'), 'do_populate_sysroot')}"
|
2014-03-28 11:04:30 +00:00
|
|
|
addtask package_write_deb after do_packagedata 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
|
|
|
|
|
|
|
PACKAGEINDEXDEPS += "dpkg-native:do_populate_sysroot"
|
|
|
|
PACKAGEINDEXDEPS += "apt-native:do_populate_sysroot"
|
2014-02-24 16:12:07 +00:00
|
|
|
|
|
|
|
do_build[recrdeptask] += "do_package_write_deb"
|