Blob Blame History Raw
# Generated by go2rpm 1.15.0.post0
%bcond check 1

# https://github.com/moby/buildkit
%global goipath         github.com/moby/buildkit
Version:                0.22.0
%global tag             v%{gsub %{version} ~ -}

%gometa -L -f

%global common_description %{expand:
Concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit.}

Name:           docker-buildkit
Release:        %autorelease
Summary:        Concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit

# Generated by go-vendor-tools
License:        Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0
URL:            %{gourl}
Source0:        %{gosource}
# Generated by go-vendor-tools
Source1:        %{archivename}-vendor.tar.bz2
Source2:        go-vendor-tools.toml

BuildRequires:  go-vendor-tools >= 0.7.0
BuildRequires:  git
BuildRequires:  golang-github-distribution-3

# Upstream binary package includes the package equivalents below
Requires:       containerd
Requires:       runc
Requires:       containernetworking-plugins
Recommends:     qemu-user-static

Provides:       golang-github-moby-buildkit = %{version}-%{release}
Obsoletes:      golang-github-moby-buildkit < 0.12.0-1

%description %{common_description}

%prep
%goprep -A
%setup -q -T -D -a1 %{forgesetupargs}
# no patch file at this time
# %%autopatch -p1

%generate_buildrequires
%go_vendor_license_buildrequires -c %{S:2}

%build

# see upstream Dockerfile for any changes to buildtags or ldflags
%global buildtags   seccomp
%global specldflags -X %{goipath}/version.Version=%{version} -X %{goipath}/version.Revision=%{release} -X %{goipath}/version.Package=%{goipath}

export GO_BUILDTAGS="%{buildtags}"
export GO_LDFLAGS="%{specldflags}"

# set currentgoldflags to nil; blocks default -X version string
# %%global currentgoldflags   %%{specldflags}

for cmd in cmd/* ; do
  %gobuild -o %{gobuilddir}/bin/$(basename $cmd) %{goipath}/$cmd
done

%install
%go_vendor_license_install -c %{S:2}
install -m 0755 -vd                     %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/

%check
%go_vendor_license_check -c %{S:2}
%if %{with check}
# skip specific tests that fail with 'operation not permitted'.
for test in \
           "TestGetRemotes" \
           "TestExtractOnMutable" \
           "TestMergeOp" \
           "TestDiffOp" \
           "TestCLIIntegration" \
           "TestSnapshotExtract" \
           "TestJobsIntegration" \
           "TestGhaCacheIntegration" \
; do
awk -i inplace '/^func.*'"$test"'\(/ { print; print "\tt.Skip(\"disabled failing test\")"; next}1' $(grep -rl $test)
done

# tags and ldflags defined to mimic build settings
# currentgoldflags is reset under check and ignores being set check
# use LDFLAGS
export LDFLAGS="%{specldflags}"
%define gotestflags       %{gocompilerflags} -tags "%{buildtags}"

# exclude directories where tests fail with 'operation not permitted' errors
%gocheck -d cache/contenthash -t source -d client -d frontend -t frontend/dockerfile -d snapshot -t util/overlay
%endif

%files -f %{go_vendor_license_filelist}
%license vendor/modules.txt
%doc docs examples AUTHORS README.md
%{_bindir}/buildctl
%{_bindir}/buildkitd


%changelog
%autochangelog