diff options
author | Rene Wagner <rw@handhelds.org> | 2005-08-03 19:40:58 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2005-08-03 19:40:58 +0000 |
commit | 8a4adf77cb17f20506911ff94e7683936a7f575c (patch) | |
tree | 91f363b9fc02fbbd17ee7f051136254b9f2d2210 /classes/sourcepkg.bbclass | |
parent | 12a36bed12ccb9f09981de5fa0585992a5e438c9 (diff) |
sourcepkg.bbclass: generate .orig.tar.gz and .diff.tar.gz. the latter also contains all extra files, the .bb and a showdata dump. output goes to $DEPLOY_DIR/source now.
Diffstat (limited to 'classes/sourcepkg.bbclass')
-rw-r--r-- | classes/sourcepkg.bbclass | 106 |
1 files changed, 100 insertions, 6 deletions
diff --git a/classes/sourcepkg.bbclass b/classes/sourcepkg.bbclass index 52cf2647b6..dd9a1e2e25 100644 --- a/classes/sourcepkg.bbclass +++ b/classes/sourcepkg.bbclass @@ -1,13 +1,107 @@ +DEPLOY_DIR_SRC ?= "${DEPLOY_DIR}/source" +EXCLUDE_FROM ?= ".pc" -do_tarballing(){ +# used as part of a path. make sure it's set +DISTRO ?= "openembedded" + +def get_src_tree(d): + import bb + import os, os.path + + workdir = bb.data.getVar('WORKDIR', d, 1) + if not workdir: + bb.error("WORKDIR not defined, unable to find source tree.") + return + + s = bb.data.getVar('S', d, 0) + if not s: + bb.error("S not defined, unable to find source tree.") + return + + s_tree_raw = s.split('/')[1] + s_tree = bb.data.expand(s_tree_raw, d) + + src_tree_path = os.path.join(workdir, s_tree) + try: + os.listdir(src_tree_path) + except OSError: + bb.fatal("Expected to find source tree in '%s' which doesn't exist." % src_tree_path) + bb.debug("Assuming source tree is '%s'" % src_tree_path) + + return s_tree + +sourcepkg_do_create_orig_tgz(){ + + mkdir -p ${DEPLOY_DIR_SRC} + cd ${WORKDIR} + for i in ${EXCLUDE_FROM}; do + echo $i > temp/exclude-from-file + done + + src_tree=${@get_src_tree(d)} + + echo $src_tree + oenote "Creating .orig.tar.gz in ${DEPLOY_DIR_SRC}/${P}.orig.tar.gz" + tar cvzf ${DEPLOY_DIR_SRC}/${P}.orig.tar.gz $src_tree --exclude-from temp/exclude-from-file + cp -a $src_tree $src_tree.orig +} + +sourcepkg_do_archive_bb() { + + src_tree=${@get_src_tree(d)} + dest=${WORKDIR}/$src_tree/${DISTRO} + mkdir -p $dest + + cp ${FILE} $dest +} + +python sourcepkg_do_dumpdata() { + import os + import os.path + + workdir = bb.data.getVar('WORKDIR', d, 1) + distro = bb.data.getVar('DISTRO', d, 1) + s_tree = get_src_tree(d) + openembeddeddir = os.path.join(workdir, s_tree, distro) + dumpfile = os.path.join(openembeddeddir, bb.data.expand("${P}-${PR}.showdata.dump",d)) + + try: + os.mkdir(openembeddeddir) + except OSError: + # dir exists + pass + + bb.note("Dumping metadata into '%s'" % dumpfile) + f = open(dumpfile, "w") + # emit variables and shell functions + bb.data.emit_env(f, d, True) + # emit the metadata which isnt valid shell + for e in d.keys(): + if bb.data.getVarFlag(e, 'python', d): + f.write("\npython %s () {\n%s}\n" % (e, bb.data.getVar(e, d, 1))) + f.close() +} + +sourcepkg_do_create_diff_gz(){ - mkdir -p ${DL_DIR}/sourcepkg/ cd ${WORKDIR} - echo '.pc' > tar-exclude - tar cjvf ${DL_DIR}/sourcepkg/${P}.tar.bz2 `basename ${S}` -X tar-exclude - md5sum ${DL_DIR}/sourcepkg/${P}.tar.bz2 > ${DL_DIR}/sourcepkg/${P}.tar.bz2.md5 + + src_tree=${@get_src_tree(d)} + + for i in `find . -maxdepth 1 -type f`; do + mkdir -p $src_tree/${DISTRO}/files + cp $i $src_tree/${DISTRO}/files + done + + oenote "Creating .diff.gz in ${DEPLOY_DIR_SRC}/${P}-${PR}.diff.gz" + 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 + rm -rf $src_tree.orig } -addtask tarballing after do_patch before do_configure +EXPORT_FUNCTIONS do_create_orig_tgz do_archive_bb do_dumpdata do_create_diff_gz +addtask create_orig_tgz after do_unpack before do_patch +addtask archive_bb after do_patch before do_dumpdata +addtask dumpdata after archive_bb before do_create_diff_gz +addtask create_diff_gz after do_dump_data before do_configure |