You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-vendor-tools/SPECS/go-vendor-tools.spec

141 lines
3.8 KiB

# Copyright (C) 2024 Maxwell G <maxwell@gtmx.me>
# SPDX-License-Identifier: MIT
# License text: https://spdx.org/licenses/MIT
%bcond manpages 1
%global forgeurl https://gitlab.com/fedora/sigs/go/go-vendor-tools
%define tag v%{version_no_tilde %{quote:%nil}}
%define bash_completions_dir /usr/share/bash-completion/completions
%define fish_completions_dir /usr/share/fish/vendor_completions.d
%define zsh_completions_dir /usr/share/zsh/site-functions
Name: go-vendor-tools
Version: 0.5.1
%forgemeta
Release: 2%{?dist}.inferit
Summary: Tools for handling Go library vendoring in Fedora
# BSD-3-Clause: src/go_vendor_tools/archive.py
License: MIT AND BSD-3-Clause
URL: %{forgeurl}
Source0: %{forgesource}
BuildArch: noarch
BuildRequires: python3-devel
%if %{with manpages}
BuildRequires: scdoc
%endif
Recommends: (askalono-cli or trivy)
Recommends: go-vendor-tools+all
%global common_description %{expand:
go-vendor-tools provides tools and macros for handling Go library vendoring in
Fedora.}
%description %common_description
%package doc
Summary: Documentation for go-vendor-tools
Enhances: go-vendor-tools
%description doc %common_description
%prep
%autosetup -p1 %{forgesetupargs}
%generate_buildrequires
%pyproject_buildrequires -x all,test
%build
%pyproject_wheel
%if %{with manpages}
./doc/man/mkman.sh
%endif
mkdir -p bash_completions fish_completions zsh_completions
for bin in go_vendor_archive go_vendor_license; do
register-python-argcomplete --shell bash "${bin}" > "bash_completions/${bin}"
register-python-argcomplete --shell fish "${bin}" > "fish_completions/${bin}.fish"
# Compatibility with old argcomplete versions
if ! (register-python-argcomplete --shell zsh "${bin}" > "zsh_completions/_${bin}"); then
echo "#compdef ${bin}" > "zsh_completions/_${bin}"
echo -e "autoload -Uz bashcompinit\nbashcompinit" > "zsh_completions/_${bin}"
cat "bash_completions/${bin}" >> "zsh_completions/_${bin}"
fi
done
%install
%pyproject_install
# TODO(anyone): Use -l flag once supported by EL 9.
%pyproject_save_files go_vendor_tools
# Install RPM macros
install -Dpm 0644 rpm/macros.go_vendor_tools -t %{buildroot}%{_rpmmacrodir}
# Install documentation
mkdir -p %{buildroot}%{_docdir}/go-vendor-tools-doc
cp -rL doc/* %{buildroot}%{_docdir}/go-vendor-tools-doc
# Install manpages
%if %{with manpages}
install -Dpm 0644 doc/man/*.1 -t %{buildroot}%{_mandir}/man1/
%endif
# Install completions
install -Dpm 0644 bash_completions/* -t %{buildroot}%{bash_completions_dir}/
install -Dpm 0644 fish_completions/* -t %{buildroot}%{fish_completions_dir}/
install -Dpm 0644 zsh_completions/* -t %{buildroot}%{zsh_completions_dir}/
%check
%pytest
%files -f %{pyproject_files}
# Install top-level markdown files
%doc *.md
%license LICENSES/*
%{_bindir}/go_vendor*
%{bash_completions_dir}/go_vendor_*
%{fish_completions_dir}/go_vendor_*.fish
%{zsh_completions_dir}/_go_vendor_*
%{_rpmmacrodir}/macros.go_vendor_tools
%if %{with manpages}
%{_mandir}/man1/go*.1*
%endif
%files doc
%doc %{_docdir}/go-vendor-tools-doc/
%pyproject_extras_subpkg -n go-vendor-tools all
%changelog
* Thu Jul 25 2024 Sergey Cherevko <s.cherevko@msvsphere-os.ru> - 0.5.1-2.inferit
- Adapted for MSVphere 9 build
- Rebuilt for MSVSphere 9.4
* Fri Jun 14 2024 Maxwell G <maxwell@gtmx.me> - 0.5.1-2
- Rebuild for Python 3.13
* Fri Apr 12 2024 Maxwell G <maxwell@gtmx.me> - 0.5.1-1
- Update to 0.5.1.
* Wed Apr 3 2024 Maxwell G <maxwell@gtmx.me> - 0.3.0-3
- Fix directory ownership patch
* Wed Apr 3 2024 Maxwell G <maxwell@gtmx.me> - 0.3.0-2
- Backport patch to fix directory ownership for %%go_vendor_license_install filelist
* Thu Mar 28 2024 Maxwell G <maxwell@gtmx.me> - 0.3.0-1
- Initial package (rhbz#2268011).