sg3-utils: add newer buildable version
[openembedded.git] / classes / src_distribute_local.bbclass
1 inherit src_distribute
2
3 SRC_DIST_LOCAL ?= "move+symlink"
4 SRC_DISTRIBUTEDIR ?= "${DEPLOY_DIR}/sources"
5 SRC_DISTRIBUTECOMMAND[dirs] = "${SRC_DISTRIBUTEDIR}/${LIC}/${PN}"
6
7 # symlinks the files to the SRC_DISTRIBUTEDIR
8 SRC_DISTRIBUTECOMMAND-symlink () {
9     test -e "${SRC}.md5" && ln -sf "${SRC}.md5" .
10     ln -sf "${SRC}" .
11 }
12
13 # copies the files to the SRC_DISTRIBUTEDIR
14 SRC_DISTRIBUTECOMMAND-copy () {
15     test -e "${SRC}.md5" && cp -f "${SRC}.md5" .
16     cp -fr "${SRC}" .
17 }
18
19 # moves the files to the SRC_DISTRIBUTEDIR and symlinks them back
20 SRC_DISTRIBUTECOMMAND-move+symlink () {
21     if ! [ -L ${SRC} ]; then
22         src=`basename "${SRC}"`
23         mv ${SRC} .
24         ln -sf $src "${SRC}"
25         if [ -e ${SRC}.md5 ]; then
26             mv ${SRC}.md5 .
27             ln -sf $src "${SRC}.md5"
28         fi
29     fi
30 }
31
32 #SRC_DISTRIBUTECOMMAND = "${@str(d.getVar('SRC_DISTRIBUTECOMMAND-%s' % d.getVar('SRC_DIST_LOCAL', 1), 1))}"
33 python () {
34     if d.getVar("SRC_DISTRIBUTECOMMAND", 1) is None:
35         cmd = d.getVar("SRC_DISTRIBUTECOMMAND-%s" % d.getVar("SRC_DIST_LOCAL", 1), 0)
36         if cmd:
37             d.setVar("SRC_DISTRIBUTECOMMAND", cmd)
38 }