diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5398f82 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +RPMBUILD +oe-workdir +oe-logs +git_dir_pack +*.src.rpm diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..fb2e7e7 --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +RPM_BASE:=$(shell \ + rpmspec --query --qf "%{name}-%{version}-%{release}" mlxbf-bfscripts.spec) +SRPM_NAME:=$(RPM_BASE).src.rpm +TAR_BASE:=$(shell \ + rpmspec --query --qf "%{name}-%{version}" mlxbf-bfscripts.spec) +TAR_NAME:=$(TAR_BASE).tar.gz +GIT_FILES:=$(shell git ls-files -co --exclude-standard) + +.PHONY: all clean +all: $(SRPM_NAME) + +clean: + rm -r RPMBUILD + rm -r git_dir_pack + rm -f mlxbf-bfscripts*.src.rpm + +RPMBUILD/SOURCES/$(TAR_NAME): $(GIT_FILES) + mkdir -p RPMBUILD/SOURCES + rm -rf git_dir_pack + mkdir -p git_dir_pack/$(TAR_BASE) + rsync --relative $(GIT_FILES) git_dir_pack/$(TAR_BASE) + (cd git_dir_pack; tar -zcvf ../$@ $(TAR_BASE)) + +$(SRPM_NAME): RPMBUILD/SOURCES/$(TAR_NAME) mlxbf-bfscripts.spec + rpmbuild -bs --define "_topdir $(shell pwd)/RPMBUILD" mlxbf-bfscripts.spec + cp RPMBUILD/SRPMS/$(SRPM_NAME) ./ diff --git a/mlxbf-bfscripts.spec b/mlxbf-bfscripts.spec new file mode 100644 index 0000000..933f694 --- /dev/null +++ b/mlxbf-bfscripts.spec @@ -0,0 +1,122 @@ +%global debug_package %{nil} + +Summary: Utility scripts for managing Mellanox BlueField hardware +Name: mlxbf-bfscripts +Version: 3.0.0~beta1 +URL: https://github.com/Mellanox/bfscripts +Release: 3%{?dist} +License: BSD + +BuildArch: noarch + +# Source is created by: +# git clone https://github.com/Mellanox/bfscripts +# cd bfscripts +# git checkout 56a22690f9a7223261ffa70bcb9b3ae8d26021cc +# rpkg spec --sources +Source: mlxbf-bfscripts-3.0.0~beta1.tar.gz + +BuildRequires: systemd-rpm-macros +BuildRequires: python3-devel +BuildRequires: /usr/bin/pathfix.py + +Requires: mlxbf-bootctl +Requires: mlxbf-aarch64-firmware +Requires: bash +Requires: python +Requires: grub2-tools +Requires: dosfstools +Requires: e2fsprogs +Requires: efibootmgr +Requires: pciutils +Requires: util-linux +Requires: binutils +Requires: systemd + +%description +Useful scripts for managing Mellanox BlueField hardware. + +%prep +%setup +pathfix.py -pni "%{__python3} %{py3_shbang_opts}" mlx-mkbfb + +%build +exit 0 + +%install +%global installdir %{buildroot}%{_bindir} +%global man1dir %{buildroot}%{_mandir}/man1 +%global man8dir %{buildroot}%{_mandir}/man8 +mkdir -p %{installdir} +install -p -d %{man1dir} +install -p -d %{man8dir} + +install -p bfbootmgr %{installdir} +install -p man/bfbootmgr.8 %{man8dir} +install -p bfcfg %{installdir} +install -p man/bfcfg.8 %{man8dir} +install -p bfcpu-freq %{installdir} +install -p man/bfcpu-freq.8 %{man8dir} +install -p bfdracut %{installdir} +install -p man/bfdracut.8 %{man8dir} +install -p bffamily %{installdir} +install -p man/bffamily.8 %{man8dir} +install -p bfinst %{installdir} +install -p man/bfinst.8 %{man8dir} +install -p bfpxe %{installdir} +install -p man/bfpxe.8 %{man8dir} +install -p bfrec %{installdir} +install -p man/bfrec.8 %{man8dir} +install -p bfsbkeys %{installdir} +install -p man/bfsbkeys.8 %{man8dir} +install -p bfvcheck %{installdir} +install -p man/bfvcheck.8 %{man8dir} +install -p bfver %{installdir} +install -p man/bfver.8 %{man8dir} +install -p bfauxpwr %{installdir} +install -p man/bfauxpwr.8 %{man8dir} +install -p bfhcafw %{installdir} +install -p man/bfhcafw.8 %{man8dir} + +install -p mlx-mkbfb %{installdir} +install -p man/mlx-mkbfb.1 %{man1dir} + +install -p -d %{buildroot}%{_unitdir} +install -p bfvcheck.service %{buildroot}%{_unitdir}/ + +install -p -d %{buildroot}%{_presetdir} +install -p 80-bfvcheck.preset %{buildroot}%{_presetdir}/ + +%post +%systemd_post bfvcheck.service + +%preun +%systemd_preun bfvcheck.service + +%postun +%systemd_postun bfvcheck.service + +%files +%license LICENSE +%{_bindir}/bf* +%{_bindir}/mlx-mkbfb +%attr(644, root, root) %{_mandir}/man1/* +%attr(644, root, root) %{_mandir}/man8/* +%attr(644, root, root) %{_unitdir}/bfvcheck.service +%attr(644, root, root) %{_presetdir}/80-bfvcheck.preset + +%doc README.md + +%changelog +* Fri Jul 24 2020 Spencer Lingard - 3.0.0~beta1-3 +- Add -p to all install invocations +- Change __install macro to just install +- Add autogenerated comment to Source to tell how to obtain sources + +* Tue Jul 21 2020 Spencer Lingard - 3.0.0~beta1-2 +- Use systemd macros for unit setup +- Use preset file instead of enabling service manually +- Fix Requires/BuildRequires + +* Wed Jul 1 2020 Spencer Lingard - 3.0.0~beta1-1 +Initial packaging.