Subject: dpkg-vendor: implement --select-closest command versions

From: Raphael Hertzog <[email-masked]>
Date: Fri, 13 Jul 2012 16:07:32 +0200

Package: dpkg-dev
Version: 1.16.7
Severity: wishlist
User: [email-masked]
Usertags: dpkg-vendor

The --derives-from command works but when you have multiple levels of
derivatives, it imposes you to order your checks in the correct order 
to have the expected behaviour. It's also not reliable in the case
where the derivative relationships are symmetric (i.e. like RedHat and Fedora
which are evolving in parallel but building on each another). This
symmetric relationship is explicitely allowed in the ID_LIKE field
of /etc/os-release.

Therefore I suggest to implement a "dpkg-vendor --select-closest <distro1>
<distro2> ..." command that would compare all the listed distributions and
that would return the distribution which is closest to the current
distribution. This enables us to do:

TARGET_VENDOR := $(shell dpkg-vendor --select-closest debian ubuntu mint)

ifeq($(TARGET_VENDOR),mint)
    # Mint specific options
else ifeq($(TARGET_VENDOR),ubuntu)
    # Ubuntu specific options
else ifeq($(TARGET_VENDOR),debian)
    # Debian specific options
endif

This command can be reliably implemented with /etc/dpkg/origin/* and with
/etc/os-release since the latter orders the derivatives listed in ID_LIKE
from the closest to the furthest.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Get the Debian Administrator's Handbook:
→ http://debian-handbook.info/get/