Commit 2a3e86 Initial import (#1491172).

4 files Authored and Committed by decathorpe 5 months ago
Initial import (#1491172).

    
1 @@ -0,0 +1,1 @@
2 + /templexxx-xor-c3e2175.tar.gz
1 @@ -1,3 +0,0 @@
2 - # golang-github-templexxx-xor
3 - 
4 - The golang-github-templexxx-xor package 
5 \ No newline at end of file
  1 @@ -0,0 +1,162 @@
  2 + # Generate devel rpm
  3 + %global with_devel 1
  4 + # Build project from bundled dependencies
  5 + %global with_bundled 0
  6 + # Build with debug info rpm
  7 + %global with_debug 0
  8 + # Run tests in check section
  9 + %global with_check 1
 10 + # Generate unit-test rpm
 11 + %global with_unit_test 1
 12 + 
 13 + %if 0%{?with_debug}
 14 + %global _dwz_low_mem_die_limit 0
 15 + %else
 16 + %global debug_package   %{nil}
 17 + %endif
 18 + 
 19 + %global provider        github
 20 + %global provider_tld    com
 21 + %global project         templexxx
 22 + %global repo            xor
 23 + # https://github.com/templexxx/xor
 24 + %global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
 25 + %global import_path     %{provider_prefix}
 26 + %global commit          c3e21753f58ff766a2569cf2f06f8f7dfb27b7c2
 27 + %global shortcommit     %(c=%{commit}; echo ${c:0:7})
 28 + 
 29 + # commit c3e21753f58ff766a2569cf2f06f8f7dfb27b7c2 == version 0.1.1
 30 + 
 31 + 
 32 + Name:           golang-%{provider}-%{project}-%{repo}
 33 + Version:        0.1.1
 34 + Release:        1%{?dist}
 35 + Summary:        XOR code engine in pure Go
 36 + License:        MIT
 37 + URL:            https://%{provider_prefix}
 38 + Source0:        https://%{provider_prefix}/archive/%{commit}/%{project}-%{repo}-%{shortcommit}.tar.gz
 39 + 
 40 + # e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
 41 + ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm}}
 42 + # If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
 43 + BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
 44 + 
 45 + %description
 46 + %{summary}
 47 + 
 48 + 
 49 + %if 0%{?with_devel}
 50 + %package        devel
 51 + Summary:        %{summary}
 52 + BuildArch:      noarch
 53 + 
 54 + Provides:       golang(%{import_path}) = %{version}-%{release}
 55 + 
 56 + %description    devel
 57 + %{summary}
 58 + 
 59 + This package contains library source intended for
 60 + building other packages which use import path with
 61 + %{import_path} prefix.
 62 + %endif
 63 + 
 64 + 
 65 + %if 0%{?with_unit_test} && 0%{?with_devel}
 66 + %package        unit-test-devel
 67 + Summary:        Unit tests for %{name} package
 68 + 
 69 + # test subpackage tests code from devel subpackage
 70 + Requires:       %{name}-devel = %{version}-%{release}
 71 + 
 72 + %description    unit-test-devel
 73 + %{summary}
 74 + 
 75 + This package contains unit tests for project
 76 + providing packages with %{import_path} prefix.
 77 + %endif
 78 + 
 79 + 
 80 + %prep
 81 + %setup -q -n %{repo}-%{commit}
 82 + 
 83 + 
 84 + %build
 85 + 
 86 + 
 87 + %install
 88 + # source codes for building projects
 89 + %if 0%{?with_devel}
 90 + install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
 91 + echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
 92 + 
 93 + # find all *.go but no *_test.go files and generate devel.file-list
 94 + for file in $(find . \( -iname "*.go" -or -iname "*.s" \) \! -iname "*_test.go") ; do
 95 +     dirprefix=$(dirname $file)
 96 +     install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
 97 +     cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
 98 +     echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
 99 + 
100 +     while [ "$dirprefix" != "." ]; do
101 +         echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
102 +         dirprefix=$(dirname $dirprefix)
103 +     done
104 + done
105 + %endif
106 + 
107 + # testing files for this project
108 + %if 0%{?with_unit_test} && 0%{?with_devel}
109 + install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
110 + 
111 + # find all *_test.go files and generate unit-test-devel.file-list
112 + for file in $(find . -iname "*_test.go") ; do
113 +     dirprefix=$(dirname $file)
114 +     install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
115 +     cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
116 +     echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
117 + 
118 +     while [ "$dirprefix" != "." ]; do
119 +         echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
120 +         dirprefix=$(dirname $dirprefix)
121 +     done
122 + done
123 + %endif
124 + 
125 + %if 0%{?with_devel}
126 + sort -u -o devel.file-list devel.file-list
127 + %endif
128 + 
129 + 
130 + %check
131 + %if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
132 + export GOPATH=%{buildroot}/%{gopath}:%{gopath}
133 + 
134 + %if ! 0%{?gotest:1}
135 + %global gotest go test
136 + %endif
137 + 
138 + %gotest %{import_path}
139 + %endif
140 + 
141 + 
142 + #define license tag if not already defined
143 + %{!?_licensedir:%global license %doc}
144 + 
145 + 
146 + %if 0%{?with_devel}
147 + %files devel -f devel.file-list
148 + %license LICENSE
149 + %doc README.md
150 + %dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
151 + %endif
152 + 
153 + %if 0%{?with_unit_test} && 0%{?with_devel}
154 + %files unit-test-devel -f unit-test-devel.file-list
155 + %license LICENSE
156 + %doc README.md
157 + %endif
158 + 
159 + 
160 + %changelog
161 + * Wed Sep 13 2017 Fabio Valentini <decathorpe@gmail.com> - 0.1.1-1
162 + - First package for Fedora
163 + 
1 @@ -0,0 +1,1 @@
2 + SHA512 (templexxx-xor-c3e2175.tar.gz) = f6b277e12213aa8b51792a1d171f785a21b8ba6650bd758a98002deccc17fd819183288119355217828d18a6645913fcd13783943318767d2fe6f56d2776ebf4