%{?scl:%scl_package git-lfs} %{!?scl:%global pkg_name %{name}} # Generate devel rpm %global with_devel 0 # Build with debug info rpm %global with_debug 1 # Run tests in check section %global with_check 1 # Generate unit-test rpm %global with_unit_test 0 # Build man pages %global with_manpages 1 # Fallback to rh-go-toolset-1.12. rh-go-toolset-1.12-scldevel is probably not available in # the buildroot. %{!?scl_go_toolset:%global scl_go_toolset go-toolset-1.12} %{!?scl_prefix_go_toolset:%global scl_prefix_go_toolset %{scl_go_toolset}-} %global gobuilddir %{_builddir}/%{name}-%{version}/_build %global goipath github.com/git-lfs/git-lfs # Define gopath macro if it is not present in go-toolset # https://bugzilla.redhat.com/show_bug.cgi?id=1863057 %{!?gopath:%global gopath %{_datadir}/gocode} %if 0%{?with_debug} %global _dwz_low_mem_die_limit 0 %else %global debug_package %{nil} %endif %if ! 0%{?gobuild:1} %define gobuild(o:) go build -ldflags "${LDFLAGS:-} -compressdwarf=false -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**}; %endif %global provider github %global provider_tld com %global project git-lfs %global repo git-lfs # https://github.com/git-lfs/git-lfs %global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} %global import_path %{provider_prefix} %global commit 48b28d971c1101de4f461f6b603110ffd295a31f %global shortcommit %(c=%{commit}; echo ${c:0:7}) Name: %{?scl_prefix}git-lfs Version: 2.11.0 Release: 4%{?dist} Summary: Git extension for versioning large files License: MIT URL: https://git-lfs.github.io/ Source0: https://%{provider_prefix}/archive/v%{version}/%{pkg_name}-%{version}.tar.gz Source1: manpages.tgz # See this script. Generating of manpages is performed on other distros due to some missing numerous dependencies on RHEL Source2: gen-manpages.sh ExclusiveArch: %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm} aarch64 ppc64le s390x} %{?scl:Requires:%scl_runtime} BuildRequires: %{scl_prefix_go_toolset}golang Provides: bundled(golang(github.com/alexbrainman/sspi)) = 4729b3d4d8581b2db83864d1018926e4154f9406 Provides: bundled(golang(github.com/avast/retry-go)) = a322e24d96313ab405dec28ad5711f036c6d25a3 Provides: bundled(golang(github.com/davecgh/go-spew)) = 8991bc29aa16c548c550c7ff78260e27b9ab7c73 Provides: bundled(golang(github.com/dpotapov/go-spnego)) = c2c609116ad04b25367e2789f273aaf8d1c263da Provides: bundled(golang(github.com/git-lfs/gitobj)) = c6c142b484a6cecc0e79bebe3d9e931c5c00e982 Provides: bundled(golang(github.com/git-lfs/go-netrc)) = e0e9ca483a183481412e6f5a700ff20a36177503 Provides: bundled(golang(github.com/git-lfs/go-ntlm)) = c5056e7fa0664ea69eed654a9618fa5e342dc347 Provides: bundled(golang(github.com/git-lfs/wildmatch)) = 87c0f52cdf80ddb5b7de681298e5fee5898e8e16 Provides: bundled(golang(github.com/hashicorp/go-uuid)) = 4f571afc59f3043a65f8fe6bf46d887b10a01d43 Provides: bundled(golang(github.com/inconshreveable/mousetrap)) = 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 Provides: bundled(golang(github.com/jcmturner/gofork)) = dc7c13fece037a4a36e2b3c69db4991498d30692 Provides: bundled(golang(github.com/mattn/go-isatty)) = 6ca4dbf54d38eea1a992b3c722a76a5d1c4cb25c Provides: bundled(golang(github.com/olekukonko/ts)) = 78ecb04241c0121483589a30b0814836a746187d Provides: bundled(golang(github.com/pkg/errors)) = c605e284fe17294bda444b34710735b29d1a9d90 Provides: bundled(golang(github.com/pmezard/go-difflib)) = 792786c7400a136282c1664665ae0a8db921c6c2 Provides: bundled(golang(github.com/rubyist/tracerx)) = 787959303086f44a8c361240dfac53d3e9d53ed2 Provides: bundled(golang(github.com/spf13/cobra)) = ef82de70bb3f60c65fb8eebacbb2d122ef517385 Provides: bundled(golang(github.com/spf13/pflag)) = 298182f68c66c05229eb03ac171abe6e309ee79a Provides: bundled(golang(github.com/ssgelm/cookiejarparser)) = ead01002df3bee9f6d64bfde0c7387bd2368a2e0 Provides: bundled(golang(github.com/stretchr/testify)) = 3ebf1ddaeb260c4b1ae502a01c7844fa8c1fa0e9 Provides: bundled(golang(github.com/xeipuuv/gojsonpointer)) = 4e3ac2762d5f479393488629ee9370b50873b3a6 Provides: bundled(golang(github.com/xeipuuv/gojsonreference)) = bd5ef7bd5415a7ac448318e64f11a24cd21e594b Provides: bundled(golang(github.com/xeipuuv/gojsonschema)) = 6b67b3fab74d992bd07f72550006ab2c6907c416 Provides: bundled(golang(golang.org/x/crypto)) = a29dc8fdc73485234dbef99ebedb95d2eced08de Provides: bundled(golang(golang.org/x/net)) = 83d349e8ac1aeaa6e5b8669cbd094dccb2a7661d Provides: bundled(golang(golang.org/x/sync)) = 37e7f081c4d4c64e13b10787722085407fe5d15f Provides: bundled(golang(golang.org/x/sys)) = 97732733099d6a942a73b889770774366de963ed Provides: bundled(golang(golang.org/x/text)) = f21a4dfb5e38f5895301dc265a8def02365cc3d0 Provides: bundled(golang(gopkg.in/jcmturner/aescts.v1)) = f6abebb3171c4c1b1fea279cb7c7325020a26290 Provides: bundled(golang(gopkg.in/jcmturner/dnsutils.v1)) = 13eeb8d49ffb74d7a75784c35e4d900607a3943c Provides: bundled(golang(gopkg.in/jcmturner/gokrb5.v5)) = 32ba44ca5b42f17a4a9f33ff4305e70665a1bc0 Provides: bundled(golang(gopkg.in/jcmturner/rpc.v0)) = 4480c480c9cd343b54b0acb5b62261cbd33d7adf Provides: bundled(golang(gopkg.in/yaml.v2)) = 53403b58ad1b561927d19068c655246f2db79d48 %if 0%{?with_check} # For tests BuildRequires: perl-Digest-SHA BuildRequires: perl-Test-Harness # Tests require full git suite, but not generally needed. BuildRequires: %{?scl_prefix}git >= 1.8.2 %endif # https://github.com/git-lfs/git-lfs/commit/263bfd784aa0bb23e942033605fce6c870fc8e4f # 1.8.5 needed for macOS, but 1.8.2 sufficient for Linux. Requires: %{?scl_prefix}git-core >= 1.8.2 %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. %if 0%{?with_devel} %package -n %{?scl_prefix}golang-%{provider}-%{project}-%{repo}-devel Summary: %{summary} BuildArch: noarch %{?scl:Requires:%scl_runtime} %description -n %{?scl_prefix}golang-%{provider}-%{project}-%{repo}-devel %{summary} This package contains library source intended for building other packages which use import path with %{import_path} prefix. %endif %if 0%{?with_unit_test} && 0%{?with_devel} %package -n %{?scl_prefix}golang-%{provider}-%{project}-%{repo}-unit-test-devel Summary: Unit tests for %{pkg_name} package # test subpackage tests code from devel subpackage %{?scl:Requires:%scl_runtime} Requires: golang-%{provider}-%{project}-%{repo}-devel = %{version}-%{release} %description -n %{?scl_prefix}golang-%{provider}-%{project}-%{repo}-unit-test-devel %{summary} This package contains unit tests for project providing packages with %{import_path} prefix. %endif %prep %autosetup -p1 -n %{pkg_name}-%{version} # In Fedora this is done by %goprep install -m 0755 -vd %{gobuilddir}/bin install -m 0755 -vd "$(dirname %{gobuilddir}/src/%{goipath})" ln -fs "$(pwd)" "%{gobuilddir}/src/%{goipath}" %if %{?with_manpages} # Unpack manpages generated by %%{SOURCE2} tar -xf %{SOURCE1} %endif # Modify Makefile so that it expects binaries where we build them. sed -i -e 's!\.\./bin/!/%{gobuilddir}/bin/!g' t/Makefile %build %{?scl:scl enable %{scl_go_toolset} - << "EOF"} mkdir -p src/%{provider}.%{provider_tld}/%{project}/ ln -s $(pwd) src/%{provider}.%{provider_tld}/%{project}/%{repo} export GOPATH=%{gobuilddir}:%{gopath} export GO111MODULE=off # Build manpages first (some embedding in the executable is done.) pushd docs %gobuild -o mangen man/mangen.go ./mangen rm mangen man/mangen.go popd %gobuild -o %{gobuilddir}/bin/git-lfs %{provider_prefix} %if 0%{?with_check} # Build test executables # Pushing the directory must be done to enable go build to find the vendored sources pushd src/%{provider}.%{provider_tld}/%{project}/%{repo} for go in t/cmd/*.go; do %gobuild -o "%{gobuilddir}/bin/$(basename $cmd .go)" "$cmd" done %gobuild -o "%{gobuilddir}/bin/git-lfs-test-server-api" t/git-lfs-test-server-api/*.go popd %endif %{?scl:EOF} %install install -Dpm0755 %{gobuilddir}/bin/git-lfs %{buildroot}%{_bindir}/%{pkg_name} %if 0%{?with_manpages} install -d -p %{buildroot}%{_mandir}/man1/ install -Dpm0644 docs/man/*.1 %{buildroot}%{_mandir}/man1/ install -d -p %{buildroot}%{_mandir}/man5/ install -Dpm0644 docs/man/*.5 %{buildroot}%{_mandir}/man5/ # Remove unwanted files from man folder # https://bugzilla.redhat.com/show_bug.cgi?id=1852842 rm docs/man/*.1 docs/man/*.5 %endif # source codes for building projects %if 0%{?with_devel} install -d -p %{buildroot}%{gopath}/src/%{import_path}/ echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list # find all *.go but no *_test.go files and generate devel.file-list for file in $(find . \( -iname "*.go" -or -iname "*.s" \) \! -iname "*_test.go") ; do dirprefix=$(dirname $file) install -d -p %{buildroot}%{gopath}/src/%{import_path}/$dirprefix cp -pav $file %{buildroot}%{gopath}/src/%{import_path}/$file echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list while [ "$dirprefix" != "." ]; do echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list dirprefix=$(dirname $dirprefix) done done %endif # testing files for this project %if 0%{?with_unit_test} && 0%{?with_devel} install -d -p %{buildroot}%{gopath}/src/%{import_path}/ # find all *_test.go files and generate unit-test-devel.file-list for file in $(find . -iname "*_test.go") ; do dirprefix=$(dirname $file) install -d -p %{buildroot}%{gopath}/src/%{import_path}/$dirprefix cp -pav $file %{buildroot}%{gopath}/src/%{import_path}/$file echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list while [ "$dirprefix" != "." ]; do echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list dirprefix=$(dirname $dirprefix) done done %endif %if 0%{?with_devel} sort -u -o devel.file-list devel.file-list %endif %post %{?scl:scl enable %{scl} - << "EOF"} %{_bindir}/%{pkg_name} install --system %{?scl:EOF} %preun if [ $1 -eq 0 ]; then %{?scl:scl enable %{scl} - << "EOF"} %{_bindir}/%{pkg_name} uninstall --system %{?scl:EOF} fi exit 0 %check %{?scl:scl enable %{scl_go_toolset} - << "EOF"} %if 0%{?with_check} export GO111MODULE=off export GOPATH=%{buildroot}%{gopath}:$(pwd):%{gopath} export GIT_LFS_TEST_MAXPROCS=$(getconf _NPROCESSORS_ONLN) SKIPCOMPILE=1 pushd src/%{provider}.%{provider_tld}/%{project}/%{pkg_name} /usr/bin/scl enable %{scl} ./script/cibuild popd %endif %{?scl:EOF} %files %license LICENSE.md %{_bindir}/%{pkg_name} %if 0%{?with_manpages} %{_mandir}/man1/%{pkg_name}*.1* %{_mandir}/man5/%{pkg_name}*.5* %endif %if 0%{?with_devel} %files -n golang-%{provider}-%{project}-%{repo}-devel -f devel.file-list %license LICENSE.md %dir %{gopath}/src/%{provider}.%{provider_tld}/%{project} %endif %if 0%{?with_unit_test} && 0%{?with_devel} %files -n golang-%{provider}-%{project}-%{repo}-unit-test-devel -f unit-test-devel.file-list %license LICENSE.md %endif %changelog * Wed Sep 23 2020 Vít Ondruch - 2.11.0-4 - Provide non-compressed .debug_info. Resolves: rhbz#1881950 * Tue Sep 22 2020 Vít Ondruch - 2.11.0-3 - Fix %%preun scriptlet. Related: rhbz#1867991 * Thu Jul 23 2020 Ondrej Pohorelsky - 2.11.0-2 - Enable scl in %%post and %%preun to prevent using system git - Resolves: rhbz#1867991 * Thu Jul 23 2020 Ondrej Pohorelsky - 2.11.0-1 - Initial build for rh-git227-git-lfs-2.11.0 - Resolves: rhbz#1853404 * Thu Jul 19 2018 Sebastian Kisela - 2.4.1-3 - Add pregenerated manpages, due to missing dependency 'ronn' in rhel7. * Wed Jul 18 2018 Sebastian Kisela - 2.4.1-2 - Initial build for rh-git218-git-lfs-2.4.1 * Fri Jul 13 2018 Fedora Release Engineering - 2.4.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild * Wed May 23 2018 Elliott Sales de Andrade - 2.4.1-1 - Update to latest release * Mon May 21 2018 Carl George - 2.4.0-3 - Fix %%preun to correctly remove the lfs filter on uninstall (rhbz#1580357) * Mon Mar 12 2018 Carl George - 2.4.0-2 - Add %%go_arches fallback to work around Koji issues * Sun Mar 04 2018 Elliott Sales de Andrade - 2.4.0-1 - Update to latest release. * Thu Feb 08 2018 Elliott Sales de Andrade - 2.3.4-6 - Add patches to build with Go 1.10. * Wed Feb 07 2018 Fedora Release Engineering - 2.3.4-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild * Mon Dec 04 2017 Carl George - 2.3.4-4 - Use vendored libraries on RHEL - Skip test on RHEL - Don't build man pages on RHEL due to missing ronn - Don't build html versions of man pages * Fri Dec 01 2017 Elliott Sales de Andrade - 2.3.4-3 - Require git-core instead of git. * Fri Nov 03 2017 Elliott Sales de Andrade - 2.3.4-2 - Patch tests to work on slow systems like arm and aarch builders. - Fix "git lfs help" command. * Fri Nov 03 2017 Elliott Sales de Andrade - 2.3.4-1 - Update to latest release. - Run all tests during build. * Fri Sep 01 2017 Elliott Sales de Andrade - 2.2.1-3 - Remove redundant doc tag on manpages. - Use path macros in %%post/%%postun. * Thu Aug 31 2017 Elliott Sales de Andrade - 2.2.1-2 - Disable unnecessary subpackages. * Sun Jul 30 2017 Elliott Sales de Andrade - 2.2.1-1 - Update to latest version. * Wed Apr 19 2017 Elliott Sales de Andrade - 2.0.2-2 - Patch up to build with Go 1.7 * Wed Apr 19 2017 Elliott Sales de Andrade - 2.0.2-1 - Update to latest release - Add some requested macros * Tue Mar 14 2017 Elliott Sales de Andrade - 2.0.1-1 - Update to latest release - Don't disable git-lfs globally during upgrade * Mon Mar 06 2017 Elliott Sales de Andrade - 2.0.0-1 - Update to latest release * Sun Feb 12 2017 Elliott Sales de Andrade - 1.5.5-1 - Update to latest release - Add -devel and -unit-test-devel subpackages - Add post/preun scriptlets for global enablement * Sun May 15 2016 Igor Gnatenko - 1.2.0-1 - Initial package