From: Mark Hatle <mark.hatle@windriver.com>
To: <yocto@yoctoproject.org>
Subject: Re: ALTERNATIVE_TARGET, ALTERNATIVE_PRIORITY problem
Date: Tue, 27 Jan 2015 10:53:12 -0600 [thread overview]
Message-ID: <54C7C278.6020606@windriver.com> (raw)
In-Reply-To: <CAJrRHk5GoTZAB9hxOtEkjBP3fQoBB2u+H7Z5eD9Jy4hqwvmfTg@mail.gmail.com>
On 1/27/15 9:37 AM, Joseph Andrew de la Peña wrote:
> Good day Yocto Community,
>
> I would like to ask what's wrong with my implementation with update-alternatives:
I think that you have some of the variables confused below. I've quoted bits of
the class's header (internal documentation):
# List all of the alternatives needed by a package:
# ALTERNATIVE_<pkg> = "name1 name2 name3 ..."
# The pathname of the link
# ALTERNATIVE_LINK_NAME[name] = "target"
# NOTE: If ALTERNATIVE_LINK_NAME is not defined, it defaults to ${bindir}/name
# The default link to create for all targets
# ALTERNATIVE_TARGET = "target"
or
# A non-default link to create for a target
# ALTERNATIVE_TARGET[name] = "target"
# A package specific link for a target
# ALTERNATIVE_TARGET_<pkg>[name] = "target"
#
# This is useful when a recipe provides multiple alternatives for the
# same item.
So if you have a single binary called 'bar', and want it to show up as bar1,
bar2 and bar3 using the alternatives you would do:
PACKAGES =+ "${PN}-bar1 ${PN}-bar2 ${PN}-bar3"
ALTERNATIVE_${PN}-bar1 = "bar1"
ALTERNATIVE_${PN}-bar2 = "bar2"
ALTERNATIVE_${PN}-bar3 = "bar3"
ALTERNATIVE_TARGET = "/bin/bar"
ALTERNATIVE_LINK_NAME[bar1] = "/bin/bar1"
ALTERNATIVE_LINK_NAME[bar2] = "/bin/bar2"
ALTERNATIVE_LINK_NAME[bar3] = "/bin/bar3"
FILES_${PN} = "/bin/bar"
The result would be:
package ${PN} contains /bin/bar
package ${PN}-bar1 would create a link /bin/bar1 -> /bin/bar
package ${PN}-bar2 would create a link /bin/bar2 -> /bin/bar
package ${PN}-bar3 would create a link /bin/bar3 -> /bin/bar
If you want to do the other way around, have three packages that all provide
'bar'. You would do:
PACKAGES =+ "${PN}-bar1 ${PN}-bar2 ${PN}-bar3"
ALTERNATIVE_${PN}-bar1 = "bar"
ALTERNATIVE_${PN}-bar2 = "bar"
ALTERNATIVE_${PN}-bar3 = "bar"
ALTERNATIVE_LINK_NAME[bar] = "/bin/bar"
ALTERNATIVE_TARGET_${PN}-bar1 = "/bin/bar1"
ALTERNATIVE_TARGET_${PN}-bar2 = "/bin/bar2"
ALTERNATIVE_TARGET_${PN}-bar3 = "/bin/bar3"
FILES_${PN}-bar1 = "/bin/bar1"
FILES_${PN}-bar2 = "/bin/bar2"
FILES_${PN}-bar3 = "/bin/bar3"
package ${PN}-bar1 would own a file /bin/bar1 and link it to /bin/bar
package ${PN}-bar2 would own a file /bin/bar2 and link it to /bin/bar
package ${PN}-bar3 would own a file /bin/bar3 and link it to /bin/bar
(You can verify the above by looking at the package data, if using RPM, rpm -qp
<package> --scripts will show you the logic for adding the alternative.)
As for the install time, the packaging system will "choose" to install a package
that meets the dependency you select. If you don't specifically name ${PN}-bar1
in your install, it may not be selected in favor of one of the other providers.
The PRIORITY only affects if multiple packages are installed, which one takes
priority over the others.
--Mark
> =================
>
> *bar_git.bb <http://bar_git.bb/>:*
>
> PACKAGES =+ "${PN}-bar1 ${PN}-bar2 ${PN}-bar3"
> RPROVIDES_${PN}-bar1 = "bar"
> RPROVIDES_${PN}-bar2 = "bar"
> RPROVIDES_${PN}-bar3 = "bar"
>
> ALTERNATIVE_LINK_NAME[bar] = "${datadir}/foo/bar"
>
> ALTERNATIVE_${PN}-bar1 = "bar"
> ALTERNATIVE_TARGET_${PN}-bar1 = "${datadir}/foo/bar1"
> ALTERNATIVE_PRIORITY_${PN}-bar1 = "99"
>
> ALTERNATIVE_${PN}-bar2 = "bar"
> ALTERNATIVE_TARGET_${PN}-bar2 = "${datadir}/foo/bar2"
> ALTERNATIVE_PRIORITY_${PN}-bar2 = "98"
>
> ALTERNATIVE_${PN}-bar3 = "bar"
> ALTERNATIVE_TARGET_${PN}-bar3 = "${datadir}/foo/bar3"
> ALTERNATIVE_PRIORITY_${PN}-bar3 = "97"
>
> inherit update-alternatives
>
> *packagegroup-foobar.bb <http://packagegroup-foobar.bb/>:*
>
> RDEPENDS_foobar = "bar"
>
> =================
>
> The end result is always bar3 is present and bar is pointing to bar3. I never
> get bar1 being present which is the result I want.
>
> Please do recommend how will I properly use ALTERNATIVE_TARGET and
> ALTERNATIVE_PRIORITY.
>
> Thanks,
> Joseph
>
>
next prev parent reply other threads:[~2015-01-27 16:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-27 15:37 ALTERNATIVE_TARGET, ALTERNATIVE_PRIORITY problem Joseph Andrew de la Peña
2015-01-27 16:53 ` Mark Hatle [this message]
2015-01-28 11:12 ` Joseph Andrew de la Peña
2015-02-04 1:26 ` Mark Hatle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54C7C278.6020606@windriver.com \
--to=mark.hatle@windriver.com \
--cc=yocto@yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.