summaryrefslogtreecommitdiffstats
path: root/meta-oe/classes
diff options
context:
space:
mode:
authorTudor Florea <tudor.florea@enea.com>2015-10-08 22:51:41 +0200
committerTudor Florea <tudor.florea@enea.com>2015-10-08 22:51:41 +0200
commit1219bf8a90a7bf8cd3a5363551ef635d51e8fc8e (patch)
treea21a5fc103bb3bd65ecd85ed22be5228fc54e447 /meta-oe/classes
downloadmeta-openembedded-1219bf8a90a7bf8cd3a5363551ef635d51e8fc8e.tar.gz
initial commit for Enea Linux 5.0 arm
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta-oe/classes')
-rw-r--r--meta-oe/classes/breakpad.bbclass33
-rw-r--r--meta-oe/classes/gitpkgv.bbclass113
-rw-r--r--meta-oe/classes/gitver.bbclass75
-rw-r--r--meta-oe/classes/gpe.bbclass17
-rw-r--r--meta-oe/classes/machine_kernel_pr.bbclass8
5 files changed, 246 insertions, 0 deletions
diff --git a/meta-oe/classes/breakpad.bbclass b/meta-oe/classes/breakpad.bbclass
new file mode 100644
index 000000000..e4d6808a6
--- /dev/null
+++ b/meta-oe/classes/breakpad.bbclass
@@ -0,0 +1,33 @@
1# Class to inherit when you want to build against Breakpad.
2# Apart from inheriting this class, you need to set BREAKPAD_BIN in
3# your recipe, and make sure that you link against libbreakpad_client.a.
4
5DEPENDS += "breakpad breakpad-native"
6
7CFLAGS += "-I${STAGING_DIR_TARGET}${includedir}/breakpad "
8CXXFLAGS += "-I${STAGING_DIR_TARGET}${includedir}/breakpad "
9
10BREAKPAD_BIN ?= ""
11
12python () {
13 breakpad_bin = d.getVar("BREAKPAD_BIN", True)
14
15 if not breakpad_bin:
16 PN = d.getVar("PN", True)
17 FILE = os.path.basename(d.getVar("FILE", True))
18 bb.error("To build %s, see breakpad.bbclass for instructions on \
19 setting up your Breakpad configuration" % PN)
20 raise ValueError('BREAKPAD_BIN not defined in %s' % PN)
21}
22
23# Add creation of symbols here
24PACKAGE_PREPROCESS_FUNCS += "breakpad_package_preprocess"
25breakpad_package_preprocess () {
26 mkdir -p ${PKGD}/usr/share/breakpad-syms
27 find ${D} -name ${BREAKPAD_BIN} -exec sh -c "dump_syms {} > ${PKGD}/usr/share/breakpad-syms/${BREAKPAD_BIN}.syms" \;
28}
29
30PACKAGES =+ "${PN}-breakpad"
31
32FILES_${PN}-breakpad = "/usr/share/breakpad-syms"
33
diff --git a/meta-oe/classes/gitpkgv.bbclass b/meta-oe/classes/gitpkgv.bbclass
new file mode 100644
index 000000000..7bdc53893
--- /dev/null
+++ b/meta-oe/classes/gitpkgv.bbclass
@@ -0,0 +1,113 @@
1# gitpkgv.bbclass provides a GITPKGV and GITPKGVTAG variables to be
2# used in PKGV, as described bellow:
3#
4# - GITPKGV which is a sortable version with the format NN+GITHASH, to
5# be used in PKGV, where
6#
7# NN equals the total number of revs up to SRCREV
8# GITHASH is SRCREV's (full) hash
9#
10# - GITPKGVTAG which is the output of 'git describe' allowing for
11# automatic versioning
12#
13# gitpkgv.bbclass assumes the git repository has been cloned, and
14# contains SRCREV. So ${GITPKGV} and ${GITPKGVTAG} should never be
15# used in PV, only in PKGV. It can handle SRCREV = ${AUTOREV}, as
16# well as SRCREV = "<some fixed git hash>".
17#
18# WARNING: if upstream repository is always using consistent and
19# sortable tag name scheme you can get sortable version including tag
20# name with ${GITPKGVTAG}, but be aware that ie tag sequence "v1.0,
21# v1.2, xtest, v2.0" will force you to increment PE to get upgradeable
22# path to v2.0 revisions
23#
24# use example:
25#
26# inherit gitpkgv
27#
28# PV = "1.0+gitr${SRCPV}" # expands to something like 1.0+gitr3+4c1c21d7dbbf93b0df336994524313dfe0d4963b
29# PKGV = "1.0+gitr${GITPKGV}" # expands also to something like 1.0+gitr31337+4c1c21d7d
30#
31# or
32#
33# inherit gitpkgv
34#
35# PV = "1.0+gitr${SRCPV}" # expands to something like 1.0+gitr3+4c1c21d7dbbf93b0df336994524313dfe0d4963b
36# PKGV = "${GITPKGVTAG}" # expands to something like 1.0-31337+g4c1c21d
37# if there is tag v1.0 before this revision or
38# ver1.0-31337+g4c1c21d if there is tag ver1.0
39
40GITPKGV = "${@get_git_pkgv(d, False)}"
41GITPKGVTAG = "${@get_git_pkgv(d, True)}"
42
43def gitpkgv_drop_tag_prefix(version):
44 import re
45 if re.match("v\d", version):
46 return version[1:]
47 else:
48 return version
49
50def get_git_pkgv(d, use_tags):
51 import os
52 import bb
53 from pipes import quote
54
55 src_uri = d.getVar('SRC_URI', 1).split()
56 fetcher = bb.fetch2.Fetch(src_uri, d)
57 ud = fetcher.ud
58
59 #
60 # If SRCREV_FORMAT is set respect it for tags
61 #
62 format = d.getVar('SRCREV_FORMAT', True)
63 if not format:
64 format = 'default'
65
66 found = False
67 for url in ud.values():
68 if url.type == 'git':
69 for name, rev in url.revisions.items():
70 if not os.path.exists(url.localpath):
71 return None
72
73 found = True
74
75 vars = { 'repodir' : quote(url.localpath),
76 'rev' : quote(rev) }
77
78 rev = bb.fetch2.get_srcrev(d).split('+')[1]
79 rev_file = os.path.join(url.localpath, "oe-gitpkgv_" + rev)
80
81 if not os.path.exists(rev_file) or os.path.getsize(rev_file)==0:
82 commits = bb.fetch2.runfetchcmd(
83 "cd %(repodir)s && "
84 "git rev-list %(rev)s -- 2> /dev/null "
85 "| wc -l" % vars,
86 d, quiet=True).strip().lstrip('0')
87
88 if commits != "":
89 oe.path.remove(rev_file, recurse=False)
90 open(rev_file, "w").write("%d\n" % int(commits))
91 else:
92 commits = "0"
93 else:
94 commits = open(rev_file, "r").readline(128).strip()
95
96 if use_tags:
97 try:
98 output = bb.fetch2.runfetchcmd(
99 "cd %(repodir)s && "
100 "git describe %(rev)s 2>/dev/null" % vars,
101 d, quiet=True).strip()
102 ver = gitpkgv_drop_tag_prefix(output)
103 except Exception:
104 ver = "0.0-%s-g%s" % (commits, rev[:7])
105 else:
106 ver = "%s+%s" % (commits, rev[:7])
107
108 format = format.replace(name, ver)
109
110 if found:
111 return format
112
113 return '0+0'
diff --git a/meta-oe/classes/gitver.bbclass b/meta-oe/classes/gitver.bbclass
new file mode 100644
index 000000000..e7b5155ee
--- /dev/null
+++ b/meta-oe/classes/gitver.bbclass
@@ -0,0 +1,75 @@
1# Copyright (C) 2009 Chris Larson <clarson@kergoth.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3#
4# gitver.bbclass provides a GITVER variable which is a (fairly) sane version,
5# for use in ${PV}, extracted from the ${S} git checkout, assuming it is one.
6# This is most useful in concert with srctree.bbclass.
7
8def git_drop_tag_prefix(version):
9 import re
10 if re.match("v\d", version):
11 return version[1:]
12 else:
13 return version
14
15GIT_TAGADJUST = "git_drop_tag_prefix(version)"
16GITVER = "${@get_git_pv('${S}', d, tagadjust=lambda version:${GIT_TAGADJUST})}"
17GITSHA = "${@get_git_hash('${S}', d)}"
18
19def gitrev_run(cmd, path):
20 (output, error) = bb.process.run(cmd, cwd=path)
21 return output.rstrip()
22
23def get_git_pv(path, d, tagadjust=None):
24 import os
25 import bb.process
26
27 gitdir = os.path.abspath(os.path.join(d.getVar("S", True), ".git"))
28 try:
29 ver = gitrev_run("git describe --tags", gitdir)
30 except Exception, exc:
31 bb.fatal(str(exc))
32
33 if not ver:
34 try:
35 ver = gitrev_run("git rev-parse --short HEAD", gitdir)
36 except Exception, exc:
37 bb.fatal(str(exc))
38
39 if ver:
40 return "0.0+%s" % ver
41 else:
42 return "0.0"
43 else:
44 if tagadjust:
45 ver = tagadjust(ver)
46 return ver
47
48def mark_recipe_dependencies(path, d):
49 from bb.parse import mark_dependency
50
51 gitdir = os.path.join(path, ".git")
52
53 # Force the recipe to be reparsed so the version gets bumped
54 # if the active branch is switched, or if the branch changes.
55 mark_dependency(d, os.path.join(gitdir, "HEAD"))
56
57 # Force a reparse if anything in the index changes.
58 mark_dependency(d, os.path.join(gitdir, "index"))
59
60 try:
61 ref = gitrev_run("git symbolic-ref -q HEAD", gitdir)
62 except bb.process.CmdError:
63 pass
64 else:
65 if ref:
66 mark_dependency(d, os.path.join(gitdir, ref))
67
68 # Catch new tags.
69 tagdir = os.path.join(gitdir, "refs", "tags")
70 if os.path.exists(tagdir):
71 mark_dependency(d, tagdir)
72
73python () {
74 mark_recipe_dependencies(d.getVar("S", True), d)
75}
diff --git a/meta-oe/classes/gpe.bbclass b/meta-oe/classes/gpe.bbclass
new file mode 100644
index 000000000..9fc136590
--- /dev/null
+++ b/meta-oe/classes/gpe.bbclass
@@ -0,0 +1,17 @@
1DEPENDS_prepend = "virtual/libintl intltool-native "
2GPE_TARBALL_SUFFIX ?= "gz"
3SRC_URI = "${GPE_MIRROR}/${BP}.tar.${GPE_TARBALL_SUFFIX}"
4FILES_${PN} += "${datadir}/gpe ${datadir}/application-registry"
5SECTION ?= "gpe"
6
7inherit gettext
8
9gpe_do_compile() {
10 oe_runmake PREFIX=${prefix}
11}
12
13gpe_do_install() {
14 oe_runmake PREFIX=${prefix} DESTDIR=${D} install
15}
16
17EXPORT_FUNCTIONS do_compile do_install
diff --git a/meta-oe/classes/machine_kernel_pr.bbclass b/meta-oe/classes/machine_kernel_pr.bbclass
new file mode 100644
index 000000000..463b64d8e
--- /dev/null
+++ b/meta-oe/classes/machine_kernel_pr.bbclass
@@ -0,0 +1,8 @@
1python __anonymous () {
2
3 machine_kernel_pr = d.getVar('MACHINE_KERNEL_PR', True)
4
5 if machine_kernel_pr:
6 d.setVar('PR', machine_kernel_pr)
7}
8