Difference between pages "Portage Dynamic Slot" and "Test"

From Funtoo
(Difference between pages)
Jump to navigation Jump to search
 
 
Line 1: Line 1:
Portage-2.3.1 in the experimental tree contains support for dynamic slots.
{{#get_web_data:url=http://build.funtoo.org/index.xml|format=xml|use xpath|data=builds=/subarches/subarch[@name='amd64-bulldozer']/@builds}}
;Builds: {{#external_value:builds}}


{{fancynote|If you plan to use dynamic slots, please read this page in its entirety, especially the [[#Requirements|Requirements]] below, to ensure you are using dynamic slots correctly.}}
asdflk asdlfk asdlf alsdf lasd flasd flasd flasd flasd flasd flasd flas dflasd flasdl flasdf lasdfl alsdf lasdf lasdflafsd la sdf
<div style="align: center;"><div style="border: 1px solid #888;">
[[{{#show: Organization:Brownrice Internet| ?Logo|link=none}}|350px|class=img-responsive|link=Organization:Brownrice Internet]]</div><br/>
[[Organization:Brownrice Internet|Learn about Funtoo-friendly organization: Brownrice Internet]]</div>
asdflk asdlfk asdlf alsdf lasd flasd flasd flasd flasd flasd flasd flas dflasd flasdl flasdf lasdfl alsdf lasdf lasdflafsd la sdf
{{fullurl:News:The Many Builds of Funtoo Linux}}
{{#widget:AddThis}}


== Traditional SLOT ==
I like the {{f|/etc/make.conf}} file, which can also be referred to as {{f|/etc/portage/make.conf}}. It is a groovy file. Another cool file is {{f|/etc/fstab}}.


Historically, Portage has supported SLOTs, which are defined statically in the ebuild and allow certain package versions to be installed alongside other versions of the same package. For example, <tt>libpng-1.4.2</tt> could have a <tt>SLOT</tt> of <tt>"1.4"</tt> while <tt>libpng-1.5</tt> could have a <tt>SLOT</tt> of <tt>"1.5"</tt>. This indicates that these ebuilds can be installed alongside each other.
=== make.conf mentions ===


It has been the policy of Gentoo Linux to only allow <tt>SLOT</tt> to be set statically in the ebuild, and not vary (via code) within the ebuild. Traditionally, within a single ebuild it must always be the same, non-variable value.
{{#ask: [[Mentions file::make.conf]]
| format=category
}}


== Dynamic SLOT ==
{{console|body=
 
# ##i##bluetoothctl
Funtoo dynamic slot functionality changes this policy and allows <tt>SLOT</tt> to vary. This is useful for custom builds of an application whose paths are defined by an external variable passed in to Portage.
[##g##NEW##!g##] Controller 00:02:72:C9:62:65 antec [default]
 
##bl##[bluetooth]##!bl###power on
Here is an example of how dynamic slot works in an ebuild, and shows how it is intended to be used -- to allow custom versions of ebuilds to be built alongside non-custom versions:
Changing power on succeeded
 
##bl##[bluetooth]##!bl### ##i##agent on
<pre>
Agent registered
SLOT="$PV"
##bl##[bluetooth]##!bl### ##i##scan on
IUSE="custom"
Discovery started
 
##bl##[bluetooth]##!bl### ##i##devices
pkg_setup() {
Device 00:1F:20:3D:1E:75 Logitech K760
    if use custom && has "${EBUILD_PHASE:none}" "unpack" "prepare" "compile" "install"; then
##bl##[bluetooth]##!bl### ##i##pair 00:1F:20:3D:1E:75
        if [ -n "$CUSTOM_CONFIG" ]; then
Attempting to pair with 00:1F:20:3D:1E:75
            SLOT="$PV-${CUSTOM_CONFIG##*/}"
[##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Connected: yes
        else
##r##[agent]##!r## Passkey: 454358
            die "Please define CUSTOM_CONFIG to use 'custom' USE variable"
##r##[agent]##!r## Passkey: ##i##4##!i##54358
        fi
##r##[agent]##!r## Passkey: ##i##45##!i##4358
    fi
##r##[agent]##!r## Passkey: ##i##454##!i##358
}
##r##[agent]##!r## Passkey: ##i##4543##!i##58
 
##r##[agent]##!r## Passkey: ##i##45435##!i##8
src_compile() {
##r##[agent]##!r## Passkey: ##i##454358##!i##
    econf --prefix=/usr/$SLOT --special_options=$CUSTOM_CONFIG || die
[##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Paired: yes
    emake || die
Pairing successful
}
[##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Connected: no
 
##bl##[bluetooth]##!bl### ##i##connect 00:1F:20:3D:1E:75
src_install() {
Attempting to connect to 00:1F:20:3D:1E:75
    emake install DESTDIR="$D" || die
[##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Connected: yes
    insinto /usr/$SLOT
Connection successful
    doins foo
##bl##[bluetooth]##!bl### ##i##quit
}
[##r##DEL##!r##] Controller 00:02:72:C9:62:65 antec [default]
</pre>
#
 
}}
Above, the ebuild has a USE flag called "custom". When it is set, the ebuild looks for a variable called <tt>CUSTOM_CONFIG</tt> in the environment (this would typically be exported into the current shell.) The name of the <tt>CUSTOM_CONFIG</tt> file is used to modify <tt>SLOT</tt>, so that if <tt>CUSTOM_CONFIG</tt> pointed to <tt>/foo/bar/oni</tt>, and the ebuild version was <tt>1.0-r1</tt>, then <tt>SLOT</tt> would be set to <tt>1.0-oni</tt>.
 
Also note that this ebuild takes care to ensure that the ebuild modifies all paths so that the files in this ebuild will not conflict with the paths in other versions of this ebuild. This is how dynamic slot is intended to be used. I plan to use this functionality in Funtoo Linux to support custom kernel ebuilds.
 
== Requirements ==
 
* A default <tt>SLOT</tt> value must be defined in the main body of the ebuild, as normal, and just like a traditional <tt>SLOT</tt>, it must not vary within an individual ebuild. This value is cached in the metadata.
* <tt>pkg_setup</tt> can be used to override <tt>SLOT</tt> but this should not be the default behavior. It should be enabled via USE variable.
* <tt>pkg_setup</tt> should override the SLOT only in certain required phases that reference the dynamic SLOT. Use <tt>EBUILD_PHASE</tt> for this, as in the example.
* Ensure that files in your ebuild are installed to different locations so that they do not conflict with any other installed versions of this ebuild.
* Typically, you would ''not'' use dynamic slot for standard ebuilds that other ebuilds depend on. It is generally intended for "custom" versions of ebuilds that need to vary based on local user settings. However, your ebuild can build in a "standard" mode without dynamic slot enabled via USE, and build in a "custom" mode when dynamic slot ''is'' enabled.
 
== Implementation ==
 
Dynamic Slot functionality has been implemented by making the following changes to Portage:
 
* https://github.com/funtoo/portage-funtoo/commit/537e239c610b3af5d2c860f27018cf7934fb6e00
 
 
[[Category:Portage]]
[[Category:Labs]]

Revision as of 15:22, January 12, 2015

Exception parsing XML: String could not be parsed as XML.

Builds

asdflk asdlfk asdlf alsdf lasd flasd flasd flasd flasd flasd flasd flas dflasd flasdl flasdf lasdfl alsdf lasdf lasdflafsd la sdf

[[{{#show: Organization:Brownrice Internet| ?Logo|link=none}}|350px|class=img-responsive|link=Organization:Brownrice Internet]]

Learn about Funtoo-friendly organization: Brownrice Internet

asdflk asdlfk asdlf alsdf lasd flasd flasd flasd flasd flasd flasd flas dflasd flasdl flasdf lasdfl alsdf lasdf lasdflafsd la sdf https://www.funtoo.org/News:The_Many_Builds_of_Funtoo_Linux

I like the /etc/make.conf file, which can also be referred to as /etc/portage/make.conf. It is a groovy file. Another cool file is /etc/fstab.

make.conf mentions

{{#ask: Mentions file::make.conf | format=category }}

root # bluetoothctl 
[NEW] Controller 00:02:72:C9:62:65 antec [default]
root ##bl##[bluetooth]##!bl###power on
Changing power on succeeded
root ##bl##[bluetooth]##!bl### agent on
Agent registered
root ##bl##[bluetooth]##!bl### scan on
Discovery started
root ##bl##[bluetooth]##!bl### devices
Device 00:1F:20:3D:1E:75 Logitech K760
root ##bl##[bluetooth]##!bl### pair 00:1F:20:3D:1E:75
Attempting to pair with 00:1F:20:3D:1E:75
[CHG] Device 00:1F:20:3D:1E:75 Connected: yes
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
[CHG] Device 00:1F:20:3D:1E:75 Paired: yes
Pairing successful
[CHG] Device 00:1F:20:3D:1E:75 Connected: no
root ##bl##[bluetooth]##!bl### connect 00:1F:20:3D:1E:75
Attempting to connect to 00:1F:20:3D:1E:75
[CHG] Device 00:1F:20:3D:1E:75 Connected: yes
Connection successful
root ##bl##[bluetooth]##!bl### quit
[DEL] Controller 00:02:72:C9:62:65 antec [default]
root #