1 DEPLOY_DIR_SRC ?= "${DEPLOY_DIR}/sources"
2 EXCLUDE_FROM ?= ".pc autom4te.cache"
4 # used as part of a path. make sure it's set
5 DISTRO ?= "openembedded"
11 workdir = bb.data.getVar('WORKDIR', d, 1)
13 bb.error("WORKDIR not defined, unable to find source tree.")
16 s = bb.data.getVar('S', d, 0)
18 bb.error("S not defined, unable to find source tree.")
21 s_tree_raw = s.split('/')[1]
22 s_tree = bb.data.expand(s_tree_raw, d)
24 src_tree_path = os.path.join(workdir, s_tree)
26 os.listdir(src_tree_path)
28 bb.fatal("Expected to find source tree in '%s' which doesn't exist." % src_tree_path)
29 bb.debug("Assuming source tree is '%s'" % src_tree_path)
33 sourcepkg_do_create_orig_tgz(){
35 mkdir -p ${DEPLOY_DIR_SRC}
37 for i in ${EXCLUDE_FROM}; do
38 echo $i >> temp/exclude-from-file
41 src_tree=${@get_src_tree(d)}
44 oenote "Creating .orig.tar.gz in ${DEPLOY_DIR_SRC}/${P}.orig.tar.gz"
45 tar cvzf ${DEPLOY_DIR_SRC}/${P}.orig.tar.gz --exclude-from temp/exclude-from-file $src_tree
46 cp -pPR $src_tree $src_tree.orig
49 sourcepkg_do_archive_bb() {
51 src_tree=${@get_src_tree(d)}
52 dest=${WORKDIR}/$src_tree/${DISTRO}
58 python sourcepkg_do_dumpdata() {
62 workdir = bb.data.getVar('WORKDIR', d, 1)
63 distro = bb.data.getVar('DISTRO', d, 1)
64 s_tree = get_src_tree(d)
65 openembeddeddir = os.path.join(workdir, s_tree, distro)
66 dumpfile = os.path.join(openembeddeddir, bb.data.expand("${P}-${PR}.showdata.dump",d))
69 os.mkdir(openembeddeddir)
74 bb.note("Dumping metadata into '%s'" % dumpfile)
75 f = open(dumpfile, "w")
76 # emit variables and shell functions
77 bb.data.emit_env(f, d, True)
78 # emit the metadata which isnt valid shell
80 if bb.data.getVarFlag(e, 'python', d):
81 f.write("\npython %s () {\n%s}\n" % (e, bb.data.getVar(e, d, 1)))
85 sourcepkg_do_create_diff_gz(){
88 for i in ${EXCLUDE_FROM}; do
89 echo $i >> temp/exclude-from-file
93 src_tree=${@get_src_tree(d)}
95 for i in `find . -maxdepth 1 -type f`; do
96 mkdir -p $src_tree/${DISTRO}/files
97 cp $i $src_tree/${DISTRO}/files
100 oenote "Creating .diff.gz in ${DEPLOY_DIR_SRC}/${P}-${PR}.diff.gz"
101 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
102 rm -rf $src_tree.orig
105 EXPORT_FUNCTIONS do_create_orig_tgz do_archive_bb do_dumpdata do_create_diff_gz
107 do_create_orig_tgz[deptask] = "do_unpack"
108 do_create_diff_gz[deptask] = "do_patch"
109 do_archive_bb[deptask] = "do_patch"
110 do_dumpdata[deptask] = "do_unpack"
112 addtask create_orig_tgz after do_unpack before do_patch
113 addtask archive_bb after do_patch before do_dumpdata
114 addtask dumpdata after do_archive_bb before do_create_diff_gz
115 addtask create_diff_gz after do_dumpdata before do_configure