diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
commit | 4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch) | |
tree | ba5f07bf3f9d22d82e54a462313f5d244036c768 /app-emulation/rkt |
reinit the tree, so we can have metadata
Diffstat (limited to 'app-emulation/rkt')
-rw-r--r-- | app-emulation/rkt/Manifest | 11 | ||||
-rw-r--r-- | app-emulation/rkt/metadata.xml | 32 | ||||
-rw-r--r-- | app-emulation/rkt/rkt-1.27.0.ebuild | 256 | ||||
-rw-r--r-- | app-emulation/rkt/rkt-1.28.1.ebuild | 256 |
4 files changed, 555 insertions, 0 deletions
diff --git a/app-emulation/rkt/Manifest b/app-emulation/rkt/Manifest new file mode 100644 index 000000000000..00fdfbb75d31 --- /dev/null +++ b/app-emulation/rkt/Manifest @@ -0,0 +1,11 @@ +DIST kvmtool-cfae4d64482ed745214e3c62dd84b79c2ae0f325.tar.gz 245010 SHA256 4aad2913d66c7a3c308e0ca34c214307850b2556ab35999e7f86c253cb8bbf82 SHA512 7cca005136f3628dfef359f83732d6f8cc062c5e4a8d77f57c6dd5e007ed06c85f0c275c8844228b404755dbf3f4d45f6a149fc64235f4f1abe0058214e24730 WHIRLPOOL 341f9be7ff9517c822da00166cbf5334cf329f51895bb459c3e0bdda2f0c8724957bb79b354eadf9249b4c1f4b8d677c7c6ca57eaa04553804779ec8c53b37f4 +DIST linux-4.9.2.tar.xz 93189108 SHA256 8dda9aedd17ae0bf1e06ebb4b79082f83fb3ade45cbcc3ca4c30bf3faf085738 SHA512 85adf3715cba4a457efea8359ebed34413ac63ee58fe920c5713501dec1e727e167416e9d67a9e2d9430aa9f3a53ad0ac26a4f749984bc5a3f3c37ac504f75de WHIRLPOOL 74df775ab092a6be6684243d4c0d557c0ce27907c7e8ed97be54a45901e8f507deab1d5e72c35092884836f3fe446f838342ec0b53a3aa1c884489caadaf6a62 +DIST qemu-2.8.0.tar.bz2 28368517 SHA256 dafd5d7f649907b6b617b822692f4c82e60cf29bc0fc58bc2036219b591e5e62 SHA512 50f2988d822388ba9fd1bf5dbe68359033ed7432d7f0f9790299f32f63faa6dc72979256b5632ba572d47ee3e74ed40e3e8e331dc6303ec1599f1b4367cb78c2 WHIRLPOOL 0ce4e0539657eb832e4039819e7360c792b6aa41c718f0e0d762f4933217f0d370af94b1d6d9776853575b4a6811d8c85db069bf09d21bd15399ac8b50440ff5 +DIST rkt-1.27.0.tar.gz 3423285 SHA256 213427c551ddc912622e967b30437e13485b88dcf7021c977a3205a1b03801a1 SHA512 8884683ed1bd456542f61f407509db1664589f05732b4c179954781fb847d00d311e973f7646b07eb5685e437793dc4e265686f5bb91b6131dd101466d21ab40 WHIRLPOOL b2fb1715ab1eea03a0c7345c9502f984116fe3ab3f394d9e9ab237dbedc4c902dd7790c99c3dabc80c124c7ebaf76aa21b53e7c42e13be0df53d7fdf4ba308bf +DIST rkt-1.28.1.tar.gz 3425099 SHA256 2610749f412ca697c57a797c8dd0024c4c215d7dd824599d8ed6f4297abd5e07 SHA512 02d47f4e95e5ff9dc82cd645f1c69bb1fe5ab856c32b3b29bcd74c0e96ae0b5831a610cbde04614d216e4f7387af54f904ebd31ddc3acc1d2cfa0178805fd811 WHIRLPOOL a7e1489b1295795fe3908e51f81be6db3ffd6b0ad17aa4828e7fb07551ea4a6b215fda9f6e4658aa5e7b4e36bcf3472aec8726e2751943c6b0a1aeb910ebe9cf +DIST rkt-pxe-1235.0.0.img 243713684 SHA256 988e4ad8e044dd8bff54cb5e0a34a1ed25cf7bc8cc241f1a90e3fe7f1412f315 SHA512 b19821c63b7b53a1aad3b6e279189f9ceed1f5db1a691d12a70eb7340cceb4c3fd4f7f61a913d9482aec5ce28740b9ee777f86a1ce54f597f50341d701372542 WHIRLPOOL f3905ce3a2a55a027197a2d11ca541323fdfd560d186b4a2c39a8f45e19811067d5de4fbd3656935b12787e1dec79d118d7a01d52a8ef7abd0dad4f38a222b1c +DIST systemd-231.tar.gz 4381464 SHA256 899733ad6c157cedbb89aec4efe3bc824dcfd65a1d6f6bebc7b043f7924e39b4 SHA512 199fa33a0494d1d15f7fe3c796fe14913ad386766571d4d3fbb1cb1c446e04f6d06a965213be4c594a7183e810fc2fd4804fe14f64f21b0a1278b717889811c6 WHIRLPOOL 7779291e9fb9873cb1773b8583cf6d4b7dec837363ea89c4a73c1e397a76752b66f8b57d8fc4d9cef768cc1855b5e325ad88a8a69eb5380aa924e0a6dead41b1 +EBUILD rkt-1.27.0.ebuild 7935 SHA256 bb8174b398da396d6e513e1bde5d81ad78bb341ee92c97bdb525d2696383bc59 SHA512 c4004001fa8b3405db814072cd4b684b1d908d30aaf6f27017cec9d1053264ddf7dd658e7fd561a262827b9b6ba45f0e963627e4f05ee24714eb28e825df0372 WHIRLPOOL ff3dc20bda0a665a88ffd6388312b206f9087009455896ca128aab80e917f6525107ac56f73ead1fe30f0837a85b0f7f269b4c340c35d34d83844e1bda84a3a6 +EBUILD rkt-1.28.1.ebuild 7935 SHA256 bb8174b398da396d6e513e1bde5d81ad78bb341ee92c97bdb525d2696383bc59 SHA512 c4004001fa8b3405db814072cd4b684b1d908d30aaf6f27017cec9d1053264ddf7dd658e7fd561a262827b9b6ba45f0e963627e4f05ee24714eb28e825df0372 WHIRLPOOL ff3dc20bda0a665a88ffd6388312b206f9087009455896ca128aab80e917f6525107ac56f73ead1fe30f0837a85b0f7f269b4c340c35d34d83844e1bda84a3a6 +MISC ChangeLog 7991 SHA256 30a1b4af83fc5287d114ea22878ebda9a1f836154faedc5d98d0ab6b958ea2bc SHA512 c07091f33bbf19dc6c6854af43d8fd1c20a699741781551ccc2e36e6bb23bb4b7ceb689c28d8242a18b8c77a34a1cf986cd664f41b9a2cf2c96783691149cfb6 WHIRLPOOL 77cae18c32825b6fd76ed6c0c19e6f7641e7e6c5789f7e11cfe23c87ab281cfac0fc1a3a265e1e7c83341eaef8bd75b65225ce76f0522b66c9d0ff6cf7ab1c58 +MISC metadata.xml 1468 SHA256 da602dafea8bc6a9f51415e55758c77df8a25affb5b33a0a179076c672c85c89 SHA512 e0548fddd59d422eb04b0b18b98b273d0f3d39465c91539fdfce71583388a6651e878725cf196b0c74efa42b489c44b12e4671e28b3f16d76a16fb8184c3da1a WHIRLPOOL caa1d09b248e7f226bc32aaf21591746e27ef04b2f5c9313cc1e43706fdf2b795abace41ee8584b7ee1e9dd2d7ef9671f87c91915429218bf18234e9dbdbffc4 diff --git a/app-emulation/rkt/metadata.xml b/app-emulation/rkt/metadata.xml new file mode 100644 index 000000000000..d9f76835717a --- /dev/null +++ b/app-emulation/rkt/metadata.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>zmedico@gentoo.org</email> + <name>Zac Medico</name> + </maintainer> + <longdescription lang="en"> + rkt is the next-generation container manager for Linux clusters. + Designed for security, simplicity, and composability within modern + cluster architectures, rkt discovers, verifies, fetches, and executes + application containers with pluggable isolation. rkt can run the same + container with varying degrees of protection, from lightweight, + OS-level namespace and capabilities isolation to heavier, VM-level + hardware virtualization. + </longdescription> + <use> + <flag name="actool">Install the actool for ACI manipulation</flag> + <flag name="rkt_stage1_coreos">Download and use a prebuilt stage1.aci from CoreOS</flag> + <flag name="rkt_stage1_fly">Build stage1-fly.aci</flag> + <flag name="rkt_stage1_kvm" restrict="<app-emulation/rkt-1.15.0"> + This flag has been replaced by the rkt_stage1_kvm_* flags + </flag> + <flag name="rkt_stage1_kvm_lkvm">Build stage1-kvm-lkvm.aci</flag> + <flag name="rkt_stage1_kvm_qemu">Build stage1-kvm-qemu.aci</flag> + <flag name="rkt_stage1_src">Build the stage1.aci from source</flag> + <flag name="rkt_stage1_host">Assemble stage1.aci from host binaries</flag> + </use> + <upstream> + <remote-id type="github">coreos/rkt</remote-id> + </upstream> +</pkgmetadata> diff --git a/app-emulation/rkt/rkt-1.27.0.ebuild b/app-emulation/rkt/rkt-1.27.0.ebuild new file mode 100644 index 000000000000..c15c8003546e --- /dev/null +++ b/app-emulation/rkt/rkt-1.27.0.ebuild @@ -0,0 +1,256 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit bash-completion-r1 autotools flag-o-matic systemd toolchain-funcs user + +KEYWORDS="~amd64" + +PXE_VERSION="1235.0.0" +PXE_SYSTEMD_VERSION="v231" +KVM_LINUX_VERSION="4.9.2" +KVMTOOL_VERSION="cfae4d64482ed745214e3c62dd84b79c2ae0f325" +QEMU_VERSION="v2.8.0" +PXE_URI="http://alpha.release.core-os.net/amd64-usr/${PXE_VERSION}/coreos_production_pxe_image.cpio.gz" +PXE_FILE="${PN}-pxe-${PXE_VERSION}.img" + +SRC_URI_KVM="mirror://kernel/linux/kernel/v4.x/linux-${KVM_LINUX_VERSION}.tar.xz + ${PXE_URI} -> ${PXE_FILE} +" + +SRC_URI="https://github.com/coreos/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz +rkt_stage1_coreos? ( $PXE_URI -> $PXE_FILE ) +rkt_stage1_kvm_lkvm? ( + https://kernel.googlesource.com/pub/scm/linux/kernel/git/will/kvmtool/+archive/${KVMTOOL_VERSION}.tar.gz -> kvmtool-${KVMTOOL_VERSION}.tar.gz + ${SRC_URI_KVM} +) +rkt_stage1_kvm_qemu? ( + http://wiki.qemu-project.org/download/qemu-${QEMU_VERSION#v}.tar.bz2 + ${SRC_URI_KVM} +) +rkt_stage1_src? ( https://github.com/systemd/systemd/archive/${PXE_SYSTEMD_VERSION}.tar.gz -> systemd-${PXE_SYSTEMD_VERSION#v}.tar.gz )" + +DESCRIPTION="rkt is an App Container runtime for Linux" +HOMEPAGE="https://github.com/coreos/rkt" + +LICENSE="Apache-2.0" +SLOT="0" +# The rkt_stage1_kvm flag has been replaced by the rkt_stage1_kvm_lkvm and rkt_stage1_kvm_qemu flags +IUSE="doc examples +rkt_stage1_coreos +rkt_stage1_fly rkt_stage1_host rkt_stage1_kvm rkt_stage1_kvm_lkvm rkt_stage1_kvm_qemu rkt_stage1_src +actool systemd" +REQUIRED_USE="!systemd? ( !rkt_stage1_host ) || ( rkt_stage1_coreos rkt_stage1_fly rkt_stage1_host rkt_stage1_kvm_lkvm rkt_stage1_kvm_qemu rkt_stage1_src ) !rkt_stage1_kvm" + +# Some tests fail. +# rkt_stage1_src needs to copy /bin/mount, which requires root privileges during src_compile +RESTRICT="test rkt_stage1_src? ( userpriv )" + +DEPEND=">=dev-lang/go-1.5 + app-arch/cpio + app-crypt/trousers + sys-fs/squashfs-tools + dev-perl/Capture-Tiny + rkt_stage1_src? ( >=sys-apps/util-linux-2.27 ) + rkt_stage1_kvm_qemu? ( + sys-apps/attr[static-libs(+)] + sys-libs/libcap[static-libs(+)] + sys-libs/zlib[static-libs(+)] + >=x11-libs/pixman-0.28.0[static-libs(+)] + )" + +RDEPEND="!app-emulation/rocket + rkt_stage1_host? ( systemd? ( + >=sys-apps/systemd-222 + app-shells/bash:0 + ) )" + +BUILDDIR="build-${P}" +STAGE1_DEFAULT_LOCATION="/usr/share/rkt/stage1.aci" + +pkg_setup() { + enewgroup rkt-admin + enewgroup rkt +} + +src_unpack() { + local x + for x in ${A}; do + case ${x} in + *.img|linux-*) continue ;; + kvmtool-*) + mkdir kvmtool || die + pushd kvmtool >/dev/null || die + unpack ${x} + popd >/dev/null || die + ;; + *) + unpack ${x} + esac + done +} + +src_prepare() { + eapply_user + + # This patch breaks linux kernel cc-option checks when the + # compiler doesn't recognize the -no-pie option. + rm stage1/usr_from_kvm/kernel/patches/0002-for-debian-gcc.patch || die + + # avoid sdjournal include for bug 595874 + if ! use systemd; then + sed -e "s/^\\(LOCAL_DIST_SRC_FILTER := .*\\)'$/\\1|api_service'/" \ + -i rkt/rkt.mk || die + fi + + sed -e 's|^RKT_REQ_PROG(\[GIT\],.*|#\0|' -i configure.ac || die + + # disable git fetch of systemd + sed -e 's~^include makelib/git.mk$~'\ +'ifneq ($(wildcard $(RKT_STAGE1_SYSTEMD_SRC)),)\n\n'\ +'get_systemd_sources: | $(UFS_SYSTEMDDIR)\n'\ +'\tmv "$(RKT_STAGE1_SYSTEMD_SRC)" "$(UFS_SYSTEMD_SRCDIR)"\n\n'\ +'$(UFS_SYSTEMD_CONFIGURE): get_systemd_sources\n\n'\ +'else ifneq ($(wildcard $(UFS_SYSTEMD_SRCDIR)),)\n\n'\ +'else\n'\ +'\t\0\n'\ +'endif~' -i stage1/usr_from_src/usr_from_src.mk || die + + # disable git fetch of kvmtool + sed -e 's~^include makelib/git.mk$~'\ +'ifneq ($(wildcard $(shell echo "$${WORKDIR}/kvmtool")),)\n\n'\ +'$(call forward-vars, get_lkvm_sources, LKVM_SRCDIR)\n'\ +'get_lkvm_sources: | $(LKVM_TMPDIR)\n'\ +'\tmv "$${WORKDIR}/kvmtool" "$(LKVM_SRCDIR)"\n\n'\ +'$(LKVM_PATCH_STAMP): get_lkvm_sources\n\n'\ +'else ifneq ($(wildcard $(LKVM_SRCDIR)),)\n\n'\ +'else\n'\ +'\t\0\n'\ +'endif~' -i stage1/usr_from_kvm/lkvm.mk || die + + # disable git fetch of qemu + sed -e 's~^include makelib/git.mk$~'\ +'ifneq ($(wildcard $(shell echo "$${WORKDIR}/qemu-'${QEMU_VERSION#v}'")),)\n\n'\ +'$(call forward-vars, get_qemu_sources, QEMU_SRCDIR)\n'\ +'get_qemu_sources: | $(QEMU_TMPDIR)\n'\ +'\tmv "$${WORKDIR}/qemu-'${QEMU_VERSION#v}'" "$(QEMU_SRCDIR)"\n\n'\ +'$(QEMU_CONF_STAMP): get_qemu_sources\n\n'\ +'else ifneq ($(wildcard $(QEMU_SRCDIR)),)\n\n'\ +'else\n'\ +'\t\0\n'\ +'endif~' \ + -e 's|QEMU_CONFIGURATION_OPTS :=|\0 --disable-bzip2 --disable-libssh2 --disable-opengl|' \ + -i stage1/usr_from_kvm/qemu.mk || die + + # disable fetch of kernel sources + sed -e 's|wget .*|ln -s "$${DISTDIR}/linux-'${KVM_LINUX_VERSION}'.tar.xz" "$@"|' \ + -i stage1/usr_from_kvm/kernel.mk || die + + if use rkt_stage1_host; then + # Make systemdUnitsPath consistent with host + sed -e 's|\(systemdUnitsPath := \).*|\1"'$(systemd_get_systemunitdir)'"|' \ + -i stage1/init/init.go || die + fi + + eautoreconf +} + +src_configure() { + local flavors hypervisors myeconfargs=( + --with-stage1-default-images-directory="/usr/share/rkt" + --with-stage1-default-location="${STAGE1_DEFAULT_LOCATION}" + ) + + use systemd || myeconfargs+=( --enable-sdjournal=no ) + + # enable flavors (first is default) + use rkt_stage1_host && flavors+=",host" + use rkt_stage1_src && flavors+=",src" + use rkt_stage1_coreos && flavors+=",coreos" + use rkt_stage1_fly && flavors+=",fly" + { use rkt_stage1_kvm_lkvm || use rkt_stage1_kvm_qemu; } && flavors+=",kvm" + myeconfargs+=( --with-stage1-flavors="${flavors#,}" ) + + if use rkt_stage1_src; then + myeconfargs+=( + --with-stage1-systemd-version=${PXE_SYSTEMD_VERSION} + --with-stage1-systemd-src="${WORKDIR}/systemd-${PXE_SYSTEMD_VERSION#v}" + ) + fi + + if use rkt_stage1_coreos || use rkt_stage1_kvm_lkvm || use rkt_stage1_kvm_qemu; then + myeconfargs+=( + --with-coreos-local-pxe-image-path="${DISTDIR}/${PXE_FILE}" + --with-coreos-local-pxe-image-systemd-version="${PXE_SYSTEMD_VERSION}" + ) + fi + + if use rkt_stage1_kvm_lkvm || use rkt_stage1_kvm_qemu; then + use rkt_stage1_kvm_lkvm && hypervisors+=",lkvm" + use rkt_stage1_kvm_qemu && hypervisors+=",qemu" + myeconfargs+=( --with-stage1-kvm-hypervisors="${hypervisors#,}" ) + fi + + # Go's 6l linker does not support PIE, disable so cgo binaries + # which use 6l+gcc for linking can be built correctly. + if gcc-specs-pie; then + append-ldflags -nopie + fi + + export CC=$(tc-getCC) + export CGO_ENABLED=1 + export CGO_CFLAGS="${CFLAGS}" + export CGO_CPPFLAGS="${CPPFLAGS}" + export CGO_CXXFLAGS="${CXXFLAGS}" + export CGO_LDFLAGS="${LDFLAGS}" + export BUILDDIR + + econf "${myeconfargs[@]}" +} + +src_compile() { + local arch=${ARCH} + case ${arch} in + amd64) arch=x86_64;; + esac + ARCH=${arch} emake V=3 + ARCH=${arch} emake V=3 bash-completion +} + +src_install() { + dodoc README.md + use doc && dodoc -r Documentation + use examples && dodoc -r examples + use actool && dobin "${S}/${BUILDDIR}/tools/actool" + + dobin "${S}/${BUILDDIR}/target/bin/rkt" + + insinto /usr/share/rkt + doins "${S}/${BUILDDIR}/target/bin/"*.aci + + # create symlink for default stage1 image path + if use rkt_stage1_host; then + dosym stage1-host.aci "${STAGE1_DEFAULT_LOCATION}" + elif use rkt_stage1_src; then + dosym stage1-src.aci "${STAGE1_DEFAULT_LOCATION}" + elif use rkt_stage1_coreos; then + dosym stage1-coreos.aci "${STAGE1_DEFAULT_LOCATION}" + elif use rkt_stage1_fly; then + dosym stage1-fly.aci "${STAGE1_DEFAULT_LOCATION}" + elif use rkt_stage1_kvm_lkvm; then + dosym stage1-kvm-lkvm.aci "${STAGE1_DEFAULT_LOCATION}" + elif use rkt_stage1_kvm_qemu; then + dosym stage1-kvm-qemu.aci "${STAGE1_DEFAULT_LOCATION}" + fi + + systemd_dounit "${S}"/dist/init/systemd/*.service \ + "${S}"/dist/init/systemd/*.timer \ + "${S}"/dist/init/systemd/*.socket + + insinto /usr/lib/tmpfiles.d + doins "${S}"/dist/init/systemd/tmpfiles.d/* + + newbashcomp "${S}"/dist/bash_completion/rkt.bash rkt + + keepdir /etc/${PN} + fowners :rkt-admin /etc/${PN} + fperms 2775 /etc/${PN} +} diff --git a/app-emulation/rkt/rkt-1.28.1.ebuild b/app-emulation/rkt/rkt-1.28.1.ebuild new file mode 100644 index 000000000000..c15c8003546e --- /dev/null +++ b/app-emulation/rkt/rkt-1.28.1.ebuild @@ -0,0 +1,256 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit bash-completion-r1 autotools flag-o-matic systemd toolchain-funcs user + +KEYWORDS="~amd64" + +PXE_VERSION="1235.0.0" +PXE_SYSTEMD_VERSION="v231" +KVM_LINUX_VERSION="4.9.2" +KVMTOOL_VERSION="cfae4d64482ed745214e3c62dd84b79c2ae0f325" +QEMU_VERSION="v2.8.0" +PXE_URI="http://alpha.release.core-os.net/amd64-usr/${PXE_VERSION}/coreos_production_pxe_image.cpio.gz" +PXE_FILE="${PN}-pxe-${PXE_VERSION}.img" + +SRC_URI_KVM="mirror://kernel/linux/kernel/v4.x/linux-${KVM_LINUX_VERSION}.tar.xz + ${PXE_URI} -> ${PXE_FILE} +" + +SRC_URI="https://github.com/coreos/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz +rkt_stage1_coreos? ( $PXE_URI -> $PXE_FILE ) +rkt_stage1_kvm_lkvm? ( + https://kernel.googlesource.com/pub/scm/linux/kernel/git/will/kvmtool/+archive/${KVMTOOL_VERSION}.tar.gz -> kvmtool-${KVMTOOL_VERSION}.tar.gz + ${SRC_URI_KVM} +) +rkt_stage1_kvm_qemu? ( + http://wiki.qemu-project.org/download/qemu-${QEMU_VERSION#v}.tar.bz2 + ${SRC_URI_KVM} +) +rkt_stage1_src? ( https://github.com/systemd/systemd/archive/${PXE_SYSTEMD_VERSION}.tar.gz -> systemd-${PXE_SYSTEMD_VERSION#v}.tar.gz )" + +DESCRIPTION="rkt is an App Container runtime for Linux" +HOMEPAGE="https://github.com/coreos/rkt" + +LICENSE="Apache-2.0" +SLOT="0" +# The rkt_stage1_kvm flag has been replaced by the rkt_stage1_kvm_lkvm and rkt_stage1_kvm_qemu flags +IUSE="doc examples +rkt_stage1_coreos +rkt_stage1_fly rkt_stage1_host rkt_stage1_kvm rkt_stage1_kvm_lkvm rkt_stage1_kvm_qemu rkt_stage1_src +actool systemd" +REQUIRED_USE="!systemd? ( !rkt_stage1_host ) || ( rkt_stage1_coreos rkt_stage1_fly rkt_stage1_host rkt_stage1_kvm_lkvm rkt_stage1_kvm_qemu rkt_stage1_src ) !rkt_stage1_kvm" + +# Some tests fail. +# rkt_stage1_src needs to copy /bin/mount, which requires root privileges during src_compile +RESTRICT="test rkt_stage1_src? ( userpriv )" + +DEPEND=">=dev-lang/go-1.5 + app-arch/cpio + app-crypt/trousers + sys-fs/squashfs-tools + dev-perl/Capture-Tiny + rkt_stage1_src? ( >=sys-apps/util-linux-2.27 ) + rkt_stage1_kvm_qemu? ( + sys-apps/attr[static-libs(+)] + sys-libs/libcap[static-libs(+)] + sys-libs/zlib[static-libs(+)] + >=x11-libs/pixman-0.28.0[static-libs(+)] + )" + +RDEPEND="!app-emulation/rocket + rkt_stage1_host? ( systemd? ( + >=sys-apps/systemd-222 + app-shells/bash:0 + ) )" + +BUILDDIR="build-${P}" +STAGE1_DEFAULT_LOCATION="/usr/share/rkt/stage1.aci" + +pkg_setup() { + enewgroup rkt-admin + enewgroup rkt +} + +src_unpack() { + local x + for x in ${A}; do + case ${x} in + *.img|linux-*) continue ;; + kvmtool-*) + mkdir kvmtool || die + pushd kvmtool >/dev/null || die + unpack ${x} + popd >/dev/null || die + ;; + *) + unpack ${x} + esac + done +} + +src_prepare() { + eapply_user + + # This patch breaks linux kernel cc-option checks when the + # compiler doesn't recognize the -no-pie option. + rm stage1/usr_from_kvm/kernel/patches/0002-for-debian-gcc.patch || die + + # avoid sdjournal include for bug 595874 + if ! use systemd; then + sed -e "s/^\\(LOCAL_DIST_SRC_FILTER := .*\\)'$/\\1|api_service'/" \ + -i rkt/rkt.mk || die + fi + + sed -e 's|^RKT_REQ_PROG(\[GIT\],.*|#\0|' -i configure.ac || die + + # disable git fetch of systemd + sed -e 's~^include makelib/git.mk$~'\ +'ifneq ($(wildcard $(RKT_STAGE1_SYSTEMD_SRC)),)\n\n'\ +'get_systemd_sources: | $(UFS_SYSTEMDDIR)\n'\ +'\tmv "$(RKT_STAGE1_SYSTEMD_SRC)" "$(UFS_SYSTEMD_SRCDIR)"\n\n'\ +'$(UFS_SYSTEMD_CONFIGURE): get_systemd_sources\n\n'\ +'else ifneq ($(wildcard $(UFS_SYSTEMD_SRCDIR)),)\n\n'\ +'else\n'\ +'\t\0\n'\ +'endif~' -i stage1/usr_from_src/usr_from_src.mk || die + + # disable git fetch of kvmtool + sed -e 's~^include makelib/git.mk$~'\ +'ifneq ($(wildcard $(shell echo "$${WORKDIR}/kvmtool")),)\n\n'\ +'$(call forward-vars, get_lkvm_sources, LKVM_SRCDIR)\n'\ +'get_lkvm_sources: | $(LKVM_TMPDIR)\n'\ +'\tmv "$${WORKDIR}/kvmtool" "$(LKVM_SRCDIR)"\n\n'\ +'$(LKVM_PATCH_STAMP): get_lkvm_sources\n\n'\ +'else ifneq ($(wildcard $(LKVM_SRCDIR)),)\n\n'\ +'else\n'\ +'\t\0\n'\ +'endif~' -i stage1/usr_from_kvm/lkvm.mk || die + + # disable git fetch of qemu + sed -e 's~^include makelib/git.mk$~'\ +'ifneq ($(wildcard $(shell echo "$${WORKDIR}/qemu-'${QEMU_VERSION#v}'")),)\n\n'\ +'$(call forward-vars, get_qemu_sources, QEMU_SRCDIR)\n'\ +'get_qemu_sources: | $(QEMU_TMPDIR)\n'\ +'\tmv "$${WORKDIR}/qemu-'${QEMU_VERSION#v}'" "$(QEMU_SRCDIR)"\n\n'\ +'$(QEMU_CONF_STAMP): get_qemu_sources\n\n'\ +'else ifneq ($(wildcard $(QEMU_SRCDIR)),)\n\n'\ +'else\n'\ +'\t\0\n'\ +'endif~' \ + -e 's|QEMU_CONFIGURATION_OPTS :=|\0 --disable-bzip2 --disable-libssh2 --disable-opengl|' \ + -i stage1/usr_from_kvm/qemu.mk || die + + # disable fetch of kernel sources + sed -e 's|wget .*|ln -s "$${DISTDIR}/linux-'${KVM_LINUX_VERSION}'.tar.xz" "$@"|' \ + -i stage1/usr_from_kvm/kernel.mk || die + + if use rkt_stage1_host; then + # Make systemdUnitsPath consistent with host + sed -e 's|\(systemdUnitsPath := \).*|\1"'$(systemd_get_systemunitdir)'"|' \ + -i stage1/init/init.go || die + fi + + eautoreconf +} + +src_configure() { + local flavors hypervisors myeconfargs=( + --with-stage1-default-images-directory="/usr/share/rkt" + --with-stage1-default-location="${STAGE1_DEFAULT_LOCATION}" + ) + + use systemd || myeconfargs+=( --enable-sdjournal=no ) + + # enable flavors (first is default) + use rkt_stage1_host && flavors+=",host" + use rkt_stage1_src && flavors+=",src" + use rkt_stage1_coreos && flavors+=",coreos" + use rkt_stage1_fly && flavors+=",fly" + { use rkt_stage1_kvm_lkvm || use rkt_stage1_kvm_qemu; } && flavors+=",kvm" + myeconfargs+=( --with-stage1-flavors="${flavors#,}" ) + + if use rkt_stage1_src; then + myeconfargs+=( + --with-stage1-systemd-version=${PXE_SYSTEMD_VERSION} + --with-stage1-systemd-src="${WORKDIR}/systemd-${PXE_SYSTEMD_VERSION#v}" + ) + fi + + if use rkt_stage1_coreos || use rkt_stage1_kvm_lkvm || use rkt_stage1_kvm_qemu; then + myeconfargs+=( + --with-coreos-local-pxe-image-path="${DISTDIR}/${PXE_FILE}" + --with-coreos-local-pxe-image-systemd-version="${PXE_SYSTEMD_VERSION}" + ) + fi + + if use rkt_stage1_kvm_lkvm || use rkt_stage1_kvm_qemu; then + use rkt_stage1_kvm_lkvm && hypervisors+=",lkvm" + use rkt_stage1_kvm_qemu && hypervisors+=",qemu" + myeconfargs+=( --with-stage1-kvm-hypervisors="${hypervisors#,}" ) + fi + + # Go's 6l linker does not support PIE, disable so cgo binaries + # which use 6l+gcc for linking can be built correctly. + if gcc-specs-pie; then + append-ldflags -nopie + fi + + export CC=$(tc-getCC) + export CGO_ENABLED=1 + export CGO_CFLAGS="${CFLAGS}" + export CGO_CPPFLAGS="${CPPFLAGS}" + export CGO_CXXFLAGS="${CXXFLAGS}" + export CGO_LDFLAGS="${LDFLAGS}" + export BUILDDIR + + econf "${myeconfargs[@]}" +} + +src_compile() { + local arch=${ARCH} + case ${arch} in + amd64) arch=x86_64;; + esac + ARCH=${arch} emake V=3 + ARCH=${arch} emake V=3 bash-completion +} + +src_install() { + dodoc README.md + use doc && dodoc -r Documentation + use examples && dodoc -r examples + use actool && dobin "${S}/${BUILDDIR}/tools/actool" + + dobin "${S}/${BUILDDIR}/target/bin/rkt" + + insinto /usr/share/rkt + doins "${S}/${BUILDDIR}/target/bin/"*.aci + + # create symlink for default stage1 image path + if use rkt_stage1_host; then + dosym stage1-host.aci "${STAGE1_DEFAULT_LOCATION}" + elif use rkt_stage1_src; then + dosym stage1-src.aci "${STAGE1_DEFAULT_LOCATION}" + elif use rkt_stage1_coreos; then + dosym stage1-coreos.aci "${STAGE1_DEFAULT_LOCATION}" + elif use rkt_stage1_fly; then + dosym stage1-fly.aci "${STAGE1_DEFAULT_LOCATION}" + elif use rkt_stage1_kvm_lkvm; then + dosym stage1-kvm-lkvm.aci "${STAGE1_DEFAULT_LOCATION}" + elif use rkt_stage1_kvm_qemu; then + dosym stage1-kvm-qemu.aci "${STAGE1_DEFAULT_LOCATION}" + fi + + systemd_dounit "${S}"/dist/init/systemd/*.service \ + "${S}"/dist/init/systemd/*.timer \ + "${S}"/dist/init/systemd/*.socket + + insinto /usr/lib/tmpfiles.d + doins "${S}"/dist/init/systemd/tmpfiles.d/* + + newbashcomp "${S}"/dist/bash_completion/rkt.bash rkt + + keepdir /etc/${PN} + fowners :rkt-admin /etc/${PN} + fperms 2775 /etc/${PN} +} |