RPM Community Forums

Mailing List Message of <rpm-devel>

Re: Releasing rpm-5.0.1

From: Jeff Johnson <n3npq@mac.com>
Date: Mon 28 Jan 2008 - 18:59:55 CET
Message-Id: <257BB8BB-0D40-45D9-B571-CE7D2D5D9C8F@mac.com>

On Jan 28, 2008, at 10:08 AM, Stefan Westmeier wrote:

> I would like to see the issue with the dependency check during  
> installation
> of packages being fixed.
>
> I am working with Piet and I consider this issue important.
>

Yah, very important.

I just diagnosed (and fixed).

Here's the analysis:

The return code of 0 from rpmtsCheck() is traditionally used
to mean "rpmtsCheck() worked" rather than
	0 == no dependency problems exist
	1 == dependency problems exist
	2 == unspecified error

And so the test for whether an installation proceeded was (this is  
lib/rpminstall,c
from 4.4.9):
         ps = rpmtsProblems(ts);
         if (!stopInstall && rpmpsNumProblems(ps) > 0) {
             rpmMessage(RPMMESS_ERROR, _("Failed dependencies:\n"));
             rpmpsPrint(NULL, ps);
             eiu->numFailed = eiu->numPkgs;
             stopInstall = 1;

Note that the test is on rpmpsNumProblems(ps) > 0, not rpmtsCheck()  
return code.

This code was rewritten (and is way simpler), but the "Failed  
dependencies: ..."
termination changed to (this is lib/rpminstall.c from rpm-5.0.0):

int rpmcliInstallProblems(rpmts ts, const char * msg, int rc)
         /*@globals fileSystem @*/
         /*@modifies ts, fileSystem @*/
{
     rpmps ps = rpmtsProblems(ts);

     if (rc && rpmpsNumProblems(ps) > 0) {
         if (msg)
             rpmlog(RPMLOG_ERR, "%s:\n", msg);
         rpmpsPrint(NULL, ps);
     }
     ps = rpmpsFree(ps);
     return rc;
}

int rpmcliInstallCheck(rpmts ts)
{
/*@-evalorder@*/
     return rpmcliInstallProblems(ts, _("Failed dependencies"),  
rpmtsCheck(ts));
/*@=evalorder@*/
}

Note that both rc and rpmpsNumProblems(ps) > 0 are checked.

The real fixing is deeper, enriching the return codes from rpmtsCheck 
() to
reflect whether problems were found.

I've attached a patch that fixes your immediate problem, but I need  
to check
a few more code paths, and I may return rpmRC instead of {0, 1, 2}  
integers.

Here is the test case I used (with the patch):

+ rpm=rpm
+ pre=/tmp/most
+ opts='--noparentdirs --dbpath /tmp/most/var/lib/rpm'
+ pkgs='most_if-1.0-1.i686.rpm most-bin-1.0-1-req-1.1.i686.rpm'
+ rm -rf /tmp/most
+ mkdir -p /tmp/most/var/lib/rpm
+ rpm -Uvh --noparentdirs --dbpath /tmp/most/var/lib/rpm --relocate / 
=/tmp/most most_if-1.0-1.i686.rpm most-bin-1.0-1-req-1.1.i686.rpm
error: Failed dependencies:
         most_if = 1.1 is needed by most-bin-1.0-1.i686

Thanks for poking me again to look, this fix most definitely needs to  
be in rpm-5.0.1.

73 de Jeff


Received on Mon Jan 28 19:00:14 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.