diff --git a/SPECS/podman.spec b/SPECS/podman.spec index e891c05..daf7235 100644 --- a/SPECS/podman.spec +++ b/SPECS/podman.spec @@ -1,12 +1,23 @@ +%global with_devel 0 +%global with_bundled 1 +%global with_check 0 +%global with_unit_test 0 +%bcond_without varlink +%global with_debug 1 + +%if 0%{?with_debug} %global _find_debuginfo_dwz_opts %{nil} %global _dwz_low_mem_die_limit 0 - +%else +%global debug_package %{nil} +%endif %define gobuild(o:) GO111MODULE=off go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" -a -v -x %{?**}; %ifarch ppc64 # certain options do not exist on ppc64 big endian -%define gobuild(o:) GO111MODULE=off go build -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" -a -v -x %{?**}; +%define gobuild(o:) GO111MODULE=off go build -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -A %endif + %define gogenerate go generate %define provider github @@ -14,11 +25,8 @@ %define project containers %define repo libpod # https://github.com/containers/libpod -%define provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} -%define import_path %{provider_prefix} -%define git0 https://%{provider}.%{provider_tld}/%{project}/%{repo} -%define commit0 37a3aa6c83603ec774939a8d07c950dd3b26110a -%define shortcommit0 %(c=%{commit0}; echo ${c:0:7}) +%define import_path %{provider}.%{provider_tld}/%{project}/%{repo} +%define git0 https://%{import_path} %define repo_plugins dnsname # https://github.com/containers/libpod @@ -29,18 +37,22 @@ # Used for comparing with latest upstream tag # to decide whether to autobuild (non-rawhide only) -%define built_tag v1.9.1 +%define built_tag v2.0.3 %define built_tag_strip %(b=%{built_tag}; echo ${b:1}) -%define download_url https://github.com/containers/libpod/archive/%{built_tag}.tar.gz +%define download_url %{git0}/archive/%{built_tag}.tar.gz Name: podman -Version: 1.9.1 +Version: 2.0.3 Release: 1%{?dist} Epoch: 2 Summary: Manage Pods, Containers and Container Images License: ASL 2.0 URL: https://%{name}.io/ Source0: %{download_url} +# To build a random user's fork/commit, comment out above line, +# uncomment below Source0, and replace the placeholders with the right info +# Also, adjust %%prep section as necessary. +#Source0: https://github.com/$GITHUB_USER/$GITHUB_USER_REPO/archive/$BRANCH.tar.gz Source1: https://github.com/containers/dnsname/archive/f5af33dedcfc5e707e5560baa4a72f8d96a968fe/dnsname-f5af33d.tar.gz Provides: %{name}-manpages = %{epoch}:%{version}-%{release} Obsoletes: %{name}-manpages < %{epoch}:%{version}-%{release} @@ -61,19 +73,21 @@ BuildRequires: make BuildRequires: systemd BuildRequires: systemd-devel Requires: containers-common -Requires: containernetworking-plugins >= 0.7.5-1 +Requires: containernetworking-plugins >= 0.8.6-1 Requires: iptables Requires: nftables -Requires: conmon +Requires: conmon >= 2:2.0.18-1 Requires: %{name}-plugins = %{epoch}:%{version}-%{release} +Obsoletes: oci-systemd-hook <= 0.2.0-3 BuildRequires: btrfs-progs-devel BuildRequires: ostree-devel -Requires: slirp4netns >= 0.3.0-2 Requires: fuse-overlayfs >= 0.3-8 -Requires: runc #Requires: crun >= 0.13-2 Requires: libvarlink-util +Requires: catatonit Requires: container-selinux +Requires: runc +Requires: slirp4netns >= 0.3.0-2 # vendored libraries # awk '{print "Provides: bundled(golang("$1")) = "$2}' vendor.conf | sort @@ -184,12 +198,13 @@ eases the transition from other container engines and allows the management of pods, containers and images. Simply put: alias docker=%{name}. Most %{name} commands can be run as a regular user, without requiring additional privileges. + %{name} uses Buildah(1) internally to create container images. Both tools share image (not container) storage, hence each can use or manipulate images (but not containers) created by the other. -%{summary} -%{repo} Simple management tool for pods, containers and images +%{summary} +%{name} is a simple management tool for pods, containers and images %package docker Summary: Emulate Docker CLI using %{name} @@ -200,17 +215,72 @@ Conflicts: docker-latest Conflicts: docker-ce Conflicts: docker-ee Conflicts: moby-engine + %description docker This package installs a script named docker that emulates the Docker CLI by executes %{name} commands, it also creates links between all Docker CLI man pages and %{name}. - +%if 0%{?with_devel} %package devel Summary: Library for applications looking to use Container Pods BuildArch: noarch Provides: %{repo}-devel = %{epoch}:%{version}-%{release} +%if 0%{?with_check} && ! 0%{?with_bundled} +BuildRequires: golang(github.com/BurntSushi/toml) +BuildRequires: golang(github.com/containerd/cgroups) +BuildRequires: golang(github.com/containernetworking/plugins/pkg/ns) +BuildRequires: golang(github.com/containers/image/copy) +BuildRequires: golang(github.com/containers/image/directory) +BuildRequires: golang(github.com/containers/image/docker) +BuildRequires: golang(github.com/containers/image/docker/archive) +BuildRequires: golang(github.com/containers/image/docker/reference) +BuildRequires: golang(github.com/containers/image/docker/tarfile) +BuildRequires: golang(github.com/containers/image/image) +BuildRequires: golang(github.com/containers/image/oci/archive) +BuildRequires: golang(github.com/containers/image/pkg/strslice) +BuildRequires: golang(github.com/containers/image/pkg/sysregistries) +BuildRequires: golang(github.com/containers/image/signature) +BuildRequires: golang(github.com/containers/image/storage) +BuildRequires: golang(github.com/containers/image/tarball) +BuildRequires: golang(github.com/containers/image/transports/alltransports) +BuildRequires: golang(github.com/containers/image/types) +BuildRequires: golang(github.com/containers/storage) +BuildRequires: golang(github.com/containers/storage/pkg/archive) +BuildRequires: golang(github.com/containers/storage/pkg/idtools) +BuildRequires: golang(github.com/containers/storage/pkg/reexec) +BuildRequires: golang(github.com/coreos/go-systemd/dbus) +BuildRequires: golang(github.com/cri-o/ocicni/pkg/ocicni) +BuildRequires: golang(github.com/docker/distribution/reference) +BuildRequires: golang(github.com/docker/docker/daemon/caps) +BuildRequires: golang(github.com/docker/docker/pkg/mount) +BuildRequires: golang(github.com/docker/docker/pkg/namesgenerator) +BuildRequires: golang(github.com/docker/docker/pkg/stringid) +BuildRequires: golang(github.com/docker/docker/pkg/system) +BuildRequires: golang(github.com/docker/docker/pkg/term) +BuildRequires: golang(github.com/docker/docker/pkg/truncindex) +BuildRequires: golang(github.com/ghodss/yaml) +BuildRequires: golang(github.com/godbus/dbus) +BuildRequires: golang(github.com/mattn/go-sqlite3) +BuildRequires: golang(github.com/mrunalp/fileutils) +BuildRequires: golang(github.com/opencontainers/go-digest) +BuildRequires: golang(github.com/opencontainers/image-spec/specs-go/v1) +BuildRequires: golang(github.com/opencontainers/runc/libcontainer) +BuildRequires: golang(github.com/opencontainers/runtime-spec/specs-go) +BuildRequires: golang(github.com/opencontainers/runtime-tools/generate) +BuildRequires: golang(github.com/opencontainers/selinux/go-selinux) +BuildRequires: golang(github.com/opencontainers/selinux/go-selinux/label) +BuildRequires: golang(github.com/pkg/errors) +BuildRequires: golang(github.com/sirupsen/logrus) +BuildRequires: golang(github.com/ulule/deepcopier) +BuildRequires: golang(golang.org/x/crypto/ssh/terminal) +BuildRequires: golang(golang.org/x/sys/unix) +BuildRequires: golang(k8s.io/apimachinery/pkg/util/wait) +BuildRequires: golang(k8s.io/client-go/tools/remotecommand) +BuildRequires: golang(k8s.io/kubernetes/pkg/kubelet/container) +%endif + Requires: golang(github.com/BurntSushi/toml) Requires: golang(github.com/containerd/cgroups) Requires: golang(github.com/containernetworking/plugins/pkg/ns) @@ -275,42 +345,73 @@ Provides: golang(%{import_path}/pkg/chrootuser) = %{epoch}:%{version}-%{release} Provides: golang(%{import_path}/pkg/registrar) = %{epoch}:%{version}-%{release} Provides: golang(%{import_path}/pkg/storage) = %{epoch}:%{version}-%{release} Provides: golang(%{import_path}/utils) = %{epoch}:%{version}-%{release} -%description devel + +%description -n libpod-devel +%{summary} + This package contains library source intended for building other packages which use import path with %{import_path} prefix. +%endif +%if 0%{?with_unit_test} && 0%{?with_devel} +%package unit-test-devel +Summary: Unit tests for %{name} package +%if 0%{?with_check} +#Here comes all BuildRequires: PACKAGE the unit tests +#in %%check section need for running +%endif -%package -n libpod-devel -Summary: Libpod-devel -%description -n libpod-devel +# test subpackage tests code from devel subpackage +Requires: %{name}-devel = %{epoch}:%{version}-%{release} + +%if 0%{?with_check} && ! 0%{?with_bundled} +BuildRequires: golang(github.com/stretchr/testify/assert) +BuildRequires: golang(github.com/urfave/cli) +%endif + +Requires: golang(github.com/stretchr/testify/assert) +Requires: golang(github.com/urfave/cli) + +%description unit-test-devel %{summary} +%{name} provides a library for applications looking to use the +Container Pod concept popularized by Kubernetes. +This package contains unit tests for project +providing packages with %{import_path} prefix. +%endif %package tests Summary: Tests for %{name} + Requires: %{name} = %{epoch}:%{version}-%{release} Requires: bats Requires: jq Requires: skopeo +Requires: nmap-ncat + %description tests %{summary} -This package contains system tests for %{name} +This package contains system tests for %{name} %package remote Summary: (Experimental) Remote client for managing %{name} containers + %description remote Remote client for managing %{name} containers. + This experimental remote client is under heavy development. Please do not run %{name}-remote in production. + %{name}-remote uses the varlink connection to connect to a %{name} client to manage pods, containers and container images. %{name}-remote supports ssh connections as well. - %package plugins Summary: Plugins for %{name} + %description plugins This plugin sets up the use of dnsmasq on a given CNI network so that Pods can resolve each other by name. When configured, @@ -319,15 +420,19 @@ that dnsmasq will read in. Similarly, when a pod is removed from the network, it will remove the entry from the hosts file. Each CNI network will have its own dnsmasq instance. - %prep -%autosetup -Sgit -n %{repo}-%{built_tag_strip} +%autosetup -Sgit -n %{name}-%{built_tag_strip} +# If you have replaced Source0 for building a random commit, uncomment +# comment out the autosetup line above and uncomment below autosetup line +# Use appropriate value for $BRANCH as in Source0 +#%%autosetup -Sgit -n %%{name}-$BRANCH + # untar dnsname tar zxf %{SOURCE1} - %build export GO111MODULE=off + # build plugins first cause we don't wanna use podman's buildtags pushd dnsname-%{commit_plugins} mkdir _build @@ -339,6 +444,7 @@ ln -s vendor src export GOPATH=$(pwd)/_build:$(pwd) %gobuild -o bin/dnsname %{import_path_plugins}/plugins/meta/dnsname popd + export GOPATH=$(pwd)/_build:$(pwd) mkdir _build pushd _build @@ -346,63 +452,55 @@ mkdir -p src/%{provider}.%{provider_tld}/%{project} ln -s ../../../../ src/%{import_path} popd ln -s vendor src + %gogenerate ./pkg/varlink/... # build %%{name} -export BUILDTAGS="systemd varlink seccomp exclude_graphdriver_devicemapper $(hack/btrfs_installed_tag.sh) $(hack/btrfs_tag.sh) $(hack/libdm_tag.sh) $(hack/ostree_tag.sh) $(hack/selinux_tag.sh)" +export BUILDTAGS="systemd seccomp exclude_graphdriver_devicemapper $(hack/btrfs_installed_tag.sh) $(hack/btrfs_tag.sh) $(hack/libdm_tag.sh) $(hack/ostree_tag.sh) $(hack/selinux_tag.sh)" +export BUILDTAGS+=" varlink" +### ### ### !export BUILDTAGS+=" exclude_graphdriver_btrfs containers_image_ostree_stub" %ifarch ppc64 export CGO_ENABLED=1 %endif %gobuild -o bin/%{name} %{import_path}/cmd/%{name} - + # build %%{name}-remote -export BUILDTAGS+=" remoteclient" +export BUILDTAGS+=" remote" %gobuild -o bin/%{name}-remote %{import_path}/cmd/%{name} %ifarch ppc64 unset CGO_ENABLED %endif - - + +%{__make} docs + %install -%if 0%{?fedora} -sed -s 's/^runtime[ =].*"runc/runtime = "crun/' libpod.conf -i -%endif -sed -i 's/install.remote: podman-remote/install.remote:/' Makefile -sed -i 's/install.bin: podman/install.bin:/' Makefile rm -rf docs/containers-mounts.conf.5.md -install -dp %{buildroot}%{_unitdir} -PODMAN_VERSION=%{version} %{__make} PREFIX=%{buildroot}%{_prefix} ETCDIR=%{buildroot}%{_sysconfdir} \ - install.bin \ - install.remote \ - install.man \ - install.cni \ - install.systemd \ - install.completions \ - install.docker - +PODMAN_VERSION=%{version} %{__make} PREFIX=%{buildroot}%{_prefix} \ + ETCDIR=%{buildroot}%{_sysconfdir} \ + BUILDTAGS="varlink" \ + install.bin-nobuild \ + install.remote-nobuild \ + install.man-nobuild \ + install.cni \ + install.systemd \ + install.completions \ + install.docker + mv pkg/hooks/README.md pkg/hooks/README-hooks.md -# install libpod.conf -install -dp %{buildroot}%{_datadir}/containers -install -p -m 644 %{repo}.conf %{buildroot}%{_datadir}/containers - # install plugins pushd dnsname-%{commit_plugins} %{__make} PREFIX=%{_prefix} DESTDIR=%{buildroot} install popd -# install /etc/modules-load.d/podman.conf -echo br_netfilter > %{name}.conf -install -dp %{buildroot}%{_sysconfdir}/modules-load.d -install -p -m 644 %{name}.conf %{buildroot}%{_sysconfdir}/modules-load.d/ - # do not include docker and podman-remote man pages in main package for file in `find %{buildroot}%{_mandir}/man[15] -type f | sed "s,%{buildroot},," | grep -v -e remote -e docker`; do echo "$file*" >> podman.file-list done # source codes for building projects +%if 0%{?with_devel} install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list @@ -418,31 +516,64 @@ for file in $(find . \( -iname "*.go" -or -iname "*.s" \) \! -iname "*_test.go" dirprefix=$(dirname $dirprefix) done done +%endif -#TODO Next release this section should be removed, since the make install will handle it -# install service -install -m 644 contrib/systemd/user/podman.socket %{buildroot}/%{_userunitdir}/podman.socket -install -m 644 contrib/systemd/user/podman.service %{buildroot}/%{_userunitdir}/podman.service -install -m 644 contrib/systemd/system/podman.socket %{buildroot}/%{_unitdir}/podman.socket -install -m 644 contrib/systemd/system/podman.service %{buildroot}/%{_unitdir}/podman.service +# testing files for this project +%if 0%{?with_unit_test} && 0%{?with_devel} +install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ +# find all *_test.go files and generate unit-test-devel.file-list +for file in $(find . -iname "*_test.go" | grep -v "vendor") ; do + dirprefix=$(dirname $file) + install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix + cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file + echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list + while [ "$dirprefix" != "." ]; do + echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list + dirprefix=$(dirname $dirprefix) + done +done +%endif + +%if 0%{?with_devel} sort -u -o devel.file-list devel.file-list +%endif %check +%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel} +%if ! 0%{?with_bundled} +export GOPATH=%{buildroot}/%{gopath}:%{gopath} +%else +# Since we aren't packaging up the vendor directory we need to link +# back to it somehow. Hack it up so that we can add the vendor +# directory from BUILD dir as a gopath to be searched when executing +# tests from the BUILDROOT dir. +ln -s ./ ./vendor/src # ./vendor/src -> ./vendor + +export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath} +%endif + +%if ! 0%{?gotest:1} +%global gotest go test +%endif + +%gotest %{import_path}/cmd/%{name} +%gotest %{import_path}/libkpod +%gotest %{import_path}/libpod +%gotest %{import_path}/pkg/registrar +%endif + install -d -p %{buildroot}/%{_datadir}/%{name}/test/system cp -pav test/system %{buildroot}/%{_datadir}/%{name}/test/ - %triggerpostun -- %{name} < 1.1 %{_bindir}/%{name} system renumber exit 0 - #define license tag if not already defined %{!?_licensedir:%global license %doc} - -%files -f %{name}.file-list +%files -f podman.file-list %license LICENSE %doc README.md CONTRIBUTING.md pkg/hooks/README-hooks.md install.md transfer.md %{_bindir}/%{name} @@ -451,35 +582,38 @@ exit 0 %dir %{_datadir}/zsh/site-functions %{_datadir}/zsh/site-functions/_%{name} %config(noreplace) %{_sysconfdir}/cni/net.d/87-%{name}-bridge.conflist -%{_datadir}/containers/%{repo}.conf -%{_unitdir}/io.%{name}.service -%{_unitdir}/io.%{name}.socket -%{_userunitdir}/io.%{name}.service -%{_userunitdir}/io.%{name}.socket -%{_usr}/lib/tmpfiles.d/%{name}.conf %{_unitdir}/%{name}.service %{_unitdir}/%{name}.socket %{_userunitdir}/%{name}.service %{_userunitdir}/%{name}.socket -%{_sysconfdir}/modules-load.d/%{name}.conf +%{_unitdir}/io.%{name}.service +%{_unitdir}/io.%{name}.socket +%{_userunitdir}/io.%{name}.service +%{_userunitdir}/io.%{name}.socket +%{_tmpfilesdir}/%{name}.conf %files docker %{_bindir}/docker %{_mandir}/man1/docker*.1* %{_usr}/lib/tmpfiles.d/%{name}-docker.conf +%if 0%{?with_devel} %files -n libpod-devel -f devel.file-list %license LICENSE %doc README.md CONTRIBUTING.md pkg/hooks/README-hooks.md install.md transfer.md %dir %{gopath}/src/%{provider}.%{provider_tld}/%{project} +%endif +%if 0%{?with_unit_test} && 0%{?with_devel} +%files unit-test-devel -f unit-test-devel.file-list +%license LICENSE +%doc README.md CONTRIBUTING.md pkg/hooks/README-hooks.md install.md transfer.md +%endif %files remote %license LICENSE %{_bindir}/%{name}-remote %{_mandir}/man1/%{name}-remote*.1* -%{_mandir}/man5/%{name}-remote*.5* - %files tests %license LICENSE @@ -487,7 +621,6 @@ exit 0 %dir %{_datadir}/%{name}/test/system %{_datadir}/%{name}/test/system/* - %files plugins %license dnsname-%{commit_plugins}/LICENSE %doc dnsname-%{commit_plugins}/{README.md,README_PODMAN.md}