Centos – Replacing libpng-devel (1.5.3) with libpng12-devel RPMs on CentOS

centosrpm

I have a CentOS 6.4 box with a lot of other RPMs.

I want to replace libpng-devel with libpng12.devel. If I do an rpm -e libpng-devel I get the following:

error: Failed dependencies:
    pkgconfig(libpng) is needed by (installed) cairo-devel-1.10.2-7.el6.x86_64
    pkgconfig(libpng15) is needed by (installed) gdk-pixbuf2-devel-2.26.1-1.el6.x86_64
    libpng-devel is needed by (installed) cairo-devel-1.10.2-7.el6.x86_64
    libpng-devel is needed by (installed) gtk2-devel-2.24.10-1.el6.x86_64
    libpng-devel(x86-64) = 2:1.5.13-2.el6 is needed by (installed) libpng-static-2:1.5.13-2.el6.x86_64

Deleting those takes me down a rabbit hole.

I tried yum downgrade and got the following:

[mono@localhost ~]$ sudo yum downgrade libpng
Loaded plugins: fastestmirror
Setting up Downgrade Process
Loading mirror speeds from cached hostfile
 * base: mirror.net.cen.ct.gov
 * extras: mirror.dattobackup.com
 * rpmforge: repoforge.mirror.constant.com
 * updates: mirror.umd.edu
Resolving Dependencies
--> Running transaction check
---> Package libpng.x86_64 2:1.2.49-1.el6_2 will be a downgrade
---> Package libpng.x86_64 2:1.5.13-2.el6 will be erased
--> Finished Dependency Resolution
Error: Package: gdk-pixbuf2-devel-2.26.1-1.el6.x86_64 (installed)
           Requires: libpng15.so.15()(64bit)
           Removing: 2:libpng-1.5.13-2.el6.x86_64 (installed)
               libpng15.so.15()(64bit)
           Downgraded By: 2:libpng-1.2.49-1.el6_2.x86_64 (base)
               Not found
Error: Package: 2:libpng-devel-1.5.13-2.el6.x86_64 (installed)
           Requires: libpng(x86-64) = 2:1.5.13-2.el6
           Removing: 2:libpng-1.5.13-2.el6.x86_64 (installed)
               libpng(x86-64) = 2:1.5.13-2.el6
           Downgraded By: 2:libpng-1.2.49-1.el6_2.x86_64 (base)
               libpng(x86-64) = 2:1.2.49-1.el6_2
Error: Package: 2:libpng-devel-1.5.13-2.el6.x86_64 (installed)
           Requires: libpng15.so.15()(64bit)
           Removing: 2:libpng-1.5.13-2.el6.x86_64 (installed)
               libpng15.so.15()(64bit)
           Downgraded By: 2:libpng-1.2.49-1.el6_2.x86_64 (base)
               Not found
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
[mono@localhost ~]$

Downgrading the others took me down a similar rabbithole.

I tried localinstall/localupdate and they did not seem to work either:

[mono@localhost ~]$ sudo yum --nogpgcheck localinstall ~/rpmbuild/RPMS/x86_64/libpng12-devel-1.2.50-3.el6.x86_64.rpm
Loaded plugins: fastestmirror
Setting up Local Package Process
Examining /home/mono/rpmbuild/RPMS/x86_64/libpng12-devel-1.2.50-3.el6.x86_64.rpm: libpng12-devel-1.2.50-3.el6.x86_64
Marking /home/mono/rpmbuild/RPMS/x86_64/libpng12-devel-1.2.50-3.el6.x86_64.rpm to be installed
Loading mirror speeds from cached hostfile
 * base: mirror.net.cen.ct.gov
 * extras: mirror.dattobackup.com
 * rpmforge: repoforge.mirror.constant.com
 * updates: mirror.umd.edu
Resolving Dependencies
--> Running transaction check
---> Package libpng12-devel.x86_64 0:1.2.50-3.el6 will be installed
--> Processing Conflict: libpng12-devel-1.2.50-3.el6.x86_64 conflicts libpng-devel
No package matched to upgrade: libpng12-devel
--> Finished Dependency Resolution
Error: libpng12-devel conflicts with 2:libpng-devel-1.5.13-2.el6.x86_64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
[mono@localhost ~]$ sudo yum --nogpgcheck localupdate ~/rpmbuild/RPMS/x86_64/libpng12-devel-1.2.50-3.el6.x86_64.rpm
Loaded plugins: fastestmirror
Setting up Local Package Process
Examining /home/mono/rpmbuild/RPMS/x86_64/libpng12-devel-1.2.50-3.el6.x86_64.rpm: libpng12-devel-1.2.50-3.el6.x86_64
Package libpng12-devel not installed, cannot update it. Run yum install to install it instead.
Nothing to do
[mono@localhost ~]$

Is there any way I can delete one rpm and add another in the same command? Is there a multi-command RPM transaction? RPM transactions seem to be for historical auditing, so I think I'm googling for the wrong word. I need to swap out these RPMs a lot on my system, so if there is a way to link them by modifying the rpm spec and rebuilding it that's acceptable too.

Best Answer

You typically don't do a remove (-e) and then an install. This will push RPM to want to remove any applications that depend on this RPM. Rather you want to do an upgrade.

$ rpm -Uvh libpng12-devel

If this package is in fact a drop in upgrade for "libpng" it will do the remove and install as a single move, thus pacifying the dependencies.

Use yum

Also I would use yum to do it too, it is able to help you out more than just regular RPM with trickier things like this. Use this command:

$ yum update libpng12-devel

You can also also install local RPMs with yum:

$ yum --nogpgcheck localinstall libpng12-devel....rpm

This will often times offer you up suggestions on how to cope best with these types of trickier package management operations.

Related Question