[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Versioned provides



I've fixed up the boogers in the versioned provides code in the current
dpkg CVS. You can now do things like:

	Package: foo
	Depends: pkg1 (>= 1.0)

	Package: bar
	Provides: pkg1 (= 1.1)

Note, you can only use the equality in versioned provides. There are
several reasons, not the least of which is sane code (in addition to a
sane mind). Here's a copy of the comments I added to main/packages.c
explaining:

   /* For versioned depends, we only check providers with
    * dvr_exact. It doesn't make sense to check ones without a
    * version since we have nothing to verify it. Also, it is
    * way too complex to allow anything but exact in a provided
    * version. A few examples below to deter you from
    * trying:
    *
    *  - foo depends on pkg1 (>= 0.6), bar provides pkg1 (<= 1.0).
    *    Should pass (easy enough)
    *
    *  - foo depends on pkg1 (>= 0.7) and (<= 1.1), bar
    *    provides pkg1 (>= 1.2). Should fail (little harder)
    *
    *  - foo depends on pkg1 (>= 0.4), bar provides pkg1 (<= 1.0)
    *    and (>= 0.5), IOW, inclusive of only those versions.
    *    This would require backchecking the other provided
    *    versions in the possi, which would make things sickly
    *    complex and overly time consuming. Should fail (very hard)
    *
    *  There's probably some miracle formula to do this, but I
    *  don't see it, and there's little to gain, IMNHO. Also,
    *  packages can get around most of these by providing
    *  multiple dvr_exact versions. -- Ben
    */

A few cavaets:

 * If a dependency is versioned, it will only look at versioned provides
   to satisfy it. That should make sense to anyone who thinks about it.
 * Versioned provides can satisfy unversioned depends.
 * If a versioned provides is anything but (= x.x.x), it will ignore it
   completely. Dpkg-deb warns about improperly versioned provides when
   creating a .deb, lintian should aswell.
 * Packages that have versioned provides should call:

	dpkg --assert-versioned-provides

   In their preinst script to avoid allowing it to incorrectly satisfy
   versioned deps with older dpkg's.

PS: Wichert, happy now? :)

-- 
 -----------=======-=-======-=========-----------=====------------=-=------
/  Ben Collins  --  ...on that fantastic voyage...  --  Debian GNU/Linux   \
`  bcollins@debian.org  --  bcollins@openldap.org  --  bcollins@linux.com  '
 `---=========------=======-------------=-=-----=-===-======-------=--=---'

Attachment: pgpY0KalzIS4d.pgp
Description: PGP signature


Reply to: