File golang-packaging.spec of Package golang-packaging

#
# spec file for package golang-packaging
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%{?!_rpmmacrodir:%define _rpmmacrodir /etc/rpm}

Name:           golang-packaging
Version:        1709890831.4ba1f49
Release:        0
Summary:        A toolchain to help packaging golang
License:        GPL-3.0-only
Group:          Development/Languages/Golang
URL:            https://github.com/openSUSE/%{name}
Source0:         %{name}-%{version}.tar.xz
Source1:         golang-src-macros.sh

BuildRequires:  rpm
BuildRequires:  xz
Requires:       go
Requires:       awk
Requires:       sed
Requires:       jq
BuildArch:      noarch

%description
A toolchain to help packaging golang, written in bash.

%prep
%setup -q

%build

%install
mkdir -p %{buildroot}%{_rpmmacrodir}
mkdir -p %{buildroot}%{_rpmconfigdir}

install -m0755 golang.prov %{buildroot}%{_rpmconfigdir}
install -m0755 golang.req %{buildroot}%{_rpmconfigdir}
install -m0755 golang.sh %{buildroot}%{_rpmconfigdir}
install -m0755 %SOURCE1 %{buildroot}%{_rpmconfigdir}
install -m0644 macros.go %{buildroot}%{_rpmmacrodir}

echo "%%golang_filelist %{_rpmconfigdir}/golang-src-macros.sh filelist" >> %{buildroot}%{_rpmmacrodir}/macros.go
echo "%%golang_src_install %{_rpmconfigdir}/golang-src-macros.sh install" >> %{buildroot}%{_rpmmacrodir}/macros.go

%if 0%{?suse_version} >= 1320
mkdir -p %{buildroot}%{_rpmconfigdir}/fileattrs
install -m0644 golang.attr %{buildroot}%{_rpmconfigdir}/fileattrs/
%endif

%files
%defattr(-,root,root)
%doc README.md CHANGELOG
%license COPYING
%{_rpmconfigdir}/golang.prov
%{_rpmconfigdir}/golang.req
%{_rpmconfigdir}/golang.sh
%{_rpmconfigdir}/golang-src-macros.sh
%{_rpmmacrodir}/macros.go

%if 0%{?suse_version} >= 1320
%{_rpmconfigdir}/fileattrs/golang.attr
%endif

%changelog
openSUSE Build Service is sponsored by