aboutsummaryrefslogtreecommitdiffstats
path: root/classes/src_distribute_local.bbclass
diff options
context:
space:
mode:
authorChris Larson <clarson@mvista.com>2009-05-28 15:27:31 -0700
committerChris Larson <clarson@mvista.com>2009-08-19 14:54:29 -0700
commitee09ed852dd3e6a831a9ae5c31f260a4a9057645 (patch)
tree42539baf08100852144578ea298c8ba42a1c2bb8 /classes/src_distribute_local.bbclass
parentf9b6fb8272850ebb1a001f6f055df8a3c74733fd (diff)
downloadopenembedded-ee09ed852dd3e6a831a9ae5c31f260a4a9057645.tar.gz
src_distribute*.bbclass: cleanup, revamp parts, distribute all sources.
- Kill the big shell function with the case statement used in _local in favor of a set of bitbake variables, with the appropriate one selected as SRC_DISTRIBUTECOMMAND. - Add and use SRC_DISTRIBUTE_DLONLY to toggle distribution of all sources versus just those downloaded to DL_DIR. This variable expects to be set to an integer, anything but 0 will enable dlonly operation. This is disabled by default. - Add a more sanely named distribute_sources_all, and make distsrcall depend on it, for compatibility. - By default, distributes the sources into ${SRC_DISTRIBUTEDIR}/${LIC}/${PN}/. - Move some _local specific bits, like use of SRC_DISTRIBUTEDIR, out of the main class. - Set a "LIC" var along with the "SRC" when running SRC_DISTRIBUTECOMMAND, to facilitate the above. Signed-off-by: Chris Larson <clarson@mvista.com>
Diffstat (limited to 'classes/src_distribute_local.bbclass')
-rw-r--r--classes/src_distribute_local.bbclass58
1 files changed, 32 insertions, 26 deletions
diff --git a/classes/src_distribute_local.bbclass b/classes/src_distribute_local.bbclass
index 5f0cef5bec..ed58ed14e1 100644
--- a/classes/src_distribute_local.bbclass
+++ b/classes/src_distribute_local.bbclass
@@ -1,31 +1,37 @@
inherit src_distribute
-# SRC_DIST_LOCAL possible values:
-# copy copies the files from ${A} to the distributedir
-# symlink symlinks the files from ${A} to the distributedir
-# move+symlink moves the files into distributedir, and symlinks them back
SRC_DIST_LOCAL ?= "move+symlink"
SRC_DISTRIBUTEDIR ?= "${DEPLOY_DIR}/sources"
-SRC_DISTRIBUTECOMMAND () {
- s="${SRC}"
- if [ ! -L "$s" ] && (echo "$s"|grep "^${DL_DIR}"); then
- :
- else
- exit 0;
- fi
- mkdir -p ${SRC_DISTRIBUTEDIR}
- case "${SRC_DIST_LOCAL}" in
- copy)
- test -e $s.md5 && cp -f $s.md5 ${SRC_DISTRIBUTEDIR}/
- cp -f $s ${SRC_DISTRIBUTEDIR}/
- ;;
- symlink)
- test -e $s.md5 && ln -sf $s.md5 ${SRC_DISTRIBUTEDIR}/
- ln -sf $s ${SRC_DISTRIBUTEDIR}/
- ;;
- move+symlink)
- mv $s ${SRC_DISTRIBUTEDIR}/
- ln -sf ${SRC_DISTRIBUTEDIR}/`basename $s` $s
- ;;
- esac
+SRC_DISTRIBUTECOMMAND[dirs] = "${SRC_DISTRIBUTEDIR}/${LIC}/${PN}"
+
+# symlinks the files to the SRC_DISTRIBUTEDIR
+SRC_DISTRIBUTECOMMAND-symlink () {
+ test -e ${SRC}.md5 && ln -sf ${SRC}.md5 .
+ ln -sf ${SRC} .
+}
+
+# copies the files to the SRC_DISTRIBUTEDIR
+SRC_DISTRIBUTECOMMAND-copy () {
+ test -e ${SRC}.md5 && cp -f ${SRC}.md5 .
+ cp -f ${SRC} .
+}
+
+# moves the files to the SRC_DISTRIBUTEDIR and symlinks them back
+SRC_DISTRIBUTECOMMAND-move+symlink () {
+ if ! [ -L ${SRC} ]; then
+ mv ${SRC} .
+ ln -sf $PWD/`basename ${SRC}` ${SRC}
+ if [ -e ${SRC}.md5 ]; then
+ mv ${SRC}.md5 .
+ ln -sf $PWD/`basename ${SRC}.md5` ${SRC}.md5
+ fi
+ fi
+}
+
+#SRC_DISTRIBUTECOMMAND = "${@str(d.getVar('SRC_DISTRIBUTECOMMAND-%s' % d.getVar('SRC_DIST_LOCAL', 1), 1))}"
+python () {
+ if d.getVar("SRC_DISTRIBUTECOMMAND", 1) is None:
+ cmd = d.getVar("SRC_DISTRIBUTECOMMAND-%s" % d.getVar("SRC_DIST_LOCAL", 1), 0)
+ if cmd:
+ d.setVar("SRC_DISTRIBUTECOMMAND", cmd)
}