summaryrefslogtreecommitdiff
path: root/packages/app-virtualization/moby/moby-17.05.0.exheres-0
blob: 454d71a5eab1f88aa9f859c7cc50bf4930c988bb (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Copyright 2016 Marc-Antoine Perennou <marc-antoine.perennou@clever-cloud.com>
# Copyright 2017 Arnaud Lefebvre <arnaud.lefebvre@clever-cloud.com>
# Distributed under the terms of the GNU General Public License v2

# -ce because Moby now has a Community Edition tag
MY_PV=${PV}-ce
MY_PNV=${PN}-${MY_PV}
# Most of the time, files or binaries will be called docker- and not moby
MY_DPN=docker
MY_DPNV=${MY_DPN}-${MY_PV}

require github [ user=${PN} tag=v${PV}-ce ]
require systemd-service [ systemd_files=[ contrib/init/systemd ] ]
require openrc-service
require bash-completion zsh-completion udev-rules [ udev_files=[ contrib/udev ] ]

SUMMARY="ship and run any application as a lightweight container"
DESCRIPTION="
A collaborative project for the container ecosystem to assemble
container-based systems
"
HOMEPAGE="https://mobyproject.org/"

LICENCES="Apache-2.0"
SLOT="0"
PLATFORMS="~amd64"
MYOPTIONS="
    vim-syntax
    ( providers: eudev systemd ) [[ number-selected = exactly-one ]]
"
# man-pages need to be built in a docker container or to pull dependencies via glide,
# the go package manager. So we build them when we package a new version and upload them
DOWNLOADS+=" https://blackyoup-exherbo.cellar.services.clever-cloud.com/${MY_PNV}_man-pages.tar.gz"

DEPENDENCIES="
    build:
        dev-lang/go[>=1.7.5]
    build+run:
        dev-db/sqlite:3
        sys-fs/btrfs-progs
        sys-fs/lvm2[>=2.02.103]
        sys-libs/libcap
        sys-libs/libseccomp
        providers:eudev? ( sys-apps/eudev )
        providers:systemd? ( sys-apps/systemd )
        vim-syntax? ( app-editors/vim )
    run:
        group/docker
        net-firewall/iptables
        net-misc/bridge-utils
        sys-apps/containerd[>=0.2.6_pre20170329]
        sys-apps/iproute2
        sys-apps/runc[>=1.0.1_pre20170310]
        sys-apps/tini[=0.13.1_pre20161117]
    post:
        virtualization-lib/libnetwork[>=0.8.0_pre20170419] [[
            description = [ provides docker-proxy binary ]
        ]]
"

BUGS_TO="marc-antoine.perennou@clever-cloud.com"

# Testsuite requires to rebuild too and needs a running docker daemon
# We cannot strip because of a runtime check on the docker-init binary
RESTRICT="test strip"

docker_make() {
    DOCKER_CROSSPLATFORMS="linux/386 linux/arm darwin/amd64 darwin/386 freebsd/amd64 freebsd/386freebsd/arm" \
    AUTO_GOPATH=1 \
    IAMSTATIC='false' \
    DOCKER_GITCOMMIT=${MY_PV} \
    edo ./hack/make.sh "$@"
}

src_prepare() {
    default
    edo rm contrib/init/systemd/{REVIEWERS,${MY_DPN}.service.rpm} # this isn't a service!
    edo sed -i "s:/usr/bin/:/usr/$(exhost --target)/bin/:" \
        contrib/init/systemd/${MY_DPN}.service \
        contrib/init/openrc/{${MY_DPN}.confd,${MY_DPN}.initd}
}

src_compile() {
    docker_make dynbinary-daemon dynbinary-client
}

src_test() {
    docker_make dyntest
}

src_install() {
    local bindir=/usr/$(exhost --target)/bin

    newbin bundles/${MY_PV}/dynbinary-client/${MY_DPNV} ${MY_DPN}
    newbin bundles/${MY_PV}/dynbinary-daemon/${MY_DPN}d-${MY_PV} ${MY_DPN}d
    dosym containerd ${bindir}/docker-containerd
    dosym containerd-shim ${bindir}/docker-containerd-shim
    dosym runc ${bindir}/docker-runc
    dosym ctr ${bindir}/docker-containerd-ctr
    dosym tini-static ${bindir}/docker-init

    install_systemd_files
    install_udev_files
    newinitd contrib/init/openrc/docker.initd docker
    newconfd contrib/init/openrc/docker.confd docker
    openrc_expart /etc/init.d/docker
    openrc_expart /etc/conf.d/docker
    dobashcompletion contrib/completion/bash/docker
    dozshcompletion contrib/completion/zsh/_docker
    doman "${WORKBASE}"/man*/*

    if option vim-syntax; then
        insinto /usr/share/vim/vimfiles/syntax/
        doins contrib/syntax/vim/syntax/dockerfile.vim
        insinto /usr/share/vim/vimfiles/ftdetect/
        doins contrib/syntax/vim/ftdetect/dockerfile.vim
    fi
}