golang-github-google-btree-vl.spec 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. %global with_devel 1
  2. %global with_bundled 0
  3. %global with_debug 0
  4. %global with_check 1
  5. %global with_unit_test 1
  6. %if 0%{?with_debug}
  7. %global _dwz_low_mem_die_limit 0
  8. %else
  9. %global debug_package %{nil}
  10. %endif
  11. %define copying() \
  12. %if 0%{?fedora} >= 21 || 0%{?rhel} >= 7 \
  13. %license %{*} \
  14. %else \
  15. %doc %{*} \
  16. %endif
  17. %global provider github
  18. %global provider_tld com
  19. %global project google
  20. %global repo btree
  21. # https://github.com/google/btree
  22. %global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
  23. %global import_path %{provider_prefix}
  24. %global commit cc6329d4279e3f025a53a83c397d2339b5705c45
  25. %global shortcommit %(c=%{commit}; echo ${c:0:7})
  26. Name: golang-%{provider}-%{project}-%{repo}
  27. Version: 0
  28. Release: 0.2.git%{shortcommit}%{?_dist_release}
  29. Summary: BTree implementation for Go
  30. License: ASL 2.0
  31. URL: https://%{provider_prefix}
  32. Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
  33. # If go_arches not defined fall through to implicit golang archs
  34. %if 0%{?go_arches:1}
  35. ExclusiveArch: %{go_arches}
  36. %else
  37. ExclusiveArch: %{ix86} x86_64 %{arm}
  38. %endif
  39. %description
  40. %{summary}
  41. %if 0%{?with_devel}
  42. %package devel
  43. Summary: %{summary}
  44. BuildArch: noarch
  45. %if 0%{?with_check}
  46. %endif
  47. Provides: golang(%{import_path}) = %{version}-%{release}
  48. %description devel
  49. %{summary}
  50. This package contains library source intended for
  51. building other packages which use import path with
  52. %{import_path} prefix.
  53. %endif
  54. %if 0%{?with_unit_test}
  55. %package unit-test
  56. Summary: Unit tests for %{name} package
  57. # If go_arches not defined fall through to implicit golang archs
  58. %if 0%{?go_arches:1}
  59. ExclusiveArch: %{go_arches}
  60. %else
  61. ExclusiveArch: %{ix86} x86_64 %{arm}
  62. %endif
  63. # If gccgo_arches does not fit or is not defined fall through to golang
  64. %ifarch 0%{?gccgo_arches}
  65. BuildRequires: gcc-go >= %{gccgo_min_vers}
  66. %else
  67. BuildRequires: golang
  68. %endif
  69. %if 0%{?with_check}
  70. #Here comes all BuildRequires: PACKAGE the unit tests
  71. #in %%check section need for running
  72. %endif
  73. # test subpackage tests code from devel subpackage
  74. Requires: %{name}-devel = %{version}-%{release}
  75. %description unit-test
  76. %{summary}
  77. This package contains unit tests for project
  78. providing packages with %{import_path} prefix.
  79. %endif
  80. %prep
  81. %setup -q -n %{repo}-%{commit}
  82. %build
  83. %install
  84. # source codes for building projects
  85. %if 0%{?with_devel}
  86. install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
  87. # find all *.go but no *_test.go files and generate unit-test.file-list
  88. for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
  89. install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
  90. cp $file %{buildroot}/%{gopath}/src/%{import_path}/$file
  91. echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
  92. done
  93. %endif
  94. # testing files for this project
  95. %if 0%{?with_unit_test}
  96. install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
  97. # find all *_test.go files and generate unit-test.file-list
  98. for file in $(find . -iname "*_test.go"); do
  99. install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
  100. cp $file %{buildroot}/%{gopath}/src/%{import_path}/$file
  101. echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
  102. done
  103. %endif
  104. %check
  105. %if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
  106. %ifarch 0%{?gccgo_arches}
  107. function gotest { %{gcc_go_test} "$@"; }
  108. %else
  109. %if 0%{?golang_test:1}
  110. function gotest { %{golang_test} "$@"; }
  111. %else
  112. function gotest { go test "$@"; }
  113. %endif
  114. %endif
  115. export GOPATH=%{buildroot}/%{gopath}:%{gopath}
  116. gotest %{import_path}
  117. %endif
  118. %if 0%{?with_devel}
  119. %files devel -f devel.file-list
  120. %copying LICENSE
  121. %doc README.md
  122. %dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
  123. %dir %{gopath}/src/%{import_path}
  124. %endif
  125. %if 0%{?with_unit_test}
  126. %files unit-test -f unit-test.file-list
  127. %copying LICENSE
  128. %doc README.md
  129. %endif
  130. %changelog
  131. * Mon Jan 18 2016 IWAI, Masaharu <iwaim.sub@gmail.com> 0-0.2.gitcc6329d
  132. - initial build for Vine Linux
  133. * Tue Jul 28 2015 jchaloup <jchaloup@redhat.com> - 0-0.1.gitcc6329d
  134. - First package for Fedora
  135. resolves: #1245967