mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-07 16:34:28 +01:00
packaging: merge packaging repository
git-subtree-dir: tools/packaging git-subtree-mainline:f818b46a41git-subtree-split:1f22d72d5dSigned-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
26
tools/packaging/obs-packaging/runtime/_service-template
Normal file
26
tools/packaging/obs-packaging/runtime/_service-template
Normal 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@</param>
|
||||
<param name="revision">@HASH@</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
tools/packaging/obs-packaging/runtime/debian.compat
Normal file
1
tools/packaging/obs-packaging/runtime/debian.compat
Normal file
@@ -0,0 +1 @@
|
||||
9
|
||||
@@ -0,0 +1,20 @@
|
||||
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
|
||||
|
||||
Package: kata-runtime
|
||||
Architecture: @deb_arch@
|
||||
Depends: kata-containers-image (= @kata_osbuilder_version_release@),
|
||||
kata-linux-container (= @linux_container_version_release@),
|
||||
kata-proxy (= @kata_proxy_version_release@),
|
||||
kata-shim (= @kata_shim_version_release@),
|
||||
kata-ksm-throttler(= @ksm_throttler_version_release@),
|
||||
qemu-vanilla(= @qemu_vanilla_version_release@)
|
||||
Description:
|
||||
An Open Containers Initiative (OCI) "runtime" that launches an Intel VT-x
|
||||
secured Kata Containers hypervisor, rather than a standard Linux container.
|
||||
46
tools/packaging/obs-packaging/runtime/debian.rules-template
Normal file
46
tools/packaging/obs-packaging/runtime/debian.rules-template
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/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-vanilla-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 \
|
||||
QEMUCMD=$(DEFAULT_QEMU) \
|
||||
COMMIT=@HASH@ \
|
||||
SKIP_GO_VERSION_CHECK=1
|
||||
|
||||
override_dh_auto_install:
|
||||
mkdir -p debian/$(PKG_NAME)
|
||||
|
||||
cd $(GOPATH)/src/$(IMPORTNAME)/; \
|
||||
make install \
|
||||
DESTDIR=$(shell pwd)/debian/$(PKG_NAME)/ \
|
||||
PREFIX=/usr \
|
||||
COMMIT=@HASH@ \
|
||||
QEMUCMD=$(DEFAULT_QEMU) \
|
||||
SKIP_GO_VERSION_CHECK=1
|
||||
|
||||
sed -i -e '/^initrd =/d' $(shell pwd)/debian/$(PKG_NAME)/usr/share/defaults/kata-containers/configuration.toml
|
||||
@@ -0,0 +1,25 @@
|
||||
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@-@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, fakeroot, devscripts, debhelper,
|
||||
build-essential, dh-autoreconf, make
|
||||
Homepage: https://katacontainers.io
|
||||
Debtransform-Tar: kata-runtime-@VERSION@.tar.gz
|
||||
|
||||
Package: kata-runtime
|
||||
Architecture: @deb_arch@
|
||||
Depends: kata-containers-image (= @kata_osbuilder_version_release@),
|
||||
kata-linux-container (= @linux_container_version_release@),
|
||||
kata-proxy (= @kata_proxy_version_release@),
|
||||
kata-shim (= @kata_shim_version_release@),
|
||||
kata-ksm-throttler(= @ksm_throttler_version_release@),
|
||||
qemu-vanilla(= @qemu_vanilla_version_release@)
|
||||
Description:
|
||||
An Open Containers Initiative (OCI) "runtime" that launches an Intel VT-x
|
||||
secured Kata Containers hypervisor, rather than a standard Linux container.
|
||||
100
tools/packaging/obs-packaging/runtime/kata-runtime.spec-template
Normal file
100
tools/packaging/obs-packaging/runtime/kata-runtime.spec-template
Normal file
@@ -0,0 +1,100 @@
|
||||
%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-vanilla-system-x86_64
|
||||
|
||||
%define LIBEXECDIR /usr/libexec
|
||||
|
||||
%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@
|
||||
Release: @RELEASE@
|
||||
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
|
||||
|
||||
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-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
|
||||
%autosetup -N -S git
|
||||
# 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 $HOME/rpmbuild/BUILD/kata-runtime-%{version} $HOME/rpmbuild/BUILD/go/src/%{IMPORTNAME}
|
||||
cd $HOME/rpmbuild/BUILD/go/src/%{IMPORTNAME}
|
||||
make \
|
||||
QEMUCMD=%{DEFAULT_QEMU} \
|
||||
COMMIT=@HASH@ \
|
||||
SKIP_GO_VERSION_CHECK=1
|
||||
|
||||
%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 \
|
||||
DESTDIR=%{buildroot} \
|
||||
PREFIX=/usr \
|
||||
QEMUCMD=%{DEFAULT_QEMU} \
|
||||
COMMIT=@HASH@ \
|
||||
SKIP_GO_VERSION_CHECK=1 \
|
||||
install
|
||||
sed -i -e '/^initrd =/d' %{buildroot}/usr/share/defaults/kata-containers/configuration.toml
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
/usr/bin/kata-runtime
|
||||
/usr/bin/containerd-shim-kata-v2
|
||||
%{LIBEXECDIR}
|
||||
%{LIBEXECDIR}/kata-containers
|
||||
%{LIBEXECDIR}/kata-containers/kata-netmon
|
||||
/usr/bin/kata-collect-data.sh
|
||||
/usr/share/defaults/
|
||||
/usr/share/defaults/kata-containers/
|
||||
/usr/share/defaults/kata-containers/configuration*.toml
|
||||
/usr/share/bash-completion
|
||||
/usr/share/bash-completion/completions
|
||||
/usr/share/bash-completion/completions/kata-runtime
|
||||
162
tools/packaging/obs-packaging/runtime/update.sh
Executable file
162
tools/packaging/obs-packaging/runtime/update.sh
Executable file
@@ -0,0 +1,162 @@
|
||||
#!/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.
|
||||
[ -z "${DEBUG}" ] || set -o xtrace
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
source ../versions.txt
|
||||
source ../scripts/pkglib.sh
|
||||
|
||||
SCRIPT_NAME=$0
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
replace_list=()
|
||||
|
||||
# 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
|
||||
|
||||
#
|
||||
# Given the name of a package returns the full package version to be used for
|
||||
# DEB and RPM dependency constraints as follows, composed of:
|
||||
# - a version,
|
||||
# - an optional hash (only for select packages),
|
||||
# - a release number (only for "deb" packages)
|
||||
#
|
||||
pkg_required_ver() {
|
||||
local pkg="$1"
|
||||
local versionVar="${pkg}_version"
|
||||
local hashVar="${pkg}_hash"
|
||||
local version=$(echo ${!versionVar})
|
||||
local gitHash=
|
||||
|
||||
# Make pkg match the package name on OBS
|
||||
pkg="${pkg#kata_}"
|
||||
pkg="${pkg//_/-}"
|
||||
pkg="${pkg//osbuilder/kata-containers-image}"
|
||||
pkg="${pkg//kernel/linux-container}"
|
||||
|
||||
if [ -n "${PROJECT_REPO:-}" ]; then
|
||||
local proj="${PROJECT_REPO%/runtime}"
|
||||
else
|
||||
local proj="home:${OBS_PROJECT}:${OBS_SUBPROJECT}"
|
||||
fi
|
||||
local release="$(get_obs_pkg_release "${proj}/${pkg//_/-}")"
|
||||
|
||||
case "$pkg" in
|
||||
linux-container)
|
||||
version="${version}.$(cat "${SCRIPT_DIR}/../../kernel/kata_config_version")"
|
||||
;;
|
||||
qemu-*)
|
||||
gitHash=$(echo ${!hashVar}})
|
||||
;;
|
||||
esac
|
||||
|
||||
local debVer=$(pkg_version "$version" "$release" "$gitHash")
|
||||
local rpmVer=$(pkg_version "$version" "" "$gitHash")
|
||||
|
||||
echo "${debVer}" "${rpmVer}"
|
||||
}
|
||||
|
||||
|
||||
# Parse arguments
|
||||
cli "$@"
|
||||
|
||||
[ "$VERBOSE" == "true" ] && set -x
|
||||
|
||||
declare -a pkgVersions
|
||||
# Package depedencies
|
||||
info "Requires:"
|
||||
pkgVersions=($(pkg_required_ver "kata_proxy"))
|
||||
declare -A PROXY_REQUIRED_VERSION
|
||||
PROXY_REQUIRED_VERSION["deb"]=${pkgVersions[0]}
|
||||
PROXY_REQUIRED_VERSION["rpm"]=${pkgVersions[1]}
|
||||
info "proxy ${PROXY_REQUIRED_VERSION[@]}"
|
||||
|
||||
declare -A SHIM_REQUIRED_VERSION
|
||||
pkgVersions=($(pkg_required_ver "kata_shim"))
|
||||
SHIM_REQUIRED_VERSION["deb"]=${pkgVersions[0]}
|
||||
SHIM_REQUIRED_VERSION["rpm"]=${pkgVersions[1]}
|
||||
info "shim ${SHIM_REQUIRED_VERSION[@]}"
|
||||
|
||||
declare -A KERNEL_REQUIRED_VERSION
|
||||
pkgVersions=($(pkg_required_ver "kernel"))
|
||||
KERNEL_REQUIRED_VERSION["deb"]=${pkgVersions[0]}
|
||||
KERNEL_REQUIRED_VERSION["rpm"]=${pkgVersions[1]}
|
||||
info "kata-linux-container ${KERNEL_REQUIRED_VERSION[@]}"
|
||||
|
||||
declare -A KSM_THROTTLER_REQUIRED_VERSION
|
||||
pkgVersions=($(pkg_required_ver "kata_ksm_throttler"))
|
||||
KSM_THROTTLER_REQUIRED_VERSION["deb"]=${pkgVersions[0]}
|
||||
KSM_THROTTLER_REQUIRED_VERSION["rpm"]=${pkgVersions[1]}
|
||||
info "ksm-throttler ${KSM_THROTTLER_REQUIRED_VERSION[@]}"
|
||||
|
||||
declare -A KATA_IMAGE_REQUIRED_VERSION
|
||||
pkgVersions=($(pkg_required_ver "kata_osbuilder"))
|
||||
KATA_IMAGE_REQUIRED_VERSION["deb"]=${pkgVersions[0]}
|
||||
KATA_IMAGE_REQUIRED_VERSION["rpm"]=${pkgVersions[1]}
|
||||
info "image ${KATA_IMAGE_REQUIRED_VERSION[@]}"
|
||||
|
||||
|
||||
declare -A KATA_QEMU_VANILLA_REQUIRED_VERSION
|
||||
pkgVersions=($(pkg_required_ver "qemu_vanilla"))
|
||||
KATA_QEMU_VANILLA_REQUIRED_VERSION["deb"]=${pkgVersions[0]}
|
||||
KATA_QEMU_VANILLA_REQUIRED_VERSION["rpm"]=${pkgVersions[1]}
|
||||
info "qemu-vanilla ${KATA_QEMU_VANILLA_REQUIRED_VERSION[@]}"
|
||||
|
||||
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/runtime}
|
||||
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
||||
((RELEASE++))
|
||||
|
||||
set_versions "$kata_runtime_hash"
|
||||
|
||||
replace_list+=(
|
||||
"GO_CHECKSUM=$go_checksum"
|
||||
"GO_VERSION=$go_version"
|
||||
"GO_ARCH=$GO_ARCH"
|
||||
"HASH=$short_hashtag"
|
||||
"RELEASE=$RELEASE"
|
||||
"VERSION=$VERSION"
|
||||
"kata_osbuilder_version=${KATA_IMAGE_REQUIRED_VERSION["rpm"]}"
|
||||
"kata_osbuilder_version_release=${KATA_IMAGE_REQUIRED_VERSION["deb"]}"
|
||||
"kata_proxy_version=${PROXY_REQUIRED_VERSION["rpm"]}"
|
||||
"kata_proxy_version_release=${PROXY_REQUIRED_VERSION["deb"]}"
|
||||
"kata_shim_version=${SHIM_REQUIRED_VERSION["rpm"]}"
|
||||
"kata_shim_version_release=${SHIM_REQUIRED_VERSION["deb"]}"
|
||||
"ksm_throttler_version=${KSM_THROTTLER_REQUIRED_VERSION["rpm"]}"
|
||||
"ksm_throttler_version_release=${KSM_THROTTLER_REQUIRED_VERSION["deb"]}"
|
||||
"linux_container_version=${KERNEL_REQUIRED_VERSION["rpm"]}"
|
||||
"linux_container_version_release=${KERNEL_REQUIRED_VERSION["deb"]}"
|
||||
"qemu_vanilla_version=${KATA_QEMU_VANILLA_REQUIRED_VERSION["rpm"]}"
|
||||
"qemu_vanilla_version_release=${KATA_QEMU_VANILLA_REQUIRED_VERSION["deb"]}"
|
||||
)
|
||||
|
||||
verify
|
||||
echo "Verify succeed."
|
||||
get_git_info
|
||||
changelog_update $VERSION
|
||||
generate_files "$SCRIPT_DIR" "${replace_list[@]}"
|
||||
build_pkg "${PROJECT_REPO}"
|
||||
Reference in New Issue
Block a user