Skip to content

Commit

Permalink
Use automatic dependency generation for RPM builds. (#9937)
Browse files Browse the repository at this point in the history
Our current RPM spec file includes _all_ of our library dependencies as
statically listed `Requires:` lines. This, in turn, requires a very
large number of conditionals in the dependencies to account for package
naming differences between RPM distros, and also makes it a pain in the
arse to port the spec file to work with new releases of existing
distros.

This changes the spec file to just use the automatic `Requires:`
generation functionality that's already included in the RPM build
process. The net effect is that the spec file ends up much cleaner, and
it works just about anywhere with minimal modification., as well as us
not having to track anything but build dependencies manually.
  • Loading branch information
Ferroin committed Sep 17, 2020
1 parent 47e71bd commit 8f7b2c8
Showing 1 changed file with 7 additions and 44 deletions.
51 changes: 7 additions & 44 deletions netdata.spec.in
Expand Up @@ -5,6 +5,11 @@
#TODO: Temporary fix for the build-id error during go.d plugin set up
%global _missing_build_ids_terminate_build 0

# XXX: We are using automatic `Requires:` generation for libraries
# whenever possible, DO NOT LIST LIBRARY DEPENDENCIES UNLESS THE RESULTANT
# PACKAGE IS BROKEN WITHOUT THEM.
AutoReqProv: yes

%if "@HAVE_LIBBPF@" == "1"
%global have_bpf 1
%else
Expand Down Expand Up @@ -148,31 +153,10 @@ BuildRequires: json-c-devel
# Runtime dependencies
#
Requires: python
Requires: zlib
%if 0%{?suse_version}
# for libuv, Requires version >= 1
Requires: libuv1
Requires: libJudy1
Requires: libjson-c4
Requires: libuuid1
%else
# for libuv, Requires version >= 1
Requires: libuv >= 1
Requires: Judy
Requires: json-c
Requires: libuuid
%endif
Requires: openssl
Requires: lz4

# Core requirements for the install to succeed
Requires(pre): /usr/sbin/groupadd
Requires(pre): /usr/sbin/useradd
%if 0%{?suse_version} >= 1140
Requires(post): libcap1
%else
Requires(post): libcap
%endif

%{netdata_initd_requires}

Expand All @@ -188,19 +172,6 @@ BuildRequires: libmnl-devel
BuildRequires: libnetfilter_acct-devel
%endif

%if 0%{?suse_version}
Requires: libmnl0
%else
Requires: libmnl
%endif

%if 0%{?fedora}
Requires: libnetfilter_acct
%else
%if 0%{?suse_version} >= 1140
Requires: libnetfilter_acct1
%endif
%endif
# end nfacct plugin dependencies

# freeipmi plugin dependencies
Expand All @@ -221,16 +192,6 @@ BuildRequires: libprotobuf-c-devel
%else
BuildRequires: protobuf-c-devel
%endif

%if 0%{?suse_version}
Requires: libsnappy1
Requires: protobuf-c
Requires: libprotobuf15
%else
Requires: snappy
Requires: protobuf-c
Requires: protobuf
%endif
# end - prometheus remote write dependencies

# #####################################################################
Expand Down Expand Up @@ -559,6 +520,8 @@ are sensor monitoring, system event monitoring, power control, and serial-over-L
%attr(4750,root,netdata) %{_libexecdir}/%{name}/plugins.d/freeipmi.plugin

%changelog
* Wed Sep 16 2020 Austin Hemmelgarn <austin@netdata.cloud> 0.0.0-14
- Convert to using 'AutoReq: yes' for library dependencies.
* Thu Feb 13 2020 Austin Hemmelgarn <austin@netdata.cloud> 0.0.0-13
- Add handling for custom libmosquitto fork
* Wed Jan 01 2020 Austin Hemmelgarn <austin@netdata.cloud> 0.0.0-12
Expand Down

0 comments on commit 8f7b2c8

Please sign in to comment.