diff options
-rw-r--r-- | meta/classes-global/package_tar.bbclass | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/meta/classes-global/package_tar.bbclass b/meta/classes-global/package_tar.bbclass deleted file mode 100644 index de995f9747..0000000000 --- a/meta/classes-global/package_tar.bbclass +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | inherit package | ||
8 | |||
9 | IMAGE_PKGTYPE ?= "tar" | ||
10 | |||
11 | python do_package_tar () { | ||
12 | import subprocess | ||
13 | |||
14 | oldcwd = os.getcwd() | ||
15 | |||
16 | workdir = d.getVar('WORKDIR') | ||
17 | if not workdir: | ||
18 | bb.error("WORKDIR not defined, unable to package") | ||
19 | return | ||
20 | |||
21 | outdir = d.getVar('DEPLOY_DIR_TAR') | ||
22 | if not outdir: | ||
23 | bb.error("DEPLOY_DIR_TAR not defined, unable to package") | ||
24 | return | ||
25 | |||
26 | dvar = d.getVar('D') | ||
27 | if not dvar: | ||
28 | bb.error("D not defined, unable to package") | ||
29 | return | ||
30 | |||
31 | packages = d.getVar('PACKAGES') | ||
32 | if not packages: | ||
33 | bb.debug(1, "PACKAGES not defined, nothing to package") | ||
34 | return | ||
35 | |||
36 | pkgdest = d.getVar('PKGDEST') | ||
37 | |||
38 | bb.utils.mkdirhier(outdir) | ||
39 | bb.utils.mkdirhier(dvar) | ||
40 | |||
41 | for pkg in packages.split(): | ||
42 | localdata = bb.data.createCopy(d) | ||
43 | root = "%s/%s" % (pkgdest, pkg) | ||
44 | |||
45 | overrides = localdata.getVar('OVERRIDES', False) | ||
46 | localdata.setVar('OVERRIDES', '%s:%s' % (overrides, pkg)) | ||
47 | |||
48 | bb.utils.mkdirhier(root) | ||
49 | basedir = os.path.dirname(root) | ||
50 | tarfn = localdata.expand("${DEPLOY_DIR_TAR}/${PKG}-${PKGV}-${PKGR}.tar.gz") | ||
51 | os.chdir(root) | ||
52 | dlist = os.listdir(root) | ||
53 | if not dlist: | ||
54 | bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV'), localdata.getVar('PKGR'))) | ||
55 | continue | ||
56 | args = "tar -cz --exclude=CONTROL --exclude=DEBIAN -f".split() | ||
57 | ret = subprocess.call(args + [tarfn] + dlist) | ||
58 | if ret != 0: | ||
59 | bb.error("Creation of tar %s failed." % tarfn) | ||
60 | |||
61 | os.chdir(oldcwd) | ||
62 | } | ||
63 | |||
64 | python () { | ||
65 | if d.getVar('PACKAGES') != '': | ||
66 | deps = ' tar-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot' | ||
67 | d.appendVarFlag('do_package_write_tar', 'depends', deps) | ||
68 | d.setVarFlag('do_package_write_tar', 'fakeroot', "1") | ||
69 | } | ||
70 | |||
71 | |||
72 | python do_package_write_tar () { | ||
73 | bb.build.exec_func("read_subpackage_metadata", d) | ||
74 | bb.build.exec_func("do_package_tar", d) | ||
75 | } | ||
76 | do_package_write_tar[dirs] = "${D}" | ||
77 | addtask package_write_tar before do_build after do_packagedata do_package | ||