%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 1
# 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
Summary: A command-line wrapper for git with github shortcuts
Name: hub
Version: 2.7.1
Release: 1%{?dist}
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: rubygem-cucumber
BuildRequires: vim-filesystem
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
Requires: vim-filesystem
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-and-cucumber.patch
# Fedora: add build-id for debugsource
Patch0003: 0003-Add-build_id.patch
# Fedora: Don't compress DWARF data
Patch0004: 0004-Don-t-compress-DWARF.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}
%setup
%else
%setup -n %{name}-%{commit}
%endif
%patch0002 -p1
%patch0003 -p1
%if 0%{?fedora} >= 29
%patch0004 -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
%{_datarootdir}/vim/vimfiles/ftdetect/pullrequest.vim
%{_datarootdir}/vim/vimfiles/syntax/pullrequest.vim
%changelog
* Wed Jan 23 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.7.1-1
- Update to 2.7.1
- https://github.com/github/hub/releases/tag/v2.7.1
- https://github.com/github/hub/releases/tag/v2.7.0
* Thu Nov 01 2018 Stephen Gallagher <sgallagh@redhat.com> - 2.6.0-1
- Update to 2.6.0
- https://github.com/github/hub/releases/tag/v2.6.0
- Features
* Use "scissors" line to delineate comments in editable messages instead of
stripping away lines that start with #
* New command `hub issue show <NUMBER>`
* Add `hub release show --format=<FORMAT>` functionality
* `hub pr list --format=%rs` lists requested reviewers
* Add support for communicating with GitHub Enterprise over Unix socket
- Fixes
* Prevent `hub create` setting a public upstream when creating a private repo
* Fix `hub release create/edit/delete` when there are multiple git remotes
* Auto-detect private/pushable repos in `hub remote add`
* Fix `hub ci-status` exit code when there is only Checks
* Allow `hub compare <RANGE>` even if not on any branch
* Ensure consistent sort direction when listing issues, PRs
* Match requested team names by slug instead of name in
`hub pull-request -r <TEAM>`
* Fri Sep 28 2018 Stephen Gallagher <sgallagh@redhat.com> - 2.5.1-1
- Update to 2.5.1
- hub issue create: ignore the .github/ISSUE_TEMPLATE directory instead of
crashing
- hub pull-request: avoid re-requesting reviewers in case of CODEOWNERS
- hub ci-status: handle cases when Checks API is unavailable, like older
GitHub Enterprise
- Handle HTTP 422 message format from server response
- Ignore crash for malformed ~/.config/hub file
- Clarify hub init -g documentation that it doesn't imply hub create
- hub clone: add more documentation about git protocol used
* Tue Jul 17 2018 Stephen Gallagher <sgallagh@redhat.com> - 2.5.0-2
- Fix generation of debuginfo for F29
* Mon Jul 16 2018 Stephen Gallagher <sgallagh@redhat.com> - 2.5.0-1
- Update to 2.5.0
- Features
* Have ci-status also query Checks API
- Fixes
* Do not pass '--cmd' to vi editor to ensure compatibility with older vi
* Simplify cherry-picking commits from pull request URLs
* Allow single-character branches/tag names in hub compare
* Fix hub compare for Enterprise when <USER> is specified
* Support remote add -t BRANCH argument
* Bash shell completion fixes for git 2.18
* Documentation fixes
* Thu Jun 14 2018 Stephen Gallagher <sgallagh@redhat.com> - 2.4.0-2
- Don't own manpage directory
* 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> - 2.3.0-1
- Release hub 2.3.0
- https://github.com/github/hub/releases/tag/v2.3.0
* 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