%global provider github
%global provider_tld com
%global project github
%global repo hub
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path %{provider_prefix}
%global stable_release 0
# Run ./hub-latest.sh to automatically update this to the latest git HEAD
# https://fedoraproject.org/wiki/Packaging:SourceURL#Github
# For a number of reasons (immutability, availability, uniqueness), you must
# use the full commit revision hash when referring to the sources.
%global commit a9a497c53cbbcead28b45114de5ca07c0acec66c
%global shortcommit %(c=%{commit}; echo ${c:0:7})
# Tests cannot run in mock buildroot currently
# It's recommended to run them locally by switching this value
# before pushing to Koji
%global run_tests 0
%undefine _missing_build_ids_terminate_build
Summary: A command-line wrapper for git with github shortcuts
Name: hub
Version: prerelease
Release: 6%{?dist}
Group: Development/Languages
License: MIT
URL: http://hub.github.com/
# https://fedoraproject.org/wiki/Packaging:SourceURL#Github
# Keep in mind that github tarballs are generated on-demand, so their
# modification dates will vary and cause checksum tests to fail. Reviewers will
# need to use diff -r to verify the tarballs.
%if 0%{?stable_release}
Source0: https://%{provider_prefix}/archive/v%{version}/%{repo}-%{version}.tar.gz
%else
Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{version}-%{shortcommit}.tar.gz
%endif
ExclusiveArch: %{go_arches}
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
BuildRequires: git-core
BuildRequires: rubygem-ronn
BuildRequires: golang(gopkg.in/yaml.v1)
BuildRequires: golang(github.com/bmizerany/assert)
BuildRequires: golang(github.com/BurntSushi/toml)
BuildRequires: golang(github.com/kballard/go-shellquote)
BuildRequires: golang(github.com/mitchellh/go-homedir)
Requires: git-core
Provides: bundled(golang(github.com/inconshreveable/go-update))
Provides: bundled(golang(github.com/mattn/go-colorable))
Provides: bundled(golang(github.com/mattn/go-isatty))
Provides: bundled(golang(github.com/octokit/go-octokit))
Provides: bundled(golang(github.com/ogier/pflag))
# Fedora: use system ronn
Patch0002: 0002-Use-system-ronn.patch
%description
hub is a command line tool that wraps `git` in order to extend it with extra
features and commands that make working with GitHub easier.
$ hub clone rtomayko/tilt
# expands to:
$ git clone git://github.com/rtomayko/tilt.git
%prep
%if 0%{?stable_release}
%autosetup -p1
%else
%autosetup -n %{name}-%{commit} -p1
%endif
mkdir -p src/github.com/github/
ln -s `pwd` src/github.com/github/hub
rm -rf vendor/gopkg.in/yaml.v1 \
vendor/github.com/bmizerany/assert \
vendor/github.com/BurntSushi/toml \
vendor/github.com/kballard/go-shellquote \
vendor/github.com/mitchellh/go-homedir
ln -s /usr/share/gocode/src/gopkg.in/yaml.v1 \
vendor/gopkg.in/yaml.v1
ln -s /usr/share/gocode/src/github.com/bmizerany/assert \
vendor/github.com/bmizerany/assert
ln -s /usr/share/gocode/src/github.com/BurntSushi/toml \
vendor/github.com/BurntSushi/toml
ln -s /usr/share/gocode/src/github.com/kballard/go-shellquote \
vendor/github.com/kballard/go-shellquote
ln -s /usr/share/gocode/src/github.com/mitchellh/go-homedir \
vendor/github.com/mitchellh/go-homedir
%build
GOPATH=`pwd` %make_build
%install
GOPATH=`pwd` %make_install PREFIX=%{_prefix}
# Bash-completion
install -d -m 755 %{buildroot}%{_sysconfdir}/bash_completion.d/
cp -p etc/hub.bash_completion.sh %{buildroot}%{_sysconfdir}/bash_completion.d/.
# ZSH-completion
install -d -m 755 %{buildroot}%{_datarootdir}/zsh/site-functions/
cp -p etc/hub.zsh_completion %{buildroot}%{_datarootdir}/zsh/site-functions/_hub
%check
%if 0%{run_tests}
# Tests are currently nonfunctional in mock
# All calls to 'git' are failing to find a valid repo, but
# they work when run outside of mock.
export GOPATH=$(pwd):$(pwd)/Godeps/_workspace:%{gopath}
find . -maxdepth 2 -name '*.go' '!' -name '*_test.go' | \
cut -d/ -f2 | sort -u | grep -v '.go$' | sed 's!^!github.com/github/hub/!' | \
xargs go test -v
%endif
%files
%license LICENSE
%doc README.md CONTRIBUTING.md
%{_bindir}/hub
%{_mandir}/man1/*
%{_sysconfdir}/bash_completion.d/
%{_datarootdir}/zsh/site-functions/_hub
%changelog
* Thu Jun 14 2018 Stephen Gallagher <sgallagh@redhat.com> - prerelease-6
- Updating to upstream commit a9a497c53cbbcead28b45114de5ca07c0acec66c
* Thu Jun 14 2018 Stephen Gallagher <sgallagh@redhat.com> - prerelease-5
- Don't own manpage directory
* Wed Jun 13 2018 Stephen Gallagher <sgallagh@redhat.com> - prerelease-4
- Updating to upstream commit e8a7d7968161f70f3cbd9b7c07a021ca01b54c3f
* Wed Jun 13 2018 Stephen Gallagher <sgallagh@redhat.com> - 2.4.0-1
- Release hub 2.4.0
- https://github.com/github/hub/releases/tag/v2.4.0
* Fri Jun 01 2018 Stephen Gallagher <sgallagh@redhat.com> - prerelease-2
- Updating to upstream commit cd988bc491f97008377fadfeae549fc7b7dd5d25
* Mon May 07 2018 Stephen Gallagher <sgallagh@redhat.com> - prerelease-1
- Updating to upstream commit 1e5bb959dcc11f515d8865ece27c5fc9dd3b2d39
- Add scripts to udpate to the latest git HEAD
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.9-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.9-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.9-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Wed Mar 01 2017 Stephen Gallagher <sgallagh@redhat.com> - 2.2.9-3
- Rebuild for golang bug that caused segfaults
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Thu Nov 17 2016 Stephen Gallagher <sgallagh@redhat.com> - 2.2.9-1
- Update to latest stable release 2.2.9
* Wed Sep 28 2016 Stephen Gallagher <sgallagh@redhat.com> - 2.2.5-3
- Really fix location of ZSH completion script
* Tue Sep 13 2016 Stephen Gallagher <sgallagh@redhat.com> - 2.2.5-2
- Fix location of ZSH completion script
* Wed Aug 31 2016 Stephen Gallagher <sgallagh@redhat.com> - 2.2.5-1
- Update to new (and latest) major release of hub
- Include ZSH completion script
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.12.4-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Fri Sep 11 2015 Ralph Bean <rbean@redhat.com> - 1.12.4-5
- Adjust ownership of bash_completion file/dir.
* Fri Sep 11 2015 Ralph Bean <rbean@redhat.com> - 1.12.4-4
- Ship bash completion file.
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.12.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Wed May 27 2015 Ralph Bean <rbean@redhat.com> - 1.12.4-2
- Require ruby (for ruby-mri. jruby and hub don't get along.)
https://bugzilla.redhat.com/show_bug.cgi?id=1225254
* Wed Apr 22 2015 Ralph Bean <rbean@redhat.com> - 1.12.4-1
- New version
- Stop building with rdoc for now because its being so squirrely.
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.12.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Wed May 28 2014 Ralph Bean <rbean@redhat.com> - 1.12.1-1
- Latest upstream.
* Thu May 22 2014 Ralph Bean <rbean@redhat.com> - 1.12.0-4
- Add -doc subpackage with rdoc product.
- Add check section, but left it commented out due to dep issues.
- Remove spurious man files.
- Remove weirdly nested docs from rdoc.
* Wed Apr 02 2014 Ralph Bean <rbean@redhat.com> - 1.12.0-3
- Update Source0 URL to use the github guidelines.
- Replace weird %%prep %%setup stuff with something more familiar.
* Wed Apr 02 2014 Ralph Bean <rbean@redhat.com> - 1.12.0-2
- Remove version from the doc directory.
- Replace install macro with just "install".
* Mon Mar 31 2014 Ralph Bean <rbean@redhat.com> - 1.12.0-1
- Initial packaging for Fedora