Simplify golist tarball unpacking

We should unpack into %{buildsubdir} instead of creating other
directories under %{_builddir} that won't be properly cleaned up. Also,
this generally simplifies the specfile.
This commit is contained in:
Maxwell G 2023-06-22 18:06:38 +00:00 committed by Yaakov Selkowitz
parent 21968bfa69
commit a6615a38f6

View File

@ -29,7 +29,7 @@ Version: 3.2.0
%if 0%{?bundle_golist}
# do not create debuginfo packages when we add a build section
%global debug_package %{nil}
%global golist_builddir %{_builddir}/golist-%{golist_version}
%global golist_builddir golist-%{golist_version}
%global golist_goipath pagure.io/golist
# where to bundle the golist executable
%global golist_execdir %{_libexecdir}/go-rpm-macros
@ -119,7 +119,7 @@ This package contains documented rpm spec templates showcasing how to use the
macros provided by go-rpm-macros to create Go packages.
%prep
%forgeautosetup -p1
%autosetup -p1 %{forgesetupargs} -a1
%writevars -f rpm/macros.d/macros.go-srpm golang_arches golang_arches_future gccgo_arches gopath
for template in templates/rpm/*\.spec ; do
target=$(echo "${template}" | sed "s|^\(.*\)\.spec$|\1-bare.spec|g")
@ -129,13 +129,8 @@ done
# unpack golist and vendor deps
%if 0%{?bundle_golist}
pushd %{_builddir}
tar -xf %{SOURCE1}
cd golist-%{golist_version}
tar -xf %{SOURCE2}
cp %{_builddir}/golist-%{golist_version}/LICENSE %{_builddir}/go-rpm-macros-%{version}/LICENSE-golist
cp %{_builddir}/golist-%{golist_version}/vendor/modules.txt %{_builddir}/go-rpm-macros-%{version}/modules.txt
popd
tar -C %{golist_builddir} -xf %{SOURCE2}
cp %{golist_builddir}/LICENSE LICENSE-golist
%endif
%build
@ -143,7 +138,7 @@ popd
%if 0%{?bundle_golist}
pushd %{golist_builddir}
for cmd in cmd/* ; do
%gobuild -o %{golist_builddir}/bin/$(basename $cmd) ./$cmd
%gobuild -o bin/$(basename $cmd) ./$cmd
done
popd
%endif
@ -207,7 +202,10 @@ sed -i "s,golist ,%{golist_execdir}/golist ,g" \
%ifarch %{golang_arches} %{gccgo_arches}
%files
%license LICENSE.txt %{?bundle_golist:LICENSE-golist modules.txt}
%license LICENSE.txt
%if %{defined bundle_golist}
%license LICENSE-golist %{golist_builddir}/vendor/modules.txt
%endif
%doc README.md
%{_bindir}/*
%{_rpmconfigdir}/fileattrs/*.attr