From 3e1154266f3381af6067a6c03e4b0599bb87806a Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 30 Oct 2015 12:39:59 +0100 Subject: [PATCH] xbps-src: support "alternatives" from xbps-0.48. --- Manual.md | 4 ++++ common/environment/setup-subpkg/subpkg.sh | 2 +- common/hooks/do-pkg/00-gen-pkg.sh | 7 +++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Manual.md b/Manual.md index bcf16f47973..d1d67ab84e0 100644 --- a/Manual.md +++ b/Manual.md @@ -493,6 +493,10 @@ pkgver the resulting package should revert. This field *must* be defined before defined in `reverts` must be lesser than the one defined in `version`. example: `reverts="2.0_1 2.0_2"` +- `alternatives` A white space separated list of supported alternatives the package provides. +A list is composed of three components separated by a colon: group, symlink and target. +i.e `alternatives="vi:/usr/bin/vi:/usr/bin/nvi ex:/usr/bin/ex:/usr/bin/nvi-ex"`. + #### Repositories diff --git a/common/environment/setup-subpkg/subpkg.sh b/common/environment/setup-subpkg/subpkg.sh index a73b76abd1a..aa2105d7185 100644 --- a/common/environment/setup-subpkg/subpkg.sh +++ b/common/environment/setup-subpkg/subpkg.sh @@ -2,7 +2,7 @@ # a package template and can also be used in subpkgs. ## VARIABLES -unset -v noarch conf_files mutable_files preserve triggers +unset -v noarch conf_files mutable_files preserve triggers alternatives unset -v depends run_depends replaces provides conflicts tags # hooks/post-install/03-strip-and-debug-pkgs diff --git a/common/hooks/do-pkg/00-gen-pkg.sh b/common/hooks/do-pkg/00-gen-pkg.sh index b65383e274d..6d6b75beade 100644 --- a/common/hooks/do-pkg/00-gen-pkg.sh +++ b/common/hooks/do-pkg/00-gen-pkg.sh @@ -82,6 +82,12 @@ genpkg() { _conf_files="${_conf_files} ${f}" done fi + if [ -n "$alternatives" ]; then + local _alternatives= + for f in ${alternatives}; do + _alternatives="${_alternatives} ${f}" + done + fi msg_normal "Creating $binpkg for repository $pkgdir ...\n" @@ -100,6 +106,7 @@ genpkg() { ${_gitrevs:+--source-revisions "${_gitrevs}"} \ ${_shprovides:+--shlib-provides "${_shprovides}"} \ ${_shrequires:+--shlib-requires "${_shrequires}"} \ + ${_alternatives:+--alternatives "${_alternatives}"} \ ${_preserve:+--preserve} \ ${_tags:+--tags "${tags}"} \ --architecture ${arch} \