summaryrefslogtreecommitdiffstats
path: root/meta/golang-entgo-ent.spec
blob: d68b0adeb90a6af9177919384ed1a5f0c19b72e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Generated by go2rpm 1.6.0
%bcond_without check

# https://github.com/ent/ent
%global goipath         entgo.io/ent
%global forgeurl        https://github.com/ent/ent
Version:                0.10.0

%gometa

# this was previously golang-github-facebook-ent
%global goaltipaths     github.com/facebook/ent

%global common_description %{expand:
An entity framework for Go.}

%global golicenses      LICENSE
%global godocs          doc examples README.md README_jp.md\\\
                        CODE_OF_CONDUCT.md CONTRIBUTING.md README_zh.md\\\
                        entc/integration/README.md doc

Name:           %{goname}
Release:        %autorelease
Summary:        An entity framework for Go

# Upstream license specification: Apache-2.0
License:        ASL 2.0
URL:            %{gourl}
Source:         %{gosource}

# multiple tests have 32-bit issues, upstream does not test on it
ExcludeArch:    %{ix86}

BuildRequires:  golang(github.com/go-openapi/inflect)
BuildRequires:  golang(github.com/google/uuid)
BuildRequires:  golang(github.com/gorilla/websocket)
BuildRequires:  golang(github.com/json-iterator/go)
BuildRequires:  golang(github.com/mattn/go-sqlite3)
BuildRequires:  golang(github.com/mitchellh/mapstructure)
BuildRequires:  golang(github.com/modern-go/reflect2)
BuildRequires:  golang(github.com/olekukonko/tablewriter)
BuildRequires:  golang(github.com/pkg/errors)
BuildRequires:  golang(github.com/spf13/cobra)
BuildRequires:  golang(go.opencensus.io/stats)
BuildRequires:  golang(go.opencensus.io/stats/view)
BuildRequires:  golang(go.opencensus.io/tag)
BuildRequires:  golang(go.opencensus.io/trace)
BuildRequires:  golang(golang.org/x/sync/errgroup)
BuildRequires:  golang(golang.org/x/sync/semaphore)
BuildRequires:  golang(golang.org/x/tools/go/packages)
BuildRequires:  golang(golang.org/x/tools/imports)

%if %{with check}
# Tests
BuildRequires:  golang(github.com/DATA-DOG/go-sqlmock)
BuildRequires:  golang(github.com/jessevdk/go-flags)
BuildRequires:  golang(github.com/json-iterator/go)
BuildRequires:  golang(github.com/stretchr/testify/assert)
BuildRequires:  golang(github.com/stretchr/testify/mock)
BuildRequires:  golang(github.com/stretchr/testify/require)
BuildRequires:  golang(golang.org/x/tools/go/packages/packagestest)
%endif

# manually-added BRs
BuildRequires:  golang(ariga.io/atlas/sql/migrate)
BuildRequires:  golang(ariga.io/atlas/sql/mysql)
BuildRequires:  golang(ariga.io/atlas/sql/postgres)
BuildRequires:  golang(ariga.io/atlas/sql/schema)
BuildRequires:  golang(ariga.io/atlas/sql/sqlite)


%description
%{common_description}

%gopkg

%prep
%goprep
# rename integration doc to avoid name clash
mv entc/integration/README.md entc/integration/README-integration.md

%generate_buildrequires

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

%install
%gopkginstall
install -m 0755 -vd                     %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/

%if %{with check}
%check
# remove failing tests
rm entc/internal/snapshot_test.go
rm entc/load/load_test.go
%gocheck
%endif

%files
%license LICENSE
%doc doc examples README.md README_jp.md CODE_OF_CONDUCT.md CONTRIBUTING.md
%doc README_zh.md entc/integration/README-integration.md doc
%{_bindir}/*

%gopkgfiles

%changelog
%autochangelog