Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | inherit package |
| 2 | |
| 3 | IMAGE_PKGTYPE ?= "ipk" |
| 4 | |
| 5 | IPKGCONF_TARGET = "${WORKDIR}/opkg.conf" |
| 6 | IPKGCONF_SDK = "${WORKDIR}/opkg-sdk.conf" |
| 7 | |
| 8 | PKGWRITEDIRIPK = "${WORKDIR}/deploy-ipks" |
| 9 | |
| 10 | # Program to be used to build opkg packages |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 11 | OPKGBUILDCMD ??= "opkg-build -Z xz" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 12 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 13 | OPKG_ARGS += "--force_postinstall --prefer-arch-to-version" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 14 | OPKG_ARGS += "${@['', '--no-install-recommends'][d.getVar("NO_RECOMMENDATIONS") == "1"]}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 15 | OPKG_ARGS += "${@['', '--add-exclude ' + ' --add-exclude '.join((d.getVar('PACKAGE_EXCLUDE') or "").split())][(d.getVar("PACKAGE_EXCLUDE") or "").strip() != ""]}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 16 | |
| 17 | OPKGLIBDIR = "${localstatedir}/lib" |
| 18 | |
| 19 | python do_package_ipk () { |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 20 | import multiprocessing |
| 21 | import traceback |
| 22 | |
| 23 | class IPKWritePkgProcess(multiprocessing.Process): |
| 24 | def __init__(self, *args, **kwargs): |
| 25 | multiprocessing.Process.__init__(self, *args, **kwargs) |
| 26 | self._pconn, self._cconn = multiprocessing.Pipe() |
| 27 | self._exception = None |
| 28 | |
| 29 | def run(self): |
| 30 | try: |
| 31 | multiprocessing.Process.run(self) |
| 32 | self._cconn.send(None) |
| 33 | except Exception as e: |
| 34 | tb = traceback.format_exc() |
| 35 | self._cconn.send((e, tb)) |
| 36 | |
| 37 | @property |
| 38 | def exception(self): |
| 39 | if self._pconn.poll(): |
| 40 | self._exception = self._pconn.recv() |
| 41 | return self._exception |
| 42 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 43 | |
| 44 | oldcwd = os.getcwd() |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 45 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 46 | workdir = d.getVar('WORKDIR') |
| 47 | outdir = d.getVar('PKGWRITEDIRIPK') |
| 48 | tmpdir = d.getVar('TMPDIR') |
| 49 | pkgdest = d.getVar('PKGDEST') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 50 | if not workdir or not outdir or not tmpdir: |
| 51 | bb.error("Variables incorrectly set, unable to package") |
| 52 | return |
| 53 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 54 | packages = d.getVar('PACKAGES') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 55 | if not packages or packages == '': |
| 56 | bb.debug(1, "No packages; nothing to do") |
| 57 | return |
| 58 | |
| 59 | # We're about to add new packages so the index needs to be checked |
| 60 | # so remove the appropriate stamp file. |
| 61 | if os.access(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"), os.R_OK): |
| 62 | os.unlink(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN")) |
| 63 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 64 | max_process = int(d.getVar("BB_NUMBER_THREADS") or os.cpu_count() or 1) |
| 65 | launched = [] |
| 66 | error = None |
| 67 | pkgs = packages.split() |
| 68 | while not error and pkgs: |
| 69 | if len(launched) < max_process: |
| 70 | p = IPKWritePkgProcess(target=ipk_write_pkg, args=(pkgs.pop(), d)) |
| 71 | p.start() |
| 72 | launched.append(p) |
| 73 | for q in launched: |
| 74 | # The finished processes are joined when calling is_alive() |
| 75 | if not q.is_alive(): |
| 76 | launched.remove(q) |
| 77 | if q.exception: |
| 78 | error, traceback = q.exception |
| 79 | break |
| 80 | |
| 81 | for p in launched: |
| 82 | p.join() |
| 83 | |
| 84 | os.chdir(oldcwd) |
| 85 | |
| 86 | if error: |
| 87 | raise error |
| 88 | } |
| 89 | do_package_ipk[vardeps] += "ipk_write_pkg" |
| 90 | do_package_ipk[vardepsexclude] = "BB_NUMBER_THREADS" |
| 91 | |
| 92 | def ipk_write_pkg(pkg, d): |
| 93 | import re, copy |
| 94 | import subprocess |
| 95 | import textwrap |
| 96 | import collections |
| 97 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 98 | def cleanupcontrol(root): |
| 99 | for p in ['CONTROL', 'DEBIAN']: |
| 100 | p = os.path.join(root, p) |
| 101 | if os.path.exists(p): |
| 102 | bb.utils.prunedir(p) |
| 103 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 104 | outdir = d.getVar('PKGWRITEDIRIPK') |
| 105 | pkgdest = d.getVar('PKGDEST') |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 106 | recipesource = os.path.basename(d.getVar('FILE')) |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 107 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 108 | localdata = bb.data.createCopy(d) |
| 109 | root = "%s/%s" % (pkgdest, pkg) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 110 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 111 | lf = bb.utils.lockfile(root + ".lock") |
| 112 | try: |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 113 | localdata.setVar('ROOT', '') |
| 114 | localdata.setVar('ROOT_%s' % pkg, root) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 115 | pkgname = localdata.getVar('PKG_%s' % pkg) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 116 | if not pkgname: |
| 117 | pkgname = pkg |
| 118 | localdata.setVar('PKG', pkgname) |
| 119 | |
| 120 | localdata.setVar('OVERRIDES', d.getVar("OVERRIDES", False) + ":" + pkg) |
| 121 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 122 | basedir = os.path.join(os.path.dirname(root)) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 123 | arch = localdata.getVar('PACKAGE_ARCH') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 124 | |
| 125 | if localdata.getVar('IPK_HIERARCHICAL_FEED', False) == "1": |
| 126 | # Spread packages across subdirectories so each isn't too crowded |
| 127 | if pkgname.startswith('lib'): |
| 128 | pkg_prefix = 'lib' + pkgname[3] |
| 129 | else: |
| 130 | pkg_prefix = pkgname[0] |
| 131 | |
| 132 | # Keep -dbg, -dev, -doc, -staticdev, -locale and -locale-* packages |
| 133 | # together. These package suffixes are taken from the definitions of |
| 134 | # PACKAGES and PACKAGES_DYNAMIC in meta/conf/bitbake.conf |
| 135 | if pkgname[-4:] in ('-dbg', '-dev', '-doc'): |
| 136 | pkg_subdir = pkgname[:-4] |
| 137 | elif pkgname.endswith('-staticdev'): |
| 138 | pkg_subdir = pkgname[:-10] |
| 139 | elif pkgname.endswith('-locale'): |
| 140 | pkg_subdir = pkgname[:-7] |
| 141 | elif '-locale-' in pkgname: |
| 142 | pkg_subdir = pkgname[:pkgname.find('-locale-')] |
| 143 | else: |
| 144 | pkg_subdir = pkgname |
| 145 | |
| 146 | pkgoutdir = "%s/%s/%s/%s" % (outdir, arch, pkg_prefix, pkg_subdir) |
| 147 | else: |
| 148 | pkgoutdir = "%s/%s" % (outdir, arch) |
| 149 | |
| 150 | bb.utils.mkdirhier(pkgoutdir) |
| 151 | os.chdir(root) |
| 152 | cleanupcontrol(root) |
| 153 | from glob import glob |
| 154 | g = glob('*') |
| 155 | if not g and localdata.getVar('ALLOW_EMPTY', False) != "1": |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 156 | bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV'), localdata.getVar('PKGR'))) |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 157 | return |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 158 | |
| 159 | controldir = os.path.join(root, 'CONTROL') |
| 160 | bb.utils.mkdirhier(controldir) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 161 | ctrlfile = open(os.path.join(controldir, 'control'), 'w') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 162 | |
| 163 | fields = [] |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 164 | pe = d.getVar('PKGE') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 165 | if pe and int(pe) > 0: |
| 166 | fields.append(["Version: %s:%s-%s\n", ['PKGE', 'PKGV', 'PKGR']]) |
| 167 | else: |
| 168 | fields.append(["Version: %s-%s\n", ['PKGV', 'PKGR']]) |
| 169 | fields.append(["Description: %s\n", ['DESCRIPTION']]) |
| 170 | fields.append(["Section: %s\n", ['SECTION']]) |
| 171 | fields.append(["Priority: %s\n", ['PRIORITY']]) |
| 172 | fields.append(["Maintainer: %s\n", ['MAINTAINER']]) |
| 173 | fields.append(["License: %s\n", ['LICENSE']]) |
| 174 | fields.append(["Architecture: %s\n", ['PACKAGE_ARCH']]) |
| 175 | fields.append(["OE: %s\n", ['PN']]) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 176 | if d.getVar('HOMEPAGE'): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 177 | fields.append(["Homepage: %s\n", ['HOMEPAGE']]) |
| 178 | |
| 179 | def pullData(l, d): |
| 180 | l2 = [] |
| 181 | for i in l: |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 182 | l2.append(d.getVar(i)) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 183 | return l2 |
| 184 | |
| 185 | ctrlfile.write("Package: %s\n" % pkgname) |
| 186 | # check for required fields |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 187 | for (c, fs) in fields: |
| 188 | for f in fs: |
| 189 | if localdata.getVar(f, False) is None: |
| 190 | raise KeyError(f) |
| 191 | # Special behavior for description... |
| 192 | if 'DESCRIPTION' in fs: |
| 193 | summary = localdata.getVar('SUMMARY') or localdata.getVar('DESCRIPTION') or "." |
| 194 | ctrlfile.write('Description: %s\n' % summary) |
| 195 | description = localdata.getVar('DESCRIPTION') or "." |
| 196 | description = textwrap.dedent(description).strip() |
| 197 | if '\\n' in description: |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 198 | # Manually indent: multiline description includes a leading space |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 199 | for t in description.split('\\n'): |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 200 | ctrlfile.write(' %s\n' % (t.strip() or ' .')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 201 | else: |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 202 | # Auto indent |
| 203 | ctrlfile.write('%s\n' % textwrap.fill(description, width=74, initial_indent=' ', subsequent_indent=' ')) |
| 204 | else: |
| 205 | ctrlfile.write(c % tuple(pullData(fs, localdata))) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 206 | # more fields |
| 207 | |
| 208 | custom_fields_chunk = get_package_additional_metadata("ipk", localdata) |
| 209 | if custom_fields_chunk is not None: |
| 210 | ctrlfile.write(custom_fields_chunk) |
| 211 | ctrlfile.write("\n") |
| 212 | |
| 213 | mapping_rename_hook(localdata) |
| 214 | |
| 215 | def debian_cmp_remap(var): |
| 216 | # In debian '>' and '<' do not mean what it appears they mean |
| 217 | # '<' = less or equal |
| 218 | # '>' = greater or equal |
| 219 | # adjust these to the '<<' and '>>' equivalents |
| 220 | # |
| 221 | for dep in var: |
| 222 | for i, v in enumerate(var[dep]): |
| 223 | if (v or "").startswith("< "): |
| 224 | var[dep][i] = var[dep][i].replace("< ", "<< ") |
| 225 | elif (v or "").startswith("> "): |
| 226 | var[dep][i] = var[dep][i].replace("> ", ">> ") |
| 227 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 228 | rdepends = bb.utils.explode_dep_versions2(localdata.getVar("RDEPENDS") or "") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 229 | debian_cmp_remap(rdepends) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 230 | rrecommends = bb.utils.explode_dep_versions2(localdata.getVar("RRECOMMENDS") or "") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 231 | debian_cmp_remap(rrecommends) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 232 | rsuggests = bb.utils.explode_dep_versions2(localdata.getVar("RSUGGESTS") or "") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 233 | debian_cmp_remap(rsuggests) |
| 234 | # Deliberately drop version information here, not wanted/supported by ipk |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 235 | rprovides = dict.fromkeys(bb.utils.explode_dep_versions2(localdata.getVar("RPROVIDES") or ""), []) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 236 | rprovides = collections.OrderedDict(sorted(rprovides.items(), key=lambda x: x[0])) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 237 | debian_cmp_remap(rprovides) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 238 | rreplaces = bb.utils.explode_dep_versions2(localdata.getVar("RREPLACES") or "") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 239 | debian_cmp_remap(rreplaces) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 240 | rconflicts = bb.utils.explode_dep_versions2(localdata.getVar("RCONFLICTS") or "") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 241 | debian_cmp_remap(rconflicts) |
| 242 | |
| 243 | if rdepends: |
| 244 | ctrlfile.write("Depends: %s\n" % bb.utils.join_deps(rdepends)) |
| 245 | if rsuggests: |
| 246 | ctrlfile.write("Suggests: %s\n" % bb.utils.join_deps(rsuggests)) |
| 247 | if rrecommends: |
| 248 | ctrlfile.write("Recommends: %s\n" % bb.utils.join_deps(rrecommends)) |
| 249 | if rprovides: |
| 250 | ctrlfile.write("Provides: %s\n" % bb.utils.join_deps(rprovides)) |
| 251 | if rreplaces: |
| 252 | ctrlfile.write("Replaces: %s\n" % bb.utils.join_deps(rreplaces)) |
| 253 | if rconflicts: |
| 254 | ctrlfile.write("Conflicts: %s\n" % bb.utils.join_deps(rconflicts)) |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 255 | ctrlfile.write("Source: %s\n" % recipesource) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 256 | ctrlfile.close() |
| 257 | |
| 258 | for script in ["preinst", "postinst", "prerm", "postrm"]: |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 259 | scriptvar = localdata.getVar('pkg_%s' % script) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 260 | if not scriptvar: |
| 261 | continue |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 262 | scriptfile = open(os.path.join(controldir, script), 'w') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 263 | scriptfile.write(scriptvar) |
| 264 | scriptfile.close() |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 265 | os.chmod(os.path.join(controldir, script), 0o755) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 266 | |
| 267 | conffiles_str = ' '.join(get_conffiles(pkg, d)) |
| 268 | if conffiles_str: |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 269 | conffiles = open(os.path.join(controldir, 'conffiles'), 'w') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 270 | for f in conffiles_str.split(): |
| 271 | if os.path.exists(oe.path.join(root, f)): |
| 272 | conffiles.write('%s\n' % f) |
| 273 | conffiles.close() |
| 274 | |
| 275 | os.chdir(basedir) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 276 | subprocess.check_output("PATH=\"%s\" %s %s %s" % (localdata.getVar("PATH"), |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 277 | d.getVar("OPKGBUILDCMD"), pkg, pkgoutdir), |
| 278 | stderr=subprocess.STDOUT, |
| 279 | shell=True) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 280 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 281 | if d.getVar('IPK_SIGN_PACKAGES') == '1': |
| 282 | ipkver = "%s-%s" % (d.getVar('PKGV'), d.getVar('PKGR')) |
| 283 | ipk_to_sign = "%s/%s_%s_%s.ipk" % (pkgoutdir, pkgname, ipkver, d.getVar('PACKAGE_ARCH')) |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 284 | sign_ipk(d, ipk_to_sign) |
| 285 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 286 | finally: |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 287 | cleanupcontrol(root) |
| 288 | bb.utils.unlockfile(lf) |
| 289 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 290 | # Otherwise allarch packages may change depending on override configuration |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 291 | ipk_write_pkg[vardepsexclude] = "OVERRIDES" |
| 292 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 293 | |
| 294 | SSTATETASKS += "do_package_write_ipk" |
| 295 | do_package_write_ipk[sstate-inputdirs] = "${PKGWRITEDIRIPK}" |
| 296 | do_package_write_ipk[sstate-outputdirs] = "${DEPLOY_DIR_IPK}" |
| 297 | |
| 298 | python do_package_write_ipk_setscene () { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 299 | tmpdir = d.getVar('TMPDIR') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 300 | |
| 301 | if os.access(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"), os.R_OK): |
| 302 | os.unlink(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN")) |
| 303 | |
| 304 | sstate_setscene(d) |
| 305 | } |
| 306 | addtask do_package_write_ipk_setscene |
| 307 | |
| 308 | python () { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 309 | if d.getVar('PACKAGES') != '': |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 310 | deps = ' opkg-utils-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot xz-native:do_populate_sysroot' |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 311 | d.appendVarFlag('do_package_write_ipk', 'depends', deps) |
| 312 | d.setVarFlag('do_package_write_ipk', 'fakeroot', "1") |
| 313 | } |
| 314 | |
| 315 | python do_package_write_ipk () { |
| 316 | bb.build.exec_func("read_subpackage_metadata", d) |
| 317 | bb.build.exec_func("do_package_ipk", d) |
| 318 | } |
| 319 | do_package_write_ipk[dirs] = "${PKGWRITEDIRIPK}" |
| 320 | do_package_write_ipk[cleandirs] = "${PKGWRITEDIRIPK}" |
| 321 | do_package_write_ipk[umask] = "022" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 322 | do_package_write_ipk[depends] += "${@oe.utils.build_depends_string(d.getVar('PACKAGE_WRITE_DEPS'), 'do_populate_sysroot')}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 323 | addtask package_write_ipk after do_packagedata do_package |
| 324 | |
| 325 | PACKAGEINDEXDEPS += "opkg-utils-native:do_populate_sysroot" |
| 326 | PACKAGEINDEXDEPS += "opkg-native:do_populate_sysroot" |
| 327 | |
| 328 | do_build[recrdeptask] += "do_package_write_ipk" |