# Generated by go2rpm
# https://github.com/google/starlark-go/issues/335
%ifnarch %{arm} %{ix86}
%bcond_without check
%endif

# Avoid noarch package built differently on different architectures
%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^golang\\(golang.org/x/sys/unix\\)$

# https://github.com/google/starlark-go
%global goipath             go.starlark.net
%global forgeurl            https://github.com/google/starlark-go
%global commit              e81fc95f7bd5bb1495fe69f27c1a99fcc77caa48

%gometa

%global common_description %{expand:
Starlark is a dialect of Python intended for use as a configuration language.
Like Python, it is an untyped dynamic language with high-level data types,
first-class functions with lexical scope, and garbage collection. Unlike
CPython, independent Starlark threads execute in parallel, so Starlark
workloads scale well on parallel machines. Starlark is a small and simple
language with a familiar and highly readable syntax. You can use it as an
expressive notation for structured data, defining functions to eliminate
repetition, or you can use it to add scripting capabilities to an existing
application.}

%global golicenses          LICENSE
%global godocs              *.md

%global gosupfiles      ${star[@]}

Name:           %{goname}
Version:        0
Release:        0.9%{?dist}
Summary:        Dialect of Python intended for use as a configuration language

# A couple of test files are under the Apache License 2.0
License:        BSD and ASL 2.0
URL:            %{gourl}
Source0:        %{gosource}

BuildRequires:  golang(github.com/chzyer/readline)
BuildRequires:  golang(golang.org/x/sys/unix)
BuildRequires:  golang(google.golang.org/protobuf/encoding/protojson)
BuildRequires:  golang(google.golang.org/protobuf/encoding/prototext)
BuildRequires:  golang(google.golang.org/protobuf/proto)
BuildRequires:  golang(google.golang.org/protobuf/reflect/protodesc)
BuildRequires:  golang(google.golang.org/protobuf/reflect/protoreflect)
BuildRequires:  golang(google.golang.org/protobuf/reflect/protoregistry)
BuildRequires:  golang(google.golang.org/protobuf/types/descriptorpb)
BuildRequires:  golang(google.golang.org/protobuf/types/dynamicpb)

# The tests fail when using more than one path in the GOPATH
Patch0001:      fix_tests.patch

%description
%{common_description}

%gopkg

%prep
%goprep
%patch0001 -p1

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

%install
mapfile -t star <<< $(find . -name "*.star" -type f)
%gopkginstall
install -m 0755 -vd                     %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/

%if %{with check}
%check
%gocheck
%endif

%files
%license %{golicenses}
%doc %{godocs}
%{_bindir}/*

%gopkgfiles

%changelog
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Tue Jul 19 2022 Maxwell G <gotmax@e.email> - 0-0.8
- Rebuild for CVE-2022-{1705,32148,30631,30633,28131,30635,30632,30630,1962} in
  golang

* Sat Jun 18 2022 Robert-André Mauchin <zebob.m@gmail.com> - 0-0.7
- Rebuilt for CVE-2022-1996, CVE-2022-24675, CVE-2022-28327, CVE-2022-27191,
  CVE-2022-29526, CVE-2022-30629

* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Wed Jan 13 22:34:45 CET 2021 Robert-André Mauchin <zebob.m@gmail.com> - 0-0.3.20210113gite81fc95
- Bump to commit e81fc95f7bd5bb1495fe69f27c1a99fcc77caa48

* Mon Aug 17 14:27:43 CEST 2020 Robert-André Mauchin <zebob.m@gmail.com> - 0-0.2.20190817git4379bb3
- Add star files

* Mon Jun 22 2020 Álex Sáez <asm@redhat.com> - 0-0.1.20190817git4379bb3
- First package for Fedora