Blob Blame History Raw
%global debug_package   %{nil}
%global import_path     code.google.com/p/go.tools
%global gopath          %{_datadir}/gocode
%global rev             17c8fe23290ad2f8aab00230300e0d0075ba659c
%global shortrev        %(r=%{rev}; echo ${r:0:12})

%global go_arch %(go env GOHOSTARCH)
%global go_root %(go env GOROOT)

Name:           golang-googlecode-tools
Version:        0
Release:        0.9.hg%{shortrev}%{?dist}
Summary:        Supplementary tools and packages for Go
License:        BSD
URL:            http://%{import_path}
Source0:        https://tools.go.googlecode.com/archive/%{rev}.zip

%description
%{summary}


%package -n golang-godoc
Summary:        Documentation tool for the Go programming language
ExclusiveArch:  %{ix86} x86_64 %{arm}
BuildRequires:  golang
Epoch:          1
%description -n golang-godoc
Godoc extracts and generates documentation for Go programs.
Obsoletes:      golang-godoc = 1.1.2


%package -n golang-vet
Summary:        Go programming language code vetting tool
ExclusiveArch:  %{ix86} x86_64 %{arm}
BuildRequires:  golang
%description -n golang-vet
Vet examines Go source code and reports suspicious constructs, such as
Printf calls whose arguments do not align with the format string. Vet
uses heuristics that do not guarantee all reports are genuine problems,
but it can find errors not caught by the compilers.


%package -n golang-cover
Summary:        Code coverage tool for the Go programming language
ExclusiveArch:  %{ix86} x86_64 %{arm}
BuildRequires:  golang
%description -n golang-cover
Cover is a program for analyzing the coverage profiles generated by 'go
test -coverprofile=cover.out'.


%package -n golang-gotype
Summary:        Go programming language source code analysis tool
ExclusiveArch:  %{ix86} x86_64 %{arm}
BuildRequires:  golang
%description -n golang-gotype
The gotype command does syntactic and semantic analysis of Go files and
packages like the front-end of a Go compiler. Errors are reported if the
analysis fails; otherwise gotype is quiet.


%package -n golang-html2article
Summary:        Tool for creating articles from HTML files
ExclusiveArch:  %{ix86} x86_64 %{arm}
BuildRequires:  golang
BuildRequires:   golang(code.google.com/p/go.net/html)
BuildRequires:   golang(code.google.com/p/go.net/html/atom)
%description -n golang-html2article
This program takes an HTML file and outputs a corresponding article file
in present format. See: code.google.com/p/go.tools/present


## did not include the subpackages for ./cmd/oracle and ./cmd/ssadump, as they
## do not build for go1.1.2 https://bugzilla.redhat.com/show_bug.cgi?id=1029587

%package devel
Requires:       golang
Summary:        Libraries of supplementary Go tools
%if 0%{?fedora} >= 19 || 0%{?rhel} >= 7
BuildArch:      noarch
%else
ExclusiveArch:  %{ix86} x86_64 %{arm}
%endif
Provides:       golang(%{import_path}/blog) = %{version}-%{release}
Provides:       golang(%{import_path}/blog/atom) = %{version}-%{release}
Provides:       golang(%{import_path}/call) = %{version}-%{release}
Provides:       golang(%{import_path}/cmd/vet/whitelist) = %{version}-%{release}
Provides:       golang(%{import_path}/dashboard/app/build) = %{version}-%{release}
Provides:       golang(%{import_path}/dashboard/app/cache) = %{version}-%{release}
Provides:       golang(%{import_path}/dashboard/builder) = %{version}-%{release}
Provides:       golang(%{import_path}/go/exact) = %{version}-%{release}
Provides:       golang(%{import_path}/go/types) = %{version}-%{release}
Provides:       golang(%{import_path}/go/types/typemap) = %{version}-%{release}
Provides:       golang(%{import_path}/go/vcs) = %{version}-%{release}
Provides:       golang(%{import_path}/godoc) = %{version}-%{release}
Provides:       golang(%{import_path}/godoc/redirect) = %{version}-%{release}
Provides:       golang(%{import_path}/godoc/static) = %{version}-%{release}
Provides:       golang(%{import_path}/godoc/util) = %{version}-%{release}
Provides:       golang(%{import_path}/godoc/vfs) = %{version}-%{release}
Provides:       golang(%{import_path}/godoc/vfs/httpfs) = %{version}-%{release}
Provides:       golang(%{import_path}/godoc/vfs/mapfs) = %{version}-%{release}
Provides:       golang(%{import_path}/godoc/vfs/zipfs) = %{version}-%{release}
Provides:       golang(%{import_path}/importer) = %{version}-%{release}
Provides:       golang(%{import_path}/oracle) = %{version}-%{release}
Provides:       golang(%{import_path}/oracle/serial) = %{version}-%{release}
Provides:       golang(%{import_path}/playground) = %{version}-%{release}
Provides:       golang(%{import_path}/playground/socket) = %{version}-%{release}
Provides:       golang(%{import_path}/pointer) = %{version}-%{release}
Provides:       golang(%{import_path}/present) = %{version}-%{release}
Provides:       golang(%{import_path}/ssa) = %{version}-%{release}
Provides:       golang(%{import_path}/ssa/interp) = %{version}-%{release}

%description devel
%{summary}

This package contains library source intended for building other packages
which use the supplementary Go tools libraries.


%prep

%setup -n tools.go-%{shortrev}

%build
mkdir _build
pushd _build

mkdir -p src/$(dirname %{import_path})
ln -s $(dirs +1 -l) src/%{import_path}
export GOPATH=$(pwd):%{gopath}
for cmd in \
  cover \
  godoc \
  gotype \
  html2article \
  vet
do
  go build -v -a %{import_path}/cmd/$cmd
done

popd

%install
install -d %{buildroot}%{_bindir}
install -p -m 755 _build/cover %{buildroot}%{_bindir}
install -p -m 755 _build/godoc %{buildroot}%{_bindir}
install -p -m 755 _build/gotype %{buildroot}%{_bindir}
install -p -m 755 _build/html2article %{buildroot}%{_bindir}
install -p -m 755 _build/vet %{buildroot}%{_bindir}

# https://bugzilla.redhat.com/show_bug.cgi?id=1129281
install -d %{buildroot}%{go_root}/pkg/tool/linux_%{go_arch}
ln -s %{_bindir}/cover %{buildroot}%{go_root}/pkg/tool/linux_%{go_arch}/cover
ln -s %{_bindir}/vet %{buildroot}%{go_root}/pkg/tool/linux_%{go_arch}/vet

install -d %{buildroot}/%{gopath}/src/%{import_path}
for d in \
  blog \
  call \
  cmd \
  dashboard \
  go \
  godoc \
  importer \
  oracle \
  playground \
  pointer \
  present \
  ssa
do
   cp -av $d %{buildroot}/%{gopath}/src/%{import_path}/
done

# generate the spec file ownership of this source tree
src_list=$(pwd)/src.list
touch $src_list
rm $src_list
pushd %{buildroot}%{gopath}
  find src/ -type d -printf '%%%dir %{gopath}/%p\n' >> $src_list
  find src/ ! -type d -printf '%{gopath}/%p\n' >> $src_list
popd


%files -n golang-godoc
%defattr(-,root,root,-)
%{_bindir}/godoc

%files -n golang-vet
%defattr(-,root,root,-)
%{_bindir}/vet
%{go_root}/pkg/tool/linux_%{go_arch}/vet

%files -n golang-cover
%defattr(-,root,root,-)
%{_bindir}/cover
%{go_root}/pkg/tool/linux_%{go_arch}/cover

%files -n golang-gotype
%defattr(-,root,root,-)
%{_bindir}/gotype

%files -n golang-html2article
%defattr(-,root,root,-)
%{_bindir}/html2article

%files -f src.list devel
%defattr(-,root,root,-)
%doc AUTHORS CONTRIBUTORS LICENSE PATENTS README

%changelog
* Tue Aug 19 2014 Vincent Batts <vbatts@fedoraproject.org> - 0-0.9.hg17c8fe23290a
- setting an epoch for godoc to fix bz1099074

* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.8.hg17c8fe23290a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Tue Aug 12 2014 Vincent Batts <vbatts@redhat.com> 0-0.7.hg17c8fe23290a
- fix bz1129281 and cleanup file ownership

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.6.hg17c8fe23290a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Thu Jan 16 2014 Vincent Batts <vbatts@redhat.com> 0-0.5.hg17c8fe23290a
- working on the arch dependencies
- clean up file ownership

* Thu Dec 05 2013 Vincent Batts <vbatts@redhat.com> 0-0.4.hg17c8fe23290a
- golang-godoc to obsolete the package from golang 1.1.2

* Tue Nov 12 2013 Vincent Batts <vbatts@redhat.com> 0-0.3.hg17c8fe23290a
- removing conflicting directory ownership

* Tue Nov 12 2013 Vincent Batts <vbatts@redhat.com> 0-0.2.hg17c8fe23290a
- adding subpackages for all available commands

* Sun Nov 10 2013 Vincent Batts <vbatts@redhat.com> 0-0.1.hg17c8fe23290a
- initial build