rpm: Add sshca-cli RPM spec
The *sshca-cli* RPM package can be used to install the SSHCA CLI client on Fedora (and other RPM-based distributions). The `.spec` file was originally generated using [rust2rpm], but several manual modifications were required. Notably, the script does not generate `BuildRequres` tags when run in "vendored" mode (i.e. third-party crate sources are included in the source RPM package instead of packaged as separate RPMS).dev/auto-reload
parent
b203bbd87c
commit
f6abf699e8
|
@ -1 +1,5 @@
|
||||||
/target
|
/target
|
||||||
|
/vendor
|
||||||
|
/*.log
|
||||||
|
/*.tar.xz
|
||||||
|
/*.rpm
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
NAME := sshca-cli
|
||||||
|
VERSION := $(shell sed -nr '/^version =/s/version = "(.*)"/\1/p' Cargo.toml)
|
||||||
|
RELEASE := $(shell rpm --eval "$$(sed -nr '/^Release:/s/Release:\s*(.*)/\1/p' sshca-cli.spec)")
|
||||||
|
ARCH := $(shell uname -m)
|
||||||
|
|
||||||
|
MOCK_CONFIG = fedora-$(shell rpm --eval %fedora)-$(ARCH)
|
||||||
|
|
||||||
|
debug: target/debug/$(NAME)
|
||||||
|
|
||||||
|
release: target/release/$(NAME)
|
||||||
|
|
||||||
|
target/debug/$(NAME): $(find src) $(wildcard Cargo.*)
|
||||||
|
cargo build
|
||||||
|
|
||||||
|
target/release/$(NAME): $(find src) $(wildcard Cargo.*)
|
||||||
|
cargo build --release
|
||||||
|
|
||||||
|
rpm: $(NAME)-$(VERSION)-$(RELEASE).$(ARCH).rpm
|
||||||
|
|
||||||
|
$(NAME)-$(VERSION)-$(RELEASE).$(ARCH).rpm: \
|
||||||
|
$(NAME)-$(VERSION)-$(RELEASE).src.rpm
|
||||||
|
mkdir -p rpmbuild
|
||||||
|
rpmbuild --rebuild \
|
||||||
|
-D "_topdir ${PWD}/rpmbuild" \
|
||||||
|
$<
|
||||||
|
mv rpmbuild/RPMS/$(ARCH)/*.rpm .
|
||||||
|
rm -rf rpmbuild
|
||||||
|
|
||||||
|
srpm: $(NAME)-$(VERSION)-$(RELEASE).src.rpm
|
||||||
|
|
||||||
|
$(NAME)-$(VERSION)-$(RELEASE).src.rpm: \
|
||||||
|
$(NAME).spec \
|
||||||
|
$(NAME)-$(VERSION).tar.xz \
|
||||||
|
$(NAME)-$(VERSION)-vendor.tar.xz
|
||||||
|
rpmbuild -bs \
|
||||||
|
-D "_topdir ${PWD}" \
|
||||||
|
-D '_builddir %{_topdir}' \
|
||||||
|
-D '_buildrootdir %{_topdir}' \
|
||||||
|
-D '_rpmdir %{_topdir}' \
|
||||||
|
-D '_sourcedir %{_topdir}' \
|
||||||
|
-D '_specdir %{_topdir}' \
|
||||||
|
-D '_srcrpmdir %{_topdir}' \
|
||||||
|
$<
|
||||||
|
|
||||||
|
$(NAME)-$(VERSION).tar.xz: \
|
||||||
|
$(shell find src -type f) \
|
||||||
|
Cargo.toml \
|
||||||
|
Cargo.lock \
|
||||||
|
$(wildcard LICENSE-*.txt)
|
||||||
|
tar -czf $@ \
|
||||||
|
--transform 's/^/$(NAME)-$(VERSION)\//' \
|
||||||
|
src \
|
||||||
|
Cargo.lock \
|
||||||
|
Cargo.toml \
|
||||||
|
LICENSE-*.txt
|
||||||
|
|
||||||
|
$(NAME)-$(VERSION)-vendor.tar.xz: Cargo.lock
|
||||||
|
cargo vendor
|
||||||
|
tar -czf $@ vendor
|
||||||
|
|
||||||
|
mockbuild: $(NAME)-$(VERSION)-$(RELEASE).src.rpm
|
||||||
|
mock -r $(MOCK_CONFIG) --resultdir $(PWD) $<
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(NAME)*-$(VERSION)-$(RELEASE).*.rpm
|
||||||
|
rm -f $(NAME)-$(VERSION).tar.xz
|
||||||
|
rm -f $(NAME)-$(VERSION)-vendor.tar.xz
|
||||||
|
rm -f build.log hw_info.log installed_pkgs.log root.log state.log
|
||||||
|
|
||||||
|
fullclean: clean
|
||||||
|
rm -rf target
|
||||||
|
|
||||||
|
.PHONY: \
|
||||||
|
clean \
|
||||||
|
debug \
|
||||||
|
mockbuild \
|
||||||
|
release \
|
||||||
|
rpm \
|
||||||
|
srpm
|
|
@ -0,0 +1,60 @@
|
||||||
|
# Generated by rust2rpm 25
|
||||||
|
%bcond_without check
|
||||||
|
|
||||||
|
# prevent library files from being installed
|
||||||
|
%global __cargo_is_lib() 0
|
||||||
|
|
||||||
|
%global crate sshca-cli
|
||||||
|
|
||||||
|
Name: sshca-cli
|
||||||
|
Version: 0.1.0
|
||||||
|
Release: 1%{?dist}
|
||||||
|
Summary: CLI client for SSHCA
|
||||||
|
|
||||||
|
SourceLicense: MIT OR Apache-2.0
|
||||||
|
License: MIT OR Apache-2.0
|
||||||
|
# LICENSE.dependencies contains a full license breakdown
|
||||||
|
|
||||||
|
URL: https://git.pyrocufflink.net/dustin/sshca
|
||||||
|
Source: sshca-cli-%{version}.tar.xz
|
||||||
|
Source: sshca-cli-%{version}-vendor.tar.xz
|
||||||
|
|
||||||
|
ExclusiveArch: %{rust_arches}
|
||||||
|
|
||||||
|
BuildRequires: cargo-rpm-macros >= 25
|
||||||
|
BuildRequires: openssl-devel
|
||||||
|
|
||||||
|
%global _description %{expand:
|
||||||
|
CLI client for SSHCA.}
|
||||||
|
|
||||||
|
%description %{_description}
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -n %{crate}-%{version} -p1 -a1
|
||||||
|
%cargo_prep -v vendor
|
||||||
|
|
||||||
|
|
||||||
|
%build
|
||||||
|
%cargo_build
|
||||||
|
%{cargo_license_summary}
|
||||||
|
%{cargo_license} > LICENSE.dependencies
|
||||||
|
%{cargo_vendor_manifest}
|
||||||
|
|
||||||
|
%install
|
||||||
|
%cargo_install
|
||||||
|
|
||||||
|
%if %{with check}
|
||||||
|
%check
|
||||||
|
%cargo_test
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%files
|
||||||
|
%license LICENSE-Apache-2.0.txt
|
||||||
|
%license LICENSE-MIT.txt
|
||||||
|
%license LICENSE.dependencies
|
||||||
|
%license cargo-vendor.txt
|
||||||
|
%{_bindir}/sshca-cli
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Sun Nov 05 2023 Dustin C. Hatch <dustin@hatch.name> - 0.1.0-1
|
||||||
|
- Initial package
|
Loading…
Reference in New Issue