1 DEPLOY_DIR_SRC ?= "${DEPLOY_DIR}/sources"
2 EXCLUDE_FROM ?= ".pc patches autom4te.cache"
4 # used as part of a path. make sure it's set
5 DISTRO ?= "openembedded"
9 workdir = bb.data.getVar('WORKDIR', d, 1)
11 bb.error("WORKDIR not defined, unable to find source tree.")
14 s = bb.data.getVar('S', d, 0)
16 bb.error("S not defined, unable to find source tree.")
19 s_tree_raw = s.split('/')[1]
20 s_tree = bb.data.expand(s_tree_raw, d)
22 src_tree_path = os.path.join(workdir, s_tree)
24 os.listdir(src_tree_path)
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)
31 sourcepkg_do_create_orig_tgz(){
33 mkdir -p ${DEPLOY_DIR_SRC}/${PN}/${PACKAGE_ARCH}
35 for i in ${EXCLUDE_FROM}; do
36 echo $i >> temp/exclude-from-file
39 src_tree=$(basename ${S})
42 oenote "Creating .orig.tar.gz in ${DEPLOY_DIR_SRC}/${PN}/${P}.orig.tar.gz"
43 tar cvzf ${DEPLOY_DIR_SRC}/${PN}/${P}.orig.tar.gz --exclude-from temp/exclude-from-file $src_tree
44 cp -pPR $src_tree $src_tree.orig
47 sourcepkg_do_archive_bb() {
49 src_tree=$(basename ${S})
50 dest=${WORKDIR}/$src_tree/${DISTRO}
56 python sourcepkg_do_dumpdata() {
58 workdir = bb.data.getVar('WORKDIR', d, 1)
59 distro = bb.data.getVar('DISTRO', d, 1)
60 s_tree = get_src_tree(d)
61 openembeddeddir = os.path.join(workdir, s_tree, distro)
62 dumpfile = os.path.join(openembeddeddir, bb.data.expand("${P}-${PR}.showdata.dump",d))
65 os.mkdir(openembeddeddir)
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
76 if bb.data.getVarFlag(e, 'python', d):
77 f.write("\npython %s () {\n%s}\n" % (e, bb.data.getVar(e, d, 1)))
81 sourcepkg_do_create_diff_gz(){
84 for i in ${EXCLUDE_FROM}; do
85 echo $i >> temp/exclude-from-file
89 src_tree=$(basename ${S})
91 for i in `find . -maxdepth 1 -type f`; do
92 mkdir -p $src_tree/${DISTRO}/files
93 cp $i $src_tree/${DISTRO}/files
96 oenote "Creating .diff.gz in ${DEPLOY_DIR_SRC}/${PN}/${PACKAGE_ARCH}/${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}/${PN}/${PACKAGE_ARCH}/${P}-${PR}.diff.gz
101 EXPORT_FUNCTIONS do_create_orig_tgz do_archive_bb do_dumpdata do_create_diff_gz
103 do_create_orig_tgz[deptask] = "do_unpack"
104 do_create_diff_gz[deptask] = "do_configure"
105 do_archive_bb[deptask] = "do_patch"
106 do_dumpdata[deptask] = "do_unpack"
108 addtask create_orig_tgz after do_unpack before do_patch
109 addtask archive_bb after do_patch before do_dumpdata
110 addtask dumpdata after do_archive_bb before do_create_diff_gz
111 addtask create_diff_gz after do_configure before do_compile