Blame SPECS/osbuild-composer.spec

478111
# Do not build with tests by default
478111
# Pass --with tests to rpmbuild to override
478111
%bcond_with tests
478111
478111
%global goipath         github.com/osbuild/osbuild-composer
478111
97df7e
Version:        28.4
478111
478111
%gometa
478111
478111
%global common_description %{expand:
478111
An image building service based on osbuild
478111
It is inspired by lorax-composer and exposes the same API.
478111
As such, it is a drop-in replacement.
478111
}
478111
478111
Name:           osbuild-composer
478111
Release:        1%{?dist}
478111
Summary:        An image building service based on osbuild
478111
478111
# osbuild-composer doesn't have support for building i686 images
478111
# and also RHEL and Fedora has now only limited support for this arch.
478111
ExcludeArch:    i686
478111
478111
# Upstream license specification: Apache-2.0
478111
License:        ASL 2.0
478111
URL:            %{gourl}
478111
Source0:        %{gosource}
478111
478111
478111
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
478111
BuildRequires:  systemd
97df7e
BuildRequires:  krb5-devel
97df7e
BuildRequires:  python3-docutils
97df7e
BuildRequires:  make
478111
%if 0%{?fedora}
478111
BuildRequires:  systemd-rpm-macros
478111
BuildRequires:  git
478111
BuildRequires:  golang(github.com/aws/aws-sdk-go)
478111
BuildRequires:  golang(github.com/Azure/azure-sdk-for-go)
478111
BuildRequires:  golang(github.com/Azure/azure-storage-blob-go/azblob)
478111
BuildRequires:  golang(github.com/BurntSushi/toml)
478111
BuildRequires:  golang(github.com/coreos/go-semver/semver)
478111
BuildRequires:  golang(github.com/coreos/go-systemd/activation)
97df7e
BuildRequires:  golang(github.com/deepmap/oapi-codegen/pkg/codegen)
97df7e
BuildRequires:  golang(github.com/go-chi/chi)
478111
BuildRequires:  golang(github.com/google/uuid)
478111
BuildRequires:  golang(github.com/julienschmidt/httprouter)
97df7e
BuildRequires:  golang(github.com/getkin/kin-openapi/openapi3)
97df7e
BuildRequires:  golang(github.com/kolo/xmlrpc)
97df7e
BuildRequires:  golang(github.com/labstack/echo/v4)
478111
BuildRequires:  golang(github.com/gobwas/glob)
478111
BuildRequires:  golang(github.com/google/go-cmp/cmp)
478111
BuildRequires:  golang(github.com/gophercloud/gophercloud)
478111
BuildRequires:  golang(github.com/stretchr/testify/assert)
97df7e
BuildRequires:  golang(github.com/ubccr/kerby)
478111
BuildRequires:  golang(github.com/vmware/govmomi)
478111
%endif
478111
97df7e
Requires: %{name}-core = %{version}-%{release}
478111
Requires: %{name}-worker = %{version}-%{release}
478111
Requires: systemd
478111
478111
Provides: weldr
478111
478111
%if 0%{?rhel}
478111
Obsoletes: lorax-composer <= 29
478111
Conflicts: lorax-composer
478111
%endif
478111
97df7e
# Remove when we stop releasing into Fedora 35
97df7e
%if 0%{?fedora} >= 34
97df7e
# lorax 34.3 is the first one without the composer subpackage
97df7e
Obsoletes: lorax-composer < 34.3
97df7e
%endif
97df7e
478111
# remove in F34
478111
Obsoletes: golang-github-osbuild-composer < %{version}-%{release}
478111
Provides:  golang-github-osbuild-composer = %{version}-%{release}
478111
97df7e
# remove when F34 is EOL
97df7e
Obsoletes: osbuild-composer-koji <= 23
97df7e
478111
%description
478111
%{common_description}
478111
478111
%prep
478111
%if 0%{?rhel}
478111
%forgeautosetup -p1
478111
%else
478111
%goprep
478111
%endif
478111
97df7e
%if 0%{?fedora} && 0%{?fedora} <= 32
97df7e
# Fedora 32 and older ships different kolo/xmlrpc and azure/azblob APIs. We
97df7e
# cannot specify build tags in gobuild macro because the macro itself
97df7e
# specifies build tags and -tags argument cannot be used more than once.
97df7e
# Therefore, this ugly hack with build tags switcharoo is required.
97df7e
# Remove when F32 is EOL.
97df7e
97df7e
# Remove the build constraint from the wrappers of the old APIs
97df7e
sed -i "s$// +build kolo_xmlrpc_oldapi$// +build !kolo_xmlrpc_oldapi$" internal/upload/koji/xmlrpc-response-oldapi.go
97df7e
sed -i "s$// +build azblob_oldapi$// +build !azblob_oldapi$" internal/upload/azure/page_blob_url_oldapi.go
97df7e
97df7e
# Add a build constraint to the wrappers of the new APIs
97df7e
sed -i "s$// +build !kolo_xmlrpc_oldapi$// +build kolo_xmlrpc_oldapi$" internal/upload/koji/xmlrpc-response.go
97df7e
sed -i "s$// +build !azblob_oldapi$// +build azblob_oldapi$" internal/upload/azure/page_blob_url.go
97df7e
%endif
97df7e
478111
%build
478111
%if 0%{?rhel}
478111
GO_BUILD_PATH=$PWD/_build
478111
install -m 0755 -vd $(dirname $GO_BUILD_PATH/src/%{goipath})
478111
ln -fs $PWD $GO_BUILD_PATH/src/%{goipath}
478111
cd $GO_BUILD_PATH/src/%{goipath}
478111
install -m 0755 -vd _bin
478111
export PATH=$PWD/_bin${PATH:+:$PATH}
478111
export GOPATH=$GO_BUILD_PATH:%{gopath}
478111
export GOFLAGS=-mod=vendor
478111
%endif
478111
478111
%gobuild -o _bin/osbuild-composer %{goipath}/cmd/osbuild-composer
478111
%gobuild -o _bin/osbuild-worker %{goipath}/cmd/osbuild-worker
478111
97df7e
make man
478111
478111
%if %{with tests} || 0%{?rhel}
478111
478111
# Build test binaries with `go test -c`, so that they can take advantage of
478111
# golang's testing package. The golang rpm macros don't support building them
478111
# directly. Thus, do it manually, taking care to also include a build id.
478111
#
478111
# On Fedora, also turn off go modules and set the path to the one into which
478111
# the golang-* packages install source code.
478111
%if 0%{?fedora}
478111
export GO111MODULE=off
478111
export GOPATH=%{gobuilddir}:%{gopath}
478111
%endif
478111
478111
TEST_LDFLAGS="${LDFLAGS:-} -B 0x$(od -N 20 -An -tx1 -w100 /dev/urandom | tr -d ' ')"
478111
97df7e
go test -c -tags=integration -ldflags="${TEST_LDFLAGS}" -o _bin/osbuild-composer-cli-tests %{goipath}/cmd/osbuild-composer-cli-tests
478111
go test -c -tags=integration -ldflags="${TEST_LDFLAGS}" -o _bin/osbuild-dnf-json-tests %{goipath}/cmd/osbuild-dnf-json-tests
478111
go test -c -tags=integration -ldflags="${TEST_LDFLAGS}" -o _bin/osbuild-weldr-tests %{goipath}/internal/client/
478111
go test -c -tags=integration -ldflags="${TEST_LDFLAGS}" -o _bin/osbuild-image-tests %{goipath}/cmd/osbuild-image-tests
97df7e
go test -c -tags=integration -ldflags="${TEST_LDFLAGS}" -o _bin/osbuild-auth-tests %{goipath}/cmd/osbuild-auth-tests
97df7e
go test -c -tags=integration -ldflags="${TEST_LDFLAGS}" -o _bin/osbuild-koji-tests %{goipath}/cmd/osbuild-koji-tests
97df7e
go build -tags=integration -ldflags="${TEST_LDFLAGS}" -o _bin/cloud-cleaner %{goipath}/cmd/cloud-cleaner
478111
478111
%endif
478111
478111
%install
97df7e
install -m 0755 -vd                                             %{buildroot}%{_libexecdir}/osbuild-composer
97df7e
install -m 0755 -vp _bin/osbuild-composer                       %{buildroot}%{_libexecdir}/osbuild-composer/
97df7e
install -m 0755 -vp _bin/osbuild-worker                         %{buildroot}%{_libexecdir}/osbuild-composer/
97df7e
install -m 0755 -vp dnf-json                                    %{buildroot}%{_libexecdir}/osbuild-composer/
478111
97df7e
install -m 0755 -vd                                             %{buildroot}%{_datadir}/osbuild-composer/repositories
97df7e
install -m 0644 -vp repositories/*                              %{buildroot}%{_datadir}/osbuild-composer/repositories/
478111
97df7e
install -m 0755 -vd                                             %{buildroot}%{_unitdir}
97df7e
install -m 0644 -vp distribution/*.{service,socket}             %{buildroot}%{_unitdir}/
478111
97df7e
install -m 0755 -vd                                             %{buildroot}%{_sysusersdir}
97df7e
install -m 0644 -vp distribution/osbuild-composer.conf          %{buildroot}%{_sysusersdir}/
478111
97df7e
install -m 0755 -vd                                             %{buildroot}%{_localstatedir}/cache/osbuild-composer/dnf-cache
97df7e
97df7e
install -m 0755 -vd                                             %{buildroot}%{_mandir}/man7
97df7e
install -m 0644 -vp docs/*.7                                    %{buildroot}%{_mandir}/man7/
478111
478111
%if %{with tests} || 0%{?rhel}
478111
97df7e
install -m 0755 -vd                                             %{buildroot}%{_libexecdir}/osbuild-composer-test
97df7e
install -m 0755 -vp _bin/osbuild-composer-cli-tests             %{buildroot}%{_libexecdir}/osbuild-composer-test/
97df7e
install -m 0755 -vp _bin/osbuild-weldr-tests                    %{buildroot}%{_libexecdir}/osbuild-composer-test/
97df7e
install -m 0755 -vp _bin/osbuild-dnf-json-tests                 %{buildroot}%{_libexecdir}/osbuild-composer-test/
97df7e
install -m 0755 -vp _bin/osbuild-image-tests                    %{buildroot}%{_libexecdir}/osbuild-composer-test/
97df7e
install -m 0755 -vp _bin/osbuild-auth-tests                     %{buildroot}%{_libexecdir}/osbuild-composer-test/
97df7e
install -m 0755 -vp _bin/osbuild-koji-tests                     %{buildroot}%{_libexecdir}/osbuild-composer-test/
97df7e
install -m 0755 -vp _bin/cloud-cleaner                          %{buildroot}%{_libexecdir}/osbuild-composer-test/
97df7e
install -m 0755 -vp tools/provision.sh                          %{buildroot}%{_libexecdir}/osbuild-composer-test/
97df7e
install -m 0755 -vp tools/gen-certs.sh                          %{buildroot}%{_libexecdir}/osbuild-composer-test/
97df7e
install -m 0755 -vp tools/image-info                            %{buildroot}%{_libexecdir}/osbuild-composer-test/
97df7e
install -m 0755 -vp tools/run-koji-container.sh                 %{buildroot}%{_libexecdir}/osbuild-composer-test/
97df7e
install -m 0755 -vp tools/koji-compose.py                       %{buildroot}%{_libexecdir}/osbuild-composer-test/
97df7e
install -m 0755 -vp tools/libvirt_test.sh                       %{buildroot}%{_libexecdir}/osbuild-composer-test/
97df7e
install -m 0755 -vd                                             %{buildroot}%{_libexecdir}/tests/osbuild-composer
97df7e
install -m 0755 -vp test/cases/*                                %{buildroot}%{_libexecdir}/tests/osbuild-composer/
97df7e
97df7e
install -m 0755 -vd                                             %{buildroot}%{_datadir}/tests/osbuild-composer/ansible
97df7e
install -m 0644 -vp test/data/ansible/*                         %{buildroot}%{_datadir}/tests/osbuild-composer/ansible/
478111
97df7e
install -m 0755 -vd                                             %{buildroot}%{_datadir}/tests/osbuild-composer/azure
97df7e
install -m 0644 -vp test/data/azure/*                           %{buildroot}%{_datadir}/tests/osbuild-composer/azure/
478111
97df7e
install -m 0755 -vd                                             %{buildroot}%{_datadir}/tests/osbuild-composer/manifests
97df7e
install -m 0644 -vp test/data/manifests/*                       %{buildroot}%{_datadir}/tests/osbuild-composer/manifests/
478111
97df7e
install -m 0755 -vd                                             %{buildroot}%{_datadir}/tests/osbuild-composer/cloud-init
97df7e
install -m 0644 -vp test/data/cloud-init/*                      %{buildroot}%{_datadir}/tests/osbuild-composer/cloud-init/
97df7e
97df7e
install -m 0755 -vd                                             %{buildroot}%{_datadir}/tests/osbuild-composer/composer
97df7e
install -m 0644 -vp test/data/composer/*                        %{buildroot}%{_datadir}/tests/osbuild-composer/composer/
97df7e
97df7e
install -m 0755 -vd                                             %{buildroot}%{_datadir}/tests/osbuild-composer/repositories
97df7e
install -m 0644 -vp test/data/repositories/*                    %{buildroot}%{_datadir}/tests/osbuild-composer/repositories/
97df7e
97df7e
install -m 0755 -vd                                             %{buildroot}%{_datadir}/tests/osbuild-composer/kerberos
97df7e
install -m 0644 -vp test/data/kerberos/*                        %{buildroot}%{_datadir}/tests/osbuild-composer/kerberos/
97df7e
97df7e
install -m 0755 -vd                                             %{buildroot}%{_datadir}/tests/osbuild-composer/keyring
97df7e
install -m 0644 -vp test/data/keyring/id_rsa.pub                %{buildroot}%{_datadir}/tests/osbuild-composer/keyring/
97df7e
install -m 0600 -vp test/data/keyring/id_rsa                    %{buildroot}%{_datadir}/tests/osbuild-composer/keyring/
97df7e
97df7e
install -m 0755 -vd                                             %{buildroot}%{_datadir}/tests/osbuild-composer/koji
97df7e
install -m 0644 -vp test/data/koji/*                            %{buildroot}%{_datadir}/tests/osbuild-composer/koji/
97df7e
97df7e
install -m 0755 -vd                                             %{buildroot}%{_datadir}/tests/osbuild-composer/x509
97df7e
install -m 0644 -vp test/data/x509/*                            %{buildroot}%{_datadir}/tests/osbuild-composer/x509/
478111
478111
%endif
478111
478111
%check
478111
%if 0%{?rhel}
478111
export GOFLAGS=-mod=vendor
478111
export GOPATH=$PWD/_build:%{gopath}
97df7e
# cd inside GOPATH, otherwise go with GO111MODULE=off ignores vendor directory
97df7e
cd $PWD/_build/src/%{goipath}
478111
%gotest ./...
478111
%else
478111
%gocheck
478111
%endif
478111
478111
%post
97df7e
%systemd_post osbuild-composer.service osbuild-composer.socket osbuild-composer-api.socket osbuild-remote-worker.socket
478111
478111
%preun
97df7e
%systemd_preun osbuild-composer.service osbuild-composer.socket osbuild-composer-api.socket osbuild-remote-worker.socket
478111
478111
%postun
97df7e
%systemd_postun_with_restart osbuild-composer.service osbuild-composer.socket osbuild-composer-api.socket osbuild-remote-worker.socket
478111
478111
%files
478111
%license LICENSE
478111
%doc README.md
97df7e
%{_mandir}/man7/%{name}.7*
478111
%{_unitdir}/osbuild-composer.service
478111
%{_unitdir}/osbuild-composer.socket
97df7e
%{_unitdir}/osbuild-composer-api.socket
97df7e
%{_unitdir}/osbuild-local-worker.socket
478111
%{_unitdir}/osbuild-remote-worker.socket
478111
%{_sysusersdir}/osbuild-composer.conf
478111
97df7e
%package core
97df7e
Summary:    The core osbuild-composer binary
97df7e
97df7e
%description core
97df7e
The core osbuild-composer binary. This is suitable both for spawning in containers and by systemd.
97df7e
97df7e
%files core
97df7e
%{_libexecdir}/osbuild-composer/osbuild-composer
97df7e
%{_libexecdir}/osbuild-composer/dnf-json
97df7e
%{_datadir}/osbuild-composer/
97df7e
478111
%package worker
478111
Summary:    The worker for osbuild-composer
478111
Requires:   systemd
97df7e
Requires:   qemu-img
97df7e
Requires:   osbuild >= 27.2
97df7e
Requires:   osbuild-ostree >= 27.2
478111
478111
# remove in F34
478111
Obsoletes: golang-github-osbuild-composer-worker < %{version}-%{release}
478111
Provides:  golang-github-osbuild-composer-worker = %{version}-%{release}
478111
478111
%description worker
478111
The worker for osbuild-composer
478111
478111
%files worker
478111
%{_libexecdir}/osbuild-composer/osbuild-worker
478111
%{_unitdir}/osbuild-worker@.service
478111
%{_unitdir}/osbuild-remote-worker@.service
478111
478111
%post worker
478111
%systemd_post osbuild-worker@.service osbuild-remote-worker@.service
478111
478111
%preun worker
478111
# systemd_preun uses systemctl disable --now which doesn't work well with template services.
478111
# See https://github.com/systemd/systemd/issues/15620
478111
# The following lines mimicks its behaviour by running two commands:
478111
478111
# disable and stop all the worker services
478111
systemctl --no-reload disable osbuild-worker@.service osbuild-remote-worker@.service
478111
systemctl stop "osbuild-worker@*.service" "osbuild-remote-worker@*.service"
478111
478111
%postun worker
478111
# restart all the worker services
478111
%systemd_postun_with_restart "osbuild-worker@*.service" "osbuild-remote-worker@*.service"
478111
478111
%if %{with tests} || 0%{?rhel}
478111
478111
%package tests
478111
Summary:    Integration tests
478111
Requires:   %{name} = %{version}-%{release}
478111
Requires:   composer-cli
478111
Requires:   createrepo_c
478111
Requires:   genisoimage
478111
Requires:   qemu-kvm-core
478111
Requires:   systemd-container
97df7e
Requires:   jq
97df7e
Requires:   unzip
97df7e
Requires:   container-selinux
97df7e
Requires:   dnsmasq
97df7e
Requires:   krb5-workstation
97df7e
Requires:   podman
97df7e
Requires:   python3
97df7e
Requires:   sssd-krb5
97df7e
Requires:   libvirt-client libvirt-daemon
97df7e
Requires:   libvirt-daemon-config-network
97df7e
Requires:   libvirt-daemon-config-nwfilter
97df7e
Requires:   libvirt-daemon-driver-interface
97df7e
Requires:   libvirt-daemon-driver-network
97df7e
Requires:   libvirt-daemon-driver-nodedev
97df7e
Requires:   libvirt-daemon-driver-nwfilter
97df7e
Requires:   libvirt-daemon-driver-qemu
97df7e
Requires:   libvirt-daemon-driver-secret
97df7e
Requires:   libvirt-daemon-driver-storage
97df7e
Requires:   libvirt-daemon-driver-storage-disk
97df7e
Requires:   libvirt-daemon-kvm
97df7e
Requires:   qemu-img
97df7e
Requires:   qemu-kvm
97df7e
Requires:   virt-install
97df7e
Requires:   expect
97df7e
Requires:   python3-lxml
97df7e
Requires:   httpd
97df7e
Requires:   openssl
97df7e
Requires:   podman-plugins
97df7e
%if 0%{?fedora}
97df7e
# koji and ansible are not in RHEL repositories. Depending on them breaks RHEL
97df7e
# gating (see OSCI-1541). The test script must enable EPEL and install those
97df7e
# packages manually.
97df7e
Requires:   koji
97df7e
Requires:   ansible
97df7e
%endif
478111
%ifarch %{arm}
478111
Requires:   edk2-aarch64
478111
%endif
478111
478111
%description tests
478111
Integration tests to be run on a pristine-dedicated system to test the osbuild-composer package.
478111
478111
%files tests
97df7e
%{_libexecdir}/osbuild-composer-test/
478111
%{_libexecdir}/tests/osbuild-composer/
478111
%{_datadir}/tests/osbuild-composer/
478111
478111
%endif
478111
478111
%changelog
97df7e
* Fri Apr 09 2021 Ondrej Budai <obudai@redhat.com> - 28.4-1
97df7e
- New upstream release
97df7e
97df7e
* Mon Mar 22 2021 Ondrej Budai <obudai@redhat.com> - 28.3-1
97df7e
- New upstream release
97df7e
97df7e
* Thu Mar 18 2021 Ondrej Budai <obudai@redhat.com> - 28.2-1
97df7e
- New upstream release
97df7e
97df7e
* Wed Mar 17 2021 Ondrej Budai <obudai@redhat.com> - 28.1-1
97df7e
- New upstream release
97df7e
97df7e
* Sat Feb 20 2021 Martin Sehnoutka <msehnout@redhat.com> - 28-1
97df7e
- New upstream release
97df7e
97df7e
* Fri Feb 05 2021 Ondrej Budai <obudai@redhat.com> - 27-1
97df7e
- New upstream release
97df7e
97df7e
* Thu Dec 17 2020 Ondrej Budai <obudai@redhat.com> - 26-1
97df7e
- New upstream release
97df7e
97df7e
* Mon Nov 30 2020 Ondrej Budai <obudai@redhat.com> - 25-1
97df7e
- New upstream release 25 (rhbz#1883481)
97df7e
478111
* Thu Sep 03 2020 Tom Gundersen <tgunders@redhat.com> - 20.1-1
478111
- New upstream release 20.1 (rhbz#1872370)
478111
478111
* Sun Aug 23 2020 Tom Gundersen <tgunders@redhat.com> - 20-1
478111
- New upstream release 20 (rhbz#1871184 and rhbz#1871179)
478111
478111
* Thu Aug 13 2020 Tom Gundersen <tgunders@redhat.com> - 19-1
478111
- New upstream release 19 (rhbz#1866015 and rhbz#1866013)
478111
478111
* Thu Jul 09 2020 Ondrej Budai <obudai@redhat.com> - 17-1
478111
- New upstream release 17 (rhbz#1831653)
478111
- Obsolete lorax-composer in favor of osbuild-composer (rhbz#1836844)
478111
478111
* Mon Jun 29 2020 Ondrej Budai <obudai@redhat.com> - 16-1
478111
- New upstream release 16 (rhbz#1831653)
478111
478111
* Fri Jun 12 2020 Ondrej Budai <obudai@redhat.com> - 15-1
478111
- New upstream release 15 (rhbz#1831653)
478111
478111
* Thu Jun 04 2020 Ondrej Budai <obudai@redhat.com> - 14-1
478111
- New upstream release 14 (rhbz#1831653)
478111
478111
* Thu May 28 2020 Ondrej Budai <obudai@redhat.com> - 13-1
478111
- New upstream release 13 (rhbz#1831653)
478111
478111
* Tue May 05 2020 Ondrej Budai <obudai@redhat.com> - 11-1
478111
- Initial package (renamed from golang-github-osbuild-composer) (rhbz#1771887)