diff --git a/.gitignore b/.gitignore index 7d1158e..076f1c8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /hub-2.2.5-7988c4b.tar.gz /hub-2.2.9-80948b0.tar.gz /hub-2.3.0-80948b0.tar.gz +/hub-2.4.0.tar.gz diff --git a/0001-Add-DESTDIR-support-for-make-install.patch b/0001-Add-DESTDIR-support-for-make-install.patch new file mode 100644 index 0000000..1459024 --- /dev/null +++ b/0001-Add-DESTDIR-support-for-make-install.patch @@ -0,0 +1,41 @@ +From 3ad950799e2640e06f487c2de214f16247e6e4a0 Mon Sep 17 00:00:00 2001 +From: Stephen Gallagher +Date: Wed, 13 Jun 2018 09:09:26 -0400 +Subject: [PATCH] Add DESTDIR support for `make install` + +When packaging for distributions (particularly RPM), it is common +for the packaging tool to install all of the files into a chroot- +style directory structure as a non-privileged user. This is done +to avoid requiring root privileges for packaging (particularly to +avoid issues where the attempt to package causes changes to be +made to the packaging host. + +The standard variable used for this (from autotools) is DESTDIR. +This patch adds DESTDIR before the prefix in install.sh to ensure +that when `make install` is run, it will direct output to the +proper location. + +Signed-off-by: Stephen Gallagher +--- + script/install.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/script/install.sh b/script/install.sh +index 55ebe96f3d9b2186828a7a4c6d20fe9d4607bd71..8bdff41f9fb2bfc01db870945d0bbccaa9a85abf 100644 +--- a/script/install.sh ++++ b/script/install.sh +@@ -15,10 +15,10 @@ fi + + prefix="${PREFIX:-$prefix}" + prefix="${prefix:-/usr/local}" + + for src in bin/hub share/man/*/*.1; do +- dest="${prefix}/${src}" ++ dest="${DESTDIR}${prefix}/${src}" + mkdir -p "${dest%/*}" + [[ $src == share/* ]] && mode="644" || mode=755 + install -m "$mode" "$src" "$dest" + done +-- +2.17.1 + diff --git a/0002-Use-system-ronn.patch b/0002-Use-system-ronn.patch new file mode 100644 index 0000000..ef60b8f --- /dev/null +++ b/0002-Use-system-ronn.patch @@ -0,0 +1,32 @@ +From 2fcfc13bac6b12e1b47109364a50cb3f73db59a1 Mon Sep 17 00:00:00 2001 +From: Stephen Gallagher +Date: Wed, 13 Jun 2018 11:02:34 -0400 +Subject: [PATCH 2/2] Use system ronn + +Signed-off-by: Stephen Gallagher +--- + Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index 6d9b7be13d2e1bd3634ffbda5e8191d8568af049..29871320616a2e05214159710177f7cfb4ddb3b2 100644 +--- a/Makefile ++++ b/Makefile +@@ -56,12 +56,12 @@ fmt: + man-pages: $(HELP_ALL:=.ronn) $(HELP_ALL) $(HELP_ALL:=.txt) + + %.txt: %.ronn + groff -Wall -mtty-char -mandoc -Tutf8 -rLL=$(TEXT_WIDTH)n $< | col -b >$@ + +-%.1: %.1.ronn bin/ronn +- bin/ronn --organization=GITHUB --manual="Hub Manual" share/man/man1/*.ronn ++%.1: %.1.ronn ++ ronn --organization=GITHUB --manual="Hub Manual" share/man/man1/*.ronn + + %.1.ronn: bin/hub + bin/hub help $(*F) --plain-text | script/format-ronn $(*F) $@ + + share/man/man1/hub.1.ronn: +-- +2.17.1 + diff --git a/hub.spec b/hub.spec index f64d5ed..f3038e1 100644 --- a/hub.spec +++ b/hub.spec @@ -5,6 +5,8 @@ %global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} %global import_path %{provider_prefix} +%global stable_release 1 + # 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. @@ -16,9 +18,11 @@ # 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: 2.3.0 +Version: 2.4.0 Release: 1%{?dist} Group: Development/Languages License: MIT @@ -28,17 +32,21 @@ URL: http://hub.github.com/ # 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. -Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{version}-%{shortcommit}.tar.gz +%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/howeyc/gopass) BuildRequires: golang(github.com/kballard/go-shellquote) BuildRequires: golang(github.com/mitchellh/go-homedir) @@ -50,6 +58,12 @@ Provides: bundled(golang(github.com/mattn/go-isatty)) Provides: bundled(golang(github.com/octokit/go-octokit)) Provides: bundled(golang(github.com/ogier/pflag)) +# Submitted upstream as https://github.com/github/hub/pull/1777 +Patch0001: 0001-Add-DESTDIR-support-for-make-install.patch + +# 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 @@ -61,32 +75,35 @@ features and commands that make working with GitHub easier. $ git clone git://github.com/rtomayko/tilt.git %prep -%setup -qn %{name}-%{commit} +%if 0%{?stable_release} +%autosetup -p1 +%else +%autosetup -n %{name}-%{commit} -p1 +%endif rm -rf vendor/gopkg.in/yaml.v1 \ vendor/github.com/bmizerany/assert \ vendor/github.com/BurntSushi/toml \ - vendor/github.com/howeyc/gopass \ vendor/github.com/kballard/go-shellquote \ vendor/github.com/mitchellh/go-homedir -%build -mkdir -p src/%{provider}.%{provider_tld}/%{project}/ -ln -s ../../../ src/%{provider}.%{provider_tld}/%{project}/%{repo} +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 -export GOPATH=$(pwd):$(pwd)/Godeps/_workspace:%{gopath} -%gobuild -o bin/%{name} %{import_path} +%build +%make_build %install -# /bin/hub -install -d -p %{buildroot}%{_bindir} -install -p -m 755 bin/%{name} %{buildroot}%{_bindir} - -# Documentation -install -d -m 755 %{buildroot}%{_mandir}/man1/ -cp -p man/hub.1 %{buildroot}%{_mandir}/man1/. - +%make_install PREFIX=%{_prefix} # Bash-completion install -d -m 755 %{buildroot}%{_sysconfdir}/bash_completion.d/ @@ -111,38 +128,19 @@ find . -maxdepth 2 -name '*.go' '!' -name '*_test.go' | \ xargs go test -v %endif -%pretrans -p --- hub versions 2.2.5-1 and 2.2.5-2 accidentally included --- a directory instead of the actual zsh completion script --- so we need to move it out of the way and install the --- correct script. This should be removable in Fedora 27. --- Script taken from --- https://fedoraproject.org/w/index.php?title=Packaging:Directory_Replacement&oldid=372506#Scriptlet_to_replace_a_directory -path = "/usr/share/zsh/site-functions/_hub" -st = posix.stat(path) -if st and st.type == "directory" then - status = os.rename(path, path .. ".rpmmoved") - if not status then - suffix = 0 - while not status do - suffix = suffix + 1 - status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix) - end - os.rename(path, path .. ".rpmmoved") - end -end - %files %license LICENSE %doc README.md CONTRIBUTING.md -%doc man/hub.1.html man/hub.1.ronn %{_bindir}/hub -%{_mandir}/man1/hub.1.gz +%{_mandir}/man1/ %{_sysconfdir}/bash_completion.d/ %{_datarootdir}/zsh/site-functions/_hub -%ghost %{_datarootdir}/zsh/site-functions/_hub.rpmmoved %changelog +* Wed Jun 13 2018 Stephen Gallagher - 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 - 2.3.0-1 - Release hub 2.3.0 - https://github.com/github/hub/releases/tag/v2.3.0 diff --git a/sources b/sources index 3920a7d..82dd4cc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (hub-2.3.0-80948b0.tar.gz) = ee0d9f012f97157242e8f372d47aa8d57a7ffd2ab79efa533d718865e79cba7f3f15c3e7354c066f4bdd37336499e661da7a92e5177a3ab3ed948b9fd6830515 +SHA512 (hub-2.4.0.tar.gz) = 302a508b7353ed96f969d399d87cd395b5561490c41f46043969a49eaa997a63d2649b3f6f23a565f1b8c821f93c4db1b8c7104c85d0b08fc6d96f03e765f2f7