# If any of the following macros should be set otherwise, # you can wrap any of them with the following conditions: # - %%if 0%%{centos} == 7 # - %%if 0%%{?rhel} == 7 # - %%if 0%%{?fedora} == 23 # Or just test for particular distribution: # - %%if 0%%{centos} # - %%if 0%%{?rhel} # - %%if 0%%{?fedora} # # Be aware, on centos, both %%rhel and %%centos are set. If you want to test # rhel specific macros, you can use %%if 0%%{?rhel} && 0%%{?centos} == 0 condition. # (Don't forget to replace double percentage symbol with single one in order to apply a condition) # Generate devel rpm %global with_devel 1 # Build project from bundled dependencies %global with_bundled 0 # Build with debug info rpm %global with_debug 0 # Run tests in check section # Cyclic deps between coreos/pkg and coreos/go-systemd %global with_check 0 # Generate unit-test rpm %global with_unit_test 1 %if 0%{?with_debug} %global _dwz_low_mem_die_limit 0 %else %global debug_package %{nil} %endif %global provider github %global provider_tld com %global project coreos %global repo go-systemd # https://github.com/coreos/go-systemd %global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} %global import_path %{provider_prefix} %global commit d6c05a1dcbb5ac02b7653da4d99e5db340c20778 %global shortcommit %(c=%{commit}; echo ${c:0:7}) Name: golang-%{provider}-%{project}-%{repo} Version: 10 Release: 2%{?dist} Summary: Go bindings to systemd socket activation, journal and D-BUS APIs License: ASL 2.0 URL: https://%{provider_prefix} Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.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}} # 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} %description %{summary} %if 0%{?with_devel} %package devel Summary: %{summary} BuildArch: noarch %if 0%{?with_check} BuildRequires: golang(github.com/godbus/dbus) BuildRequires: golang(github.com/coreos/pkg/dlopen) %endif Requires: golang(github.com/godbus/dbus) Requires: golang(github.com/coreos/pkg/dlopen) Provides: golang(%{import_path}/activation) = %{version}-%{release} Provides: golang(%{import_path}/daemon) = %{version}-%{release} Provides: golang(%{import_path}/dbus) = %{version}-%{release} Provides: golang(%{import_path}/journal) = %{version}-%{release} Provides: golang(%{import_path}/login1) = %{version}-%{release} Provides: golang(%{import_path}/machine1) = %{version}-%{release} Provides: golang(%{import_path}/sdjournal) = %{version}-%{release} Provides: golang(%{import_path}/unit) = %{version}-%{release} Provides: golang(%{import_path}/util) = %{version}-%{release} %description devel %{summary} This package contains library source intended for building other packages which use import path with %{import_path} prefix. %endif %if 0%{?with_unit_test} && 0%{?with_devel} %package unit-test Summary: Unit tests for %{name} package %if 0%{?with_check} #Here comes all BuildRequires: PACKAGE the unit tests #in %%check section need for running %endif # test subpackage tests code from devel subpackage Requires: %{name}-devel = %{version}-%{release} %description unit-test %{summary} This package contains unit tests for project providing packages with %{import_path} prefix. %endif %prep %setup -q -n %{repo}-%{commit} %build %install # source codes for building projects %if 0%{?with_devel} install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list # find all *.go but no *_test.go files and generate devel.file-list for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file) cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list done %endif # testing files for this project %if 0%{?with_unit_test} && 0%{?with_devel} install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ # find all *_test.go files and generate unit-test.file-list for file in $(find . -iname "*_test.go"); do echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file) cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list done %endif %if 0%{?with_devel} sort -u -o devel.file-list devel.file-list %endif %check %if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel} %if ! 0%{?with_bundled} export GOPATH=%{buildroot}/%{gopath}:%{gopath} %else export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath} %endif %if ! 0%{?gotest:1} %global gotest go test %endif # needs port binding #%gotest %{import_path}/activation # need /var/run/dbus/system_bus_socket #%gotest %{import_path}/dbus # need /var/run/dbus/system_bus_socket #%gotest %{import_path}/login1 # dbus_test.go:28: dial unix /var/run/dbus/system_bus_socket: connect: no such file or directory #%gotest %{import_path}/machine1 # FAIL: TestSerialize, incorrent output #%gotest %{import_path}/unit %endif #define license tag if not already defined %{!?_licensedir:%global license %doc} %if 0%{?with_devel} %files devel -f devel.file-list %license LICENSE %doc README.md %dir %{gopath}/src/%{provider}.%{provider_tld}/%{project} %endif %if 0%{?with_unit_test} && 0%{?with_devel} %files unit-test -f unit-test.file-list %license LICENSE %doc README.md %endif %changelog * Fri Dec 16 2016 Jan Chaloupka - 10-2 - Polish the spec file related: #1248722 * Wed Aug 03 2016 jchaloup - 10-1 - Bump to upstream d6c05a1dcbb5ac02b7653da4d99e5db340c20778 related: #1248722 * Thu Jul 21 2016 Fedora Release Engineering - 4-4 - https://fedoraproject.org/wiki/Changes/golang1.7 * Mon Feb 22 2016 Fedora Release Engineering - 4-3 - https://fedoraproject.org/wiki/Changes/golang1.6 * Wed Feb 03 2016 Fedora Release Engineering - 4-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild * Thu Nov 26 2015 jchaloup - 4-1 - Bump to upstream b4a58d95188dd092ae20072bac14cece0e67c388 related: #1248722 * Sat Sep 12 2015 jchaloup - 3-3 - Update to spec-2.1 related: #1248722 * Fri Sep 11 2015 jchaloup - 3-2 - Bump to upstream cea488b4e6855fee89b6c22a811e3c5baca861b6 related: #1248722 * Thu Aug 20 2015 jchaloup - 3-1 - Bump to upstream be94bc700879ae8217780e9d141789a2defa302b related: #1248722 * Thu Jul 30 2015 jchaloup - 2-8 - Update spec file to spec-2.0 resolves: #1248722 * Wed Jun 17 2015 Fedora Release Engineering - 2-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild * Tue Mar 31 2015 jchaloup - 2-6 - Bump to upstream 7a81740665de3d730bf98811f6b2ae5746e42a32 The last commit containing unchanged StartTransientUnit method (libcontainer) and still providing daemon package (fleet). related: #1165690 * Tue Mar 31 2015 jchaloup - 2-5 - Bump to upstream fe2137a286b607d0023a8356cdc22a38098246b8 related: #1165690 * Mon Mar 30 2015 jchaloup - 2-4 - Bump to upstream 2d21675230a81a503f4363f4aa3490af06d52bb8 related: #1165690 * Mon Jan 19 2015 jchaloup - 2-3 - Adding missing Provides and removing superfluous Provides related: #1165690 * Wed Nov 19 2014 jchaloup - 2-2 - Update to a606a1e936df81b70d85448221c7b1c6d8a74ef1 commit resolves: #1165688 - remove gopath and add golang >= 1.2.1-3 - add Requires on github.com/godbus/dbus * Mon Jun 09 2014 Lokesh Mandvekar - 2-1 - upstream version bump to v2 - change in NVR format since numbered versions are available * Sat Jun 07 2014 Fedora Release Engineering - 0-0.5.git8514b9f - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild * Thu Apr 10 2014 Bobby Powers 0-0.4.git8514b9f - update to latest upstream * Fri Oct 18 2013 Lokesh Mandvekar 0-0.3.git68bc612 - double quotes removed from provides * Mon Oct 14 2013 Lokesh Mandvekar 0-0.2.git68bc612 - provides golang("github.com/coreos/go-systemd") - defattr removed * Sat Oct 12 2013 Lokesh Mandvekar 0-0.1.git68bc612 - Initial fedora package