Skip to content
Snippets Groups Projects
Commit 5945e785 authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

add RPM packaging


Build and install tested on Fedora 23.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent ea59dd32
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,8 @@ VERSION = $$(basename $$(git describe --tags | tr - . | sed 's/^v//'))
all:
@echo "Usage:"
@echo
@echo " make deb - Builds debian packages."
@echo " make rpm - Builds rpm packages."
@echo " make release - Generates the release tarball."
@echo
@echo " make clean - Cleanup the local repository build files."
......@@ -56,6 +58,23 @@ build/release-stamp:
echo " -- $${author} $${date}"; \
echo; \
) > build/${PKGNAME}-${VERSION}/debian/changelog
@echo "Generating rpm specfile from template..."
@cd build/${PKGNAME}-${VERSION}; \
for spectmpl in rpm/*.spec.tmpl; do \
sed -i "s/Version:.*/Version: ${VERSION}/g" $${spectmpl}; \
mv $${spectmpl} $$(basename $${spectmpl} .tmpl); \
done; \
rmdir rpm
@echo "Generating rpm changelog..."
@( \
version=${VERSION}; \
author=$$(git show HEAD --format="format:%an <%ae>" -s); \
date=$$(git show HEAD --format="format:%ad" -s \
| awk '{print $$1,$$2,$$3,$$5}'); \
hash=$$(git show HEAD --format="format:%H" -s); \
echo '* '"$${date} $${author} $${version}-1"; \
echo " - Generated from git commit $${hash}."; \
) >> $$(ls build/${PKGNAME}-${VERSION}/*.spec)
@find build/${PKGNAME}-${VERSION}/ -exec \
touch -t $$(date -d @$$(git show -s --format="format:%at") \
+"%Y%m%d%H%M.%S") {} \;
......@@ -78,3 +97,17 @@ build/deb-stamp:
@echo "Generated debian packages:"
@for pkg in $$(ls dist/*_${VERSION}_*.deb); do echo " $${pkg}"; done
@touch build/deb-stamp
rpm: release build/rpm-stamp
build/rpm-stamp:
@echo "Building rpm packages..."
@mkdir -p build/rpm
@build=$$(pwd)/build/rpm; dist=$$(pwd)/dist/; rpmbuild \
--define "_topdir $${build}" --define "_sourcedir $${dist}" \
--define "_rpmdir $${build}" --define "_buildir $${build}" \
--define "_srcrpmdir $${build}" -ba build/${PKGNAME}-${VERSION}/*.spec
@mv build/rpm/*-${VERSION}*.src.rpm dist/
@mv build/rpm/*/*-${VERSION}*.rpm dist/
@echo "Generated rpm packages:"
@for pkg in $$(ls dist/*-${VERSION}*.rpm); do echo " $${pkg}"; done
@touch build/rpm-stamp
Name: nvmetcli
License: Apache License 2.0
Group: Applications/System
Summary: Command line interface for the kernel NVMe nvmet
Version: VERSION
Release: 1%{?dist}
URL: http://git.infradead.org/users/hch/nvmetcli.git
Source: nvmetcli-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-rpmroot
BuildArch: noarch
BuildRequires: python-devel python-setuptools systemd-units
Requires: python-configshell python-kmod
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%description
This package contains the command line interface to the NVMe over Fabrics
nvmet in the Linux kernel. It allows configuring the nvmet interactively
as well as saving / restoring the configuration to / from a json file.
%prep
%setup -q -n nvmetcli-%{version}
%build
%{__python} setup.py build
%install
rm -rf %{buildroot}
%{__python} setup.py install --skip-build --root=%{buildroot} --prefix=usr
mkdir -p %{buildroot}%{_sysconfdir}/nvmet
mkdir -p %{buildroot}/usr/sbin
install -m 755 nvmetcli %{buildroot}/usr/sbin/nvmetcli
mkdir -p %{buildroot}%{_unitdir}
install -m 644 nvmet.service %{buildroot}%{_unitdir}/nvmet.service
%clean
rm -rf %{buildroot}
%post
%systemd_post nvmet.service
%preun
%systemd_preun nvmet.service
%postun
%systemd_postun_with_restart nvmet.service
%files
%defattr(-,root,root,-)
%{python_sitelib}
%dir %{_sysconfdir}/nvmet
/usr/sbin/nvmetcli
%{_unitdir}/nvmet.service
%doc COPYING README
%changelog
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment