forked from bitly/oauth2_proxy
-
Notifications
You must be signed in to change notification settings - Fork 136
/
oauth-proxy.spec
74 lines (62 loc) · 2.53 KB
/
oauth-proxy.spec
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
# /!\ This file is maintained at https://github.com/openshift/oauth-proxy
%global debug_package %{nil}
%global snapshot 1
%if ! 0%{?gobuild:1}
%define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
%endif
%global provider github
%global provider_tld com
%global project openshift
%global repo oauth-proxy
# https://github.com/openshift/oauth-proxy
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path %{provider_prefix}
# %commit is intended to be set by tito. The values in this spec file will not be kept up to date.
%{!?commit:
%global commit 57b6863264c89307830fccadf2f122e5cea3d2a0
}
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global gopathdir %{_sourcedir}/go
%global upstream_ver 2.3
%global rpm_ver %(v=%{upstream_ver}; echo ${v//-/_})
%global download_prefix %{provider}.%{provider_tld}/openshift/%{repo}
Name: golang-%{provider}-%{project}-%{repo}
# Version and release information will be automatically managed by CD
# It will be kept in sync with OCP builds.
Version: %{rpm_ver}
Release: 1.git%{shortcommit}%{?dist}
Summary: A reverse proxy that provides authentication with OpenShift and other OAuth providers
License: MIT
URL: https://%{provider}.%{provider_tld}/%{project}/%{repo}
Source0: https://%{download_prefix}/archive/%{commit}/%{repo}-%{commit}.tar.gz
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
ExclusiveArch: %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm} ppc64le s390x}
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
Provides: %{repo} = %{version}-%{release}
%description
%{summary}
%prep
%setup -q -n %{repo}-%{commit}
%build
# Go expects a full path to the sources which is not included in the source
# tarball so create a link with the expected path
mkdir -p %{gopathdir}/src/%{provider}.%{provider_tld}/%{project}
GOSRCDIR=%{gopathdir}/src/%{import_path}
if [ ! -e "$GOSRCDIR" ]; then
ln -s `pwd` "$GOSRCDIR"
fi
export GOPATH=%{gopathdir}
# Ensure the default GOBIN is used ${GOPATH}/bin
# unset GOBIN // needed?
export LDFLAGS='-s -w'
%gobuild %{import_path}
%install
install -d %{buildroot}%{_bindir}
install -D -p -m 0755 %{repo} %{buildroot}/%{_bindir}/%{repo}
%files
%license LICENSE
%{_bindir}/%{repo}
%changelog
* Thu Apr 12 2018 Simo Sorce <simo@redhat.com> - 2.3-1.git57b68632
- New release