summaryrefslogtreecommitdiffstats
path: root/meta/classes/crate-fetch.bbclass
blob: a7fa22b2a06c8f5bf5a055a0f50a5dbbbce0b8f3 (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
#
# crate-fetch class
#
# Registers 'crate' method for Bitbake fetch2.
#
# Adds support for following format in recipe SRC_URI:
# crate://<packagename>/<version>
#

def import_crate(d):
    import crate
    if not getattr(crate, 'imported', False):
        bb.fetch2.methods.append(crate.Crate())
        crate.imported = True

python crate_import_handler() {
    import_crate(d)
}

addhandler crate_import_handler
crate_import_handler[eventmask] = "bb.event.RecipePreFinalise"

def crate_get_srcrev(d):
    import_crate(d)
    return bb.fetch2.get_srcrev(d)

# Override SRCPV to make sure it imports the fetcher first
SRCPV = "${@crate_get_srcrev(d)}"