diff options
Diffstat (limited to 'meta/classes/package_deb.bbclass')
-rw-r--r-- | meta/classes/package_deb.bbclass | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass index 6733e64534..71e46a8c8e 100644 --- a/meta/classes/package_deb.bbclass +++ b/meta/classes/package_deb.bbclass | |||
@@ -11,18 +11,18 @@ DPKG_ARCH ?= "${TARGET_ARCH}" | |||
11 | PKGWRITEDIRDEB = "${WORKDIR}/deploy-debs" | 11 | PKGWRITEDIRDEB = "${WORKDIR}/deploy-debs" |
12 | 12 | ||
13 | python package_deb_fn () { | 13 | python package_deb_fn () { |
14 | bb.data.setVar('PKGFN', bb.data.getVar('PKG',d), d) | 14 | bb.data.setVar('PKGFN', d.getVar('PKG'), d) |
15 | } | 15 | } |
16 | 16 | ||
17 | addtask package_deb_install | 17 | addtask package_deb_install |
18 | python do_package_deb_install () { | 18 | python do_package_deb_install () { |
19 | pkg = bb.data.getVar('PKG', d, True) | 19 | pkg = d.getVar('PKG', True) |
20 | pkgfn = bb.data.getVar('PKGFN', d, True) | 20 | pkgfn = d.getVar('PKGFN', True) |
21 | rootfs = bb.data.getVar('IMAGE_ROOTFS', d, True) | 21 | rootfs = d.getVar('IMAGE_ROOTFS', True) |
22 | debdir = bb.data.getVar('DEPLOY_DIR_DEB', d, True) | 22 | debdir = d.getVar('DEPLOY_DIR_DEB', True) |
23 | apt_config = bb.data.expand('${STAGING_ETCDIR_NATIVE}/apt/apt.conf', d) | 23 | apt_config = bb.data.expand('${STAGING_ETCDIR_NATIVE}/apt/apt.conf', d) |
24 | stagingbindir = bb.data.getVar('STAGING_BINDIR_NATIVE', d, True) | 24 | stagingbindir = d.getVar('STAGING_BINDIR_NATIVE', True) |
25 | tmpdir = bb.data.getVar('TMPDIR', d, True) | 25 | tmpdir = d.getVar('TMPDIR', True) |
26 | 26 | ||
27 | if None in (pkg,pkgfn,rootfs): | 27 | if None in (pkg,pkgfn,rootfs): |
28 | raise bb.build.FuncFailed("missing variables (one or more of PKG, PKGFN, IMAGE_ROOTFS)") | 28 | raise bb.build.FuncFailed("missing variables (one or more of PKG, PKGFN, IMAGE_ROOTFS)") |
@@ -206,22 +206,22 @@ python do_package_deb () { | |||
206 | import re, copy | 206 | import re, copy |
207 | import textwrap | 207 | import textwrap |
208 | 208 | ||
209 | workdir = bb.data.getVar('WORKDIR', d, True) | 209 | workdir = d.getVar('WORKDIR', True) |
210 | if not workdir: | 210 | if not workdir: |
211 | bb.error("WORKDIR not defined, unable to package") | 211 | bb.error("WORKDIR not defined, unable to package") |
212 | return | 212 | return |
213 | 213 | ||
214 | outdir = bb.data.getVar('PKGWRITEDIRDEB', d, True) | 214 | outdir = d.getVar('PKGWRITEDIRDEB', True) |
215 | if not outdir: | 215 | if not outdir: |
216 | bb.error("PKGWRITEDIRDEB not defined, unable to package") | 216 | bb.error("PKGWRITEDIRDEB not defined, unable to package") |
217 | return | 217 | return |
218 | 218 | ||
219 | packages = bb.data.getVar('PACKAGES', d, True) | 219 | packages = d.getVar('PACKAGES', True) |
220 | if not packages: | 220 | if not packages: |
221 | bb.debug(1, "PACKAGES not defined, nothing to package") | 221 | bb.debug(1, "PACKAGES not defined, nothing to package") |
222 | return | 222 | return |
223 | 223 | ||
224 | tmpdir = bb.data.getVar('TMPDIR', d, True) | 224 | tmpdir = d.getVar('TMPDIR', True) |
225 | 225 | ||
226 | if os.access(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"),os.R_OK): | 226 | if os.access(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"),os.R_OK): |
227 | os.unlink(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN")) | 227 | os.unlink(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN")) |
@@ -230,7 +230,7 @@ python do_package_deb () { | |||
230 | bb.debug(1, "No packages; nothing to do") | 230 | bb.debug(1, "No packages; nothing to do") |
231 | return | 231 | return |
232 | 232 | ||
233 | pkgdest = bb.data.getVar('PKGDEST', d, True) | 233 | pkgdest = d.getVar('PKGDEST', True) |
234 | 234 | ||
235 | for pkg in packages.split(): | 235 | for pkg in packages.split(): |
236 | localdata = bb.data.createCopy(d) | 236 | localdata = bb.data.createCopy(d) |
@@ -238,19 +238,19 @@ python do_package_deb () { | |||
238 | 238 | ||
239 | lf = bb.utils.lockfile(root + ".lock") | 239 | lf = bb.utils.lockfile(root + ".lock") |
240 | 240 | ||
241 | bb.data.setVar('ROOT', '', localdata) | 241 | localdata.setVar('ROOT', '') |
242 | bb.data.setVar('ROOT_%s' % pkg, root, localdata) | 242 | localdata.setVar('ROOT_%s' % pkg, root) |
243 | pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, True) | 243 | pkgname = localdata.getVar('PKG_%s' % pkg, True) |
244 | if not pkgname: | 244 | if not pkgname: |
245 | pkgname = pkg | 245 | pkgname = pkg |
246 | bb.data.setVar('PKG', pkgname, localdata) | 246 | localdata.setVar('PKG', pkgname) |
247 | 247 | ||
248 | bb.data.setVar('OVERRIDES', pkg, localdata) | 248 | localdata.setVar('OVERRIDES', pkg) |
249 | 249 | ||
250 | bb.data.update_data(localdata) | 250 | bb.data.update_data(localdata) |
251 | basedir = os.path.join(os.path.dirname(root)) | 251 | basedir = os.path.join(os.path.dirname(root)) |
252 | 252 | ||
253 | pkgoutdir = os.path.join(outdir, bb.data.getVar('PACKAGE_ARCH', localdata, True)) | 253 | pkgoutdir = os.path.join(outdir, localdata.getVar('PACKAGE_ARCH', True)) |
254 | bb.mkdirhier(pkgoutdir) | 254 | bb.mkdirhier(pkgoutdir) |
255 | 255 | ||
256 | os.chdir(root) | 256 | os.chdir(root) |
@@ -261,8 +261,8 @@ python do_package_deb () { | |||
261 | del g[g.index('./DEBIAN')] | 261 | del g[g.index('./DEBIAN')] |
262 | except ValueError: | 262 | except ValueError: |
263 | pass | 263 | pass |
264 | if not g and bb.data.getVar('ALLOW_EMPTY', localdata) != "1": | 264 | if not g and localdata.getVar('ALLOW_EMPTY') != "1": |
265 | bb.note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PKGV', localdata, True), bb.data.getVar('PKGR', localdata, True))) | 265 | bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV', True), localdata.getVar('PKGR', True))) |
266 | bb.utils.unlockfile(lf) | 266 | bb.utils.unlockfile(lf) |
267 | continue | 267 | continue |
268 | 268 | ||
@@ -278,7 +278,7 @@ python do_package_deb () { | |||
278 | raise bb.build.FuncFailed("unable to open control file for writing.") | 278 | raise bb.build.FuncFailed("unable to open control file for writing.") |
279 | 279 | ||
280 | fields = [] | 280 | fields = [] |
281 | pe = bb.data.getVar('PKGE', d, True) | 281 | pe = d.getVar('PKGE', True) |
282 | if pe and int(pe) > 0: | 282 | if pe and int(pe) > 0: |
283 | fields.append(["Version: %s:%s-%s\n", ['PKGE', 'PKGV', 'PKGR']]) | 283 | fields.append(["Version: %s:%s-%s\n", ['PKGE', 'PKGV', 'PKGR']]) |
284 | else: | 284 | else: |
@@ -298,10 +298,10 @@ python do_package_deb () { | |||
298 | def pullData(l, d): | 298 | def pullData(l, d): |
299 | l2 = [] | 299 | l2 = [] |
300 | for i in l: | 300 | for i in l: |
301 | data = bb.data.getVar(i, d, True) | 301 | data = d.getVar(i, True) |
302 | if data is None: | 302 | if data is None: |
303 | raise KeyError(f) | 303 | raise KeyError(f) |
304 | if i == 'DPKG_ARCH' and bb.data.getVar('PACKAGE_ARCH', d, True) == 'all': | 304 | if i == 'DPKG_ARCH' and d.getVar('PACKAGE_ARCH', True) == 'all': |
305 | data = 'all' | 305 | data = 'all' |
306 | l2.append(data) | 306 | l2.append(data) |
307 | return l2 | 307 | return l2 |
@@ -311,12 +311,12 @@ python do_package_deb () { | |||
311 | try: | 311 | try: |
312 | for (c, fs) in fields: | 312 | for (c, fs) in fields: |
313 | for f in fs: | 313 | for f in fs: |
314 | if bb.data.getVar(f, localdata) is None: | 314 | if localdata.getVar(f) is None: |
315 | raise KeyError(f) | 315 | raise KeyError(f) |
316 | # Special behavior for description... | 316 | # Special behavior for description... |
317 | if 'DESCRIPTION' in fs: | 317 | if 'DESCRIPTION' in fs: |
318 | summary = bb.data.getVar('SUMMARY', localdata, True) or bb.data.getVar('DESCRIPTION', localdata, True) or "." | 318 | summary = localdata.getVar('SUMMARY', True) or localdata.getVar('DESCRIPTION', True) or "." |
319 | description = bb.data.getVar('DESCRIPTION', localdata, True) or "." | 319 | description = localdata.getVar('DESCRIPTION', True) or "." |
320 | description = textwrap.dedent(description).strip() | 320 | description = textwrap.dedent(description).strip() |
321 | ctrlfile.write('Description: %s\n' % unicode(summary)) | 321 | ctrlfile.write('Description: %s\n' % unicode(summary)) |
322 | ctrlfile.write('%s\n' % unicode(textwrap.fill(description, width=74, initial_indent=' ', subsequent_indent=' '))) | 322 | ctrlfile.write('%s\n' % unicode(textwrap.fill(description, width=74, initial_indent=' ', subsequent_indent=' '))) |
@@ -332,18 +332,18 @@ python do_package_deb () { | |||
332 | 332 | ||
333 | bb.build.exec_func("mapping_rename_hook", localdata) | 333 | bb.build.exec_func("mapping_rename_hook", localdata) |
334 | 334 | ||
335 | rdepends = bb.utils.explode_dep_versions(bb.data.getVar("RDEPENDS", localdata, True) or "") | 335 | rdepends = bb.utils.explode_dep_versions(localdata.getVar("RDEPENDS", True) or "") |
336 | for dep in rdepends: | 336 | for dep in rdepends: |
337 | if '*' in dep: | 337 | if '*' in dep: |
338 | del rdepends[dep] | 338 | del rdepends[dep] |
339 | rrecommends = bb.utils.explode_dep_versions(bb.data.getVar("RRECOMMENDS", localdata, True) or "") | 339 | rrecommends = bb.utils.explode_dep_versions(localdata.getVar("RRECOMMENDS", True) or "") |
340 | for dep in rrecommends: | 340 | for dep in rrecommends: |
341 | if '*' in dep: | 341 | if '*' in dep: |
342 | del rrecommends[dep] | 342 | del rrecommends[dep] |
343 | rsuggests = bb.utils.explode_dep_versions(bb.data.getVar("RSUGGESTS", localdata, True) or "") | 343 | rsuggests = bb.utils.explode_dep_versions(localdata.getVar("RSUGGESTS", True) or "") |
344 | rprovides = bb.utils.explode_dep_versions(bb.data.getVar("RPROVIDES", localdata, True) or "") | 344 | rprovides = bb.utils.explode_dep_versions(localdata.getVar("RPROVIDES", True) or "") |
345 | rreplaces = bb.utils.explode_dep_versions(bb.data.getVar("RREPLACES", localdata, True) or "") | 345 | rreplaces = bb.utils.explode_dep_versions(localdata.getVar("RREPLACES", True) or "") |
346 | rconflicts = bb.utils.explode_dep_versions(bb.data.getVar("RCONFLICTS", localdata, True) or "") | 346 | rconflicts = bb.utils.explode_dep_versions(localdata.getVar("RCONFLICTS", True) or "") |
347 | if rdepends: | 347 | if rdepends: |
348 | ctrlfile.write("Depends: %s\n" % unicode(bb.utils.join_deps(rdepends))) | 348 | ctrlfile.write("Depends: %s\n" % unicode(bb.utils.join_deps(rdepends))) |
349 | if rsuggests: | 349 | if rsuggests: |
@@ -359,7 +359,7 @@ python do_package_deb () { | |||
359 | ctrlfile.close() | 359 | ctrlfile.close() |
360 | 360 | ||
361 | for script in ["preinst", "postinst", "prerm", "postrm"]: | 361 | for script in ["preinst", "postinst", "prerm", "postrm"]: |
362 | scriptvar = bb.data.getVar('pkg_%s' % script, localdata, True) | 362 | scriptvar = localdata.getVar('pkg_%s' % script, True) |
363 | if not scriptvar: | 363 | if not scriptvar: |
364 | continue | 364 | continue |
365 | try: | 365 | try: |
@@ -372,7 +372,7 @@ python do_package_deb () { | |||
372 | scriptfile.close() | 372 | scriptfile.close() |
373 | os.chmod(os.path.join(controldir, script), 0755) | 373 | os.chmod(os.path.join(controldir, script), 0755) |
374 | 374 | ||
375 | conffiles_str = bb.data.getVar("CONFFILES", localdata, True) | 375 | conffiles_str = localdata.getVar("CONFFILES", True) |
376 | if conffiles_str: | 376 | if conffiles_str: |
377 | try: | 377 | try: |
378 | conffiles = file(os.path.join(controldir, 'conffiles'), 'w') | 378 | conffiles = file(os.path.join(controldir, 'conffiles'), 'w') |
@@ -384,7 +384,7 @@ python do_package_deb () { | |||
384 | conffiles.close() | 384 | conffiles.close() |
385 | 385 | ||
386 | os.chdir(basedir) | 386 | os.chdir(basedir) |
387 | ret = os.system("PATH=\"%s\" dpkg-deb -b %s %s" % (bb.data.getVar("PATH", localdata, True), root, pkgoutdir)) | 387 | ret = os.system("PATH=\"%s\" dpkg-deb -b %s %s" % (localdata.getVar("PATH", True), root, pkgoutdir)) |
388 | if ret != 0: | 388 | if ret != 0: |
389 | bb.utils.prunedir(controldir) | 389 | bb.utils.prunedir(controldir) |
390 | bb.utils.unlockfile(lf) | 390 | bb.utils.unlockfile(lf) |
@@ -405,17 +405,17 @@ python do_package_write_deb_setscene () { | |||
405 | addtask do_package_write_deb_setscene | 405 | addtask do_package_write_deb_setscene |
406 | 406 | ||
407 | python () { | 407 | python () { |
408 | if bb.data.getVar('PACKAGES', d, True) != '': | 408 | if d.getVar('PACKAGES', True) != '': |
409 | deps = (bb.data.getVarFlag('do_package_write_deb', 'depends', d) or "").split() | 409 | deps = (d.getVarFlag('do_package_write_deb', 'depends') or "").split() |
410 | deps.append('dpkg-native:do_populate_sysroot') | 410 | deps.append('dpkg-native:do_populate_sysroot') |
411 | deps.append('virtual/fakeroot-native:do_populate_sysroot') | 411 | deps.append('virtual/fakeroot-native:do_populate_sysroot') |
412 | bb.data.setVarFlag('do_package_write_deb', 'depends', " ".join(deps), d) | 412 | bb.data.setVarFlag('do_package_write_deb', 'depends', " ".join(deps), d) |
413 | bb.data.setVarFlag('do_package_write_deb', 'fakeroot', "1", d) | 413 | d.setVarFlag('do_package_write_deb', 'fakeroot', "1") |
414 | bb.data.setVarFlag('do_package_write_deb_setscene', 'fakeroot', "1", d) | 414 | d.setVarFlag('do_package_write_deb_setscene', 'fakeroot', "1") |
415 | 415 | ||
416 | # Map TARGET_ARCH to Debian's ideas about architectures | 416 | # Map TARGET_ARCH to Debian's ideas about architectures |
417 | if bb.data.getVar('DPKG_ARCH', d, True) in ["x86", "i486", "i586", "i686", "pentium"]: | 417 | if d.getVar('DPKG_ARCH', True) in ["x86", "i486", "i586", "i686", "pentium"]: |
418 | bb.data.setVar('DPKG_ARCH', 'i386', d) | 418 | d.setVar('DPKG_ARCH', 'i386') |
419 | } | 419 | } |
420 | 420 | ||
421 | python do_package_write_deb () { | 421 | python do_package_write_deb () { |