meta-opendreambox: introduce opendreambox-srcrev.bbclass
[opendreambox.git] / meta-opendreambox / recipes-dreambox / enigma2 / enigma2-plugins_3.999.bb
1 SUMMARY = "Additional plugins for Enigma2"
2 LICENSE = "Proprietary"
3 LIC_FILES_CHKSUM = "file://COPYING;md5=8e37f34d0e40d32ea2bc90ee812c9131"
4 DEPENDS = " \
5         dbttcd \
6         dvdbackup \
7         enigma2 \
8         hdparm \
9         python-daap \
10         python-flickrapi \
11         python-gdata \
12         python-mutagen \
13         python-pycrypto \
14         python-pyopenssl \
15         python-transmissionrpc \
16         smartmontools \
17         streamripper \
18 "
19 SRCREV = "${@opendreambox_srcrev('5ef12cc93a02794e2389ab0adfd67280fd7e0224', d)}"
20
21 SRC_URI += "file://print.mak"
22
23 inherit autotools schwerkraft-git pythonnative
24
25 export BUILD_SYS
26 export HOST_SYS
27 export STAGING_INCDIR
28 export STAGING_LIBDIR
29
30 do_install_append() {
31         # create lists of files installed outside of "${libdir}/enigma2/python/Plugins" or "${datadir}/meta"
32         rm -rf ${INSTALL_ROOTDIR}
33         install -d ${INSTALL_ROOTDIR}
34         SUBDIRS=`make -f Makefile -f ${WORKDIR}/print.mak print-SUBDIRS`
35         for SUBDIR in $SUBDIRS; do
36                 oe_runmake -C $SUBDIR "DESTDIR=${INSTALL_DESTDIR}" install
37                 CATEGORY=`ls -1 ${INSTALL_PLUGINSDIR} | head -n1 | tr '[:upper:]' '[:lower:]'`
38                 NAME=`echo $SUBDIR | tr '[:upper:]' '[:lower:]'`
39                 PKG="enigma2-plugin-$CATEGORY-$NAME"
40                 rm -rf ${INSTALL_METADIR} ${INSTALL_PLUGINSDIR}
41                 find ${INSTALL_DESTDIR} -type f -name "*.la" -delete -fprintf ${INSTALL_ROOTDIR}/$PKG-dev '/%P\n'
42                 [ -s ${INSTALL_ROOTDIR}/$PKG-dev ] || rm ${INSTALL_ROOTDIR}/$PKG-dev
43                 find ${INSTALL_DESTDIR} -type f -name "*.a" -delete -fprintf ${INSTALL_ROOTDIR}/$PKG-staticdev '/%P\n'
44                 [ -s ${INSTALL_ROOTDIR}/$PKG-staticdev ] || rm ${INSTALL_ROOTDIR}/$PKG-staticdev
45                 find ${INSTALL_DESTDIR} -type f -fprintf ${INSTALL_ROOTDIR}/$PKG '/%P\n'
46                 [ -s ${INSTALL_ROOTDIR}/$PKG ] || rm ${INSTALL_ROOTDIR}/$PKG
47                 rm -rf ${INSTALL_DESTDIR}
48         done
49 }
50
51 PACKAGES_DYNAMIC = "enigma2-plugin-*"
52 PACKAGES += "${PN}-meta"
53
54 FILES_${PN} += "${datadir}/enigma2 ${datadir}/fonts"
55 FILES_${PN}-meta = "${datadir}/meta"
56
57 python populate_packages_prepend() {
58     enigma2_plugindir = bb.data.expand('${libdir}/enigma2/python/Plugins', d)
59     do_split_packages(d, enigma2_plugindir, '^(\w+/\w+)', 'enigma2-plugin-%s', '%s', recursive=True, match_path=True, prepend=True)
60     do_split_packages(d, enigma2_plugindir, '^(\w+/\w+).*/.*\.la$', 'enigma2-plugin-%s-dev', '%s (development)', recursive=True, match_path=True, prepend=True)
61     do_split_packages(d, enigma2_plugindir, '^(\w+/\w+).*/.*\.a$', 'enigma2-plugin-%s-staticdev', '%s (static development)', recursive=True, match_path=True, prepend=True)
62     do_split_packages(d, enigma2_plugindir, '^(\w+/\w+).*/\.debug/', 'enigma2-plugin-%s-dbg', '%s (debug)', recursive=True, match_path=True, prepend=True)
63     def parseControlFile(dir, d, package):
64         src = open(dir + "/" + package.split('-')[-1] + "/CONTROL/control").read()
65         for line in src.splitlines():
66             try:
67                 name, value = line.strip().split(': ', 1)
68                 if name == 'Description':
69                     d.setVar('DESCRIPTION_' + package, value)
70                 elif name == 'Depends':
71                     d.setVar('RDEPENDS_' + package, ' '.join(value.split(', ')))
72                 elif name == 'Replaces':
73                     d.setVar('RREPLACES_' + package, ' '.join(value.split(', ')))
74                 elif name == 'Conflicts':
75                     d.setVar('RCONFLICTS_' + package, ' '.join(value.split(', ')))
76             except:
77                 bb.fatal("Error parsing control file for package %s" % package)
78     def parseFileList(dir, d, package):
79         filename = os.path.join(dir, package)
80         if os.path.exists(filename):
81             varname = 'FILES_%s' % package
82             files = (d.getVar(varname, True) or "").split()
83             src = open(filename).read()
84             for line in src.splitlines():
85                 if not line in files:
86                     files.append(line)
87             d.setVar(varname, ' '.join(files))
88     tempdir = d.getVar('INSTALL_ROOTDIR', True)
89     srcdir = d.getVar('S', True)
90     for package in d.getVar('PACKAGES', True).split():
91         if package.startswith('enigma2-plugin-'):
92             parseFileList(tempdir, d, package)
93             if not package.endswith('-dev') and not package.endswith('-dbg') and not package.endswith('-staticdev'):
94                 parseControlFile(srcdir, d, package)
95 }
96
97 INSTALL_ROOTDIR = "${WORKDIR}/${PN}-packaging-tempdir"
98 INSTALL_DESTDIR = "${INSTALL_ROOTDIR}/destdir"
99 INSTALL_METADIR = "${INSTALL_DESTDIR}${datadir}/meta"
100 INSTALL_PLUGINSDIR = "${INSTALL_DESTDIR}${libdir}/enigma2/python/Plugins"