|
1 |
| -%global debug_package %{nil} |
| 1 | +# /!\ This file is maintained at https://github.com/openshift/oauth-proxy |
| 2 | +%global debug_package %{nil} |
2 | 3 | %global snapshot 1
|
3 | 4 |
|
4 | 5 | %if ! 0%{?gobuild:1}
|
5 | 6 | %define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
|
6 | 7 | %endif
|
7 | 8 |
|
8 |
| -%global provider github |
9 |
| -%global provider_tld com |
10 |
| -%global project openshift |
11 |
| -%global repo oauth-proxy |
12 |
| -# github.com/openshift/oauth-proxy |
13 |
| -%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} |
14 |
| -%global import_path %{provider_prefix} |
15 |
| -%global build_gopath %{_builddir}/%{repo}-gopath |
16 |
| -%global source https://%{provider_prefix}/archive/%{repo} |
17 |
| - |
18 |
| -Name: golang-%{provider}-%{project}-%{repo} |
19 |
| -Version: 2.3 |
20 |
| -Release: 1.%{?dist} |
| 9 | +%global provider github |
| 10 | +%global provider_tld com |
| 11 | +%global project openshift |
| 12 | +%global repo oauth-proxy |
| 13 | +# https://github.com/openshift/oauth-proxy |
| 14 | +%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} |
| 15 | +%global import_path %{provider_prefix} |
| 16 | +# %commit is intended to be set by tito. The values in this spec file will not be kept up to date. |
| 17 | +%{!?commit: |
| 18 | +%global commit 57b6863264c89307830fccadf2f122e5cea3d2a0 |
| 19 | +} |
| 20 | +%global shortcommit %(c=%{commit}; echo ${c:0:7}) |
| 21 | +%global gopathdir %{_sourcedir}/go |
| 22 | +%global upstream_ver 2.3 |
| 23 | +%global rpm_ver %(v=%{upstream_ver}; echo ${v//-/_}) |
| 24 | +%global download_prefix %{provider}.%{provider_tld}/openshift/%{repo} |
| 25 | + |
| 26 | +Name: golang-%{provider}-%{project}-%{repo} |
| 27 | +# Version and release information will be automatically managed by CD |
| 28 | +# It will be kept in sync with OCP builds. |
| 29 | +Version: %{rpm_ver} |
| 30 | +Release: 1.git%{shortcommit}%{?dist} |
21 | 31 | Summary: A reverse proxy that provides authentication with OpenShift and other OAuth providers
|
22 | 32 | License: MIT
|
23 |
| -URL: https://%{provider}.%{provider_tld}/%{project}/%{repo} |
24 |
| -Source0: ${source}.tar.gz |
| 33 | +URL: https://%{provider}.%{provider_tld}/%{project}/%{repo} |
| 34 | +Source0: https://%{download_prefix}/archive/%{commit}/%{repo}-%{commit}.tar.gz |
25 | 35 |
|
26 | 36 | # e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
|
27 | 37 | ExclusiveArch: %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm} ppc64le s390x}
|
28 |
| -BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} |
| 38 | +# If go_compiler is not set to 1, there is no virtual provide. Use golang instead. |
| 39 | +BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} |
29 | 40 |
|
30 |
| -Provides: %{repo} = %{version}-%{release} |
| 41 | +Provides: %{repo} = %{version}-%{release} |
31 | 42 |
|
32 | 43 | %description
|
33 | 44 | %{summary}
|
34 | 45 |
|
35 | 46 | %prep
|
36 |
| -%setup -q -n %{source} |
| 47 | +%setup -q -n %{repo}-%{commit} |
37 | 48 |
|
38 | 49 | %build
|
39 |
| -mkdir -p %{build_gopath}/src/%{provider}.%{provider_tld}/%{project} |
40 |
| -ln -s %{_builddir}/%{source} %{build_gopath}/src/%{import_path} |
| 50 | +# Go expects a full path to the sources which is not included in the source |
| 51 | +# tarball so create a link with the expected path |
| 52 | +mkdir -p %{gopathdir}/src/%{provider}.%{provider_tld}/%{project} |
| 53 | +GOSRCDIR=%{gopathdir}/src/%{import_path} |
| 54 | +if [ ! -e "$GOSRCDIR" ]; then |
| 55 | + ln -s `pwd` "$GOSRCDIR" |
| 56 | +fi |
| 57 | +export GOPATH=%{gopathdir} |
41 | 58 |
|
42 | 59 | # Ensure the default GOBIN is used ${GOPATH}/bin
|
43 |
| -unset GOBIN |
44 |
| -export GOPATH=%{build_gopath} |
| 60 | +# unset GOBIN // needed? |
45 | 61 | export LDFLAGS='-s -w'
|
46 | 62 | %gobuild %{import_path}
|
47 | 63 |
|
|
0 commit comments