Revert "Revert "oran-shell-release: release image for F""
[pti/rtp.git] / meta-starlingx / meta-stx-cloud / recipes-extended / registry-token-server / registry-token-server_git.bb
1
2 DESCRIPTION = "StarlingX distributedcloud packages collection"
3 HOMEPAGE = "https://opendev.org/starlingx"
4 SECTION = "network"
5 LICENSE = "Apache-2.0"
6 LIC_FILES_CHKSUM = "file://src/registry-token-server/registry-token-server/src/LICENSE;md5=d2794c0df5b907fdace235a619d80314"
7
8 PROTOCOL = "https"
9 BRANCH = "r/stx.3.0"
10 SRCNAME = "containers"
11 SRCREV = "1a4b803e946b488c1f3adb25ab0614d1b0c3c9b8"
12 PV = "1.0.0+git${SRCPV}"
13 S = "${WORKDIR}/git"
14
15 SRC_URI = "git://opendev.org/starlingx/${SRCNAME}.git;protocol=${PROTOCOL};rev=${SRCREV};branch=${BRANCH}"
16
17 GO_IMPORT = "registry-token-server"
18
19 RDEPENDS_${PN}-dev_append = " \
20         systemd \
21         "
22
23 DEPENDS += "\
24         go-logrus \
25         docker-distribution \
26         go-libtrust \
27         go-patricia \
28         go-mux \
29         go-context \
30         go-phercloud \
31         "
32
33 RDEPENDS_${PN} = " \
34         docker-distribution \
35         docker-ce \
36         "
37
38 inherit go goarch ${@bb.utils.contains('VIRTUAL-RUNTIME_init_manager','systemd','systemd','', d)}
39
40 do_compile() {
41         mkdir -p _build/src
42         ln -sfn ${S}/src/registry-token-server/registry-token-server/src/ ./_build/src/registry-token-server
43   
44         # Pass the needed cflags/ldflags so that cgo
45         # can find the needed headers files and libraries
46         export GOARCH=${TARGET_GOARCH}
47         export CGO_ENABLED="1"
48         export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
49         export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
50
51         export GOPATH="${WORKDIR}/build/_build:${STAGING_DIR_TARGET}/${prefix}/local/go"
52         cd _build/src/${GO_IMPORT}
53         #oe_runmake registry-token-server
54         export GOROOT=${STAGING_DIR_TARGET}/${prefix}/local/go
55         go build -o ${WORKDIR}/build/bin/registry-token-server registry-token-server
56 }
57
58 SYSTEMD_PACKAGES = "${PN}"
59 SYSTEMD_SERVICE_${PN} = "registry-token-server.service"
60 SYSTEMD_AUTO_ENABLE = "disable"
61
62 do_install() {
63         SRCPATH="${S}/src/registry-token-server/registry-token-server/centos/files"
64         install -d ${D}/${bindir}
65         install -m 0755 bin/registry-token-server ${D}/${bindir}
66         install -d -m 0755 ${D}/${sysconfdir}/registry-token-server/registry
67         install -m 0644 ${SRCPATH}//token_server.conf ${D}/${sysconfdir}/registry-token-server/registry
68
69         if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
70             install -d ${D}${systemd_unitdir}/system
71             install -m 0644 ${SRCPATH}/registry-token-server.service ${D}${systemd_unitdir}/system/
72         fi
73 }
74