Difference between pages "Portage Dynamic Slot" and "Package:Rutorrent"

(Difference between pages)
 
m
 
Line 1: Line 1:
Portage-2.3.1 in the experimental tree contains support for dynamic slots.
+
{{Ebuild
 +
|Summary=ruTorrent is a front-end for the popular Bittorrent client rTorrent
 +
|CatPkg=www-apps/rutorrent
 +
|Homepage=http://code.google.com/p/rutorrent/
 +
}}
  
{{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.}}
+
rutorrent is a front end to {{package|net-p2p/rtorrent}} and is designed to look like utorrent =D
  
== Traditional SLOT ==
+
{{console|body=###i## emerge www-apps/rutorrent}}
  
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.
+
===prereqs===
 +
*Install your web server {{package|www-servers/nginx}}, and get {{package|dev-lang/php}} with the fpm use flag running first.
 +
*you must turn on scgi_pass in the {{package|net-p2p/rtorrent}} config.
  
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.
+
===configuration===
 +
==== optional security lock down stuff ====
 +
{{warning|possibly broken, untested}}
  
== Dynamic SLOT ==
+
first figure out what php you're using
  
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.  
+
{{console|body=###i##eselect php list fpm
 +
[1]  php5.5 *
 +
###i## eselect php list cgi
 +
[1]  php5.5 *
 +
###i## eselect php list apache2
 +
[1]  php5.5 *
 +
###i## eselect php list cli
 +
[1]  php5.5 *
 +
}}
  
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:
+
edit the respective php.ini
  
<pre>
+
Edit the open_basedir in
SLOT="$PV"
+
/etc/php/fpm-php5.5/php.ini
IUSE="custom"
+
{{file|name=/etc/php/fpm-php5.5/php.ini|lang=|desc=php basedir|body=
 +
open_basedir = /var/www/localhost/htdocs/rutorrent/conf:/var/www/localhost/htdocs/rutorrent/php:/var/www/localhost/htdocs/rutorrent/
 +
}}
  
pkg_setup() {
+
=== nginx config===
    if use custom && has "${EBUILD_PHASE:none}" "unpack" "prepare" "compile" "install"; then
+
{{file|name=/etc/nginx/sites-available/localhost|lang=|desc=nginx configuration|body=
        if [ -n "$CUSTOM_CONFIG" ]; then
+
server {
            SLOT="$PV-${CUSTOM_CONFIG##*/}"
+
listen 127.0.0.1:80;
        else
+
server_name localhost;
            die "Please define CUSTOM_CONFIG to use 'custom' USE variable"
+
access_log /var/log/nginx/localhost.access_log main;
        fi
+
error_log /var/log/nginx/localhost.error_log info;
    fi
+
root /var/www/localhost/htdocs;
}
+
index index.php index.cgi index.htm index.html;
 +
autoindex on;
  
src_compile() {
+
        location ~ \.php$ {
    econf --prefix=/usr/$SLOT --special_options=$CUSTOM_CONFIG || die
+
                fastcgi_pass 127.0.0.1:9000;
    emake || die
+
include fastcgi.conf;
}
+
                #fastcgi_pass unix:/var/run/php5-fpm.sock;
 +
        }
  
src_install() {
+
          location /rutorrent {
    emake install DESTDIR="$D" || die
+
              include scgi_params;
    insinto /usr/$SLOT
+
              scgi_pass localhost:5000;
    doins foo
+
          }
 
}
 
}
</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.
+
restart nginx
* <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.
+
{{console|body=###i## /etc/init.d/nginx restart}}
* <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 ==
+
point your browser to
  
Dynamic Slot functionality has been implemented by making the following changes to Portage:
+
http://127.0.0.1/rutorrent
  
* https://github.com/funtoo/portage-funtoo/commit/537e239c610b3af5d2c860f27018cf7934fb6e00
+
or
  
 +
http://localhost/rutorrent
  
[[Category:Portage]]
+
{{PageNeedsUpdates}}
[[Category:Labs]]
+
{{EbuildFooter}}

Revision as of 06:51, March 8, 2015

www-apps/rutorrent


Source Repository:Gentoo Portage Tree
Homepage

Summary: ruTorrent is a front-end for the popular Bittorrent client rTorrent


News

Drobbins

Pre-built kernels!

Funtoo stage3's are now starting to offer pre-built kernels for ease of install. read more....
12 May 2015 by Drobbins
Drobbins

Better Experiences: Ego and Vim

Info on Funtoo's new personality tool called 'ego', and user-focused updates to vim's defaults.
27 April 2015 by Drobbins
Drobbins

How We're Keeping You At the Center of the Funtoo Universe

Read about recent developments that keep you, our users, at the forefront of our focus as Funtoo moves forward.
10 April 2015 by Drobbins
View More News...

Rutorrent

Tip

This is a wiki page. To edit it, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.


rutorrent is a front end to Rtorrent and is designed to look like utorrent =D

# emerge www-apps/rutorrent


prereqs

  • Install your web server Nginx, and get PHP with the fpm use flag running first.
  • you must turn on scgi_pass in the Rtorrent config.

configuration

optional security lock down stuff

Warning

possibly broken, untested

first figure out what php you're using

#eselect php list fpm
[1]   php5.5 *
# eselect php list cgi
[1]   php5.5 *
# eselect php list apache2
[1]   php5.5 *
# eselect php list cli
[1]   php5.5 *


edit the respective php.ini

Edit the open_basedir in /etc/php/fpm-php5.5/php.ini

/etc/php/fpm-php5.5/php.ini - php basedir
open_basedir = /var/www/localhost/htdocs/rutorrent/conf:/var/www/localhost/htdocs/rutorrent/php:/var/www/localhost/htdocs/rutorrent/

nginx config

/etc/nginx/sites-available/localhost - nginx configuration
server {
	listen 127.0.0.1:80;
	server_name localhost;
	access_log /var/log/nginx/localhost.access_log main;
	error_log /var/log/nginx/localhost.error_log info;
	root /var/www/localhost/htdocs;
	index index.php index.cgi index.htm index.html;
	autoindex on;

        location ~ \.php$ {
                fastcgi_pass 127.0.0.1:9000;
		include fastcgi.conf;
                #fastcgi_pass unix:/var/run/php5-fpm.sock;
        }

           location /rutorrent {
               include scgi_params;
               scgi_pass localhost:5000;
           }
}

restart nginx

# /etc/init.d/nginx restart


point your browser to

http://127.0.0.1/rutorrent

or

http://localhost/rutorrent