From 0b0c49e3b0ad23a3f196dda743286075d786b4b7 Mon Sep 17 00:00:00 2001 From: Fridolin Pokorny Date: Aug 18 2015 15:26:23 +0000 Subject: Update spec file to spec-2.0 - resolves: #1254600 --- diff --git a/golang-googlecode-sqlite.spec b/golang-googlecode-sqlite.spec index 99d47d5..be116d6 100644 --- a/golang-googlecode-sqlite.spec +++ b/golang-googlecode-sqlite.spec @@ -1,18 +1,64 @@ +%if 0%{?fedora} || 0%{?rhel} == 6 +%global with_devel 1 +%global with_bundled 0 +%global with_debug 0 +%global with_check 0 +# No tests provided +%global with_unit_test 0 +%else +%global with_devel 0 +%global with_bundled 0 +%global with_debug 0 +%global with_check 0 +%global with_unit_test 0 +%endif + +%if 0%{?with_debug} +%global _dwz_low_mem_die_limit 0 +%else %global debug_package %{nil} -%global import_path code.google.com/p/gosqlite -%global gopath %{_datadir}/gocode +%endif + +%define copying() \ +%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7 \ +%license %{*} \ +%else \ +%doc %{*} \ +%endif + +%global provider google +%global provider_sub code +%global provider_tld com +%global project p +%global repo gosqlite +%global rrepo gosqlite +# https://code.google.com/p/gosqlite +%global provider_prefix %{provider_sub}.%{provider}.%{provider_tld}/%{project}/%{repo} +%global import_path %{provider_prefix} %global rev 74691fb6f83716190870cde1b658538dd4b18eb0 -%global shortrev %(r=%{rev}; echo ${r:0:12}) +%global shortrev %(c=%{rev}; echo ${c:0:12}) -Name: golang-googlecode-sqlite +Name: golang-%{provider}%{provider_sub}-gosqlite Version: 0 -Release: 0.12.hg%{shortrev}%{?dist} +Release: 0.13.hg%{shortrev}%{?dist} Summary: Trivial sqlite3 binding for Go License: BSD -URL: http://%{import_path} -Source0: https://gosqlite.googlecode.com/archive/%{rev}.zip +URL: https://%{provider_prefix} +Source0: https://%{rrepo}.%{provider}%{provider_sub}.%{provider_tld}/archive/%{rev}.zip Source1: LICENSE-BSD3-Go -BuildArch: noarch + +# If go_arches not defined fall through to implicit golang archs +%if 0%{?go_arches:1} +ExclusiveArch: %{go_arches} +%else +ExclusiveArch: %{ix86} x86_64 %{arm} +%endif +# If gccgo_arches does not fit or is not defined fall through to golang +%ifarch 0%{?gccgo_arches} +BuildRequires: gcc-go >= %{gccgo_min_vers} +%else +BuildRequires: golang +%endif %description %{summary} @@ -20,13 +66,19 @@ BuildArch: noarch This package has no exported API. It registers a driver for the standard Go database/SQL package. +%if 0%{?with_devel} %package devel -Requires: golang +Summary: %{summary} +BuildArch: noarch + +%if 0%{?with_check} +%endif + Requires: sqlite-devel -Summary: Trivial sqlite3 binding for Go -Provides: golang(%{import_path}) = %{version}-%{release} -Provides: golang(%{import_path}/sqlite) = %{version}-%{release} -Provides: golang(%{import_path}/sqlite3) = %{version}-%{release} + +Provides: golang(%{import_path}) = %{version}-%{release} +Provides: golang(%{import_path}/sqlite) = %{version}-%{release} +Provides: golang(%{import_path}/sqlite3) = %{version}-%{release} %description devel %{summary} @@ -34,8 +86,44 @@ Provides: golang(%{import_path}/sqlite3) = %{version}-%{release} This package has no exported API. It registers a driver for the standard Go database/SQL package. +This package contains library source intended for +building other packages which use import path with +%{import_path} prefix. +%endif + +%if 0%{?with_unit_test} +%package unit-test +Summary: Unit tests for %{name} package +# If go_arches not defined fall through to implicit golang archs +%if 0%{?go_arches:1} +ExclusiveArch: %{go_arches} +%else +ExclusiveArch: %{ix86} x86_64 %{arm} +%endif +# If gccgo_arches does not fit or is not defined fall through to golang +%ifarch 0%{?gccgo_arches} +BuildRequires: gcc-go >= %{gccgo_min_vers} +%else +BuildRequires: golang +%endif + +%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 -n gosqlite-%{shortrev} +%setup -q -n %{rrepo}-%{shortrev} %build # Requested upstream to include LICENSE @@ -43,20 +131,59 @@ database/SQL package. cp %{SOURCE1} ./LICENSE %install -install -d %{buildroot}/%{gopath}/src/%{import_path} -for d in sqlite sqlite3; do - cp -av $d %{buildroot}/%{gopath}/src/%{import_path}/ +# source codes for building projects +%if 0%{?with_devel} +install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ +# find all *.go but no *_test.go files and generate devel.file-list +for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do + 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 - -%files devel -%doc LICENSE +%endif + +# testing files for this project +%if 0%{?with_unit_test} +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 + 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 + +%check +%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel} +%ifarch 0%{?gccgo_arches} +function gotest { %{gcc_go_test} "$@"; } +%else +%if 0%{?golang_test:1} +function gotest { %{golang_test} "$@"; } +%else +function gotest { go test "$@"; } +%endif +%endif + +export GOPATH=%{buildroot}/%{gopath}:%{gopath} +%endif + +%if 0%{?with_devel} +%files devel -f devel.file-list +%copying %dir %{gopath}/src/%{import_path} -%dir %{gopath}/src/%{import_path}/sqlite -%dir %{gopath}/src/%{import_path}/sqlite3 -%{gopath}/src/%{import_path}/sqlite/*.go -%{gopath}/src/%{import_path}/sqlite3/*.go +%endif + +%if 0%{?with_unit_test} +%files unit-test -f unit-test.file-list +%copying +%endif %changelog +* Wed Aug 12 2015 Fridolin Pokorny - 0-0.13.hg74691fb6f837 +- Update spec file to spec-2.0 + resolves: #1254600 + * Wed Jun 17 2015 Fedora Release Engineering - 0-0.12.hg74691fb6f837 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild