I've packaged up clamav into some rpms for distribution inside our rhn, however I'm having some issues with dependency resolution when doing upgrades.
the spec file builds 4 packages:
clamav - contains the main files
clamav-db - contains the virus definition files
libclamav - contains the clamav libs
libclamav-devel - contains devel files
I need clamav to require that the libclamav installed is the same version and release as itself. eg clamav-0.96.3-9 should require libclamav-0.96.3-9
however the clamav-db can be any version ( it gets updated with freshclam and is only really needed on installs to minimise network traffic during rpm transactions )
Now in the spec file I have defined the packages as follows
Version: 0.97.6
Release: 1
%package -n clamav
Summary: ClamAV Anti-Virus Software
Requires: libclamav = %{version}-%{release}
Requires: clamav-db
%description -n clamav
Provides the server daemon and standard client utilities for antivirus scanning.
%package -n clamav-db
Summary: ClamAV Anti-Virus Software (Initial Databases)
%description -n clamav-db
Provides the initial antivirus databases for clamav.
%package -n libclamav
Summary: ClamAV Anti-Virus Software (libraries)
%description -n libclamav
Provides support libraries for clamav.
%package -n libclamav-devel
Summary: ClamAV Anti-Virus Software (development libraries)
Requires: libclamav = %{version}-%{release}
%description -n libclamav-devel
Provides development libraries and headers for clamav.
This builds the 4 packages fine in a clean chroot. I scp them to my test server.
Current clam versions:
[root@localhost clamav]# rpm -qa '(lib)?clam*'
libclamav-0.97.3-9.i386
clamav-db-0.97.3-9.i386
clamav-0.97.3-9.i386
I have the new rpms on the local filesystem whith correct requirements:
[root@localhost clamav]# rpm -qp --qf '%{NAME}\n\t[%{REQUIRES} %|REQUIREVERSION?{%{REQUIREVERSION}}:{}|\n\t]\n' *
clamav
/bin/bash
/bin/sh
/bin/sh
/bin/sh
clamav-db
config(clamav) 0.97.6-1
libbz2.so.1
libc.so.6
libc.so.6(GLIBC_2.0)
libc.so.6(GLIBC_2.1)
libc.so.6(GLIBC_2.1.3)
libc.so.6(GLIBC_2.2)
libc.so.6(GLIBC_2.3)
libc.so.6(GLIBC_2.3.4)
libc.so.6(GLIBC_2.7)
--> libclamav 0.97.6-1
libclamav.so.6
libclamav.so.6(CLAMAV_PRIVATE)
libclamav.so.6(CLAMAV_PUBLIC)
libdl.so.2
libpthread.so.0
libpthread.so.0(GLIBC_2.0)
libpthread.so.0(GLIBC_2.1)
libpthread.so.0(GLIBC_2.3.2)
libresolv.so.2
libresolv.so.2(GLIBC_2.2)
libz.so.1
rpmlib(CompressedFileNames) 3.0.4-1
rpmlib(PayloadFilesHavePrefix) 4.0-1
rtld(GNU_HASH)
clamav-db
/bin/sh
config(clamav-db) 0.97.6-1
rpmlib(CompressedFileNames) 3.0.4-1
rpmlib(PayloadFilesHavePrefix) 4.0-1
libclamav
/bin/sh
libbz2.so.1
libc.so.6
libc.so.6(GLIBC_2.0)
libc.so.6(GLIBC_2.1)
libc.so.6(GLIBC_2.1.3)
libc.so.6(GLIBC_2.3)
libc.so.6(GLIBC_2.7)
libclamav.so.6
libclamunrar.so.6
libclamunrar.so.6(CLAMAV_PRIVATE_UNRAR)
libclamunrar_iface.so.6
libdl.so.2
libdl.so.2(GLIBC_2.0)
libdl.so.2(GLIBC_2.1)
libm.so.6
libm.so.6(GLIBC_2.0)
libpthread.so.0
libpthread.so.0(GLIBC_2.0)
libpthread.so.0(GLIBC_2.2)
libz.so.1
rpmlib(CompressedFileNames) 3.0.4-1
rpmlib(PayloadFilesHavePrefix) 4.0-1
rtld(GNU_HASH)
libclamav-devel
/bin/sh
/usr/bin/pkg-config
libclamav 0.97.6-1
libclamav.so.6
libclamunrar.so.6
libclamunrar_iface.so.6
rpmlib(CompressedFileNames) 3.0.4-1
rpmlib(PayloadFilesHavePrefix) 4.0-1
rpmlib(VersionedDependencies) 3.0.3-1
So I can see that the correct version requirements are in the rpm package.
So I install the new clamav using yum, I expect yum to complain bitterly as it will not find libclamav-0.97.6-1 in its repos. instead I get this:
[root@localhost clamav]# yum install ./clamav-0.97.6-1.i386.rpm
Loaded plugins: product-id, rhnplugin, subscription-manager
Updating certificate-based repositories.
Setting up Install Process
Examining ./clamav-0.97.6-1.i386.rpm: clamav-0.97.6-1.i386
Marking ./clamav-0.97.6-1.i386.rpm as an update to clamav-0.97.3-9.i386
Resolving Dependencies
--> Running transaction check
---> Package clamav.i386 0:0.97.3-9 will be updated
---> Package clamav.i386 0:0.97.6-1 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================================
Package Arch Version Repository Size
==========================================================================================================
Updating:
clamav i386 0.97.6-1 /clamav-0.97.6-1.i386 825 k
Transaction Summary
==========================================================================================================
Upgrade 1 Package(s)
Total size: 825 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : clamav-0.97.6-1.i386 1/2
error reading information on service clamav: No such file or directory
Cleanup : clamav-0.97.3-9.i386 2/2
Installed products updated.
Updated:
clamav.i386 0:0.97.6-1
Complete!
[root@localhost clamav]# rpm -qa '(lib)?clam*'
libclamav-0.97.3-9.i386
clamav-0.97.6-1.i386
clamav-db-0.97.3-9.i386
Weird huh?
If I remove all the currently installed clam packages and try to install the new version:
[root@localhost clamav]# rpm -qa '(lib)?clam*'
[root@localhost clamav]# yum install ./clamav-0.97.6-1.i386.rpm
Loaded plugins: product-id, rhnplugin, subscription-manager
Updating certificate-based repositories.
Setting up Install Process
Examining ./clamav-0.97.6-1.i386.rpm: clamav-0.97.6-1.i386
Marking ./clamav-0.97.6-1.i386.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package clamav.i386 0:0.97.6-1 will be installed
--> Processing Dependency: libclamav = 0.97.6-1 for package: clamav-0.97.6-1.i386
--> Processing Dependency: clamav-db for package: clamav-0.97.6-1.i386
--> Processing Dependency: libclamav.so.6 for package: clamav-0.97.6-1.i386
--> Processing Dependency: libclamav.so.6(CLAMAV_PRIVATE) for package: clamav-0.97.6-1.i386
--> Processing Dependency: libclamav.so.6(CLAMAV_PUBLIC) for package: clamav-0.97.6-1.i386
--> Running transaction check
---> Package clamav-db.i386 0:0.97.3-9 will be installed
---> Package libclamav.i386 0:0.97.3-9 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================================
Package Arch Version Repository Size
==========================================================================================================
Installing:
clamav i386 0.97.6-1 /clamav-0.97.6-1.i386 825 k
Installing for dependencies:
clamav-db i386 0.97.3-9 frog-i386-6-trunk 30 M
libclamav i386 0.97.3-9 frog-i386-6-trunk 1.4 M
Transaction Summary
==========================================================================================================
Install 3 Package(s)
Total size: 32 M
Total download size: 31 M
Installed size: 825 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): clamav-db-0.97.3-9.i386.rpm | 30 MB 00:07
(2/2): libclamav-0.97.3-9.i386.rpm | 1.4 MB 00:00
----------------------------------------------------------------------------------------------------------
Total 4.0 MB/s | 31 MB 00:07
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : clamav-db-0.97.3-9.i386 1/3
Installing : libclamav-0.97.3-9.i386 2/3
Installing : clamav-0.97.6-1.i386 3/3
error reading information on service clamav: No such file or directory
Installed products updated.
Installed:
clamav.i386 0:0.97.6-1
Dependency Installed:
clamav-db.i386 0:0.97.3-9 libclamav.i386 0:0.97.3-9
Complete!
So it's looking in the repo for the dependencies and ignoring the version part. If I run it again with the -v flag I get the dep resolution output as below
Checking deps for clamav.i386 0:0.97.6-1 - u
looking for ('config(clamav)', 'EQ', ('0', '0.97.6', '1')) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libclamav', 'EQ', ('0', '0.97.6', '1')) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('/bin/bash', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('/bin/sh', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('/bin/sh', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('/bin/sh', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('clamav-db', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libbz2.so.1', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libc.so.6', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libc.so.6(GLIBC_2.0)', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libc.so.6(GLIBC_2.1)', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libc.so.6(GLIBC_2.1.3)', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libc.so.6(GLIBC_2.2)', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libc.so.6(GLIBC_2.3)', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libc.so.6(GLIBC_2.3.4)', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libc.so.6(GLIBC_2.7)', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libclamav.so.6', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libclamav.so.6(CLAMAV_PRIVATE)', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libclamav.so.6(CLAMAV_PUBLIC)', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libdl.so.2', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libpthread.so.0', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libpthread.so.0(GLIBC_2.0)', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libpthread.so.0(GLIBC_2.1)', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libpthread.so.0(GLIBC_2.3.2)', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libresolv.so.2', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libresolv.so.2(GLIBC_2.2)', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('libz.so.1', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
looking for ('rtld(GNU_HASH)', None, (None, None, None)) as a requirement of clamav.i386 0:0.97.6-1 - u
clamav-0.97.6-1.i386 requires: libclamav = 0.97.6-1
--> Processing Dependency: libclamav = 0.97.6-1 for package: clamav-0.97.6-1.i386
Searching pkgSack for dep: libclamav
TSINFO: Marking libclamav-0.97.3-9.i386 as install for clamav-0.97.6-1.i386
clamav-0.97.6-1.i386 requires: clamav-db
--> Processing Dependency: clamav-db for package: clamav-0.97.6-1.i386
Searching pkgSack for dep: clamav-db
TSINFO: Marking clamav-db-0.97.3-9.i386 as install for clamav-0.97.6-1.i386
clamav-0.97.6-1.i386 requires: libclamav.so.6
--> Processing Dependency: libclamav.so.6 for package: clamav-0.97.6-1.i386
Searching pkgSack for dep: libclamav.so.6
libclamav-0.97.3-9.i386 already in ts, skipping this one
clamav-0.97.6-1.i386 requires: libclamav.so.6(CLAMAV_PRIVATE)
--> Processing Dependency: libclamav.so.6(CLAMAV_PRIVATE) for package: clamav-0.97.6-1.i386
Quick matched libclamav-0.97.3-9.i386 to require for libclamav.so.6(CLAMAV_PRIVATE)
clamav-0.97.6-1.i386 requires: libclamav.so.6(CLAMAV_PUBLIC)
--> Processing Dependency: libclamav.so.6(CLAMAV_PUBLIC) for package: clamav-0.97.6-1.i386
Quick matched libclamav-0.97.3-9.i386 to require for libclamav.so.6(CLAMAV_PUBLIC)
--> Running transaction check
---> Package clamav-db.i386 0:0.97.3-9 will be installed
Checking deps for clamav-db.i386 0:0.97.3-9 - u
looking for ('config(clamav-db)', 'EQ', ('0', '0.97.3', '9')) as a requirement of clamav-db.i386 0:0.97.3-9 - u
looking for ('/bin/sh', None, (None, None, None)) as a requirement of clamav-db.i386 0:0.97.3-9 - u
---> Package libclamav.i386 0:0.97.3-9 will be installed
Checking deps for libclamav.i386 0:0.97.3-9 - u
looking for ('libclamunrar_iface.so.6', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('libclamunrar.so.6', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('libclamunrar.so.6(CLAMAV_PRIVATE_UNRAR)', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('libclamav.so.6', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('libbz2.so.1', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('libpthread.so.0(GLIBC_2.0)', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('libc.so.6(GLIBC_2.1)', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('libz.so.1', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('libc.so.6(GLIBC_2.1.3)', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('libc.so.6(GLIBC_2.3)', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('libdl.so.2(GLIBC_2.1)', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('libdl.so.2', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('libm.so.6(GLIBC_2.0)', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('libdl.so.2(GLIBC_2.0)', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('libc.so.6(GLIBC_2.0)', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('libm.so.6', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('libc.so.6(GLIBC_2.7)', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('libc.so.6', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('rtld(GNU_HASH)', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('/bin/sh', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('libpthread.so.0(GLIBC_2.2)', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
looking for ('libpthread.so.0', None, (None, None, None)) as a requirement of libclamav.i386 0:0.97.3-9 - u
--> Finished Dependency Resolution
Dependency Process ending
Depsolve time: 0.339
Dependencies Resolved
So it looks like it can't find the new version of libclamav but marks the old one instead as it provides one of the files for clamav.
Can anyone help me get to the bottom of this it's really doing my nut!
Thanks