diff --git a/go-rpm-macros.spec b/go-rpm-macros.spec index 21cc29df17aec27cd9421aee85d75399b7921084..25292f9000f8c60cda805832535d022b12c2ac72 100644 --- a/go-rpm-macros.spec +++ b/go-rpm-macros.spec @@ -1,11 +1,10 @@ -%define anolis_release 2 +%define anolis_release 3 %bcond_with golist -%global _spectemplatedir %{_datadir}/rpmdevtools/anolis -%global _docdir_fmt %{name} - %global golang_arches x86_64 aarch64 %global gopath %{_datadir}/gocode +%global _spectemplatedir %{_datadir}/rpmdevtools/anolis +%global _docdir_fmt %{name} ExclusiveArch: %{golang_arches} @@ -13,46 +12,27 @@ Name: go-rpm-macros Version: 3.0.15 Release: %{anolis_release}%{?dist} Summary: Build-stage rpm automation for Go packages - License: GPLv3+ -URL: https://pagure.io/go-rpm-macros -Source: https://pagure.io/go-rpm-macros/archive/%{version}/%{name}-%{version}.tar.gz +URL: https://pagure.io/%{name} +Source: https://pagure.io/%{name}/archive/%{version}/%{name}-%{version}.tar.gz + Patch1: 0001-modify-for-anolis.patch -Requires: go-srpm-macros = %{version}-%{release} -Requires: go-filesystem = %{version}-%{release} +Requires: go-srpm-macros = %{version}-%{release} go-filesystem = %{version}-%{release} %if %{with golist} Requires: golist %endif %ifarch %{golang_arches} Requires: golang -Provides: compiler(golang) -Provides: compiler(go-compiler) = 2 +Provides: compiler(golang) compiler(go-compiler) = 2 Obsoletes: go-compilers-golang-compiler < %{version}-%{release} %endif %description -This package provides build-stage rpm automation to simplify the creation of Go -language (golang) packages. - -It does not need to be included in the default build root: go-srpm-macros will -pull it in for Go packages only. - -%package -n go-srpm-macros -Summary: Source-stage rpm automation for Go packages -BuildArch: noarch -Requires: system-rpm-config - -%description -n go-srpm-macros -This package provides SRPM-stage rpm automation to simplify the creation of Go -language (golang) packages. - -It limits itself to the automation subset required to create Go SRPM packages -and needs to be included in the default build root. - -The rest of the automation is provided by the go-rpm-macros package, that -go-srpm-macros will pull in for Go packages only. +The %{name} provides build-stage rpm automation to simplify the creation of +Go language packages. The %{name} project provides files needed to automate +Go rpm packaging. %package -n go-filesystem Summary: Directories used by Go packages @@ -65,14 +45,31 @@ This package contains the basic directory layout used by Go packages. Summary: RPM spec templates for Go packages License: MIT BuildArch: noarch -Requires: go-rpm-macros = %{version}-%{release} +Requires: %{name} = %{version}-%{release} %description -n go-rpm-templates -This package contains documented rpm spec templates showcasing how to use the -macros provided by go-rpm-macros to create Go packages. +This package contains the template of the RPM specification file that records +how to use the macros provided by %{name} to create a Go package. + +%package -n go-srpm-macros +Summary: Source-stage rpm automation for Go packages +BuildArch: noarch +Requires: system-rpm-config + +%description -n go-srpm-macros +This package provides SRPM-stage rpm automation to simplify the creation of Go +language packages. The go-srpm-macros will pull in for Go packages only. + +%package doc +Summary: Documentation files for %{name} +Requires: %{name} = %{version}-%{release} +BuildArch: noarch + +%description doc +The %{name}-doc package contains documentation files for %{name}. %prep -%forgeautosetup -p1 +%autosetup -n %{name}-%{version} -p1 %writevars -f rpm/macros.d/macros.go-srpm golang_arches gopath for template in templates/rpm/*\.spec ; do target=$(echo "${template}" | sed "s|^\(.*\)\.spec$|\1-bare.spec|g") @@ -81,6 +78,12 @@ for template in templates/rpm/*\.spec ; do done %install +install -m 0755 -vd %{buildroot}%{_rpmluadir}/anolis/srpm +install -m 0644 -vp rpm/lua/srpm/*lua \ + %{buildroot}%{_rpmluadir}/anolis/srpm +install -m 0755 -vd %{buildroot}%{_rpmluadir}/anolis/rpm +install -m 0644 -vp rpm/lua/rpm/*lua \ + %{buildroot}%{_rpmluadir}/anolis/rpm install -m 0755 -vd %{buildroot}%{gopath}/src install -m 0755 -vd %{buildroot}%{_spectemplatedir} install -m 0644 -vp templates/rpm/*spec \ @@ -90,12 +93,6 @@ install -m 0755 bin/* %{buildroot}%{_bindir} install -m 0755 -vd %{buildroot}%{rpmmacrodir} install -m 0644 -vp rpm/macros.d/macros.go-* \ %{buildroot}%{rpmmacrodir} -install -m 0755 -vd %{buildroot}%{_rpmluadir}/anolis/srpm -install -m 0644 -vp rpm/lua/srpm/*lua \ - %{buildroot}%{_rpmluadir}/anolis/srpm -install -m 0755 -vd %{buildroot}%{_rpmluadir}/anolis/rpm -install -m 0644 -vp rpm/lua/rpm/*lua \ - %{buildroot}%{_rpmluadir}/anolis/rpm install -m 0755 -vd %{buildroot}%{_rpmconfigdir}/fileattrs install -m 0644 -vp rpm/fileattrs/*.attr \ %{buildroot}%{_rpmconfigdir}/fileattrs/ @@ -109,33 +106,36 @@ install -m 0644 -vp rpm/macros.d/macros.go-compilers-golang \ %files %license LICENSE.txt -%doc README.md %{_bindir}/* %{_rpmconfigdir}/fileattrs/*.attr -%{_rpmconfigdir}/*.prov -%{_rpmconfigdir}/*.deps %{_rpmconfigdir}/macros.d/macros.go-rpm* %{_rpmconfigdir}/macros.d/macros.go-compiler* +%{_rpmconfigdir}/*.prov +%{_rpmconfigdir}/*.deps %{_rpmluadir}/anolis/rpm/*.lua -%files -n go-srpm-macros -%license LICENSE.txt -%doc README.md -%{_rpmconfigdir}/macros.d/macros.go-srpm -%{_rpmluadir}/anolis/srpm/*.lua - %files -n go-filesystem %dir %{gopath} %dir %{gopath}/src %files -n go-rpm-templates %license LICENSE-templates.txt -%doc README.md %dir %{dirname:%{_spectemplatedir}} %dir %{_spectemplatedir} %{_spectemplatedir}/*.spec +%files -n go-srpm-macros +%license LICENSE.txt +%{_rpmconfigdir}/macros.d/macros.go-srpm +%{_rpmluadir}/anolis/srpm/*.lua + +%files doc +%doc README.md + %changelog +* Wed Apr 12 2023 Jing Zhang - 3.0.15-3 +- Refact spec + * Fri Mar 31 2023 happy_orange - 3.0.15-2 - remove golist in requires