summaryrefslogtreecommitdiff
path: root/classes/gitver.bbclass
blob: 5b4ba8d1e137e0faf5bb3f5952938e86956a0c74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Copyright (C) 2009 Chris Larson <clarson@kergoth.com>
# Released under the MIT license (see COPYING.MIT for the terms)
#
# gitver.bbclass provides a GITVER variable which is a (fairly) sane version,
# for use in ${PV}, extracted from the ${S} git checkout, assuming it is one.
# This is most useful in concert with srctree.bbclass.


GITVER = "${@get_git_pv('${S}', d)}"

def get_git_pv(path, d, tagadjust=None):
    from subprocess import Popen, PIPE
    import os
    from bb import error
    from bb.parse import mark_dependency

    gitdir = os.path.abspath(os.path.join(d.getVar("S", True), ".git"))
    env = { "GIT_DIR": gitdir }

    def popen(cmd, **kwargs):
        kwargs["stderr"] = PIPE
        kwargs["stdout"] = PIPE
        kwargs["env"] = env
        try:
            pipe = Popen(cmd, **kwargs)
        except OSError, e:
            #error("Execution of %s failed: %s" % (cmd, e))
            return

        (stdout, stderr) = pipe.communicate(None)
        if pipe.returncode != 0:
            #error("Execution of %s failed: %s" % (cmd, stderr))
            return
        return stdout.rstrip()

    # Force the recipe to be reparsed so the version gets bumped
    # if the active branch is switched, or if the branch changes.
    mark_dependency(d, os.path.join(gitdir, "HEAD"))

    ref = popen(["git", "symbolic-ref", "HEAD"])
    reffile = os.path.join(gitdir, ref)
    if ref and os.path.exists(reffile):
        mark_dependency(d, reffile)
    else:
        # The ref might be hidden in packed-refs. Force a reparse if anything
        # in the working copy changes.
        mark_dependency(d, os.path.join(gitdir, "index"))

    # Catch new tags.
    tagdir = os.path.join(gitdir, "refs", "tags")
    if os.path.exists(tagdir):
        mark_dependency(d, tagdir)

    ver = popen(["git", "describe", "--tags"], cwd=path)
    if not ver:
        ver = popen(["git", "rev-parse", "--short", "HEAD"], cwd=path)
        if ver:
            return "0.0-%s" % ver
        else:
            return "0.0"
    else:
        if tagadjust:
            ver = tagadjust(ver)
        return ver
tr> -rwxr-xr-xbitbake/bin/bitbake217
-rwxr-xr-xbitbake/bin/bitbake-diffsigs9
-rwxr-xr-xbitbake/bin/bitbake-runtask91
-rwxr-xr-xbitbake/bin/bitdoc532
-rw-r--r--bitbake/contrib/README1
-rw-r--r--bitbake/contrib/bbdev.sh31
-rw-r--r--bitbake/contrib/vim/ftdetect/bitbake.vim4
-rw-r--r--bitbake/contrib/vim/syntax/bitbake.vim127
-rw-r--r--bitbake/doc/bitbake.1121
-rw-r--r--bitbake/doc/manual/Makefile56
-rw-r--r--bitbake/doc/manual/html.css281
-rw-r--r--bitbake/doc/manual/usermanual.xml534
-rw-r--r--bitbake/lib/bb/COW.py323
-rw-r--r--bitbake/lib/bb/__init__.py100
-rw-r--r--bitbake/lib/bb/build.py421
-rw-r--r--bitbake/lib/bb/cache.py556
-rw-r--r--bitbake/lib/bb/codeparser.py326
-rw-r--r--bitbake/lib/bb/command.py280
-rw-r--r--bitbake/lib/bb/cooker.py1023
-rw-r--r--bitbake/lib/bb/daemonize.py190
-rw-r--r--bitbake/lib/bb/data.py330
-rw-r--r--bitbake/lib/bb/data_smart.py371
-rw-r--r--bitbake/lib/bb/event.py300
-rw-r--r--bitbake/lib/bb/fetch/__init__.py777
-rw-r--r--bitbake/lib/bb/fetch/bzr.py147
-rw-r--r--bitbake/lib/bb/fetch/cvs.py177
-rw-r--r--bitbake/lib/bb/fetch/git.py231
-rw-r--r--bitbake/lib/bb/fetch/hg.py172
-rw-r--r--bitbake/lib/bb/fetch/local.py73
-rw-r--r--bitbake/lib/bb/fetch/osc.py150
-rw-r--r--bitbake/lib/bb/fetch/perforce.py208
-rw-r--r--bitbake/lib/bb/fetch/repo.py105
-rw-r--r--bitbake/lib/bb/fetch/ssh.py118
-rw-r--r--bitbake/lib/bb/fetch/svk.py106
-rw-r--r--bitbake/lib/bb/fetch/svn.py201
-rw-r--r--bitbake/lib/bb/fetch/wget.py95
-rw-r--r--bitbake/lib/bb/methodpool.py84
-rw-r--r--bitbake/lib/bb/msg.py144
-rw-r--r--bitbake/lib/bb/parse/__init__.py118
-rw-r--r--bitbake/lib/bb/parse/ast.py445
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py242
-rw-r--r--bitbake/lib/bb/parse/parse_py/ConfHandler.py138
-rw-r--r--bitbake/lib/bb/parse/parse_py/__init__.py33
-rw-r--r--bitbake/lib/bb/persist_data.py133
-rw-r--r--bitbake/lib/bb/providers.py323
-rw-r--r--bitbake/lib/bb/runqueue.py1520
-rw-r--r--bitbake/lib/bb/server/none.py181
-rw-r--r--bitbake/lib/bb/server/xmlrpc.py186
-rw-r--r--bitbake/lib/bb/shell.py824
-rw-r--r--bitbake/lib/bb/siggen.py223
-rw-r--r--bitbake/lib/bb/taskdata.py587
-rw-r--r--bitbake/lib/bb/ui/__init__.py17
-rw-r--r--bitbake/lib/bb/ui/crumbs/__init__.py17
-rw-r--r--bitbake/lib/bb/ui/crumbs/buildmanager.py455
-rw-r--r--bitbake/lib/bb/ui/crumbs/puccho.glade606
-rw-r--r--bitbake/lib/bb/ui/crumbs/runningbuild.py178
-rw-r--r--bitbake/lib/bb/ui/depexp.py271
-rw-r--r--bitbake/lib/bb/ui/goggle.py76
-rw-r--r--bitbake/lib/bb/ui/knotty.py192
-rw-r--r--bitbake/lib/bb/ui/ncurses.py336
-rw-r--r--bitbake/lib/bb/ui/puccho.py425
-rw-r--r--bitbake/lib/bb/ui/uievent.py124
-rw-r--r--bitbake/lib/bb/ui/uihelper.py50
-rw-r--r--bitbake/lib/bb/utils.py762
-rw-r--r--bitbake/lib/codegen.py570
-rw-r--r--bitbake/lib/ply/__init__.py4
-rw-r--r--bitbake/lib/ply/lex.py1058
-rw-r--r--bitbake/lib/ply/yacc.py3276
-rw-r--r--bitbake/lib/pysh/builtin.py710
-rw-r--r--bitbake/lib/pysh/interp.py1367
-rw-r--r--bitbake/lib/pysh/lsprof.py116
-rw-r--r--bitbake/lib/pysh/pysh.py167
-rw-r--r--bitbake/lib/pysh/pyshlex.py888
-rw-r--r--bitbake/lib/pysh/pyshyacc.py772
-rw-r--r--bitbake/lib/pysh/sherrors.py41
-rw-r--r--bitbake/lib/pysh/subprocess_fix.py77
-rw-r--r--handbook/ChangeLog38
-rw-r--r--handbook/Makefile38
-rw-r--r--handbook/TODO11
-rw-r--r--handbook/bsp-guide.xml61
-rw-r--r--handbook/bsp.xml451
-rw-r--r--handbook/development.xml825
-rw-r--r--handbook/examples/hello-autotools/hello_2.3.bb7
-rw-r--r--handbook/examples/hello-single/files/helloworld.c8
-rw-r--r--handbook/examples/hello-single/hello.bb16
-rw-r--r--handbook/examples/libxpm/libxpm_3.5.6.bb13
-rw-r--r--handbook/examples/mtd-makefile/mtd-utils_1.0.0.bb13
-rw-r--r--handbook/extendpoky.xml1040
-rw-r--r--handbook/faq.xml314
-rw-r--r--handbook/introduction.xml352
-rw-r--r--handbook/poky-beaver.pngbin26252 -> 0 bytes-rw-r--r--handbook/poky-doc-tools/ChangeLog30
-rw-r--r--handbook/poky-doc-tools/INSTALL236
-rw-r--r--handbook/poky-doc-tools/Makefile.am24
-rw-r--r--handbook/poky-doc-tools/README19
-rwxr-xr-xhandbook/poky-doc-tools/autogen.sh3
-rw-r--r--handbook/poky-doc-tools/common/Makefile.am21
-rw-r--r--handbook/poky-doc-tools/common/Vera.ttfbin65932 -> 0 bytes-rw-r--r--handbook/poky-doc-tools/common/Vera.xml1
-rw-r--r--handbook/poky-doc-tools/common/VeraMoBd.ttfbin49052 -> 0 bytes-rw-r--r--handbook/poky-doc-tools/common/VeraMoBd.xml1
-rw-r--r--handbook/poky-doc-tools/common/VeraMono.ttfbin49224 -> 0 bytes-rw-r--r--handbook/poky-doc-tools/common/VeraMono.xml1
-rw-r--r--handbook/poky-doc-tools/common/draft.pngbin24847 -> 0 bytes-rw-r--r--handbook/poky-doc-tools/common/fop-config.xml.in58
-rw-r--r--handbook/poky-doc-tools/common/ohand-color.svg150
-rw-r--r--handbook/poky-doc-tools/common/poky-db-pdf.xsl64
-rw-r--r--handbook/poky-doc-tools/common/poky-handbook.pngbin32145 -> 0 bytes-rw-r--r--handbook/poky-doc-tools/common/poky.svg163
-rw-r--r--handbook/poky-doc-tools/common/titlepage.templates.xml1240
-rw-r--r--handbook/poky-doc-tools/configure.ac27
-rw-r--r--handbook/poky-doc-tools/poky-docbook-to-pdf.in49
-rw-r--r--handbook/poky-handbook.pngbin17829 -> 0 bytes-rw-r--r--handbook/poky-handbook.xml102
-rw-r--r--handbook/poky-logo.svg117
-rw-r--r--handbook/ref-bitbake.xml348
-rw-r--r--handbook/ref-classes.xml455
-rw-r--r--handbook/ref-features.xml302
-rw-r--r--handbook/ref-images.xml72
-rw-r--r--handbook/ref-structure.xml514
-rw-r--r--handbook/ref-variables.xml879
-rw-r--r--handbook/ref-varlocality.xml211
-rw-r--r--handbook/resources.xml142
-rw-r--r--handbook/screenshots/ss-anjuta-poky-1.pngbin96531 -> 0 bytes-rw-r--r--handbook/screenshots/ss-anjuta-poky-2.pngbin76419 -> 0 bytes-rw-r--r--handbook/screenshots/ss-oprofile-viewer.pngbin51240 -> 0 bytes-rw-r--r--handbook/screenshots/ss-sato.pngbin38689 -> 0 bytes-rw-r--r--handbook/style.css953
-rw-r--r--