Skip to content

Commit 482ff60

Browse files
Use %setup macros for containerd.
This is a pre-requisite for building a containerd package for Fedora 45. Signed-off-by: Romain Geissler <romain.geissler@amadeus.com>
1 parent 43c9ca8 commit 482ff60

1 file changed

Lines changed: 18 additions & 20 deletions

File tree

‎pkg/containerd/rpm/containerd.spec‎

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ AutoReq: no
2323
%global debug_package %{nil}
2424
%endif
2525

26-
%define SHA256SUM0 08f057ece7e518b14cce2e9737228a5a899a7b58b78248a03e02f4a6c079eeaf
27-
%global import_path github.com/containerd/containerd
28-
%global gopath %{getenv:GOPATH}
29-
3026
Name: containerd.io
3127
Provides: containerd
3228
# For some reason on rhel >= 8 if we "provide" runc then it makes this package unsearchable
@@ -79,37 +75,38 @@ low-level storage and network attachments, etc.
7975

8076

8177
%prep
82-
rm -rf %{_builddir}
83-
if [ ! -d %{_sourcedir}/containerd ]; then
84-
# Copy over our source code from our gopath to our source directory
85-
cp -rf /go/src/%{import_path} %{_sourcedir}/containerd;
86-
fi
87-
# symlink the go source path to our build directory
88-
ln -s /go/src/%{import_path} %{_builddir}
78+
# Extract containerd (Source0).
79+
%setup -q -c -n src -a 0
80+
# Extract runc (Source3).
81+
%setup -q -c -n src -a 3
8982

90-
if [ ! -d %{_sourcedir}/runc ]; then
91-
# Copy over our source code from our gopath to our source directory
92-
cp -rf /go/src/github.com/opencontainers/runc %{_sourcedir}/runc
93-
fi
94-
cd %{_builddir}
83+
%build
84+
mkdir -p /go/src/github.com/containerd
85+
rm -rf /go/src/github.com/containerd/containerd
86+
ln -snf ${RPM_BUILD_DIR}/src/containerd /go/src/github.com/containerd/containerd
9587

88+
mkdir -p /go/src/github.com/opencontainers
89+
rm -rf /go/src/github.com/opencontainers/runc
90+
ln -snf ${RPM_BUILD_DIR}/src/runc /go/src/github.com/opencontainers/runc
9691

97-
%build
98-
cd %{_builddir}
92+
pushd ${RPM_BUILD_DIR}/src/containerd
9993
GO111MODULE=auto make man
100-
GO111MODULE=auto make -C /go/src/%{import_path} VERSION=%{_origversion} REVISION=%{_commit} PACKAGE=%{getenv:PKG_NAME} BUILDTAGS="%{getenv:BUILDTAGS}"
94+
GO111MODULE=auto make -C /go/src/github.com/containerd/containerd VERSION=%{_origversion} REVISION=%{_commit} PACKAGE=%{getenv:PKG_NAME} BUILDTAGS="%{getenv:BUILDTAGS}"
10195

10296
# Remove containerd-stress, as we're not shipping it as part of the packages
10397
rm -f bin/containerd-stress
10498
bin/containerd --version
10599
bin/ctr --version
100+
popd
106101

102+
pushd ${RPM_BUILD_DIR}/src/runc
107103
# Use runc's pathrs-lite backend until supported distributions package libpathrs.
108104
GO111MODULE=auto make -C /go/src/github.com/opencontainers/runc BINDIR=%{_builddir}/bin RUNC_BUILDTAGS="-libpathrs" runc install
105+
popd
109106

110107

111108
%install
112-
cd %{_builddir}
109+
pushd ${RPM_BUILD_DIR}/src/containerd
113110
mkdir -p %{buildroot}%{_bindir}
114111
install -D -p -m 0755 bin/* %{buildroot}%{_bindir}
115112
install -D -p -m 0644 %{S:1} %{buildroot}%{_unitdir}/containerd.service
@@ -122,6 +119,7 @@ for i in $(seq 1 8); do
122119
install -p -m 644 man/*.${i} %{buildroot}%{_mandir}/man${i};
123120
fi
124121
done
122+
popd
125123

126124
%post
127125
%systemd_post containerd.service

0 commit comments

Comments
 (0)