packages: Add spec files and update scripts

This commit adds the necessary spec files and scripts in order to be able to create
packages in OBS (Open Build System) and locally.

Fixes #15

Signed-off-by: Erick Cardona <erick.cardona.ruiz@intel.com>
Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
This commit is contained in:
Erick Cardona
2018-03-21 17:08:03 +00:00
committed by Jose Carlos Venegas Munoz
parent ec6628ef6b
commit 235276fbff
74 changed files with 4764 additions and 4 deletions

4
.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
typescript
*.img
*.initrd
*.tar.gz

24
Dockerfile Normal file
View File

@@ -0,0 +1,24 @@
FROM opensuse:leap
ARG GO_VERSION=${GO_VERSION:-1.10.2}
ARG SUSE_VERSION=${SUSE_VERSION:-42.3}
ARG GO_ARCH=${GO_ARCH:-amd64}
# Get OBS client, plugins and dependencies
RUN zypper -n install osc-plugin-install vim curl bsdtar git sudo pcre-tools
RUN curl -OkL https://download.opensuse.org/repositories/openSUSE:Tools/openSUSE_${SUSE_VERSION}/openSUSE:Tools.repo
RUN zypper -n addrepo openSUSE:Tools.repo
RUN zypper --gpg-auto-import-keys refresh
RUN zypper -n install build \
obs-service-tar_scm \
obs-service-verify_file \
obs-service-obs_scm \
obs-service-recompress \
obs-service-download_url
# Set Go environment
RUN curl -OL https://dl.google.com/go/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz
RUN tar -C /usr/local -xzf go${GO_VERSION}.linux-${GO_ARCH}.tar.gz
# Local build dependencies
RUN zypper -n install make gcc yum xz

View File

@@ -8,7 +8,10 @@
MK_DIR :=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
.PHONY: test test-release-tools
test: test-release-tools
test: test-release-tools test-packaging-tools
test-release-tools:
@$(MK_DIR)/release/tag_repos_test.sh
test-packaging-tools:
@$(MK_DIR)/build_from_docker.sh

60
build_all.sh Executable file
View File

@@ -0,0 +1,60 @@
#!/bin/bash
#
# Copyright (c) 2018 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
set -e
script_dir=$(dirname "$0")
#Note:Lets update qemu and the kernel first, they take longer to build.
#Note: runtime is build at the end to get the version from all its dependencies.
projects=(
qemu-lite
qemu-vanilla
kernel
kata-containers-image
proxy
shim
ksm-throttler
runtime
)
OSCRC="${HOME}/.oscrc"
PUSH=${PUSH:-""}
export BUILD_DISTROS=${BUILD_DISTROS:-xUbuntu_16.04}
# Packaging use this variable instead of use git user value
# On CI git user is not set
export AUTHOR="${AUTHOR:-user}"
export AUTHOR_EMAIL="${AUTHOR_EMAIL:-user@example.com}"
cd "$script_dir"
OBS_API="https://api.opensuse.org"
if [ -n "${OBS_USER}" ] && [ -n "${OBS_PASS}" ] && [ ! -e "${OSCRC}" ]; then
echo "Creating ${OSCRC} with user $OBS_USER"
cat << eom > "${OSCRC}"
[general]
apiurl = ${OBS_API}
[${OBS_API}]
user = ${OBS_USER}
pass = ${OBS_PASS}
eom
fi
if [ -n "${PUSH}" ]; then
# push to obs
PUSH_TO_OBS="-p"
else
# local build
PUSH_TO_OBS="-l"
fi
for p in "${projects[@]}"; do
pushd "$p" >> /dev/null
echo "update ${p}"
bash ./update.sh "${PUSH_TO_OBS}" -v
popd >> /dev/null
done

52
build_from_docker.sh Executable file
View File

@@ -0,0 +1,52 @@
#!/bin/bash
#
# Copyright (c) 2018 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
set -x
set -e
cache_dir=${PWD}/obs-cache
#where packaing repo lives
packaging_repo_dir="${PWD}"
#where results will be stored
host_datadir="${PWD}/pkgs"
obs_image="obs-kata"
export USE_DOCKER=1
if command -v go; then
export GO_ARCH=$(go env GOARCH)
else
export GO_ARCH=amd64
echo "Go not installed using $GO_ARCH to install go in dockerfile"
fi
export GO_ARCH=$(go env GOARCH)
sudo docker build \
--build-arg http_proxy="${http_proxy}" \
--build-arg https_proxy="${https_proxy}" \
-t $obs_image .
pushd kata-containers-image/ >> /dev/null
./build_image.sh
popd >> /dev/null
function faketty { script -qfc "$(printf "%q " "$@")"; }
faketty sudo docker run \
--rm \
-v "${HOME}/.ssh":/root/.ssh \
-v "${HOME}/.gitconfig":/root/.gitconfig \
-v /etc/profile:/etc/profile \
--env http_proxy="${http_proxy}" \
--env https_proxy="${https_proxy}" \
--env no_proxy="${no_proxy}" \
--env PUSH="${PUSH}" \
-v "${HOME}/.bashrc":/root/.bashrc \
-v "$cache_dir":/var/tmp/osbuild-packagecache/ \
-v "$packaging_repo_dir":${packaging_repo_dir} \
-v "$host_datadir":/var/packaging \
-v "$HOME/.oscrc":/root/.oscrc \
-ti "$obs_image" bash -c "${packaging_repo_dir}/build_all.sh"

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,64 @@
#!/bin/bash
#
# Copyright (c) 2018 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
set -x
set -o errexit
set -o nounset
set -o pipefail
tmp_dir=$(mktemp -d -t build-image-tmp.XXXXXXXXXX)
script_dir=$(dirname "$0")
source ${script_dir}/../versions.txt
readonly OSBUILDER_URL=https://github.com/kata-containers/osbuilder.git
AGENT_SHA="$kata_agent_hash"
#Image information
IMG_DISTRO="${osbuilder_default_os:-clearlinux}"
IMG_OS_VERSION="$clearlinux_version"
CLR_BASE_URL="https://download.clearlinux.org/releases/${clearlinux_version}/clear/x86_64/os/"
#Initrd information
INITRD_DISTRO="${osbuilder_default_initrd_os:-alpine}"
INITRD_OS_VERSION="$alpine_version"
readonly IMAGE_NAME="kata-containers-image_${IMG_DISTRO}_agent_${AGENT_SHA:0:7}.img"
readonly INITRD_NAME="kata-containers-initrd_${INITRD_DISTRO}_agent_${AGENT_SHA:0:7}.initrd"
rm -f "${IMAGE_NAME}"
rm -f "${INITRD_NAME}"
pushd ${tmp_dir}
git clone $OSBUILDER_URL osbuilder
pushd osbuilder
git checkout $kata_osbuilder_version
sudo -E PATH=$PATH make initrd\
DISTRO=$INITRD_DISTRO \
AGENT_VERSION=$AGENT_SHA \
OS_VERSION=$INITRD_OS_VERSION \
DISTRO_ROOTFS="${PWD}/initrd-image" \
USE_DOCKER=1 \
AGENT_INIT="yes"
sudo -E PATH=$PATH make image \
DISTRO=$IMG_DISTRO \
AGENT_VERSION=$AGENT_SHA \
IMG_OS_VERSION=$IMG_OS_VERSION \
DISTRO_ROOTFS="${PWD}/rootfs-image" \
BASE_URL=$CLR_BASE_URL
popd
popd
mv "${tmp_dir}/osbuilder/kata-containers.img" "${IMAGE_NAME}"
mv "${tmp_dir}/osbuilder/kata-containers-initrd.img" "${INITRD_NAME}"
sudo tar cfz "kata-containers.tar.gz" "${INITRD_NAME}" "${IMAGE_NAME}"

View File

@@ -0,0 +1 @@
9

View File

@@ -0,0 +1,12 @@
Source: kata-containers-image
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Standards-Version: 3.9.6
Homepage: https://katacontainers.io
Build-Depends: debhelper (>= 9), flex, bison
Package: kata-containers-image
Architecture: @deb_arch@
Description: Kata containers image

View File

@@ -0,0 +1 @@
usr/share/kata-containers

View File

@@ -0,0 +1,17 @@
#!/usr/bin/make -f
%:
dh $@
override_dh_auto_build:
override_dh_auto_install:
mkdir -p debian/kata-containers-image ; \
tar xzf /usr/src/packages/SOURCES/kata-containers.tar.gz -C /usr/src/packages/SOURCES/ ; \
image=$$(find /usr/src/packages/SOURCES/ -type f -name '*.img') ; \
initrd=$$(find /usr/src/packages/SOURCES/ -type f -name '*.initrd') ; \
install -D $${image} ./debian/kata-containers-image/usr/share/kata-containers/ ; \
install -D $${initrd} ./debian/kata-containers-image/usr/share/kata-containers/ ; \
ln -s /usr/share/kata-containers/$$(basename $${image}) \
./debian/kata-containers-image/usr/share/kata-containers/kata-containers.img ; \
ln -s /usr/share/kata-containers/$$(basename $${initrd}) \
./debian/kata-containers-image/usr/share/kata-containers/kata-containers-initrd.img ;

View File

@@ -0,0 +1,14 @@
Format: 3.0 (quilt)
Source: kata-containers-image
Version: @VERSION@-@RELEASE@
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Build-Depends: debhelper (>= 9), flex, bison
Standards-Version: 3.9.6
Homepage: https://katacontainers.io
Debtransform-Tar: kata-containers.tar.gz
Package: kata-containers-image
Architecture: @deb_arch@
Description: Kata containers image

View File

@@ -0,0 +1,48 @@
%define version @VERSION@
%define release @RELEASE@
%define agent_sha @AGENT_SHA@
%define rootfs_os @ROOTFS_OS@
Name: kata-containers-image
Version: %{version}
Release: %{release}.<B_CNT>
License: Artistic-1.0 BSD-3-Clause BSD-3-Clause-Kata BSD-4-Clause-UC GFDL-1.3 GPL-2.0 GPL-2.0+ GPL-3.0 GPL-3.0+ LGPL-2.0 LGPL-2.0+ LGPL-2.1 LGPL-3.0+ MIT MPL-2.0 Public-Domain
Summary: Kata Containers Image
Url: https://github.com/kata-containers/osbuilder
Group: image
Source0: kata-containers.tar.gz
Source1: LICENSE
%global debug_package %{nil}
@RPM_PATCH_LIST@
%description
Kata Containers rootfs image
%prep
# Patches
@RPM_APPLY_PATCHES@
%install
ImageDir=%{buildroot}/usr/share/kata-containers
mkdir -p ${ImageDir}
pushd %{_sourcedir}
tar xfz kata-containers.tar.gz
image=$(find ${PWD} -type f -name '*.img')
initrd=$(find ${PWD} -type f -name '*.initrd')
popd
install -p "${image}" ${ImageDir}/
install -p "${initrd}" ${ImageDir}/
ln -s /usr/share/kata-containers/$(basename "${image}") ${ImageDir}/kata-containers.img
ln -s /usr/share/kata-containers/$(basename "${initrd}") ${ImageDir}/kata-containers-initrd.img
%files
%if 0%{?suse_version}
%dir /usr/share/kata-containers
%endif
/usr/share/kata-containers/kata-containers-image*.img
/usr/share/kata-containers/kata-containers.img
/usr/share/kata-containers/kata-containers-initrd*.initrd
/usr/share/kata-containers/kata-containers-initrd.img

53
kata-containers-image/update.sh Executable file
View File

@@ -0,0 +1,53 @@
#!/bin/bash
#
# Copyright (c) 2018 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# Automation script to create specs to build kata-containers-image
# Default image to build is the one specified in file versions.txt
# located at the root of the repository.
set -e
source ../versions.txt
source ../scripts/pkglib.sh
SCRIPT_NAME=$0
SCRIPT_DIR=$(dirname $0)
PKG_NAME="kata-containers-image"
VERSION=$kata_osbuilder_version
GENERATED_FILES=(kata-containers-image.spec kata-containers-image.dsc debian.rules debian.control)
STATIC_FILES=(LICENSE debian.compat debian.dirs kata-containers.tar.gz)
# Parse arguments
cli "$@"
[ "$VERBOSE" == "true" ] && set -x
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/kata-containers-image}
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
((RELEASE++))
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
function check_image() {
[ ! -f "${SCRIPT_DIR}/kata-containers.tar.gz" ] && die "No kata-containers.tar.gz found!\nUse the build_image.sh script" || echo "Image: OK"
}
replace_list=(
"VERSION=$VERSION"
"RELEASE=$RELEASE"
"AGENT_SHA=${kata_agent_hash:0:7}"
"ROOTFS_OS=$osbuilder_default_os"
)
verify
check_image
echo "Verify succeed."
get_git_info
changelog_update $VERSION
generate_files "$SCRIPT_DIR" "${replace_list[@]}"
build_pkg "${PROJECT_REPO}"

View File

@@ -0,0 +1,25 @@
#
# Copyright (c) 2018 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
# Installation variables
DESTDIR :=
DEFAULTSDIR := /usr/share/
PROJECT_DIR := Kata-containers
VMLINUX := @VMLINUX@
VMLINUZ := @VMLINUZ@
DESTSYSCONFDIR := $(abspath $(DESTDIR)/$(DEFAULTSDIR)/$(PROJECT_DIR))
VMLINUX_DEST := $(abspath $(DESTSYSCONFDIR)/$(VMLINUX))
VMLINUZ_DEST := $(abspath $(DESTSYSCONFDIR)/$(VMLINUZ))
install:
install -D --owner root --group root --mode 0644 $(VMLINUX) $(VMLINUX_DEST)
install -D --owner root --group root --mode 0644 $(VMLINUZ) $(VMLINUZ_DEST)
ln -sf $(VMLINUX_DEST) $(DESTSYSCONFDIR)/vmlinuz.container
ln -sf $(VMLINUZ_DEST) $(DESTSYSCONFDIR)/vmlinux.container

13
kernel/_service-template Normal file
View File

@@ -0,0 +1,13 @@
<!--- XML Structure defined here: https://en.opensuse.org/openSUSE:Build_Service_Concept_SourceService -->
<services>
<service name="download_url">
<param name="protocol">https</param>
<param name="host">cdn.kernel.org</param>
<param name="path">/pub/linux/kernel/v4.x/linux-@VERSION@.tar.xz</param>
</service>
<service name="verify_file">
<param name="file">_service:download_url:linux-@VERSION@.tar.xz</param>
<param name="verifier">sha256</param>
<param name="checksum">@KERNEL_SHA256@</param>
</service>
</services>

1
kernel/debian.compat Normal file
View File

@@ -0,0 +1 @@
9

View File

@@ -0,0 +1,18 @@
Source: kata-linux-container
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Build-Depends: debhelper (>= 9), cpio, libelf-dev, libnewt-dev, libiberty-dev, rsync, libdw-dev, libpci-dev, pkg-config, flex, bison, libunwind8-dev, openssl, libaudit-dev, bc, python-dev, gawk, autoconf, automake, libtool, libssl-dev
Standards-Version: 3.9.6
Homepage: https://katacontainers.io
Package: kata-linux-container
Architecture: @deb_arch@
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends},
Description: linux kernel optimised for container-like workloads.
Linux kernel optimised for container-like workloads
Package: kata-linux-container-debug
Architecture: @deb_arch@
Description: Debug components for the kata-linux-container package.
This package includes the kernel config and the kernel map.

30
kernel/debian.copyright Normal file
View File

@@ -0,0 +1,30 @@
This is the Kata containers prepackaged version of the Linux kernel.
Linux was written by Linus Torvalds <Linus.Torvalds@cs.Helsinki.FI>
and others.
This package was put together by the Kata containers team, from
sources retrieved from upstream linux git.
The sources may be found at most Linux download websites, including
https://www.kernel.org/pub/linux/kernel/
This package is currently maintained by the
Kata containers team <https://github.com/kata-containers/
Linux is copyrighted by Linus Torvalds and others.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 dated June, 1991.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
On your Linux system, the complete text of the GNU General
Public License v2 can be found in `/usr/share/common-licenses/GPL-2'.
copyright (END)

2
kernel/debian.dirs Normal file
View File

@@ -0,0 +1,2 @@
usr/share/Kata-containers

35
kernel/debian.rules Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/make -f
include /usr/share/dpkg/default.mk
KernelDir=debian/kata-linux-container/usr/share/kata-containers
DebugDir=debian/kata-linux-container-debug/usr/share/kata-containers
KernelVer=${DEB_VERSION_UPSTREAM_REVISION}.container
%:
dh $@
override_dh_auto_build:
sed -i "s/^EXTRAVERSION.*/EXTRAVERSION = -$$(echo $(KernelVer) | cut -d'-' -f2)/" Makefile
cp /usr/src/packages/SOURCES/config .config
make -s ARCH=x86_64 oldconfig > /dev/null
make -s CONFIG_DEBUG_SECTION_MISMATCH=y ARCH=x86_64 -j4 all
override_dh_auto_install:
override_dh_auto_clean:
override_dh_install:
dh_install
mkdir -p $(DebugDir)
mkdir -p $(KernelDir)
install -m 644 .config $(DebugDir)/config-$(KernelVer)
install -m 644 System.map $(DebugDir)/System.map-$(KernelVer)
cp arch/x86/boot/bzImage $(KernelDir)/vmlinuz-$(KernelVer)
chmod 755 $(KernelDir)/vmlinuz-$(KernelVer)
ln -sf vmlinuz-$(KernelVer) $(KernelDir)/vmlinuz.container
cp vmlinux $(KernelDir)/vmlinux-$(KernelVer)
chmod 755 $(KernelDir)/vmlinux-$(KernelVer)
ln -sf vmlinux-$(KernelVer) $(KernelDir)/vmlinux.container
override_dh_strip:
override_dh_shlibdeps:

View File

@@ -0,0 +1,20 @@
Format: 3.0 (quilt)
Source: kata-linux-container
Version: @VERSION@-@RELEASE@
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Build-Depends: debhelper (>= 9), cpio, libelf-dev, libnewt-dev, libiberty-dev, rsync, libdw-dev, libpci-dev, pkg-config, flex, bison, libunwind8-dev, openssl, libaudit-dev, bc, python-dev, gawk, autoconf, automake, libtool, libssl-dev
Standards-Version: 3.9.6
Homepage: https://katacontainers.io
Debtransform-Tar: linux-@VERSION@.tar.xz
Package: kata-linux-container
Architecture: @deb_arch@
Description: linux kernel optimised for container-like workloads.
Linux kernel optimised for container-like workloads
Package: kata-linux-container-debug
Architecture: @deb_arch@
Description: Debug components for the kata-linux-container package.
This package includes the kernel config and the kernel map.

View File

@@ -0,0 +1,127 @@
#
# This is a special configuration of the Linux kernel, aimed exclusively
# for running inside a container
# This specialization allows us to optimize memory footprint and boot time.
#
%define bzimage_arch x86
Name: kata-linux-container
Version: @VERSION@
Release: @RELEASE@.<B_CNT>
License: GPL-2.0
Summary: The Linux kernel optimized for running inside a container
Url: http://www.kernel.org/
Group: kernel
Source0: https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-@VERSION@.tar.xz
Source1: config
%define kversion %{version}-%{release}.container
BuildRequires: bash >= 2.03
BuildRequires: bc
BuildRequires: binutils-devel
%if 0%{?rhel_version}
BuildRequires: elfutils-devel
%endif
%if 0%{?suse_version}
BuildRequires: libelf-devel
%endif
%if 0%{?fedora} || 0%{?centos_version}
BuildRequires: pkgconfig(libelf)
%endif
BuildRequires: make >= 3.78
BuildRequires: openssl-devel
BuildRequires: flex
BuildRequires: bison
# don't strip .ko files!
%global __os_install_post %{nil}
%define debug_package %{nil}
%define __strip /bin/true
# Patches
@RPM_PATCH_LIST@
%description
The Linux kernel.
%package debug
Summary: Debug components for the kata-linux-container package.
Group: Default
%description debug
Debug components for the kata-linux-container package.
This package includes the kernel config and the kernel map.
%prep
%setup -q -n linux-@VERSION@
# Patches
@RPM_APPLY_PATCHES@
cp %{SOURCE1} .
%build
BuildKernel() {
Arch=%{_arch}
ExtraVer="-%{release}.container"
perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = ${ExtraVer}/" Makefile
make -s mrproper
cp config .config
make -s ARCH=$Arch oldconfig > /dev/null
make -s CONFIG_DEBUG_SECTION_MISMATCH=y %{?_smp_mflags} ARCH=$Arch %{?sparse_mflags} || exit 1
}
BuildKernel
%install
InstallKernel() {
KernelImage=$1
KernelImageRaw=$2
Arch=%{_arch}
KernelVer=%{kversion}
KernelDir=%{buildroot}/usr/share/kata-containers
mkdir -p ${KernelDir}
cp $KernelImage ${KernelDir}/vmlinuz-$KernelVer
chmod 755 ${KernelDir}/vmlinuz-$KernelVer
ln -sf vmlinuz-$KernelVer ${KernelDir}/vmlinuz.container
cp $KernelImageRaw ${KernelDir}/vmlinux-$KernelVer
chmod 755 ${KernelDir}/vmlinux-$KernelVer
ln -sf vmlinux-$KernelVer ${KernelDir}/vmlinux.container
cp .config "${KernelDir}/config-${KernelVer}"
cp System.map "${KernelDir}/System.map-${KernelVer}"
rm -f %{buildroot}/usr/lib/modules/$KernelVer/build
rm -f %{buildroot}/usr/lib/modules/$KernelVer/source
}
InstallKernel arch/%{bzimage_arch}/boot/bzImage vmlinux
rm -rf %{buildroot}/usr/lib/firmware
%files
%dir /usr/share/kata-containers
/usr/share/kata-containers/vmlinux-%{kversion}
/usr/share/kata-containers/vmlinux.container
/usr/share/kata-containers/vmlinuz-%{kversion}
/usr/share/kata-containers/vmlinuz.container
%files debug
%defattr(-,root,root,-)
/usr/share/kata-containers/config-%{kversion}
/usr/share/kata-containers/System.map-%{kversion}

58
kernel/update.sh Executable file
View File

@@ -0,0 +1,58 @@
#!/bin/bash
#
# Copyright (c) 2018 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# Automation script to create specs to build Kata containers kernel
set -e
source ../versions.txt
source ../scripts/pkglib.sh
SCRIPT_NAME=$0
SCRIPT_DIR=$(dirname $0)
PKG_NAME="kata-linux-container"
VERSION=$kernel_version
KR_SERIES="$(echo $VERSION | cut -d "." -f 1).x"
KR_LTS=$(echo $VERSION | cut -d "." -f 1,2)
KR_PATCHES=$(eval find "patches" -type f -name "*.patch")
KR_REL=https://www.kernel.org/releases.json
KR_SHA=https://cdn.kernel.org/pub/linux/kernel/v"${KR_SERIES}"/sha256sums.asc
GENERATED_FILES=(kata-linux-container.dsc kata-linux-container.spec _service config debian.control debian.series)
STATIC_FILES=(debian.dirs debian.rules debian.compat debian.copyright)
#STATIC_FILES+=($KR_PATCHES)
# Parse arguments
cli "$@"
[ "$VERBOSE" == "true" ] && set -x
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/linux-container}
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
((RELEASE++))
kernel_sha256=$(curl -L -s -f ${KR_SHA} | awk '/linux-'${VERSION}'.tar.xz/ {print $1}')
# Generate the kernel config file
cp "configs/x86_kata_kvm_${KR_LTS}.x" config
replace_list=(
"VERSION=$VERSION"
"RELEASE=$RELEASE"
"KERNEL_SHA256=$kernel_sha256"
)
verify
echo "Verify succeed."
get_git_info
changelog_update $VERSION
generate_files "$SCRIPT_DIR" "${replace_list[@]}"
build_pkg "${PROJECT_REPO}"

View File

@@ -0,0 +1,24 @@
<!--- XML Structure defined here: https://en.opensuse.org/openSUSE:Build_Service_Concept_SourceService -->
<services>
<service name="tar_scm">
<param name="scm">git</param>
<param name="url">https://github.com/kata-containers/ksm-throttler.git</param>
<param name="filename">kata-ksm-throttler</param>
<param name="versionformat">@VERSION@.git+%h</param>
<param name="revision">@REVISION@</param>
</service>
<service name="recompress">
<param name="file">*.tar*</param>
<param name="compression">gz</param>
</service>
<service name="download_url">
<param name="protocol">https</param>
<param name="host">storage.googleapis.com</param>
<param name="path">golang/go@GO_VERSION@.linux-@GO_ARCH@.tar.gz</param>
</service>
<service name="verify_file">
<param name="file">_service:download_url:go@GO_VERSION@.linux-@GO_ARCH@.tar.gz</param>
<param name="verifier">sha256</param>
<param name="checksum">@GO_CHECKSUM@</param>
</service>
</services>

View File

@@ -0,0 +1 @@
9

View File

@@ -0,0 +1,13 @@
Source: kata-ksm-throttler
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Standards-Version: 3.9.6
Homepage: https://katacontainers.io
Build-Depends: dh-make, git, ca-certificates, execstack, devscripts, debhelper, build-essential, dh-autoreconf, make, dh-modaliases, pkg-config, dh-systemd, systemd
Package: kata-ksm-throttler
Architecture: @deb_arch@
Description:
This project implements a Kernel Same-page Merging throttling daemon.
Its goal is to regulate KSM by dynamically modifying the KSM sysfs entries, in order to minimize memory duplication as fast as possible while keeping the KSM daemon load low.

View File

@@ -0,0 +1,35 @@
#!/usr/bin/make -f
DOMAIN = github.com
ORG = kata-containers
PROJECT = ksm-throttler
IMPORTNAME = $(DOMAIN)/$(ORG)/$(PROJECT)
GO_VERSION = @GO_VERSION@
export DH_VERBOSE=1
export DH_GOPKG:=$(DOMAIN)/$(ORG)/$(PROJECT)
export DEB_BUILD_OPTIONS=nocheck
export GOPATH=/usr/src/packages/BUILD/go
export GOROOT=/tmp/local/go
export PATH:=/tmp/local/go/bin:$(PATH)
export DH_OPTIONS
%:
dh $@
override_dh_auto_build:
mkdir -p /tmp/local/
mkdir -p /usr/src/packages/BUILD/go/src/$(DOMAIN)/$(ORG)
tar xzf /usr/src/packages/SOURCES/go$(GO_VERSION).linux-@GO_ARCH@.tar.gz -C /tmp/local
ln -s /usr/src/packages/BUILD /usr/src/packages/BUILD/go/src/$(IMPORTNAME)
cd $(GOPATH)/src/$(IMPORTNAME); \
make TARGET=kata-ksm-throttler
override_dh_auto_install:
mkdir -p debian/$(PROJECT)
cd $(GOPATH)/src/$(IMPORTNAME); \
make install \
DESTDIR=$(shell pwd)/debian/kata-ksm-throttler \
TARGET=kata-ksm-throttler

View File

@@ -0,0 +1,16 @@
Format: 3.0 (quilt)
Source: kata-ksm-throttler
Version: @VERSION@.git+@HASH@-@RELEASE@
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Standards-Version: 3.9.6
Homepage: https://katacontainers.io
Build-Depends: dh-make, git, ca-certificates, execstack, devscripts, debhelper, build-essential, dh-autoreconf, make, dh-modaliases, pkg-config, dh-systemd, systemd
Debtransform-Tar: kata-ksm-throttler-@VERSION@.git+@HASH@.tar.gz
Package: kata-ksm-throttler
Architecture: @deb_arch@
Description:
This project implements a Kernel Same-page Merging throttling daemon.
Its goal is to regulate KSM by dynamically modifying the KSM sysfs entries, in order to minimize memory duplication as fast as possible while keeping the KSM daemon load low.

View File

@@ -0,0 +1,83 @@
%global PREFIX /usr/
%global DOMAIN github.com
%global ORG kata-containers
%global PROJECT ksm-throttler
%global IMPORTNAME %{DOMAIN}/%{ORG}/%{PROJECT}
%global GO_VERSION @GO_VERSION@
%global GO_ARCH @GO_ARCH@
%if 0%{?suse_version}
%define LIBEXECDIR %{_libdir}
%else
%define LIBEXECDIR %{_libexecdir}
%endif
%undefine _missing_build_ids_terminate_build
%define debug_package %{nil}
Name: kata-ksm-throttler
Version: @VERSION@.git+@HASH@
Release: @RELEASE@.<B_CNT>
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Summary : No detailed summary available
Group : Development/Tools
License : Apache-2.0
BuildRequires: git
BuildRequires: systemd
%if 0%{?suse_version} && 0%{?is_opensuse}
BuildRequires: openSUSE-release
%endif
# Patches
@RPM_PATCH_LIST@
%description
.. contents::
.. sectnum::
``kata-ksm-throttler``
===================
Overview
--------
%prep
mkdir local
tar -C local -xzf ../SOURCES/go%{GO_VERSION}.linux-%{GO_ARCH}.tar.gz
%setup -q
%autosetup -S git
@RPM_APPLY_PATCHES@
%build
export GOROOT=$HOME/rpmbuild/BUILD/local/go
export PATH=$PATH:$HOME/rpmbuild/BUILD/local/go/bin
export GOPATH=$HOME/rpmbuild/BUILD/go/
mkdir -p $HOME/rpmbuild/BUILD/go/src/%{DOMAIN}/%{ORG}
ln -s $HOME/rpmbuild/BUILD/kata-ksm-throttler-%{version} $HOME/rpmbuild/BUILD/go/src/%{IMPORTNAME}
cd $HOME/rpmbuild/BUILD/go/src/%{IMPORTNAME}
make \
TARGET=kata-ksm-throttler \
LIBEXECDIR=%{LIBEXECDIR}
%install
export GOROOT=$HOME/rpmbuild/BUILD/local/go
export PATH=$PATH:$HOME/rpmbuild/BUILD/local/go/bin
export GOPATH=$HOME/rpmbuild/BUILD/go/
cd $HOME/rpmbuild/BUILD/go/src/%{IMPORTNAME}
make install \
TARGET=kata-ksm-throttler \
DESTDIR=%{buildroot} \
LIBEXECDIR=%{LIBEXECDIR}
%files
%defattr(-,root,root,-)
%{LIBEXECDIR}/kata-ksm-throttler
%{LIBEXECDIR}/kata-ksm-throttler/kata-ksm-throttler
%{LIBEXECDIR}/kata-ksm-throttler/trigger
%{LIBEXECDIR}/kata-ksm-throttler/trigger/virtcontainers
%{LIBEXECDIR}/kata-ksm-throttler/trigger/virtcontainers/vc
/usr/lib/systemd/system/kata-ksm-throttler.service
/usr/lib/systemd/system/vc-throttler.service

55
ksm-throttler/update.sh Executable file
View File

@@ -0,0 +1,55 @@
#!/bin/bash
#
# Copyright (c) 2018 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Automation script to create specs to build ksm-throttler.
# Default: Build is the one specified in file configure.ac
# located at the root of the repository.
set -e
source ../versions.txt
source ../scripts/pkglib.sh
SCRIPT_NAME=$0
SCRIPT_DIR=$(dirname $0)
PKG_NAME="kata-ksm-throttler"
VERSION=$ksm_throttler_version
HASH=$ksm_throttler_hash
GENERATED_FILES=(_service kata-ksm-throttler.spec kata-ksm-throttler.dsc debian.control debian.rules)
STATIC_FILES=(debian.compat)
# Parse arguments
cli "$@"
[ "$VERBOSE" == "true" ] && set -x
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/ksm-throttler}
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
((RELEASE++))
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
set_versions "$ksm_throttler_hash"
replace_list=(
"GO_CHECKSUM=$go_checksum"
"GO_VERSION=$go_version"
"GO_ARCH=$GO_ARCH"
"HASH=${HASH:0:7}"
"RELEASE=$RELEASE"
"REVISION=$HASH"
"VERSION=$VERSION"
)
verify
echo "Verify succeed."
get_git_info
changelog_update $VERSION
generate_files "$SCRIPT_DIR" "${replace_list[@]}"
build_pkg "${PROJECT_REPO}"

24
proxy/_service-template Normal file
View File

@@ -0,0 +1,24 @@
<!--- XML Structure defined here: https://en.opensuse.org/openSUSE:Build_Service_Concept_SourceService -->
<services>
<service name="tar_scm">
<param name="scm">git</param>
<param name="url">https://github.com/kata-containers/proxy.git</param>
<param name="filename">kata-proxy</param>
<param name="versionformat">@VERSION@+git.%h</param>
<param name="revision">@REVISION@</param>
</service>
<service name="recompress">
<param name="file">*.tar*</param>
<param name="compression">gz</param>
</service>
<service name="download_url">
<param name="protocol">https</param>
<param name="host">storage.googleapis.com</param>
<param name="path">golang/go@GO_VERSION@.linux-@GO_ARCH@.tar.gz</param>
</service>
<service name="verify_file">
<param name="file">_service:download_url:go@GO_VERSION@.linux-@GO_ARCH@.tar.gz</param>
<param name="verifier">sha256</param>
<param name="checksum">@GO_CHECKSUM@</param>
</service>
</services>

1
proxy/debian.compat Normal file
View File

@@ -0,0 +1 @@
9

View File

@@ -0,0 +1,13 @@
Source: kata-proxy
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Standards-Version: 3.9.6
Homepage: https://katacontainers.io
Build-Depends: dh-make, git, ca-certificates, execstack, devscripts, debhelper, build-essential, dh-autoreconf, make, dh-modaliases
Package: kata-proxy
Architecture: @deb_arch@
Description:
kata-proxy works alongside the Kata Containers runtime and shim to provide a VM-based OCI runtime solution.
kata-proxy is a daemon offering access to the hyperstart VM agent to both the runtime and shim processes.

View File

@@ -0,0 +1,23 @@
#!/usr/bin/make -f
export DH_OPTIONS
export DH_GOPKG:=github.com/kata-containers/proxy
export DEB_BUILD_OPTIONS=nocheck
export PATH:=/usr/src/packages/BUILD/local/go/bin:$(PATH)
export GOROOT:=/usr/src/packages/BUILD/local/go
export GOPATH=/usr/src/packages/BUILD/go
GO_VERSION=@GO_VERSION@
%:
dh $@
override_dh_auto_build:
mkdir -p /usr/src/packages/BUILD/local/
mkdir -p /usr/src/packages/BUILD/go/src/github.com/kata-containers/
tar xzf /usr/src/packages/SOURCES/go$(GO_VERSION).linux-@GO_ARCH@.tar.gz -C /usr/src/packages/BUILD/local/
ln -s /usr/src/packages/BUILD/ /usr/src/packages/BUILD/go/src/github.com/kata-containers/proxy
cd $(GOPATH)/src/github.com/kata-containers/proxy && make
override_dh_auto_install:
mkdir debian/kata-proxy
make install LIBEXECDIR=$(shell pwd)/debian/kata-proxy/usr/libexec

View File

@@ -0,0 +1,16 @@
format: 3.0 (quilt)
Source: kata-proxy
Version: @VERSION@+git.@HASH@-@RELEASE@
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Standards-Version: 3.9.6
Build-Depends: dh-make, git, ca-certificates, execstack, devscripts, debhelper, build-essential, dh-autoreconf, make, dh-modaliases
Homepage: https://katacontainers.io
Debtransform-Tar: kata-proxy-@VERSION@+git.@HASH@.tar.gz
Package: kata-proxy
Architecture: @deb_arch@
Description:
kata-proxy works alongside the Kata Containers runtime and shim to provide a VM-based OCI runtime solution.
kata-proxy is a daemon offering access to the hyperstart VM agent to both the runtime and shim processes.

View File

@@ -0,0 +1,84 @@
%global PREFIX /usr/
%global BINDIR %{PREFIX}/bin
%global DOMAIN github.com
%global ORG kata-containers
%global PROJECT proxy
%global IMPORTNAME %{DOMAIN}/%{ORG}/%{PROJECT}
%global GO_VERSION @GO_VERSION@
%if 0%{?suse_version}
%define LIBEXECDIR %{_libdir}
%else
%define LIBEXECDIR %{_libexecdir}
%endif
%undefine _missing_build_ids_terminate_build
Name: kata-proxy
Version: @VERSION@+git.@HASH@
Release: @RELEASE@.<B_CNT>
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: pkgconfig(systemd)
BuildRequires: git
Summary : No detailed summary available
Group : Development/Tools
License : Apache-2.0
Requires: kata-proxy-bin
#!BuildIgnore: post-build-checks
# Patches
@RPM_PATCH_LIST@
%description
.. contents::
.. sectnum::
``kata-proxy``
===================
Overview
--------
%global debug_package %{nil}
%define _unpackaged_files_terminate_build 0
%package bin
Summary: bin components for the kata-proxy package.
Group: Binaries
%description bin
bin components for the kata-proxy package.
%prep
mkdir local
tar -C local -xzf ../SOURCES/go%{GO_VERSION}.linux-@GO_ARCH@.tar.gz
%setup -q
# Patches
@RPM_APPLY_PATCHES@
%build
export GOROOT=$HOME/rpmbuild/BUILD/local/go
export PATH=$PATH:$HOME/rpmbuild/BUILD/local/go/bin
export GOPATH=$HOME/rpmbuild/BUILD/go/
mkdir -p $HOME/rpmbuild/BUILD/go/src/%{DOMAIN}/%{ORG}
ln -s %{_builddir}/%{name}-%{version} $HOME/rpmbuild/BUILD/go/src/%{IMPORTNAME}
cd $HOME/rpmbuild/BUILD/go/src/%{IMPORTNAME}
make
%clean
echo "Clean build root"
rm -rf %{buildroot}
%install
make install LIBEXECDIR=%{buildroot}%{LIBEXECDIR}
%files
%defattr(-,root,root,-)
%files bin
%defattr(-,root,root,-)
%{LIBEXECDIR}/kata-containers
%{LIBEXECDIR}/kata-containers/kata-proxy

50
proxy/update.sh Executable file
View File

@@ -0,0 +1,50 @@
#!/bin/bash
#
# Copyright (c) 2018 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Automation script to create specs to build kata-proxy
set -e
source ../versions.txt
source ../scripts/pkglib.sh
SCRIPT_NAME=$0
SCRIPT_DIR=$(dirname "$0")
PKG_NAME="kata-proxy"
VERSION=$kata_proxy_version
GENERATED_FILES=(kata-proxy.spec kata-proxy.dsc debian.control debian.rules _service)
STATIC_FILES=(debian.compat)
# Parse arguments
cli "$@"
[ "$VERBOSE" == "true" ] && set -x
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/proxy}
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
((RELEASE++))
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
set_versions $kata_proxy_hash
replace_list=(
"GO_CHECKSUM=$go_checksum"
"GO_VERSION=$go_version"
"GO_ARCH=$GO_ARCH"
"HASH=$short_hashtag"
"RELEASE=$RELEASE"
"REVISION=$VERSION"
"VERSION=$VERSION"
)
verify
echo "Verify succeed."
get_git_info
changelog_update $VERSION
generate_files "$SCRIPT_DIR" "${replace_list[@]}"
build_pkg "${PROJECT_REPO}"

View File

@@ -0,0 +1,15 @@
<!--- XML Structure defined here: https://en.opensuse.org/openSUSE:Build_Service_Concept_SourceService -->
<services>
<service name="tar_scm">
<param name="scm">git</param>
<param name="url">https://github.com/kata-containers/qemu.git</param>
<param name="exclude">.git</param>
<param name="filename">qemu-lite</param>
<param name="versionformat">@VERSION@+git.%h</param>
<param name="revision">qemu-lite-@VERSION@</param>
</service>
<service name="recompress">
<param name="file">*.tar*</param>
<param name="compression">gz</param>
</service>
</services>

1
qemu-lite/debian.compat Normal file
View File

@@ -0,0 +1 @@
9

View File

@@ -0,0 +1,14 @@
Source: qemu-lite
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Build-Depends: debhelper (>= 9), cpio, libelf-dev, rsync, libdw-dev, pkg-config, flex, bison, libaudit-dev, bc, python-dev, gawk, autoconf, automake, libtool, libltdl-dev, libglib2.0-dev, libglib2.0-0, libcap-dev, libcap-ng-dev, libattr1-dev, m4, libnuma-dev, zlib1g-dev, libpixman-1-0, libpixman-1-dev
Standards-Version: 3.9.6
Homepage: https://katacontainers.io
Package: qemu-lite
Architecture: @deb_arch@
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends},
Description: linux kernel optimised for container-like workloads.
Linux kernel optimised for container-like workloads

View File

@@ -0,0 +1,28 @@
#!/usr/bin/make -f
include /usr/share/dpkg/default.mk
export LANG=C
%:
dh $@
override_dh_auto_configure:
chmod a+x "../SOURCES/configure-hypervisor.sh"
eval "../SOURCES/configure-hypervisor.sh" "qemu-lite" | xargs ./configure --prefix=/usr
override_dh_auto_build:
make
override_dh_auto_install:
dh_auto_install
for file in $(CURDIR)/debian/qemu-lite/usr/bin/* ; do \
dir=$$(dirname $$file) ;\
bin=$$(basename $$file) ;\
new=$$(echo $$bin | sed -e 's/qemu-/qemu-lite-/g' -e 's/ivshmem-/ivshmem-lite-/g' -e 's/virtfs-/virtfs-lite-/g') ;\
mv $$file "$$dir"/"$$new" ; \
done
override_dh_auto_test:
echo "Skip auto test"
override_dh_auto_clean:
echo "Skip auto clean"

1
qemu-lite/debian.series Normal file
View File

@@ -0,0 +1 @@
configure.patch

View File

@@ -0,0 +1 @@
setBadness('arch-dependent-file-in-usr-share', 0)

View File

@@ -0,0 +1,16 @@
Format: 3.0 (quilt)
Source: qemu-lite
Version: @VERSION@+git.@QEMU_LITE_HASH@-@RELEASE@
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Build-Depends: debhelper (>= 9), cpio, libelf-dev, rsync, libdw-dev, pkg-config, flex, bison, libaudit-dev, bc, python-dev, gawk, autoconf, automake, libtool, libltdl-dev, libglib2.0-dev, libglib2.0-0, libcap-dev, libcap-ng-dev, libattr1-dev, m4, libnuma-dev, zlib1g-dev, libpixman-1-0, libpixman-1-dev, librbd-dev
Standards-Version: 3.9.6
Homepage: https://katacontainers.io
Debtransform-Tar: qemu-lite-@VERSION@+git.@QEMU_LITE_HASH@.tar.gz
Package: qemu-lite
Architecture: @deb_arch@
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends},
Description: QEMU is a generic and open source machine & userspace emulator and
virtualizer.

View File

@@ -0,0 +1,199 @@
%global qemu_lite_hash @QEMU_LITE_HASH@
Name: qemu-lite
Version: @VERSION@+git.%{qemu_lite_hash}
Release: @RELEASE@.<B_CNT>
Source0: %{name}-%{version}.tar.gz
Source1: qemu-lite-rpmlintrc
Source2: configure-hypervisor.sh
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
Summary : OpenBIOS development utilities
Group : Development/Tools
License : BSD-2-Clause BSD-3-Clause GPL-2.0 GPL-2.0+ LGPL-2.0+ LGPL-2.1
Requires: qemu-lite-bin
Requires: qemu-lite-data
BuildRequires : automake
BuildRequires : bison
BuildRequires : flex
BuildRequires : gcc-c++
BuildRequires : glib2-devel
BuildRequires : libattr-devel
BuildRequires : libcap-devel
BuildRequires : libcap-ng-devel
BuildRequires : libtool
BuildRequires : libtool-ltdl-devel
BuildRequires : libtool
BuildRequires : m4
BuildRequires : findutils
%if 0%{?rhel_version} || 0%{?centos_version}
BuildRequires : librbd1-devel
%else
BuildRequires : librbd-devel
%endif
%if 0%{?suse_version}
BuildRequires : libnuma-devel
%else
BuildRequires : numactl-devel
%endif
BuildRequires : python-devel
BuildRequires : zlib-devel
BuildRequires : pkgconfig(pixman-1)
# Patches
@RPM_PATCH_LIST@
%description
===========
QEMU is a generic and open source machine & userspace emulator and
virtualizer.
%package bin
Summary: bin components for the qemu-lite package.
Group: Binaries
Requires: qemu-lite-data
%description bin
bin components for the qemu-lite package.
%package data
Summary: data components for the qemu-lite package.
Group: Data
%description data
data components for the qemu-lite package.
%global debug_package %{nil}
%prep
chmod +x %{_sourcedir}/configure-hypervisor.sh
%setup -q
# Patches
@RPM_APPLY_PATCHES@
%build
export LANG=C
eval "%{_sourcedir}/configure-hypervisor.sh" "qemu-lite" | xargs ./configure --prefix=/usr
make V=1 %{?_smp_mflags}
%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
## make_install_append content
for file in %{buildroot}/usr/bin/*
do
dir=$(dirname "$file")
bin=$(basename "$file")
new=$(echo "$bin"|sed -e 's/qemu-/qemu-lite-/g' -e 's/ivshmem-/ivshmem-lite-/g' -e 's/virtfs-/virtfs-lite-/g')
mv "$file" "$dir/$new"
done
## make_install_append end
%files
%defattr(-,root,root,-)
%files bin
%defattr(-,root,root,-)
/usr/bin/qemu-lite-ga
/usr/bin/qemu-lite-pr-helper
/usr/bin/qemu-lite-system-x86_64
/usr/bin/virtfs-lite-proxy-helper
%dir /usr/libexec
%dir /usr/libexec/qemu-lite
/usr/libexec/qemu-lite/qemu-bridge-helper
%files data
%defattr(-,root,root,-)
%dir /usr/share/qemu-lite
%dir /usr/share/qemu-lite/qemu
%dir /usr/share/qemu-lite/qemu/keymaps
/usr/share/qemu-lite/qemu/QEMU,cgthree.bin
/usr/share/qemu-lite/qemu/QEMU,tcx.bin
/usr/share/qemu-lite/qemu/acpi-dsdt.aml
/usr/share/qemu-lite/qemu/bamboo.dtb
/usr/share/qemu-lite/qemu/bios-256k.bin
/usr/share/qemu-lite/qemu/bios.bin
/usr/share/qemu-lite/qemu/efi-e1000.rom
/usr/share/qemu-lite/qemu/efi-e1000e.rom
/usr/share/qemu-lite/qemu/efi-eepro100.rom
/usr/share/qemu-lite/qemu/efi-ne2k_pci.rom
/usr/share/qemu-lite/qemu/efi-pcnet.rom
/usr/share/qemu-lite/qemu/efi-rtl8139.rom
/usr/share/qemu-lite/qemu/efi-virtio.rom
/usr/share/qemu-lite/qemu/efi-vmxnet3.rom
/usr/share/qemu-lite/qemu/keymaps/ar
/usr/share/qemu-lite/qemu/keymaps/bepo
/usr/share/qemu-lite/qemu/keymaps/common
/usr/share/qemu-lite/qemu/keymaps/cz
/usr/share/qemu-lite/qemu/keymaps/da
/usr/share/qemu-lite/qemu/keymaps/de
/usr/share/qemu-lite/qemu/keymaps/de-ch
/usr/share/qemu-lite/qemu/keymaps/en-gb
/usr/share/qemu-lite/qemu/keymaps/en-us
/usr/share/qemu-lite/qemu/keymaps/es
/usr/share/qemu-lite/qemu/keymaps/et
/usr/share/qemu-lite/qemu/keymaps/fi
/usr/share/qemu-lite/qemu/keymaps/fo
/usr/share/qemu-lite/qemu/keymaps/fr
/usr/share/qemu-lite/qemu/keymaps/fr-be
/usr/share/qemu-lite/qemu/keymaps/fr-ca
/usr/share/qemu-lite/qemu/keymaps/fr-ch
/usr/share/qemu-lite/qemu/keymaps/hr
/usr/share/qemu-lite/qemu/keymaps/hu
/usr/share/qemu-lite/qemu/keymaps/is
/usr/share/qemu-lite/qemu/keymaps/it
/usr/share/qemu-lite/qemu/keymaps/ja
/usr/share/qemu-lite/qemu/keymaps/lt
/usr/share/qemu-lite/qemu/keymaps/lv
/usr/share/qemu-lite/qemu/keymaps/mk
/usr/share/qemu-lite/qemu/keymaps/modifiers
/usr/share/qemu-lite/qemu/keymaps/nl
/usr/share/qemu-lite/qemu/keymaps/nl-be
/usr/share/qemu-lite/qemu/keymaps/no
/usr/share/qemu-lite/qemu/keymaps/pl
/usr/share/qemu-lite/qemu/keymaps/pt
/usr/share/qemu-lite/qemu/keymaps/pt-br
/usr/share/qemu-lite/qemu/keymaps/ru
/usr/share/qemu-lite/qemu/keymaps/sl
/usr/share/qemu-lite/qemu/keymaps/sv
/usr/share/qemu-lite/qemu/keymaps/th
/usr/share/qemu-lite/qemu/keymaps/tr
/usr/share/qemu-lite/qemu/kvmvapic.bin
/usr/share/qemu-lite/qemu/linuxboot.bin
/usr/share/qemu-lite/qemu/linuxboot_dma.bin
/usr/share/qemu-lite/qemu/multiboot.bin
/usr/share/qemu-lite/qemu/openbios-ppc
/usr/share/qemu-lite/qemu/openbios-sparc32
/usr/share/qemu-lite/qemu/openbios-sparc64
/usr/share/qemu-lite/qemu/palcode-clipper
/usr/share/qemu-lite/qemu/petalogix-ml605.dtb
/usr/share/qemu-lite/qemu/petalogix-s3adsp1800.dtb
/usr/share/qemu-lite/qemu/ppc_rom.bin
/usr/share/qemu-lite/qemu/pxe-e1000.rom
/usr/share/qemu-lite/qemu/pxe-eepro100.rom
/usr/share/qemu-lite/qemu/pxe-ne2k_pci.rom
/usr/share/qemu-lite/qemu/pxe-pcnet.rom
/usr/share/qemu-lite/qemu/pxe-rtl8139.rom
/usr/share/qemu-lite/qemu/pxe-virtio.rom
/usr/share/qemu-lite/qemu/qemu-icon.bmp
/usr/share/qemu-lite/qemu/qemu_logo_no_text.svg
/usr/share/qemu-lite/qemu/s390-ccw.img
/usr/share/qemu-lite/qemu/sgabios.bin
/usr/share/qemu-lite/qemu/slof.bin
/usr/share/qemu-lite/qemu/spapr-rtas.bin
/usr/share/qemu-lite/qemu/trace-events-all
/usr/share/qemu-lite/qemu/u-boot.e500
/usr/share/qemu-lite/qemu/vgabios-cirrus.bin
/usr/share/qemu-lite/qemu/vgabios-qxl.bin
/usr/share/qemu-lite/qemu/vgabios-stdvga.bin
/usr/share/qemu-lite/qemu/vgabios-virtio.bin
/usr/share/qemu-lite/qemu/vgabios-vmware.bin
/usr/share/qemu-lite/qemu/vgabios.bin
/usr/share/qemu-lite/qemu/qemu_vga.ndrv
/usr/share/qemu-lite/qemu/s390-netboot.img
/usr/share/qemu-lite/qemu/skiboot.lid

44
qemu-lite/update.sh Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/bash
#
# Copyright (c) 2018 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# Automation script to create specs to build kata containers kernel
set -e
source ../versions.txt
source ../scripts/pkglib.sh
SCRIPT_NAME=$0
SCRIPT_DIR=$(dirname $0)
PKG_NAME="qemu-lite"
VERSION=$qemu_lite_version
GENERATED_FILES=(qemu-lite.dsc qemu-lite.spec debian.rules _service debian.control)
STATIC_FILES=(debian.compat ../scripts/configure-hypervisor.sh qemu-lite-rpmlintrc)
# Parse arguments
cli "$@"
[ "$VERBOSE" == "true" ] && set -x
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/qemu-lite}
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
((RELEASE++))
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
replace_list=(
"VERSION=$VERSION"
"RELEASE=$RELEASE"
"QEMU_LITE_HASH=${qemu_lite_hash:0:10}"
)
verify
echo "Verify succeed."
get_git_info
changelog_update $VERSION
generate_files "$SCRIPT_DIR" "${replace_list[@]}"
build_pkg "${PROJECT_REPO}"

View File

@@ -0,0 +1,16 @@
<!--- XML Structure defined here: https://en.opensuse.org/openSUSE:Build_Service_Concept_SourceService -->
<services>
<service name="tar_scm">
<param name="scm">git</param>
<param name="url">https://github.com/kata-containers/qemu.git</param>
<param name="exclude">.git</param>
<param name="filename">qemu-vanilla</param>
<!--- %h in the version format is a hash from a given revision -->
<param name="versionformat">@VERSION@+git.%h</param>
<param name="revision">stable-@VERSION@</param>
</service>
<service name="recompress">
<param name="file">*.tar*</param>
<param name="compression">gz</param>
</service>
</services>

View File

@@ -0,0 +1 @@
9

View File

@@ -0,0 +1,14 @@
Source: qemu-vanilla
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Build-Depends: debhelper (>= 9), cpio, libelf-dev, rsync, libdw-dev, pkg-config, flex, bison, libaudit-dev, bc, python-dev, gawk, autoconf, automake, libtool, libltdl-dev, libglib2.0-dev, libglib2.0-0, libcap-dev, libcap-ng-dev, libattr1-dev, m4, libnuma-dev, zlib1g-dev, libpixman-1-0, libpixman-1-dev
Standards-Version: 3.9.6
Homepage: https://katacontainers.io
Package: qemu-vanilla
Architecture: @deb_arch@
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends},
Description: linux kernel optimised for container-like workloads.
Linux kernel optimised for container-like workloads

View File

@@ -0,0 +1,27 @@
#!/usr/bin/make -f
include /usr/share/dpkg/default.mk
export LANG=C
%:
dh $@
override_dh_auto_configure:
chmod a+x "../SOURCES/configure-hypervisor.sh"
eval "../SOURCES/configure-hypervisor.sh" "qemu-vanilla" | xargs ./configure --prefix=/usr
override_dh_auto_build:
make
override_dh_auto_install:
dh_auto_install
for file in $(CURDIR)/debian/qemu-vanilla/usr/bin/* ; do \
dir=$$(dirname $$file) ;\
bin=$$(basename $$file) ;\
new=$$(echo $$bin | sed -e 's/qemu-/qemu-vanilla-/g' -e 's/ivshmem-/ivshmem-vanilla-/g' -e 's/virtfs-/virtfs-vanilla-/g') ;\
mv $$file "$$dir"/"$$new" ; \
done
override_dh_auto_test:
echo "Skip auto test"
override_dh_auto_clean:
echo "Skip auto clean"

View File

@@ -0,0 +1 @@
configure.patch

View File

@@ -0,0 +1 @@
setBadness('arch-dependent-file-in-usr-share', 0)

View File

@@ -0,0 +1,16 @@
Format: 3.0 (quilt)
Source: qemu-vanilla
Version: @VERSION@+git.@QEMU_VANILLA_HASH@-@RELEASE@
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Build-Depends: debhelper (>= 9), cpio, libelf-dev, rsync, libdw-dev, pkg-config, flex, bison, libaudit-dev, bc, python-dev, gawk, autoconf, automake, libtool, libltdl-dev, libglib2.0-dev, libglib2.0-0, libcap-dev, libcap-ng-dev, libattr1-dev, m4, libnuma-dev, zlib1g-dev, libpixman-1-0, libpixman-1-dev, librbd-dev
Standards-Version: 3.9.6
Homepage: https://katacontainers.io
Debtransform-Tar: qemu-vanilla-@VERSION@+git.@QEMU_VANILLA_HASH@.tar.gz
Package: qemu-vanilla
Architecture: @deb_arch@
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends},
Description: QEMU is a generic and open source machine & userspace emulator and
virtualizer.

View File

@@ -0,0 +1,200 @@
%global qemu_vanilla_hash @QEMU_VANILLA_HASH@
Name: qemu-vanilla
Version: @VERSION@+git.%{qemu_vanilla_hash}
Release: @RELEASE@.<B_CNT>
Source0: %{name}-%{version}.tar.gz
Source1: qemu-vanilla-rpmlintrc
Source2: configure-hypervisor.sh
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
Summary : OpenBIOS development utilities
Group : Development/Tools
License : BSD-2-Clause BSD-3-Clause GPL-2.0 GPL-2.0+ LGPL-2.0+ LGPL-2.1
Requires: qemu-vanilla-bin
Requires: qemu-vanilla-data
BuildRequires : automake
BuildRequires : bison
BuildRequires : flex
BuildRequires : gcc-c++
BuildRequires : glib2-devel
BuildRequires : libattr-devel
BuildRequires : libcap-devel
BuildRequires : libcap-ng-devel
BuildRequires : libtool
BuildRequires : libtool-ltdl-devel
BuildRequires : libtool
BuildRequires : m4
BuildRequires : findutils
%if 0%{?rhel_version} || 0%{?centos_version}
BuildRequires : librbd1-devel
%else
BuildRequires : librbd-devel
%endif
%if 0%{?suse_version}
BuildRequires : libnuma-devel
%else
BuildRequires : numactl-devel
%endif
BuildRequires : python-devel
BuildRequires : zlib-devel
BuildRequires : pkgconfig(pixman-1)
# Patches
@RPM_PATCH_LIST@
%description
===========
QEMU is a generic and open source machine & userspace emulator and
virtualizer.
%package bin
Summary: bin components for the qemu-vanilla package.
Group: Binaries
Requires: qemu-vanilla-data
%description bin
bin components for the qemu-vanilla package.
%package data
Summary: data components for the qemu-vanilla package.
Group: Data
%description data
data components for the qemu-vanilla package.
%global debug_package %{nil}
%prep
chmod +x %{_sourcedir}/configure-hypervisor.sh
%setup -q
# Patches
@RPM_APPLY_PATCHES@
%build
export LANG=C
eval "%{_sourcedir}/configure-hypervisor.sh" "qemu-vanilla" | xargs ./configure --prefix=/usr
make V=1 %{?_smp_mflags}
%install
rm -rf %{buildroot}
#%make_install
make install DESTDIR=%{buildroot}
## make_install_append content
for file in %{buildroot}/usr/bin/*
do
dir=$(dirname "$file")
bin=$(basename "$file")
new=$(echo "$bin"|sed -e 's/qemu-/qemu-vanilla-/g' -e 's/ivshmem-/ivshmem-vanilla-/g' -e 's/virtfs-/virtfs-vanilla-/g')
mv "$file" "$dir/$new"
done
## make_install_append end
%files
%defattr(-,root,root,-)
%files bin
%defattr(-,root,root,-)
/usr/bin/qemu-vanilla-ga
/usr/bin/qemu-vanilla-pr-helper
/usr/bin/qemu-vanilla-system-x86_64
/usr/bin/virtfs-vanilla-proxy-helper
%dir /usr/libexec
%dir /usr/libexec/qemu-vanilla
/usr/libexec/qemu-vanilla/qemu-bridge-helper
%files data
%defattr(-,root,root,-)
%dir /usr/share/qemu-vanilla
%dir /usr/share/qemu-vanilla/qemu
%dir /usr/share/qemu-vanilla/qemu/keymaps
/usr/share/qemu-vanilla/qemu/QEMU,cgthree.bin
/usr/share/qemu-vanilla/qemu/QEMU,tcx.bin
/usr/share/qemu-vanilla/qemu/acpi-dsdt.aml
/usr/share/qemu-vanilla/qemu/bamboo.dtb
/usr/share/qemu-vanilla/qemu/bios-256k.bin
/usr/share/qemu-vanilla/qemu/bios.bin
/usr/share/qemu-vanilla/qemu/efi-e1000.rom
/usr/share/qemu-vanilla/qemu/efi-e1000e.rom
/usr/share/qemu-vanilla/qemu/efi-eepro100.rom
/usr/share/qemu-vanilla/qemu/efi-ne2k_pci.rom
/usr/share/qemu-vanilla/qemu/efi-pcnet.rom
/usr/share/qemu-vanilla/qemu/efi-rtl8139.rom
/usr/share/qemu-vanilla/qemu/efi-virtio.rom
/usr/share/qemu-vanilla/qemu/efi-vmxnet3.rom
/usr/share/qemu-vanilla/qemu/keymaps/ar
/usr/share/qemu-vanilla/qemu/keymaps/bepo
/usr/share/qemu-vanilla/qemu/keymaps/common
/usr/share/qemu-vanilla/qemu/keymaps/cz
/usr/share/qemu-vanilla/qemu/keymaps/da
/usr/share/qemu-vanilla/qemu/keymaps/de
/usr/share/qemu-vanilla/qemu/keymaps/de-ch
/usr/share/qemu-vanilla/qemu/keymaps/en-gb
/usr/share/qemu-vanilla/qemu/keymaps/en-us
/usr/share/qemu-vanilla/qemu/keymaps/es
/usr/share/qemu-vanilla/qemu/keymaps/et
/usr/share/qemu-vanilla/qemu/keymaps/fi
/usr/share/qemu-vanilla/qemu/keymaps/fo
/usr/share/qemu-vanilla/qemu/keymaps/fr
/usr/share/qemu-vanilla/qemu/keymaps/fr-be
/usr/share/qemu-vanilla/qemu/keymaps/fr-ca
/usr/share/qemu-vanilla/qemu/keymaps/fr-ch
/usr/share/qemu-vanilla/qemu/keymaps/hr
/usr/share/qemu-vanilla/qemu/keymaps/hu
/usr/share/qemu-vanilla/qemu/keymaps/is
/usr/share/qemu-vanilla/qemu/keymaps/it
/usr/share/qemu-vanilla/qemu/keymaps/ja
/usr/share/qemu-vanilla/qemu/keymaps/lt
/usr/share/qemu-vanilla/qemu/keymaps/lv
/usr/share/qemu-vanilla/qemu/keymaps/mk
/usr/share/qemu-vanilla/qemu/keymaps/modifiers
/usr/share/qemu-vanilla/qemu/keymaps/nl
/usr/share/qemu-vanilla/qemu/keymaps/nl-be
/usr/share/qemu-vanilla/qemu/keymaps/no
/usr/share/qemu-vanilla/qemu/keymaps/pl
/usr/share/qemu-vanilla/qemu/keymaps/pt
/usr/share/qemu-vanilla/qemu/keymaps/pt-br
/usr/share/qemu-vanilla/qemu/keymaps/ru
/usr/share/qemu-vanilla/qemu/keymaps/sl
/usr/share/qemu-vanilla/qemu/keymaps/sv
/usr/share/qemu-vanilla/qemu/keymaps/th
/usr/share/qemu-vanilla/qemu/keymaps/tr
/usr/share/qemu-vanilla/qemu/kvmvapic.bin
/usr/share/qemu-vanilla/qemu/linuxboot.bin
/usr/share/qemu-vanilla/qemu/linuxboot_dma.bin
/usr/share/qemu-vanilla/qemu/multiboot.bin
/usr/share/qemu-vanilla/qemu/openbios-ppc
/usr/share/qemu-vanilla/qemu/openbios-sparc32
/usr/share/qemu-vanilla/qemu/openbios-sparc64
/usr/share/qemu-vanilla/qemu/palcode-clipper
/usr/share/qemu-vanilla/qemu/petalogix-ml605.dtb
/usr/share/qemu-vanilla/qemu/petalogix-s3adsp1800.dtb
/usr/share/qemu-vanilla/qemu/ppc_rom.bin
/usr/share/qemu-vanilla/qemu/pxe-e1000.rom
/usr/share/qemu-vanilla/qemu/pxe-eepro100.rom
/usr/share/qemu-vanilla/qemu/pxe-ne2k_pci.rom
/usr/share/qemu-vanilla/qemu/pxe-pcnet.rom
/usr/share/qemu-vanilla/qemu/pxe-rtl8139.rom
/usr/share/qemu-vanilla/qemu/pxe-virtio.rom
/usr/share/qemu-vanilla/qemu/qemu-icon.bmp
/usr/share/qemu-vanilla/qemu/qemu_logo_no_text.svg
/usr/share/qemu-vanilla/qemu/s390-ccw.img
/usr/share/qemu-vanilla/qemu/sgabios.bin
/usr/share/qemu-vanilla/qemu/slof.bin
/usr/share/qemu-vanilla/qemu/spapr-rtas.bin
/usr/share/qemu-vanilla/qemu/trace-events-all
/usr/share/qemu-vanilla/qemu/u-boot.e500
/usr/share/qemu-vanilla/qemu/vgabios-cirrus.bin
/usr/share/qemu-vanilla/qemu/vgabios-qxl.bin
/usr/share/qemu-vanilla/qemu/vgabios-stdvga.bin
/usr/share/qemu-vanilla/qemu/vgabios-virtio.bin
/usr/share/qemu-vanilla/qemu/vgabios-vmware.bin
/usr/share/qemu-vanilla/qemu/vgabios.bin
/usr/share/qemu-vanilla/qemu/qemu_vga.ndrv
/usr/share/qemu-vanilla/qemu/s390-netboot.img
/usr/share/qemu-vanilla/qemu/skiboot.lid

45
qemu-vanilla/update.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/bash
#
# Copyright (c) 2018 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# Automation script to create specs to build kata containers kernel
set -e
source ../versions.txt
source ../scripts/pkglib.sh
SCRIPT_NAME=$0
SCRIPT_DIR=$(dirname $0)
PKG_NAME="qemu-vanilla"
VERSION=$qemu_vanilla_version
GENERATED_FILES=(qemu-vanilla.dsc qemu-vanilla.spec debian.rules _service debian.control )
STATIC_FILES=(debian.compat ../scripts/configure-hypervisor.sh qemu-vanilla-rpmlintrc)
# Parse arguments
cli "$@"
[ "$VERBOSE" == "true" ] && set -x
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/qemu-vanilla}
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
((RELEASE++))
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
replace_list=(
"VERSION=$VERSION"
"RELEASE=$RELEASE"
"QEMU_VANILLA_HASH=${qemu_vanilla_hash:0:10}"
)
verify
echo "Verify succeed."
get_git_info
changelog_update $VERSION
generate_files "$SCRIPT_DIR" "${replace_list[@]}"
build_pkg "${PROJECT_REPO}"

26
runtime/_service-template Normal file
View File

@@ -0,0 +1,26 @@
<!--- XML Structure defined here: https://en.opensuse.org/openSUSE:Build_Service_Concept_SourceService -->
<services>
<!--- OBS plugin tar_scm (Source control manager) -->
<service name="tar_scm">
<param name="scm">git</param>
<param name="url">https://github.com/kata-containers/runtime.git</param>
<param name="filename">kata-runtime</param>
<!--- versionformat defines the name of the tarball. -->
<param name="versionformat">@VERSION@+git.%h</param>
<param name="revision">@REVISION@</param>
</service>
<service name="recompress">
<param name="file">*.tar*</param>
<param name="compression">gz</param>
</service>
<service name="download_url">
<param name="protocol">https</param>
<param name="host">storage.googleapis.com</param>
<param name="path">golang/go@GO_VERSION@.linux-@GO_ARCH@.tar.gz</param>
</service>
<service name="verify_file">
<param name="file">_service:download_url:go@GO_VERSION@.linux-@GO_ARCH@.tar.gz</param>
<param name="verifier">sha256</param>
<param name="checksum">@GO_CHECKSUM@</param>
</service>
</services>

1
runtime/debian.compat Normal file
View File

@@ -0,0 +1 @@
9

View File

@@ -0,0 +1,16 @@
Source: kata-runtime
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Standards-Version: 3.9.6
Homepage: https://katacontainers.io
Build-Depends: dh-make, git, ca-certificates, execstack, devscripts, debhelper, build-essential, dh-autoreconf, make, dh-modaliases
Package: kata-runtime
Architecture: @deb_arch@
Depends: kata-containers-image (>= @kata_osbuilder_version@), kata-linux-container (>= @linux_container_version@),
kata-proxy (>= @kata_proxy_version@), kata-shim (>= @kata_shim_version@),
kata-ksm-throttler(>= @ksm_throttler_version@), qemu-lite(>= @qemu_lite_version@),
qemu-vanilla(>= @qemu_vanilla_version@)
Description:
An Open Containers Initiative (OCI) "runtime" that launches an Intel VT-x secured Kata Containers hypervisor, rather than a standard Linux container.

View File

@@ -0,0 +1,43 @@
#!/usr/bin/make -f
export DH_VERBOSE = 1
export PKG_NAME=kata-runtime
export DOMAIN=github.com
export ORG=kata-containers
export PROJECT=runtime
export IMPORTNAME=$(DOMAIN)/$(ORG)/$(PROJECT)
export DH_GOPKG:=$(IMPORTNAME)
export DEB_BUILD_OPTIONS=nocheck
export PATH:=/usr/src/packages/BUILD/local/go/bin:$(PATH)
export GOPATH=/usr/src/packages/BUILD/go
export GOROOT=/usr/src/packages/BUILD/local/go
export DH_OPTIONS
export DEFAULT_QEMU=qemu-lite-system-x86_64
GO_VERSION=@GO_VERSION@
%:
dh $@
override_dh_auto_clean:
override_dh_auto_build:
mkdir -p /usr/src/packages/BUILD/local/
mkdir -p /usr/src/packages/BUILD/go/src/$(DOMAIN)/$(ORG)/
tar xzf /usr/src/packages/SOURCES/go$(GO_VERSION).linux-@GO_ARCH@.tar.gz -C /usr/src/packages/BUILD/local
ln -s /usr/src/packages/BUILD /usr/src/packages/BUILD/go/src/$(IMPORTNAME)
cd $(GOPATH)/src/$(IMPORTNAME)/; \
make QEMUPATH=/usr/bin/$(DEFAULT_QEMU)
override_dh_auto_install:
mkdir -p debian/$(PKG_NAME)
cd $(GOPATH)/src/$(IMPORTNAME)/; \
make install \
SCRIPTS_DIR=$(shell pwd)/debian/usr/bin \
DESTTARGET=$(shell pwd)/debian/$(PKG_NAME)/usr/bin/kata-runtime \
QEMUPATH=/usr/bin/$(DEFAULT_QEMU) \
DESTCONFIG=$(shell pwd)/debian/$(PKG_NAME)/usr/share/defaults/kata-containers/configuration.toml
sed -i -e '/^initrd =/d' $(shell pwd)/debian/$(PKG_NAME)/usr/share/defaults/kata-containers/configuration.toml

View File

@@ -0,0 +1,21 @@
Format: 3.0 (quilt)
Source: kata-runtime
# Version is expected to be started with a digit following by an alphanumeric string
# e.g. 1.0.0+git.1234567-1
Version: @VERSION@+git.@HASH@-@RELEASE@
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Standards-Version: 3.9.6
Build-Depends: dh-make, git, ca-certificates, execstack, devscripts, debhelper, build-essential, dh-autoreconf, make, dh-modaliases
Homepage: https://katacontainers.io
Debtransform-Tar: kata-runtime-@VERSION@+git.@HASH@.tar.gz
Package: kata-runtime
Architecture: @deb_arch@
Depends: kata-containers-image (>= @kata_osbuilder_version@), kata-linux-container (>= @linux_container_version@),
kata-proxy (>= @kata_proxy_version@), kata-shim (>= @kata_shim_version@),
kata-ksm-throttler(>= @ksm_throttler_version@), qemu-lite(>= @qemu_lite_version@),
qemu-vanilla(>= @qemu_vanilla_version@)
Description:
An Open Containers Initiative (OCI) "runtime" that launches an Intel VT-x secured Kata Containers hypervisor, rather than a standard Linux container.

View File

@@ -0,0 +1,102 @@
%global PREFIX /usr/
%global BINDIR %{PREFIX}/bin
%global DOMAIN github.com
%global ORG kata-containers
%global PROJECT runtime
%global IMPORTNAME %{DOMAIN}/%{ORG}/%{PROJECT}
%global GO_VERSION @GO_VERSION@
%global DEFAULT_QEMU qemu-lite-system-x86_64
%if 0%{?suse_version}
%define LIBEXECDIR %{_libdir}
%else
%define LIBEXECDIR %{_libexecdir}
%endif
%undefine _missing_build_ids_terminate_build
%define debug_package %{nil}
Name: kata-runtime
# Version is expected to be started with a digit following by an alphanumeric string
# e.g. 1.0.0+git.1234567
Version: @VERSION@+git.@HASH@
Release: @RELEASE@.<B_CNT>
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Summary : No detailed summary available
Group : Development/Tools
License : Apache-2.0
BuildRequires: git
%if 0%{?suse_version} && 0%{?is_opensuse}
BuildRequires: openSUSE-release
%endif
%{!?el7 || !?suse_version:Requires: qemu-lite >= @qemu_lite_obs_fedora_version@ }
Requires: kata-containers-image >= @kata_osbuilder_version@
Requires: kata-linux-container >= @linux_container_version@
Requires: kata-proxy >= @kata_proxy_version@
Requires: kata-shim >= @kata_shim_version@
Requires: kata-ksm-throttler >= @ksm_throttler_version@
Requires: qemu-lite >= @qemu_lite_version@
Requires: qemu-vanilla >= @qemu_vanilla_version@
# Patches
@RPM_PATCH_LIST@
%description
.. contents::
.. sectnum::
``kata-runtime``
===================
Overview
--------
%prep
mkdir local
tar -C local -xzf ../SOURCES/go%{GO_VERSION}.linux-@GO_ARCH@.tar.gz
# Patches
@RPM_APPLY_PATCHES@
%setup -q
%autosetup -S git
%build
export GOROOT=$HOME/rpmbuild/BUILD/local/go
export PATH=$PATH:$HOME/rpmbuild/BUILD/local/go/bin
export GOPATH=$HOME/rpmbuild/BUILD/go/
mkdir -p $HOME/rpmbuild/BUILD/go/src/%{DOMAIN}/%{ORG}
ln -s $HOME/rpmbuild/BUILD/kata-runtime-%{version} $HOME/rpmbuild/BUILD/go/src/%{IMPORTNAME}
cd $HOME/rpmbuild/BUILD/go/src/%{IMPORTNAME}
make QEMUPATH=/usr/bin/%{DEFAULT_QEMU}
%check
export http_proxy=http://127.0.0.1:9/
export https_proxy=http://127.0.0.1:9/
export no_proxy=localhost
%install
export GOROOT=$HOME/rpmbuild/BUILD/local/go
export PATH=$PATH:$HOME/rpmbuild/BUILD/local/go/bin
export GOPATH=$HOME/rpmbuild/BUILD/go/
cd $HOME/rpmbuild/BUILD/go/src/%{IMPORTNAME}
make \
DESTTARGET=%{buildroot}/usr/bin/kata-runtime \
DESTCONFIG=%{buildroot}/usr/share/defaults/kata-containers/configuration.toml \
SCRIPTS_DIR=%{buildroot}/usr/bin \
QEMUPATH=/usr/bin/%{DEFAULT_QEMU} \
install
sed -i -e '/^initrd =/d' %{buildroot}/usr/share/defaults/kata-containers/configuration.toml
%files
%defattr(-,root,root,-)
/usr/bin/kata-runtime
/usr/bin/kata-collect-data.sh
/usr/share/defaults/
/usr/share/defaults/kata-containers/
/usr/share/defaults/kata-containers/configuration.toml

104
runtime/update.sh Executable file
View File

@@ -0,0 +1,104 @@
#!/bin/bash
#
# Copyright (c) 2018 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Automation script to create specs to build kata-runtime
# Default: Build is the one specified in file configure.ac
# located at the root of the repository.
set -e
source ../versions.txt
source ../scripts/pkglib.sh
SCRIPT_NAME=$0
SCRIPT_DIR=$(dirname "$0")
# Package information
# Used by pkglib.sh
export PKG_NAME="kata-runtime"
VERSION=$kata_runtime_version
# Used by pkglib
export GENERATED_FILES=(kata-runtime.spec kata-runtime.dsc debian.control debian.rules _service)
# Used by pkglib
export STATIC_FILES=(debian.compat)
#cli flags
LOCAL_BUILD=false
OBS_PUSH=false
VERBOSE=false
# Parse arguments
cli "$@"
[ "$VERBOSE" == "true" ] && set -x
# Package depedencies
info "requires:"
PROXY_RELEASE=$(get_obs_pkg_release "home:${OBS_PROJECT}:${OBS_SUBPROJECT}/proxy")
PROXY_REQUIRED_VERESION=$(pkg_version "${kata_proxy_version}" "${PROXY_RELEASE}" "${kata_proxy_hash}")
info "proxy ${PROXY_REQUIRED_VERESION}"
SHIM_RELEASE=$(get_obs_pkg_release "home:${OBS_PROJECT}:${OBS_SUBPROJECT}/shim")
SHIM_REQUIRED_VERSION=$(pkg_version "${kata_shim_version}" "${SHIM_RELEASE}" "${kata_shim_hash}")
info "shim ${SHIM_REQUIRED_VERSION}"
KERNEL_RELEASE=$(get_obs_pkg_release "home:${OBS_PROJECT}:${OBS_SUBPROJECT}/linux-container")
KERNEL_REQUIRED_VERSION=$(pkg_version "${kernel_version}" "${KERNEL_RELEASE}")
info "kata-linux-container ${KERNEL_REQUIRED_VERSION}"
KSM_THROTTLER_RELEASE=$(get_obs_pkg_release "home:${OBS_PROJECT}:${OBS_SUBPROJECT}/ksm-throttler")
KSM_THROTTLER_REQUIRED_VERSION=$(pkg_version "${ksm_throttler_version}" "${KSM_THROTTLER_RELEASE}" "${ksm_throttler_hash}")
info "ksm-throttler ${KSM_THROTTLER_REQUIRED_VERSION}"
KATA_CONTAINERS_IMAGE_RELEASE=$(get_obs_pkg_release "home:${OBS_PROJECT}:${OBS_SUBPROJECT}/kata-containers-image")
KATA_IMAGE_REQUIRED_VERSION=$(pkg_version "${kata_osbuilder_version}" "${KATA_CONTAINERS_IMAGE_RELEASE}")
info "image ${KATA_IMAGE_REQUIRED_VERSION}"
KATA_CONTAINERS_QEMU_LITE_RELEASE=$(get_obs_pkg_release "home:${OBS_PROJECT}:${OBS_SUBPROJECT}/qemu-lite")
KATA_QEMU_LITE_REQUIRED_VERSION=$(pkg_version "${qemu_lite_version}" "${KATA_CONTAINERS_QEMU_LITE_RELEASE}")
info "image ${KATA_QEMU_LITE_REQUIRED_VERSION}"
KATA_CONTAINERS_QEMU_VANILLA_RELEASE=$(get_obs_pkg_release "home:${OBS_PROJECT}:${OBS_SUBPROJECT}/qemu-vanilla")
KATA_QEMU_VANILLA_REQUIRED_VERSION=$(pkg_version "${qemu_vanilla_version}" "${KATA_CONTAINERS_QEMU_VANILLA_RELEASE}")
info "image ${KATA_QEMU_VANILLA_REQUIRED_VERSION}"
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/runtime}
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
((RELEASE++))
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
set_versions "$kata_runtime_hash"
replace_list=(
"GO_CHECKSUM=$go_checksum"
"GO_VERSION=$go_version"
"GO_ARCH=$GO_ARCH"
"HASH=$short_hashtag"
"RELEASE=$RELEASE"
"REVISION=$VERSION"
"VERSION=$VERSION"
"kata_osbuilder_version=${KATA_IMAGE_REQUIRED_VERSION}"
"kata_proxy_version=${PROXY_REQUIRED_VERESION}"
"kata_shim_version=${SHIM_REQUIRED_VERSION}"
"ksm_throttler_version=${KSM_THROTTLER_REQUIRED_VERSION}"
"linux_container_version=${KERNEL_REQUIRED_VERSION}"
"qemu_lite_version=${KATA_QEMU_LITE_REQUIRED_VERSION}"
"qemu_vanilla_version=${KATA_QEMU_VANILLA_REQUIRED_VERSION}"
)
verify
echo "Verify succeed."
get_git_info
changelog_update $VERSION
generate_files "$SCRIPT_DIR" "${replace_list[@]}"
build_pkg "${PROJECT_REPO}"

17
scripts/README.md Normal file
View File

@@ -0,0 +1,17 @@
# Packaging scripts
This directory contains useful packaging scripts.
## `configure-hypervisor.sh`
This script generates the official set of QEMU-based hypervisor build
configuration options. All repositories that need to build a hypervisor
from source **MUST** use this script to ensure the hypervisor is built
in a known way since using a different set of options can impact many
areas including performance, memory footprint and security.
Example usage:
```
$ configure-hypervisor.sh qemu-lite
```

View File

@@ -133,8 +133,9 @@ check_tags()
# options being displayed on a single line.
show_array()
{
local -n _array="$1"
local action="$2"
local action="$1"
local _array=("$@")
_array=("${_array[@]:1}")
local -i size="${#_array[*]}"
local -i i=1
@@ -411,7 +412,7 @@ main()
# Where to install data files
qemu_options+=(misc:--datadir=/usr/share/${hypervisor})
show_array qemu_options "$action"
show_array "$action" "${qemu_options[@]}"
exit 0
}

352
scripts/pkglib.sh Normal file
View File

@@ -0,0 +1,352 @@
#!/bin/bash
# This is a helper library for the setup scripts of each package
# in this repository.
source ../versions.txt
PACKAGING_DIR=/var/packaging
LOG_DIR=${PACKAGING_DIR}/build_logs
# OBS Project info
OBS_PROJECT="${OBS_PROJECT:-katacontainers}"
OBS_SUBPROJECT="${OBS_SUBPROJECT:-release}"
# BUILD OPTIONS
BUILD_DISTROS=${BUILD_DISTROS:-Fedora_27 xUbuntu_16.04 CentOS_7}
BUILD_ARCH=${BUILD_ARCH:-}x86_64
COMMIT=false
BRANCH=false
LOCAL_BUILD=false
OBS_PUSH=false
VERBOSE=false
# Used for debian.control files
# Architecture: The architecture specifies which type of hardware this
# package was compiled for.
DEB_ARCH="${DEB_ARCH:-amd64}"
if command -v go; then
export GO_ARCH=$(go env GOARCH)
else
export GO_ARCH=amd64
echo "Go not installed using $GO_ARCH to install go in dockerfile"
fi
function display_help()
{
cat <<-EOL
$SCRIPT_NAME
This script is intended to create Kata Containers 3.X packages for the OBS
(Open Build Service) platform.
Usage:
$SCRIPT_NAME [options]
Options:
-l --local-build Build the runtime locally
-c --commit-id Build with a given commit ID
-b --branch Build with a given branch name
-p --push Push changes to OBS
-a --api-url Especify an OBS API (e.g. custom private OBS)
-r --obs-repository An OBS repository to push the changes.
-w --workdir Directory of a working copy of the OBS runtime repo
-v --verbose Set the -x flag for verbosity
-C --clean Clean the repository
-V --verify Verify the environment
-h --help Display this help message
Usage examples:
$SCRIPT_NAME --local-build --branch staging
$SCRIPT_NAME --commit-id a76f45c --push --api-url http://127.0.0.1
$SCRIPT_NAME --commit-id a76f45c --push --obs-repository home:userx/repository
$SCRIPT_NAME --commit-id a76f45c --push
EOL
exit 1
}
die()
{
msg="$*"
echo >&2 "ERROR: $msg"
exit 1
}
info()
{
msg="$*"
echo "INFO: $msg"
}
function verify()
{
# This function perform some checks in order to make sure
# the script will run flawlessly.
# Make sure this script is called from ./
[ "$SCRIPT_DIR" != "." ] && die "The script must be called from its base dir."
# Verify if osc is installed, exit otherwise.
[ ! -x "$(command -v osc)" ] && die "osc is not installed."
info "OK"
}
function clean()
{
# This function clean generated files
for file in "$@"
do
[ -e $file ] && rm -v $file
done
[ -e ./debian.changelog ] && git checkout ./debian.changelog
[ -e ./release ] && git checkout ./release
echo "Clean done."
}
function get_git_info()
{
AUTHOR=${AUTHOR:-$(git config user.name)}
AUTHOR_EMAIL=${AUTHOR_EMAIL:-$(git config user.email)}
}
function set_versions()
{
local commit_hash="$1"
if [ -n "$OBS_REVISION" ]
then
# Validate input is alphanumeric, commit ID
# If a commit ID is provided, override versions.txt one
if [ -n "$COMMIT" ] && [[ "$OBS_REVISION" =~ ^[a-zA-Z0-9][-a-zA-Z0-9]{0,40}[a-zA-Z0-9]$ ]]; then
hash_tag=$OBS_REVISION
elif [ -n "$BRANCH" ]
then
hash_tag=$commit_hash
fi
else
hash_tag=$commit_hash
fi
short_hashtag="${hash_tag:0:7}"
}
function changelog_update {
d=$(date -R)
cat <<< "$PKG_NAME ($VERSION) stable; urgency=medium
* Update $PKG_NAME $VERSION ${hash_tag:0:7}
-- $AUTHOR <$AUTHOR_EMAIL> $d
" > debian.changelog
# Append, so it can be copied to the OBS repository
GENERATED_FILES+=('debian.changelog')
}
function local_build()
{
[ ! -e $PACKAGING_DIR ] && mkdir $PACKAGING_DIR
[ ! -e $LOG_DIR ] && mkdir $LOG_DIR
pushd $OBS_WORKDIR
BUILD_ARGS=('--local-package' '--no-verify' '--noservice' '--trust-all-projects' '--keep-pkgs=/var/packaging/results')
[ "$OFFLINE" == "true" ] && BUILD_ARGS+=('--offline')
osc service run
for distro in ${BUILD_DISTROS[@]}
do
# If more distros are supported, add here the relevant validations.
if [[ "$distro" =~ ^Fedora.* ]] || [[ "$distro" =~ ^CentOS.* ]]
then
echo "Perform a local build for ${distro}"
osc build ${BUILD_ARGS[@]} \
${distro} $BUILD_ARCH *.spec | tee ${LOG_DIR}/${distro}_${PKG_NAME}_build.log
elif [[ "$distro" =~ ^xUbuntu.* ]]
then
echo "Perform a local build for ${distro}"
osc build ${BUILD_ARGS[@]} \
${distro} $BUILD_ARCH *.dsc | tee ${LOG_DIR}/${distro}_${PKG_NAME}_build.log
fi
done
}
function checkout_repo()
{
local REPO="$1"
if [ -z "$OBS_WORKDIR" ]
then
# If no workdir is provided, use a temporary directory.
temp=$(basename $0)
OBS_WORKDIR=$(mktemp -d -u -t ${temp}.XXXXXXXXXXX) || exit 1
osc $APIURL co $REPO -o $OBS_WORKDIR
fi
mv ${GENERATED_FILES[@]} $OBS_WORKDIR
cp ${STATIC_FILES[@]} $OBS_WORKDIR
}
function obs_push()
{
pushd $OBS_WORKDIR
osc $APIURL addremove
osc $APIURL commit -m "Update ${PKG_NAME} $VERSION: ${hash_tag:0:7}"
popd
}
function cli()
{
OPTS=$(getopt -o abclprwvCVh: --long api-url,branch,commit-id,local-build,push,obs-repository,workdir,verbose,clean,verify,help -- "$@")
while true; do
case "${1}" in
-a | --api-url ) APIURL="$2"; shift 2;;
-b | --branch ) BRANCH="true"; OBS_REVISION="$2"; shift 2;;
-c | --commit-id ) COMMIT="true"; OBS_REVISION="$2"; shift 2;;
-l | --local-build ) LOCAL_BUILD="true"; shift;;
-p | --push ) OBS_PUSH="true"; shift;;
-r | --obs-repository ) PROJECT_REPO="$2"; shift 2;;
-w | --workdir ) OBS_WORKDIR="$2"; shift 2;;
-v | --verbose ) VERBOSE="true"; shift;;
-o | --offline ) OFFLINE="true"; shift;;
-C | --clean ) clean ${GENERATED_FILES[@]}; exit $?;;
-V | --verify ) verify; exit $?;;
-h | --help ) display_help; exit $?;;
-- ) shift; break ;;
* ) break ;;
esac
done
}
function build_pkg()
{
obs_repository="${1}"
[ -z "${obs_repository}" ] && die "${FUNCNAME}: obs repository not provided"
checkout_repo "${obs_repository}"
if [ "$LOCAL_BUILD" == "true" ]; then
info "Local build"
local_build
fi
if [ "$OBS_PUSH" == "true" ]; then
info "Push build to OBS"
obs_push
fi
}
function generate_files () {
directory=$1
replace_list=$2
template_files=$(find $directory -type f -name "*-template")
replace_list+=("deb_arch=$DEB_ARCH")
#find_patches sets $RPM_PATCH_LIST and $RPM_PATCH_LIST
# It also creates debian.series file
find_patches
replace_list+=("RPM_PATCH_LIST=$RPM_PATCH_LIST")
replace_list+=("RPM_APPLY_PATCHES=$RPM_APPLY_PATCHES")
# check replace list
# key=val
for replace in "${replace_list[@]}" ; do
[[ "$replace" = *"="* ]] || die "invalid replace $replace"
local key="${replace%%=*}"
local value="${replace##*=}"
[ -n "$key" ] || die "${replace} key is empty"
[ -n "$value" ] || die "${replace} val is empty"
grep -q "@$key@" $template_files || die "@$key@ not found in any template file"
done
for f in ${template_files}; do
genfile="${f%-template}"
cp "$f" "${genfile}"
info "Generate file ${genfile}"
for replace in "${replace_list[@]}" ; do
[[ "$replace" = *"="* ]] || die "invalid replace $replace"
local key="${replace%%=*}"
local value="${replace##*=}"
export k="@${key}@"
export v="$value"
perl -p -e 's/$ENV{k}/$ENV{v}/g' "${genfile}" > "${genfile}.out"
mv "${genfile}.out" ${genfile}
done
done
}
function pkg_version() {
local project_version="$1"
# Used for
# Release: in spec file
# DebianRevisionNumber in dsc files
local pkg_release="$2"
local commit_id="$3"
[ -n "${project_version}" ] || die "${FUNCNAME}: need version"
[ -n "${pkg_release}" ] || die "${FUNCNAME}: pkg release is needed"
pkg_version="${project_version}"
if [ -n "$commit_id" ]; then
pkg_version+="+git.${commit_id:0:7}"
fi
echo "$pkg_version-${pkg_release}"
}
function get_obs_pkg_release() {
local obs_pkg_name="$1"
local pkg
local repo_dir
local release
pkg=$(basename "${obs_pkg_name}")
repo_dir=$(mktemp -d -u -t "${pkg}.XXXXXXXXXXX")
out=$(osc ${APIURL} -q co "${obs_pkg_name}" -o "${repo_dir}") || die "failed to checkout:$out"
spec_file=$(find "${repo_dir}" -maxdepth 1 -type f -name '*.spec' | head -1)
release=$(grep -oP 'Release:\s+[0-9]+' "${spec_file}" | grep -oP '[0-9]+')
if [ -z "${release}" ]; then
release=$(grep -oP '%define\s+release\s+[0-9]+' "${spec_file}" | grep -oP '[0-9]+')
fi
rm -r "${repo_dir}"
echo "${release}"
}
#find_patches find patches in 'patches' directory.
# sets $RPM_PATCH_LIST and $RPM_PATCH_LIST
# RPM_PATCH_LIST fomat:
# Patch<number>: patch.file
# RPM_APPLY_PATCHES fomat:
# %Patch<number> -p1
# It also creates debian.series file
function find_patches() {
export RPM_PATCH_LIST="#Patches"$'\n'
export RPM_APPLY_PATCHES="#Apply patches"$'\n'
[ ! -d patches ] && info "No patches found" && return
local patches
patches=$(find patches -type f -name '*.patch' -exec basename {} \;)
n="1"
rm -f debian.series
for p in ${patches} ; do
STATIC_FILES+=("patches/$p")
RPM_PATCH_LIST+="Patch00${n}: $p"$'\n'
RPM_APPLY_PATCHES+="%patch00${n} -p1"$'\n'
echo "$p" >> debian.series
((n++))
done
}

24
shim/_service-template Normal file
View File

@@ -0,0 +1,24 @@
<!--- XML Structure defined here: https://en.opensuse.org/openSUSE:Build_Service_Concept_SourceService -->
<services>
<service name="tar_scm">
<param name="scm">git</param>
<param name="url">https://github.com/kata-containers/shim.git</param>
<param name="filename">kata-shim</param>
<param name="versionformat">@VERSION@+git.%h</param>
<param name="revision">@REVISION@</param>
</service>
<service name="recompress">
<param name="file">*.tar*</param>
<param name="compression">gz</param>
</service>
<service name="download_url">
<param name="protocol">https</param>
<param name="host">storage.googleapis.com</param>
<param name="path">golang/go@GO_VERSION@.linux-@GO_ARCH@.tar.gz</param>
</service>
<service name="verify_file">
<param name="file">_service:download_url:go@GO_VERSION@.linux-@GO_ARCH@.tar.gz</param>
<param name="verifier">sha256</param>
<param name="checksum">@GO_CHECKSUM@</param>
</service>
</services>

1
shim/debian.compat Normal file
View File

@@ -0,0 +1 @@
9

View File

@@ -0,0 +1,14 @@
Source: kata-shim
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Standards-Version: 3.9.6
Homepage: https://katacontainers.io
Build-Depends: debhelper (>= 9), git, ca-certificates, dh-modaliases, execstack, devscripts, dh-make
Package: kata-shim
Architecture: @deb_arch@
Description:
kata-shim is a process spawned by the Intel VT-x secured Kata Containers runtime per container workload.
The runtime provides the pid of the kata-shim process to containerd-shim on OCI create command.

View File

@@ -0,0 +1,21 @@
#!/usr/bin/make -f
export DEB_BUILD_OPTIONS=nocheck
export PATH:=/usr/src/packages/BUILD/local/go/bin:$(PATH)
export GOROOT:=/usr/src/packages/BUILD/local/go
export GOPATH=/usr/src/packages/BUILD/go
GO_VERSION=@GO_VERSION@
%:
dh $@
override_dh_auto_build:
mkdir -p /usr/src/packages/BUILD/local/
mkdir -p /usr/src/packages/BUILD/go/src/github.com/kata-containers/
tar xzf /usr/src/packages/SOURCES/go$(GO_VERSION).linux-@GO_ARCH@.tar.gz -C /usr/src/packages/BUILD/local/
ln -s /usr/src/packages/BUILD/ /usr/src/packages/BUILD/go/src/github.com/kata-containers/shim
cd $(GOPATH)/src/github.com/kata-containers/shim && make
override_dh_auto_install:
mkdir -p debian/kata-shim
make install LIBEXECDIR=$(shell pwd)/debian/kata-shim/usr/libexec

View File

@@ -0,0 +1,17 @@
Format: 3.0 (quilt)
Source: kata-shim
Version: @VERSION@+git.@HASH@-@RELEASE@
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Standards-Version: 3.9.6
Build-Depends: debhelper (>= 9), git, ca-certificates, dh-modaliases, execstack, devscripts, dh-make
Homepage: https://katacontainers.io
Debtransform-Tar: kata-shim-@VERSION@+git.@HASH@.tar.gz
Package: kata-shim
Architecture: @deb_arch@
Description:
kata-shim is a process spawned by the Intel VT-x secured Kata Containers runtime per container workload.
The runtime provides the pid of the kata-shim process to containerd-shim on OCI create command.

View File

@@ -0,0 +1,81 @@
%global DOMAIN github.com
%global ORG kata-containers
%global PROJECT shim
%global IMPORTNAME %{DOMAIN}/%{ORG}/%{PROJECT}
%global GO_VERSION @GO_VERSION@
%if 0%{?suse_version}
%define LIBEXECDIR %{_libdir}
%else
%define LIBEXECDIR %{_libexecdir}
%endif
%undefine _missing_build_ids_terminate_build
Name: kata-shim
Version: @VERSION@+git.@HASH@
Release: @RELEASE@.<B_CNT>
Summary : No detailed summary available
Group : Development/Tools
License : Apache-2.0
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: git
Requires: kata-shim-bin
%global debug_package %{nil}
# Patches
@RPM_PATCH_LIST@
%description
.. contents::
.. sectnum::
``kata-shim``
===================
Overview
--------
%package bin
Summary: bin components for the kata-shim package.
Group: Binaries
%description bin
bin components for the kata-shim package.
%prep
mkdir local
tar -C local -xzf ../SOURCES/go%{GO_VERSION}.linux-@GO_ARCH@.tar.gz
%setup -q
# Patches
@RPM_APPLY_PATCHES@
%build
export GOROOT=$HOME/rpmbuild/BUILD/local/go
export PATH=$PATH:$HOME/rpmbuild/BUILD/local/go/bin
export GOPATH=$HOME/rpmbuild/BUILD/go/
mkdir -p $HOME/rpmbuild/BUILD/go/src/%{DOMAIN}/%{ORG}
ln -s %{_builddir}/%{name}-%{version} $HOME/rpmbuild/BUILD/go/src/%{IMPORTNAME}
cd $HOME/rpmbuild/BUILD/go/src/%{IMPORTNAME}
make
%check
export http_proxy=http://127.0.0.1:9/
export https_proxy=http://127.0.0.1:9/
export no_proxy=localhost
%install
export GOROOT=$HOME/rpmbuild/BUILD/local/go
export PATH=$PATH:$HOME/rpmbuild/BUILD/local/go/bin
export GOPATH=$HOME/rpmbuild/BUILD/go/
make install LIBEXECDIR=%{buildroot}%{LIBEXECDIR}
%files
%defattr(-,root,root,-)
%files bin
%defattr(-,root,root,-)
%{LIBEXECDIR}/kata-containers
%{LIBEXECDIR}/kata-containers/kata-shim

50
shim/update.sh Executable file
View File

@@ -0,0 +1,50 @@
#!/bin/bash
#
# Copyright (c) 2018 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Automation script to create specs to build kata-shim
set -e
source ../versions.txt
source ../scripts/pkglib.sh
SCRIPT_NAME=$0
SCRIPT_DIR=$(dirname "$0")
PKG_NAME="kata-shim"
VERSION=$kata_shim_version
GENERATED_FILES=(kata-shim.spec kata-shim.dsc _service debian.control debian.rules)
STATIC_FILES=(debian.compat)
# Parse arguments
cli "$@"
[ "$VERBOSE" == "true" ] && set -x
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/shim}
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
((RELEASE++))
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
set_versions $kata_shim_hash
replace_list=(
"GO_CHECKSUM=$go_checksum"
"GO_VERSION=$go_version"
"GO_ARCH=$GO_ARCH"
"HASH=$short_hashtag"
"RELEASE=$RELEASE"
"REVISION=$VERSION"
"VERSION=$VERSION"
)
verify
echo "Verify succeed."
get_git_info
changelog_update $VERSION
generate_files "$SCRIPT_DIR" "${replace_list[@]}"
build_pkg "${PROJECT_REPO}"

30
versions.txt Normal file
View File

@@ -0,0 +1,30 @@
kata_runtime_hash=90e3ba602789fe67ed91acb6fbd1b3cc0f6d6d84
kata_proxy_hash=16414149f38f7099c9afd529ebfbac335a15194a
kata_shim_hash=2457ccc107ac46d7105254c089b240523b1701c4
kata_agent_hash=e444fe2bbbc57fdd47dad00f369935009b094817
ksm_throttler_hash=f47b1ec8a904424fe553426738d0c3054ae1e2e6
qemu_lite_hash=6ba2bfbee9a80bfd03605c5eb2ca743c8b68389e
qemu_vanilla_hash=e3050471ff1daa7fefe88388dfa4e1d97ba1f0bc
kata_runtime_version=0.2.0
kata_proxy_version=0.2.0
kata_shim_version=0.2.0
kata_agent_version=0.2.0
ksm_throttler_version=0.2.0
kata_osbuilder_version=0.2.0
qemu_lite_version=2.11.0
qemu_vanilla_version=2.11
kernel_version=4.14.22
# Default osbuilder image options
osbuilder_default_os=clearlinux
clearlinux_version=20640
# Default osbuilder initrd options
osbuilder_default_initrd_os=alpine
alpine_version=3.7
# Golang
go_version=1.10.2
# sha256 checksum for the go_version binary distribution ("go${go_version}.linux-amd64.tar.gz")
go_checksum=4b677d698c65370afa33757b6954ade60347aaca310ea92a63ed717d7cb0c2ff