Skip to content

Commit 995b1bf

Browse files
committed
build: improve rpm build
Improve libzbc RPM spec file to fix errors and warnings generated by rpmlint. libzbc spec file is now not generated automatically through "make rpm". Signed-off-by: Damien Le Moal <[email protected]>
1 parent 5ff12b4 commit 995b1bf

File tree

3 files changed

+42
-36
lines changed

3 files changed

+42
-36
lines changed

Makefile.am

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,23 @@ if BUILD_TEST
1111
SUBDIRS += test/programs
1212
endif
1313

14-
EXTRA_DIST = autogen.sh
14+
EXTRA_DIST = autogen.sh COPYING.BSD COPYING.LESSER README.md
1515

1616
if ENABLE_RPMBUILD
1717
rpmdir = $(abs_top_builddir)/rpmbuild
1818

1919
EXTRA_DIST += libzbc.spec
2020
RPMARCH=`$(RPM) --eval %_target_cpu`
2121

22-
spec: libzbc.spec.in
23-
@echo "Generating rpm spec file..."
24-
@echo "Version: $(PACKAGE_VERSION)" > libzbc.spec
25-
@cat libzbc.spec.in | grep -v '# ' >> libzbc.spec
26-
27-
rpm: spec dist
22+
rpm: dist
2823
@echo "Building RPM packages..."
2924
@mkdir -p $(rpmdir)
30-
$(RPMBUILD) -ta --clean -D "_topdir $(rpmdir)" libzbc-$(PACKAGE_VERSION).tar.gz
25+
@mv libzbc-$(PACKAGE_VERSION).tar.gz v$(PACKAGE_VERSION).tar.gz
26+
$(RPMBUILD) -ta --clean -D "_topdir $(rpmdir)" v$(PACKAGE_VERSION).tar.gz
3127
@mv -f $(rpmdir)/RPMS/$(RPMARCH)/*.rpm $(abs_top_builddir)
3228
@mv -f $(rpmdir)/SRPMS/*.rpm $(abs_top_builddir)
3329
@rm -rf $(rpmdir)
34-
@rm -f libzbc-$(PACKAGE_VERSION).tar.gz
35-
@rm -f libzbc.spec
30+
@rm -f v$(PACKAGE_VERSION).tar.gz
3631
else
3732
rpm:
3833
@echo "To build RPM packages, install the rpm and rpm-build packages"

README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,19 +167,27 @@ for the tests is thus not allowed.
167167
Each test outputs a log file in the `test/log` directory. These files can be
168168
consulted in case of a failed test to identify the reason for the test failure.
169169

170-
## Building rpm packages
170+
## Building RPM packages
171171

172-
The following command will build redistributable rpm packages.
172+
The *rpm* and *rpmbuild* utilities are necessary to build *libzbc* RPM
173+
packages. Once these utilities are installed, the RPM packages can be built
174+
using the following command.
173175

174176
```
177+
$ sh ./autogen.sh
178+
$ ./configure
175179
$ make rpm
176180
```
177181

178-
Three rpm packages are built: a binary package providing the library and
179-
executable tools, a development package providing *libzbc* header files and a
180-
source package. The source package can be used to build the binary and
181-
development rpm packages outside of *libzbc* source tree using the following
182-
command.
182+
Five RPM packages are built:
183+
* A binary package providing *libzbc* library, tools, documentation and
184+
license files.
185+
* A source RPM package
186+
* A *debuginfo* RPM package and a *debugsource* RPM package
187+
* A development package providing the library header files
188+
189+
The source RPM package can be used to build the binary and debug RPM packages
190+
outside of *libzbc* source tree using the following command.
183191

184192
```
185193
$ rpmbuild --rebuild libzbc-<version>.src.rpm

libzbc.spec.in renamed to libzbc.spec

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,34 @@
22
# SPDX-License-Identifier: LGPL-3.0-or-later
33
#
44
# Copyright (c) 2020 Western Digital Corporation or its affiliates.
5+
Name: libzbc
6+
Version: 5.9.0
7+
Release: 1%{?dist}
8+
Summary: A library to control SCSI/ZBC and ATA/ZAC zoned devices
59

6-
Name: libzbc
7-
Release: 1%{?dist}
8-
Summary: A library to control zoned SCSI/ATA devices
9-
Group: System Environment/Libraries
10-
License: BSD and LGPLv3+
11-
URL: https://github.com/westerndigitalcorporation/libzbc
12-
Source: %{name}-%{version}.tar.gz
10+
License: BSD and LGPLv3+
11+
URL: https://github.com/westerndigitalcorporation/%{name}
12+
Source0: https://github.com/westerndigitalcorporation/%{name}/archive/refs/tags/v%{version}.tar.gz
1313

14-
BuildRequires: autoconf
15-
BuildRequires: automake
16-
BuildRequires: libtool
17-
BuildRequires: gcc
14+
BuildRoot: %{_topdir}/BUILDROOT/
15+
BuildRequires: autoconf,autoconf-archive,automake,libtool
1816

1917
%description
20-
libzbc is a simple library providing functions for manipulating SCSI and ATA
18+
libzbc is a library providing functions for manipulating SCSI and ATA
2119
devices supporting the Zoned Block Command (ZBC) and Zoned-device ATA command
2220
set (ZAC) specifications.
23-
libzbc implementation is compliant with the latest drafts of the ZBC and ZAC
24-
standards defined by INCITS technical committee T10 and T13 (respectively).
21+
libzbc implementation is compliant with the ZBC and ZAC v1 standards
22+
defined by INCITS technical committee T10 and T13 (respectively).
2523

2624
%package devel
2725
Summary: Development header files for libzbc
28-
Group: Development/System
2926
Requires: %{name}%{?_isa} = %{version}-%{release}
3027

3128
%description devel
3229
This package provides development header files for libzbc.
3330

3431
%prep
35-
%setup
36-
rm -rf $RPM_BUILD_ROOT
37-
mkdir -p $RPM_BUILD_ROOT
32+
%autosetup
3833

3934
%build
4035
sh autogen.sh
@@ -45,17 +40,25 @@ sh autogen.sh
4540
rm -rf $RPM_BUILD_ROOT
4641
mkdir -p $RPM_BUILD_ROOT
4742
make install PREFIX=%{_prefix} DESTDIR=$RPM_BUILD_ROOT
43+
chmod -x $RPM_BUILD_ROOT%{_mandir}/man8/*.8
4844

4945
find $RPM_BUILD_ROOT -name '*.la' -delete
5046

5147
%ldconfig_scriptlets
5248

5349
%files
54-
%{_bindir}/*
5550
%{_libdir}/*
51+
%{_bindir}/*
52+
%{_mandir}/man8/*
5653
%exclude %{_libdir}/pkgconfig
5754

5855
%files devel
5956
%{_includedir}/*
6057
%{_libdir}/pkgconfig
6158

59+
%license COPYING.BSD COPYING.LESSER
60+
%doc README.md
61+
62+
%changelog
63+
* Sat May 22 2021 Damien Le Moal <[email protected]> 5.9.0-1
64+
- Version 5.9.0 initial package

0 commit comments

Comments
 (0)