Blob Blame History Raw
%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})


Summary:        A command-line wrapper for git with github shortcuts
Name:           hub
Version:        2.11.2
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-cucumber
BuildRequires: vim-filesystem
BuildRequires: groff-base

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 cucumber
Patch0001: 0001-Use-system-cucumber.patch

# Fedora: Use distro compiler settings. Many of these have been set manually
# because there isn't an easy way to get the RPM values inserted, so check
# regularly that this is not out of date.
Patch0002: 0002-Use-Fedora-compiler-settings.patch

# Fedora: don't trim out the source paths. They are needed for debuginfo
# generation
Patch0003: 0003-Don-t-trim-source-paths.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 -p1 -n %{name}-%{commit}
%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
LDFLAGS="%{__global_ldflags} %{?__golang_extldflags}" GOPATH=`pwd` %make_build

%install
LDFLAGS="%{__global_ldflags} %{?__golang_extldflags}" LC_ALL=C.UTF-8 GOPATH=`pwd` %make_install PREFIX=%{_prefix}

# Bash-completion
install -d -m 755 %{buildroot}%{_datarootdir}/bash-completion/completions/
cp -p etc/hub.bash_completion.sh %{buildroot}%{_datarootdir}/bash-completion/completions/hub

# ZSH-completion
install -d -m 755 %{buildroot}%{_datarootdir}/zsh/site-functions/
cp -p etc/hub.zsh_completion %{buildroot}%{_datarootdir}/zsh/site-functions/_hub

%check
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


%files
%license LICENSE
%doc README.md CONTRIBUTING.md
%{_bindir}/hub
%{_mandir}/man1/*
%{_datarootdir}/bash-completion/completions/hub
%{_datarootdir}/zsh/site-functions/_hub
%{_datarootdir}/vim/vimfiles/ftdetect/pullrequest.vim
%{_datarootdir}/vim/vimfiles/syntax/pullrequest.vim


%changelog
* Mon Apr 22 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.11.2-1
- Update to 2.11.2
- Avoid crash in hub remote argument parsing
- Fix `hub -C mydir merge <URL>` by propagating global git arguments to
  Before/After chains
- Preserve tilde ~ character in man pages

* Fri Mar 29 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.11.1-1
- Update to 2.11.1
- Fix compatibility with git when run with no arguments: hub --git-dir=.git
- Fix issue/PR --format %L output in no-color mode
- Create draft pull requests with hub pull-request --draft
- Fix non-draft pull requests for certain repositories

* Thu Mar 28 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.10.1-1
- Update to 2.10.1
- Fix writing over existing cache files in hub api
- Allow repository names that start with a - character
- List api among custom hub commands in help

* Thu Feb 28 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.10.0-2
- Install bash-completion into the correct path (BZ #1683866)

* Mon Feb 25 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.10.0-1
- Update to 2.10.0
- Features
  * New hub pr --format fields %pS and %pC for PR state and color
    %pS: "open", "draft", "merged", or "closed"
    %pC: green, gray, purple, or red
  * Have commands with rich output respect the --color flag
    default: --color=auto
    --color is equivalent to --color=always
    --color=never disables color for TTYs
- Fixes
  * Make man pages parseable with whatis
  * Make hub checkout work independently of remote refspec

* Wed Feb 13 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.9.0-1
- Update to 2.9.0
- Features
  * Add support for hub ci-status --format <FORMAT> string
  * Add hub create --remote-name <REMOTE> flag
  * Allow passing in a raw request body via hub api --input <FILE>
  * Cache HTTP 4xx (except 403) server responses in hub api --cache
- Fixes
  * Ensure consistent ordering of hub ci-status -v results
  * Avoid crashing on invalid GitHub hostname
  * Fix parsing empty string within command-line arguments

* Mon Feb 11 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.8.4-1
- Update to 2.8.4
- Drop DWARF decompression patch
- Use Fedora compiler and linker flags

* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.7.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* 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