diff options
Diffstat (limited to 'meta/classes/package_tar.bbclass')
-rw-r--r-- | meta/classes/package_tar.bbclass | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/meta/classes/package_tar.bbclass b/meta/classes/package_tar.bbclass index d502847d9d..475c898daf 100644 --- a/meta/classes/package_tar.bbclass +++ b/meta/classes/package_tar.bbclass | |||
@@ -3,66 +3,66 @@ inherit package | |||
3 | IMAGE_PKGTYPE ?= "tar" | 3 | IMAGE_PKGTYPE ?= "tar" |
4 | 4 | ||
5 | python package_tar_fn () { | 5 | python package_tar_fn () { |
6 | fn = os.path.join(d.getVar('DEPLOY_DIR_TAR'), "%s-%s-%s.tar.gz" % (d.getVar('PKG'), d.getVar('PKGV'), d.getVar('PKGR'))) | 6 | fn = os.path.join(d.getVar('DEPLOY_DIR_TAR'), "%s-%s-%s.tar.gz" % (d.getVar('PKG'), d.getVar('PKGV'), d.getVar('PKGR'))) |
7 | fn = d.expand(fn) | 7 | fn = d.expand(fn) |
8 | d.setVar('PKGFN', fn) | 8 | d.setVar('PKGFN', fn) |
9 | } | 9 | } |
10 | 10 | ||
11 | python do_package_tar () { | 11 | python do_package_tar () { |
12 | import subprocess | 12 | import subprocess |
13 | workdir = d.getVar('WORKDIR', True) | 13 | workdir = d.getVar('WORKDIR', True) |
14 | if not workdir: | 14 | if not workdir: |
15 | bb.error("WORKDIR not defined, unable to package") | 15 | bb.error("WORKDIR not defined, unable to package") |
16 | return | 16 | return |
17 | 17 | ||
18 | outdir = d.getVar('DEPLOY_DIR_TAR', True) | 18 | outdir = d.getVar('DEPLOY_DIR_TAR', True) |
19 | if not outdir: | 19 | if not outdir: |
20 | bb.error("DEPLOY_DIR_TAR not defined, unable to package") | 20 | bb.error("DEPLOY_DIR_TAR not defined, unable to package") |
21 | return | 21 | return |
22 | bb.mkdirhier(outdir) | 22 | bb.mkdirhier(outdir) |
23 | 23 | ||
24 | dvar = d.getVar('D', True) | 24 | dvar = d.getVar('D', True) |
25 | if not dvar: | 25 | if not dvar: |
26 | bb.error("D not defined, unable to package") | 26 | bb.error("D not defined, unable to package") |
27 | return | 27 | return |
28 | bb.mkdirhier(dvar) | 28 | bb.mkdirhier(dvar) |
29 | 29 | ||
30 | packages = d.getVar('PACKAGES', True) | 30 | packages = d.getVar('PACKAGES', True) |
31 | if not packages: | 31 | if not packages: |
32 | bb.debug(1, "PACKAGES not defined, nothing to package") | 32 | bb.debug(1, "PACKAGES not defined, nothing to package") |
33 | return | 33 | return |
34 | 34 | ||
35 | for pkg in packages.split(): | 35 | for pkg in packages.split(): |
36 | localdata = bb.data.createCopy(d) | 36 | localdata = bb.data.createCopy(d) |
37 | root = "%s/install/%s" % (workdir, pkg) | 37 | root = "%s/install/%s" % (workdir, pkg) |
38 | 38 | ||
39 | localdata.setVar('ROOT', '') | 39 | localdata.setVar('ROOT', '') |
40 | localdata.setVar('ROOT_%s' % pkg, root) | 40 | localdata.setVar('ROOT_%s' % pkg, root) |
41 | localdata.setVar('PKG', pkg) | 41 | localdata.setVar('PKG', pkg) |
42 | 42 | ||
43 | overrides = localdata.getVar('OVERRIDES') | 43 | overrides = localdata.getVar('OVERRIDES') |
44 | if not overrides: | 44 | if not overrides: |
45 | raise bb.build.FuncFailed('OVERRIDES not defined') | 45 | raise bb.build.FuncFailed('OVERRIDES not defined') |
46 | overrides = localdata.expand(overrides) | 46 | overrides = localdata.expand(overrides) |
47 | localdata.setVar('OVERRIDES', '%s:%s' % (overrides, pkg)) | 47 | localdata.setVar('OVERRIDES', '%s:%s' % (overrides, pkg)) |
48 | 48 | ||
49 | bb.data.update_data(localdata) | 49 | bb.data.update_data(localdata) |
50 | 50 | ||
51 | root = localdata.getVar('ROOT') | 51 | root = localdata.getVar('ROOT') |
52 | bb.mkdirhier(root) | 52 | bb.mkdirhier(root) |
53 | basedir = os.path.dirname(root) | 53 | basedir = os.path.dirname(root) |
54 | pkgoutdir = outdir | 54 | pkgoutdir = outdir |
55 | bb.mkdirhier(pkgoutdir) | 55 | bb.mkdirhier(pkgoutdir) |
56 | bb.build.exec_func('package_tar_fn', localdata) | 56 | bb.build.exec_func('package_tar_fn', localdata) |
57 | tarfn = localdata.getVar('PKGFN', True) | 57 | tarfn = localdata.getVar('PKGFN', True) |
58 | os.chdir(root) | 58 | os.chdir(root) |
59 | from glob import glob | 59 | from glob import glob |
60 | if not glob('*'): | 60 | if not glob('*'): |
61 | bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV', True), localdata.getVar('PKGR', True))) | 61 | bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV', True), localdata.getVar('PKGR', True))) |
62 | continue | 62 | continue |
63 | ret = subprocess.call("tar -czf %s %s" % (tarfn, '.'), shell=True) | 63 | ret = subprocess.call("tar -czf %s %s" % (tarfn, '.'), shell=True) |
64 | if ret != 0: | 64 | if ret != 0: |
65 | bb.error("Creation of tar %s failed." % tarfn) | 65 | bb.error("Creation of tar %s failed." % tarfn) |
66 | } | 66 | } |
67 | 67 | ||
68 | python () { | 68 | python () { |
@@ -76,8 +76,8 @@ python () { | |||
76 | 76 | ||
77 | 77 | ||
78 | python do_package_write_tar () { | 78 | python do_package_write_tar () { |
79 | bb.build.exec_func("read_subpackage_metadata", d) | 79 | bb.build.exec_func("read_subpackage_metadata", d) |
80 | bb.build.exec_func("do_package_tar", d) | 80 | bb.build.exec_func("do_package_tar", d) |
81 | } | 81 | } |
82 | do_package_write_tar[dirs] = "${D}" | 82 | do_package_write_tar[dirs] = "${D}" |
83 | addtask package_write_tar before do_build after do_packagedata do_package | 83 | addtask package_write_tar before do_build after do_packagedata do_package |