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