git-lfs/git-lfs.spec

187 lines
5.4 KiB
RPMSpec
Raw Normal View History

2019-07-11 00:05:43 +00:00
%bcond_without check
# https://github.com/git-lfs/git-lfs
2021-10-05 04:09:17 +00:00
%global goipath github.com/git-lfs/git-lfs/v3
2022-03-20 23:11:54 +00:00
Version: 3.1.2
2018-09-03 22:09:13 +00:00
%gometa
2017-09-02 18:54:44 +00:00
2019-07-11 00:05:43 +00:00
%global common_description %{expand:
Git extension for versioning large files.}
%global golicenses LICENSE.md
%global godocs docs CHANGELOG.md CODE-OF-CONDUCT.md\\\
CONTRIBUTING.md README.md
2017-09-02 18:54:44 +00:00
Name: git-lfs
2021-09-26 02:39:59 +00:00
Release: %autorelease
2017-09-02 18:54:44 +00:00
Summary: Git extension for versioning large files
License: MIT
URL: https://git-lfs.github.io/
Source0: https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-v%{version}.tar.gz
Source1: https://github.com/git-lfs/git-lfs/releases/download/v%{version}/sha256sums.asc#/sha256sums-%{version}.asc
Source2: https://api.github.com/repos/git-lfs/git-lfs/tarball/core-gpg-keys#/core-gpg-keys.tar.gz
Source3: README.Fedora
BuildRequires: gnupg2
2018-09-03 22:09:13 +00:00
2020-02-22 10:38:43 +00:00
BuildRequires: golang(github.com/dpotapov/go-spnego)
2022-03-20 23:11:54 +00:00
BuildRequires: golang(github.com/git-lfs/gitobj/v2) >= 2.1.0
BuildRequires: golang(github.com/git-lfs/gitobj/v2/errors) >= 2.1.0
BuildRequires: golang(github.com/git-lfs/go-netrc/netrc) >= 0-0.13.20220318gitf0c862d
2021-10-05 04:09:17 +00:00
BuildRequires: golang(github.com/git-lfs/pktline)
BuildRequires: golang(github.com/git-lfs/wildmatch/v2) >= 2.0.1
2022-03-20 23:11:54 +00:00
BuildRequires: golang(github.com/leonelquinteros/gotext) >= 1.5.0
2019-02-22 03:54:51 +00:00
BuildRequires: golang(github.com/mattn/go-isatty) >= 0.0.4
2017-09-02 18:54:44 +00:00
BuildRequires: golang(github.com/olekukonko/ts)
2018-09-03 09:03:36 +00:00
BuildRequires: golang(github.com/pkg/errors)
2017-09-02 18:54:44 +00:00
BuildRequires: golang(github.com/rubyist/tracerx)
2019-02-22 03:54:51 +00:00
BuildRequires: golang(github.com/spf13/cobra) >= 0.0.3
2020-01-08 05:15:06 +00:00
BuildRequires: golang(github.com/ssgelm/cookiejarparser) >= 1.0.1
2020-01-02 03:08:15 +00:00
BuildRequires: golang(golang.org/x/net/http2)
2019-02-22 03:54:51 +00:00
BuildRequires: golang(golang.org/x/sync/semaphore)
2019-07-11 00:05:43 +00:00
# Generate man pages
2017-09-02 18:54:44 +00:00
BuildRequires: /usr/bin/ronn
2019-07-11 00:05:43 +00:00
%if %{with check}
# Tests
2021-10-05 04:09:17 +00:00
BuildRequires: golang(github.com/stretchr/testify/assert) >= 1.6.1
BuildRequires: golang(github.com/stretchr/testify/require) >= 1.6.1
2018-09-03 22:09:13 +00:00
BuildRequires: golang(github.com/xeipuuv/gojsonschema)
2017-11-03 08:25:40 +00:00
BuildRequires: perl-Digest-SHA
2018-09-03 09:03:36 +00:00
BuildRequires: perl-Test-Harness
2017-12-01 06:40:06 +00:00
# Tests require full git suite, but not generally needed.
2018-09-03 22:09:13 +00:00
BuildRequires: git >= 1.8.5
2019-07-11 00:05:43 +00:00
%endif
2017-09-02 18:54:44 +00:00
2018-09-03 22:09:13 +00:00
Requires: git-core >= 1.8.5
2017-09-02 18:54:44 +00:00
%description
Git Large File Storage (LFS) replaces large files such as audio samples,
videos, datasets, and graphics with text pointers inside Git, while
storing the file contents on a remote server.
2019-07-11 00:05:43 +00:00
%gopkg
2017-09-02 18:54:44 +00:00
%prep
tar xf %{SOURCE2}
keyring="$(ls git-lfs-git-lfs-*/keys.asc)"
#
# Replicate gpgverify, because it requires detached signatures.
#
fatal_error() {
message="$1" # an error message
status=$2 # a number to use as the exit code
echo "gpgverify: $message" >&2
exit $status
}
check_status() {
action="$1" # a string that describes the action that was attempted
status=$2 # the exit code of the command
if test $status -ne 0 ; then
fatal_error "$action failed." $status
fi
}
# Make a temporary working directory.
workdir="$(mktemp --directory)"
check_status 'Making a temporary directory' $?
workring="${workdir}/keyring.gpg"
# Decode any ASCII armor on the keyring. This is harmless if the keyring isn't
# ASCII-armored.
gpg2 --homedir="${workdir}" --yes --output="${workring}" --dearmor "${keyring}"
check_status 'Decoding the keyring' $?
# Verify the signature using the decoded keyring.
gpgv2 --homedir="${workdir}" --keyring="${workring}" "%{SOURCE1}"
check_status 'Signature verification' $?
# Clean up. (This is not done in case of an error that may need inspection.)
rm --recursive --force ${workdir}
#
# END gpgverify.
#
cd %{_sourcedir}
sha256sum --check --ignore-missing %{SOURCE1}
2019-07-11 00:05:43 +00:00
%goprep
cp -p %SOURCE3 .
2017-09-02 18:54:44 +00:00
2018-09-04 06:09:13 +00:00
# Modify Makefile so that it expects binaries where we build them.
2019-07-11 00:05:43 +00:00
sed -i -e 's!\.\./bin/!/%{gobuilddir}/bin/!g' t/Makefile
2018-09-04 06:09:13 +00:00
2017-09-02 18:54:44 +00:00
%build
2017-11-04 04:26:57 +00:00
# Build manpages first (some embedding in the executable is done.)
pushd docs
2017-12-04 21:28:40 +00:00
ronn --roff man/*.ronn
2019-07-11 00:05:43 +00:00
%gobuild -o %{gobuilddir}/bin/mangen man/mangen.go
%{gobuilddir}/bin/mangen
2017-11-04 04:26:57 +00:00
popd
2017-09-02 18:54:44 +00:00
LDFLAGS="-X 'github.com/git-lfs/git-lfs/config.Vendor=Fedora %{fedora}' " \
2019-07-11 00:05:43 +00:00
%gobuild -o %{gobuilddir}/bin/git-lfs %{goipath}
2017-09-02 18:54:44 +00:00
2017-11-03 08:25:40 +00:00
# Build test executables
2019-07-11 00:05:43 +00:00
for cmd in t/cmd/*.go; do
%gobuild -o "%{gobuilddir}/bin/$(basename $cmd .go)" "$cmd"
2017-11-03 08:25:40 +00:00
done
2019-07-11 00:05:43 +00:00
%gobuild -o "%{gobuilddir}/bin/git-lfs-test-server-api" t/git-lfs-test-server-api/*.go
2017-11-03 08:25:40 +00:00
2020-09-04 00:02:10 +00:00
# Move man pages out of docs so they don't get installed twice.
mv docs/man .
2017-09-02 18:54:44 +00:00
%install
2019-07-11 00:05:43 +00:00
%gopkginstall
install -Dpm0755 %{gobuilddir}/bin/git-lfs %{buildroot}%{_bindir}/%{name}
2017-09-02 18:54:44 +00:00
install -d -p %{buildroot}%{_mandir}/man1/
2020-09-04 00:02:10 +00:00
install -Dpm0644 man/*.1 %{buildroot}%{_mandir}/man1/
2017-09-02 18:54:44 +00:00
install -d -p %{buildroot}%{_mandir}/man5/
2020-09-04 00:02:10 +00:00
install -Dpm0644 man/*.5 %{buildroot}%{_mandir}/man5/
2017-09-02 18:54:44 +00:00
%post
if [ "x$(git config --type=bool --get 'fedora.git-lfs.no-modify-config')" != "xtrue" ]; then
2019-01-15 06:34:58 +00:00
%{_bindir}/%{name} install --system --skip-repo
fi
2017-09-02 18:54:44 +00:00
%preun
if [ $1 -eq 0 ] && \
[ "x$(git config --type=bool --get 'fedora.git-lfs.no-modify-config')" != "xtrue" ]; then
2019-01-15 06:34:58 +00:00
%{_bindir}/%{name} uninstall --system --skip-repo
2017-09-02 18:54:44 +00:00
fi
exit 0
2019-07-11 00:05:43 +00:00
%if %{with check}
2017-09-02 18:54:44 +00:00
%check
2019-07-11 00:05:43 +00:00
%gocheck
PATH=%{buildroot}%{_bindir}:%{gobuilddir}/bin:$PATH \
2018-09-04 06:09:13 +00:00
make -C t PROVE_EXTRA_ARGS="-j$(getconf _NPROCESSORS_ONLN)"
2019-07-11 00:05:43 +00:00
%endif
2017-09-02 18:54:44 +00:00
%files
%doc README.md README.Fedora CHANGELOG.md docs
2017-09-02 18:54:44 +00:00
%license LICENSE.md
%{_bindir}/%{name}
%{_mandir}/man1/%{name}*.1*
%{_mandir}/man5/%{name}*.5*
2019-07-11 00:05:43 +00:00
%gopkgfiles
2017-09-02 18:54:44 +00:00
%changelog
2021-09-26 02:39:59 +00:00
%autochangelog