0

I am fairly new to rpm building and i have been trying to understand the syntax of "Provides" inside a spec file without success. I have the following spec file snippet for building clamav rpm:

Summary:    End-user tools for the Clam Antivirus scanner
Name:       clamav
Version:    0.103.12
Release:    1%{?dist}

%package data
Summary:    Virus signature data for the Clam Antivirus scanner
Requires:   ns-clamav-filesystem = %{version}-%{release}
Provides:   data(clamav) = full
Provides:   clamav-db = %{version}-%{release}
Obsoletes:  clamav-db < %{version}-%{release}
BuildArch:  noarch

%package update
Summary:    Auto-updater for the Clam Antivirus scanner data-files
Requires:   ns-clamav-filesystem = %{version}-%{release}
Requires:   ns-clamav-lib        = %{version}-%{release}
Provides:   data(clamav) = empty
Provides:   clamav-data-empty = %{version}-%{release}
Obsoletes:  clamav-data-empty < %{version}-%{release}

%package -n ns-clamd
Summary: The Clam AntiVirus Daemon
Requires:   data(clamav)
Requires:   ns-clamav-filesystem = %{version}-%{release}
Requires:   ns-clamav-lib        = %{version}-%{release}
Requires:   coreutils
Requires(pre):  shadow-utils

I am aware what the "Provides:" indicates here and also that parenthesis next to provides indicate the installation of a module (for that package). In my case, %package data (clamav-data) when installed, it will also state to rpm/yum that it provides clamav-db and data(clamav).

It is the data(clamav) i don't understand. How does it relate to the default package name prefix of clamav-data ? Shouldn't this be clamav(data) ?

How can I search this data(clamav) in yum/rpm? I can see this mentioned in the rpm info but when I install it how can I search it like I do on other packages? For instance yum info <package>

    #   rpm -q --requires RPMS/x86_64/ns-clamd-0.103.12-1.el8.x86_64.rpm
   /bin/sh 
   /bin/sh 
   /bin/sh 
   /bin/sh
   coreutils
   data(clamav)

   #   rpm -q RPMS/noarch/ns-clamav-data-0.103.12-1.el8.noarch.rpm  --provides
   clamav-db = 0.103.12-1.el8
   config(ns-clamav-data) = 0.103.12-1.el8
   data(clamav) = full
   ns-clamav-data = 0.103.12-1.el8

1 Answer 1

2

It is the data(clamav) i don't understand. How does it relate to the default package name prefix of clamav-data ? Shouldn't this be clamav(data) ?

Virtual provides aren't necessarily tied to the package name. For example, looking at a packaged Python module, we see:

$ rpm -q --provides python3-requests
[...]
python3dist(requests) = 2.31

Or similarly for a Perl module:

$ rpm -q --provides perl-Net-DNS
perl(Net::DNS) = 1.43
perl(Net::DNS::Domain) = 1913
perl(Net::DNS::DomainName) = 1898
[...]

In this case, I don't think there's a particular "should" that anybody is following; it's simply a virtual dependency that is provided by multiple packages, which means that another package can declare a dependency on data(clamav) and have that requirement satisfied by any one of those packages.

How can I search this data(clamav) in yum/rpm? I can see this mentioned in the rpm info but when I install it how can I search it like I do on other packages? For instance yum info

You can search for your data(clamav) provides just like any other dependency. For example, to list available packages in your repositories that provide this resource:

yum repoquery --whatprovides 'data(clamav)'

Which on my system returns:

clamav-data-0:1.0.5-3.fc40.noarch
clamav-data-0:1.0.7-1.fc40.noarch
clamav-freshclam-0:1.0.5-3.fc40.i686
clamav-freshclam-0:1.0.5-3.fc40.x86_64
clamav-freshclam-0:1.0.7-1.fc40.i686
clamav-freshclam-0:1.0.7-1.fc40.x86_64

Or if you want to search locally installed rpms:

rpm -q --whatprovides 'data(clamav)'

The Fedora packaging guidelines contains several notes on the use of Provides:, although none of them explicitly cover the situation about which you're asking.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.