RPM Community Forums

Mailing List Message of <rpm-devel>

Re: [CVS] RPM: rpm/ CHANGES rpm/lib/ depends.c rpmns.c rpmns.h

From: Jeff Johnson <n3npq@mac.com>
Date: Sat 26 Jan 2008 - 18:57:45 CET
Message-Id: <4852F5A0-A09A-4D1F-B8C3-17CCCE05186B@mac.com>
Ralf --

Perhaps
	Requires: verify(N) = E:V-R
will simplify some of your OpenPKG framework hardening.

Easy way to exercise the verify(...) probe is
     mkdir -p /etc/rpm/sysinfo
     echo "verify(zlib)" >> /etc/rpm/sysinfo/Requirename

Return code is goofy atm, the I/O spew while checking dependencies
will need some fiddling, and there are some obvious generalizations to
     Requires: verify(*)		# same as -Va
     Requires: verify(/path)	# same as -Vf path
and a few extensions that I can think of, I'm sure you can think of  
some uses too.

(aside) Its kinda funny: I've spent the last couple of
years devising obscure means to accomodate files
not contained in *.rpm packages, for Mac OS X and more.

One sometimes forgets the advantages of package management ...

Enjoy!

73 de Jeff

On Jan 26, 2008, at 12:44 PM, Jeff Johnson wrote:

>   RPM Package Manager, CVS Repository
>   http://rpm5.org/cvs/
>    
> ______________________________________________________________________ 
> ______
>
>   Server: rpm5.org                         Name:   Jeff Johnson
>   Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
>   Module: rpm                              Date:   26-Jan-2008  
> 18:44:18
>   Branch: HEAD                             Handle: 2008012617441700
>
>   Modified files:
>     rpm                     CHANGES
>     rpm/lib                 depends.c rpmns.c rpmns.h
>
>   Log:
>     - jbj: add verify(N) = E:V-R runtime dependency probe. more to  
> do ...
>
>   Summary:
>     Revision    Changes     Path
>     1.2100      +1  -0      rpm/CHANGES
>     1.378       +24 -0      rpm/lib/depends.c
>     1.15        +2  -0      rpm/lib/rpmns.c
>     1.13        +1  -0      rpm/lib/rpmns.h
>    
> ______________________________________________________________________ 
> ______
>
>   patch -p0 <<'@@ .'
>   Index: rpm/CHANGES
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r1.2099 -r1.2100 CHANGES
>   --- rpm/CHANGES	26 Jan 2008 17:05:02 -0000	1.2099
>   +++ rpm/CHANGES	26 Jan 2008 17:44:17 -0000	1.2100
>   @@ -1,4 +1,5 @@
>    5.0.0 -> 5.1a1:
>   +    - jbj: add verify(N) = E:V-R runtime dependency probe. more  
> to do ...
>        - jbj: stub in RPMTAG_FILESTAT and RPMTAG_STAT extensions, w- 
> i-p.
>        - jbj: re-add PayloadFilesHavePrefix/CompressedFileNames w -- 
> lsb.
>        - rse: provide %{shrink:<body>} macro for removing leading 
> +trailing and removing intermediate whitespaces
>   @@ .
>   patch -p0 <<'@@ .'
>   Index: rpm/lib/depends.c
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r1.377 -r1.378 depends.c
>   --- rpm/lib/depends.c	30 Dec 2007 14:33:06 -0000	1.377
>   +++ rpm/lib/depends.c	26 Jan 2008 17:44:17 -0000	1.378
>   @@ -845,6 +845,30 @@
>    	goto exit;
>        }
>
>   +    if (NSType == RPMNS_TYPE_VERIFY) {
>   +	QVA_t qva = memset(alloca(sizeof(*qva)), 0, sizeof(*qva));
>   +
>   +	qva->qva_flags = VERIFY_ALL & ~(VERIFY_DEPS|VERIFY_SCRIPT);
>   +	rc = 0;		/* assume success */
>   +	if (rpmtsGetRdb(ts) != NULL) {
>   +	    mi = rpmtsInitIterator(ts, RPMTAG_PROVIDENAME, Name, 0);
>   +	    while ((h = rpmdbNextIterator(mi)) != NULL) {
>   +		if (!rpmdsAnyMatchesDep(h, dep, _rpmds_nopromote))
>   +		    continue;
>   +		xx = (showVerifyPackage(qva, ts, h) ? 1 : 0);
>   +fprintf(stderr, "==> xx %d\n", xx);
>   +		if (xx)
>   +		    rc = 1;
>   +	    }
>   +	    mi = rpmdbFreeIterator(mi);
>   +	}
>   +
>   +	if (Flags & RPMSENSE_MISSINGOK)
>   +	    goto unsatisfied;
>   +	rpmdsNotify(dep, _("(verify probe)"), rc);
>   +	goto exit;
>   +    }
>   +
>        if (NSType == RPMNS_TYPE_GNUPG) {
>    	const char * EVR = rpmdsEVR(dep);
>    	if (!(EVR && *EVR)) {
>   @@ .
>   patch -p0 <<'@@ .'
>   Index: rpm/lib/rpmns.c
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r1.14 -r1.15 rpmns.c
>   --- rpm/lib/rpmns.c	12 Jan 2008 22:29:32 -0000	1.14
>   +++ rpm/lib/rpmns.c	26 Jan 2008 17:44:17 -0000	1.15
>   @@ -90,6 +90,7 @@
>        { "sanitycheck",	RPMNS_TYPE_SANITY },
>        { "vcheck",		RPMNS_TYPE_VCHECK },
>        { "signature",	RPMNS_TYPE_SIGNATURE },
>   +    { "verify",		RPMNS_TYPE_VERIFY },
>        { "exists",		RPMNS_TYPE_ACCESS },
>        { "executable",	RPMNS_TYPE_ACCESS },
>        { "readable",	RPMNS_TYPE_ACCESS },
>   @@ -208,6 +209,7 @@
>        case RPMNS_TYPE_SANITY:
>        case RPMNS_TYPE_VCHECK:
>        case RPMNS_TYPE_SIGNATURE:
>   +    case RPMNS_TYPE_VERIFY:
>    	ns->NS = ns->str;
>    	if (ns->NS[0] == '!')
>    	    ns->NS++;
>   @@ .
>   patch -p0 <<'@@ .'
>   Index: rpm/lib/rpmns.h
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r1.12 -r1.13 rpmns.h
>   --- rpm/lib/rpmns.h	30 Dec 2007 14:33:06 -0000	1.12
>   +++ rpm/lib/rpmns.h	26 Jan 2008 17:44:17 -0000	1.13
>   @@ -51,6 +51,7 @@
>        RPMNS_TYPE_SANITY	=  (1 << 25),	/*!< sanitycheck(foo) */
>        RPMNS_TYPE_VCHECK	=  (1 << 26),	/*!< vcheck(foo) */
>        RPMNS_TYPE_SIGNATURE=  (1 << 27),	/*!< signature(/text:/sig)  
> = /pub:id */
>   +    RPMNS_TYPE_VERIFY	=  (1 << 28),	/*!< verify(N) = E:V-R */
>    } nsType;
>
>    #if defined(_RPMNS_INTERNAL)
>   @@ .
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> CVS Sources Repository                                rpm-cvs@rpm5.org
Received on Sat Jan 26 18:57:52 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.