summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/sourcepkg.bbclass107
1 files changed, 0 insertions, 107 deletions
diff --git a/meta/classes/sourcepkg.bbclass b/meta/classes/sourcepkg.bbclass
deleted file mode 100644
index 102c109324..0000000000
--- a/meta/classes/sourcepkg.bbclass
+++ /dev/null
@@ -1,107 +0,0 @@
1DEPLOY_DIR_SRC ?= "${DEPLOY_DIR}/source"
2EXCLUDE_FROM ?= ".pc autom4te.cache"
3
4# used as part of a path. make sure it's set
5DISTRO ?= "openembedded"
6
7def get_src_tree(d):
8
9 workdir = d.getVar('WORKDIR', True)
10 if not workdir:
11 bb.error("WORKDIR not defined, unable to find source tree.")
12 return
13
14 s = d.getVar('S', 0)
15 if not s:
16 bb.error("S not defined, unable to find source tree.")
17 return
18
19 s_tree_raw = s.split('/')[1]
20 s_tree = d.expand(s_tree_raw)
21
22 src_tree_path = os.path.join(workdir, s_tree)
23 try:
24 os.listdir(src_tree_path)
25 except OSError:
26 bb.fatal("Expected to find source tree in '%s' which doesn't exist." % src_tree_path)
27 bb.debug("Assuming source tree is '%s'" % src_tree_path)
28
29 return s_tree
30
31sourcepkg_do_create_orig_tgz(){
32
33 mkdir -p ${DEPLOY_DIR_SRC}
34 cd ${WORKDIR}
35 for i in ${EXCLUDE_FROM}; do
36 echo $i >> temp/exclude-from-file
37 done
38
39 src_tree=${@get_src_tree(d)}
40
41 echo $src_tree
42 bbnote "Creating .orig.tar.gz in ${DEPLOY_DIR_SRC}/${P}.orig.tar.gz"
43 tar cvzf ${DEPLOY_DIR_SRC}/${P}.orig.tar.gz --exclude-from temp/exclude-from-file $src_tree
44 tar -cf - -C $src_tree -ps . | tar -xf - -C $src_tree.orig
45}
46
47sourcepkg_do_archive_bb() {
48
49 src_tree=${@get_src_tree(d)}
50 dest=${WORKDIR}/$src_tree/${DISTRO}
51 mkdir -p $dest
52
53 cp ${FILE} $dest
54}
55
56python sourcepkg_do_dumpdata() {
57
58 workdir = d.getVar('WORKDIR', True)
59 distro = d.getVar('DISTRO', True)
60 s_tree = get_src_tree(d)
61 openembeddeddir = os.path.join(workdir, s_tree, distro)
62 dumpfile = os.path.join(openembeddeddir, d.expand("${P}-${PR}.showdata.dump"))
63
64 try:
65 os.mkdir(openembeddeddir)
66 except OSError:
67 # dir exists
68 pass
69
70 bb.note("Dumping metadata into '%s'" % dumpfile)
71 f = open(dumpfile, "w")
72 # emit variables and shell functions
73 bb.data.emit_env(f, d, True)
74 # emit the metadata which isnt valid shell
75 for e in d.keys():
76 if d.getVarFlag(e, 'python'):
77 f.write("\npython %s () {\n%s}\n" % (e, d.getVar(e, True)))
78 f.close()
79}
80
81sourcepkg_do_create_diff_gz(){
82
83 cd ${WORKDIR}
84 for i in ${EXCLUDE_FROM}; do
85 echo $i >> temp/exclude-from-file
86 done
87
88
89 src_tree=${@get_src_tree(d)}
90
91 for i in `find . -maxdepth 1 -type f`; do
92 mkdir -p $src_tree/${DISTRO}/files
93 cp $i $src_tree/${DISTRO}/files
94 done
95
96 bbnote "Creating .diff.gz in ${DEPLOY_DIR_SRC}/${P}-${PR}.diff.gz"
97 LC_ALL=C TZ=UTC0 diff --exclude-from=temp/exclude-from-file -Naur $src_tree.orig $src_tree | gzip -c > ${DEPLOY_DIR_SRC}/${P}-${PR}.diff.gz
98 rm -rf $src_tree.orig
99}
100
101EXPORT_FUNCTIONS do_create_orig_tgz do_archive_bb do_dumpdata do_create_diff_gz
102
103addtask create_orig_tgz after do_unpack before do_patch
104addtask archive_bb after do_patch before do_dumpdata
105addtask dumpdata after archive_bb before do_create_diff_gz
106addtask create_diff_gz after do_dump_data before do_configure
107