Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
686
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
RPM Spec 10.63 KB | None | 0 0
  1. %if 0%{?fedora}
  2. %global with_devel 1
  3. # no bundled dependencies so far
  4. %global with_bundled 0
  5. %global with_debug 1
  6. %global with_check 1
  7. %else
  8. %global with_devel 0
  9. # no bundled dependencies so far
  10. %global with_bundled 0
  11. %global with_debug 0
  12. %global with_check 0
  13. %endif
  14.  
  15. %if 0%{?with_debug}
  16. %global _dwz_low_mem_die_limit 0
  17. %else
  18. %global debug_package   %{nil}
  19. %endif
  20.  
  21. %if ! 0%{?gobuild:1}
  22. %define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
  23. %endif
  24.  
  25. %global provider        github
  26. %global provider_tld    com
  27. %global project         hashicorp
  28. %global repo            consul
  29. # https://github.com/hashicorp/consul
  30. %global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
  31. %global import_path     %{provider_prefix}
  32. %global commit          46499d6e7237ca8547c15ce44e9b93bea48a455b
  33. %global shortcommit     %(c=%{commit}; echo ${c:0:7})
  34.  
  35. Name:           consul
  36. Version:        0.6.0
  37. Release:        0.6.git%{shortcommit}%{?dist}
  38. Summary:        Tool for service discovery, monitoring and configuration http://www.consul.io
  39. License:        MPLv2.0
  40. URL:            https://%{provider_prefix}
  41. Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
  42.  
  43. # e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
  44. ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm}}
  45. # If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
  46. BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
  47.  
  48. %if ! 0%{?with_bundled}
  49. # commands.go
  50. #BuildRequires: golang(github.com/mitchellh/cli)
  51. BuildRequires: golang-github-mitchellh-cli-devel-temporary
  52.  
  53. # main.go
  54. #BuildRequires: golang(github.com/mitchellh/cli)
  55. BuildRequires: golang-github-mitchellh-cli-devel-temporary
  56. %endif
  57.  
  58. %description
  59. %{summary}
  60.  
  61. %if 0%{?with_devel} || ! 0%{?with_bundled}
  62. %package -n golang-%{provider}-%{project}-%{repo}-devel
  63. Summary:       %{summary}
  64. BuildArch:      noarch
  65.  
  66. %if 0%{?with_check} && ! 0%{?with_bundled}
  67. BuildRequires: golang(github.com/armon/circbuf)
  68. BuildRequires: golang(github.com/armon/go-metrics)
  69. BuildRequires: golang(github.com/armon/go-metrics/datadog)
  70. BuildRequires: golang(github.com/armon/go-radix)
  71. BuildRequires: golang(github.com/fsouza/go-dockerclient)
  72. BuildRequires: golang(github.com/hashicorp/go-checkpoint)
  73. BuildRequires: golang(github.com/hashicorp/go-cleanhttp)
  74. BuildRequires: golang(github.com/hashicorp/go-memdb)
  75. BuildRequires: golang(github.com/hashicorp/go-msgpack/codec)
  76. BuildRequires: golang(github.com/hashicorp/go-syslog)
  77. BuildRequires: golang(github.com/hashicorp/golang-lru)
  78. BuildRequires: golang(github.com/hashicorp/hcl)
  79. BuildRequires: golang(github.com/hashicorp/logutils)
  80. BuildRequires: golang(github.com/hashicorp/memberlist)
  81. BuildRequires: golang(github.com/hashicorp/net-rpc-msgpackrpc)
  82. BuildRequires: golang(github.com/hashicorp/raft)
  83. BuildRequires: golang(github.com/hashicorp/raft-boltdb)
  84. BuildRequires: golang(github.com/hashicorp/scada-client)
  85. BuildRequires: golang(github.com/hashicorp/serf/coordinate)
  86. BuildRequires: golang(github.com/hashicorp/serf/serf)
  87. BuildRequires: golang(github.com/hashicorp/yamux)
  88. BuildRequires: golang(github.com/inconshreveable/muxado)
  89. BuildRequires: golang(github.com/miekg/dns)
  90. #BuildRequires: golang(github.com/mitchellh/cli)
  91. BuildRequires: golang-github-mitchellh-cli-devel-temporary
  92. BuildRequires: golang(github.com/mitchellh/mapstructure)
  93. BuildRequires: golang(github.com/ryanuber/columnize)
  94. # indirect dep
  95. BuildRequires: golang(github.com/docker/go-units)
  96. BuildRequires: golang(github.com/opencontainers/runc/libcontainer/user)
  97. %endif
  98.  
  99. Requires:      golang(github.com/armon/circbuf)
  100. Requires:      golang(github.com/armon/go-metrics)
  101. Requires:      golang(github.com/armon/go-metrics/datadog)
  102. Requires:      golang(github.com/armon/go-radix)
  103. Requires:      golang(github.com/fsouza/go-dockerclient)
  104. Requires:      golang(github.com/hashicorp/go-checkpoint)
  105. Requires:      golang(github.com/hashicorp/go-cleanhttp)
  106. Requires:      golang(github.com/hashicorp/go-memdb)
  107. Requires:      golang(github.com/hashicorp/go-msgpack/codec)
  108. Requires:      golang(github.com/hashicorp/go-syslog)
  109. Requires:      golang(github.com/hashicorp/golang-lru)
  110. Requires:      golang(github.com/hashicorp/hcl)
  111. Requires:      golang(github.com/hashicorp/logutils)
  112. Requires:      golang(github.com/hashicorp/memberlist)
  113. Requires:      golang(github.com/hashicorp/net-rpc-msgpackrpc)
  114. Requires:      golang(github.com/hashicorp/raft)
  115. Requires:      golang(github.com/hashicorp/raft-boltdb)
  116. Requires:      golang(github.com/hashicorp/scada-client)
  117. Requires:      golang(github.com/hashicorp/serf/coordinate)
  118. Requires:      golang(github.com/hashicorp/serf/serf)
  119. Requires:      golang(github.com/hashicorp/yamux)
  120. Requires:      golang(github.com/inconshreveable/muxado)
  121. Requires:      golang(github.com/miekg/dns)
  122. #Requires:      golang(github.com/mitchellh/cli)
  123. Requires:      golang-github-mitchellh-cli-devel-temporary
  124. Requires:      golang(github.com/mitchellh/mapstructure)
  125. Requires:      golang(github.com/ryanuber/columnize)
  126. # Indirect dep
  127. Requires:      golang(github.com/docker/go-units)
  128. Requires:      golang(github.com/opencontainers/runc/libcontainer/user)
  129.  
  130. Provides:      golang(%{import_path}/acl) = %{version}-%{release}
  131. Provides:      golang(%{import_path}/api) = %{version}-%{release}
  132. Provides:      golang(%{import_path}/command) = %{version}-%{release}
  133. Provides:      golang(%{import_path}/command/agent) = %{version}-%{release}
  134. Provides:      golang(%{import_path}/consul) = %{version}-%{release}
  135. Provides:      golang(%{import_path}/consul/state) = %{version}-%{release}
  136. Provides:      golang(%{import_path}/consul/structs) = %{version}-%{release}
  137. Provides:      golang(%{import_path}/testutil) = %{version}-%{release}
  138. Provides:      golang(%{import_path}/tlsutil) = %{version}-%{release}
  139. Provides:      golang(%{import_path}/watch) = %{version}-%{release}
  140.  
  141. %description -n golang-%{provider}-%{project}-%{repo}-devel
  142. %{summary}
  143.  
  144. This package contains library source intended for
  145. building other packages which use %{project}/%{repo}.
  146. %endif
  147.  
  148. %if 0%{?with_unit_test} && 0%{?with_devel}
  149. %package -n golang-%{provider}-%{project}-%{repo}-unit-test-devel
  150. Summary:         Unit tests for %{name} package
  151. %if 0%{?with_check}
  152. #Here comes all BuildRequires: PACKAGE the unit tests
  153. #in %%check section need for running
  154. %endif
  155.  
  156. # test subpackage tests code from devel subpackage
  157. Requires:        %{name}-devel = %{version}-%{release}
  158.  
  159. %if 0%{?with_check} && ! 0%{?with_bundled}
  160. %endif
  161.  
  162. %description -n golang-%{provider}-%{project}-%{repo}-unit-test-devel
  163. %{summary}
  164.  
  165. This package contains unit tests for project
  166. providing packages with %{import_path} prefix.
  167. %endif
  168.  
  169. %prep
  170. %setup -q -n %{repo}-%{commit}
  171.  
  172. %build
  173. mkdir -p src/github.com/hashicorp
  174. ln -s ../../../ src/github.com/hashicorp/consul
  175.  
  176. %if ! 0%{?with_bundled}
  177. export GOPATH=$(pwd):%{gopath}
  178. %else
  179. export GOPATH=$(pwd):$(pwd)/Godeps/_workspace:%{gopath}
  180. %endif
  181.  
  182. %gobuild -o bin/%{name} %{import_path}
  183.  
  184. %install
  185. # consul subpackage
  186. install -D -p -m 0755 bin/%{name} %{buildroot}%{_bindir}/%{name}
  187.  
  188. %if 0%{?with_devel} || ! 0%{?with_bundled}
  189. install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
  190. echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
  191. # find all *.go but no *_test.go files and generate devel.file-list
  192. for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
  193.     echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
  194.     install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
  195.     cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
  196.     echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
  197. done
  198. %endif
  199.  
  200. # testing files for this project
  201. %if 0%{?with_unit_test} && 0%{?with_devel}
  202. install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
  203. # find all *_test.go files and generate unit-test-devel.file-list
  204. for file in $(find . -iname "*_test.go"); do
  205.     echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
  206.     install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
  207.     cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
  208.     echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
  209. done
  210. %endif
  211.  
  212. %if 0%{?with_devel} || ! 0%{?with_bundled}
  213. sort -u -o devel.file-list devel.file-list
  214. %endif
  215.  
  216. %check
  217. %if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
  218. %if ! 0%{?with_bundled}
  219. export GOPATH=%{buildroot}/%{gopath}:%{gopath}
  220. %else
  221. export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
  222. %endif
  223.  
  224. %if ! 0%{?gotest:1}
  225. %global gotest go test
  226. %endif
  227.  
  228. %gotest %{import_path}
  229. %gotest %{import_path}/acl
  230. %gotest %{import_path}/api
  231. #%%gotest %{import_path}/command
  232. #%%gotest %{import_path}/command/agent
  233. #%%gotest %{import_path}/consul
  234. %gotest %{import_path}/consul/state
  235. %gotest %{import_path}/consul/structs
  236. %gotest %{import_path}/testutil
  237. #%%gotest %{import_path}/tlsutil
  238. %gotest %{import_path}/watch
  239. %endif
  240.  
  241. #define license tag if not already defined
  242. %{!?_licensedir:%global license %doc}
  243.  
  244. %files
  245. %license LICENSE
  246. %doc CHANGELOG.md README.md
  247. %{_bindir}/%{name}
  248.  
  249. %if 0%{?with_devel} || ! 0%{?with_bundled}
  250. %files -n golang-%{provider}-%{project}-%{repo}-devel -f devel.file-list
  251. %license LICENSE
  252. %doc CHANGELOG.md README.md
  253. %dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
  254. %endif
  255.  
  256. %if 0%{?with_unit_test} && 0%{?with_devel}
  257. %files -n golang-%{provider}-%{project}-%{repo}-unit-test-devel -f unit-test-devel.file-list
  258. %license LICENSE
  259. %doc CHANGELOG.md README.md
  260. %endif
  261.  
  262. %changelog
  263. * Thu Jul 21 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.0-0.6.git46499d6
  264. - https://fedoraproject.org/wiki/Changes/golang1.7
  265.  
  266. * Thu Mar 17 2016 jchaloup <jchaloup@redhat.com> - 0.6.0-0.5.git46499d6
  267. - Polish the spec file
  268.   resolves: #1318556
  269.  
  270. * Mon Feb 22 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.0-0.4.git46499d6
  271. - https://fedoraproject.org/wiki/Changes/golang1.6
  272.  
  273. * Tue Feb 16 2016 jchaloup <jchaloup@redhat.com> - 0.6.0-0.3.git46499d6
  274. - Add deps missing in docker (temporary fix)
  275.   related: #1290013
  276.  
  277. * Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.0-0.2.git46499d6
  278. - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
  279.  
  280. * Wed Dec 09 2015 jchaloup <jchaloup@redhat.com> - 0.6.0-0.1.git46499d6
  281. - Update to 0.6.0
  282.   resolves: #1290013
  283.  
  284. * Wed Apr 15 2015 jchaloup <jchaloup@redhat.com> - 0-0.1.git5079177
  285. - First package for Fedora
  286.   resolves: #1208616
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement