Note

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Difference between revisions of "Funtoo:Metro"

From Funtoo
Jump to navigation Jump to search
 
(43 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<languages/>
{{Project
{{Software
|summary=This project is focused on {{c|metro}}, the framework used to create new Funtoo Linux builds.
|name=Metro
|leads=Drobbins
|authors=[[User:Drobbins|Daniel Robbins]]
|subpages=Initial Setup, Evolved Bootstrap, Manual Setup, Concepts and Terminology, Configuring Metro, Recipes, Automation, Data Model
|description=Metro is the Funtoo Linux automated build system, and is used to build Funtoo Linux stage tarballs.
|translate=yes
|source=[https://github.com/funtoo/metro GitHub]}}
|updates={{Project/Update
{{Subpages|AutoSetup,Manual Setup,How Metro Works,Configuring Metro,Data Model,Recipes}}
|date=2022-10-10
<translate>
|status=Metro now has a new [[Funtoo:Metro/Initial Setup|Initial Setup]] guide, which explains how to use the totally rewritten (and reliable) setup tool.
<!--T:1-->
== Installation ==
 
<!--T:21-->
'''The recommended and supported method''' is to use the Git repository of Metro
 
<!--T:22-->
Ensure that {{Package|dev-vcs/git}}, {{Package|dev-python/requests}}, {{Package|dev-python/sqlalchemy}} and {{Package|dev-python/lxml}} are installed on your system.
 
<!--T:23-->
{{console|body=
# ##i##emerge dev-vcs/git dev-python/requests dev-python/sqlalchemy dev-python/lxml
}}
}}
<!--T:24-->
Next, clone the master git repository as follows:
<!--T:25-->
{{console|body=
# ##i##cd /root
# ##i##git clone git://github.com/funtoo/metro.git
# ##i##cp /root/metro/metro.conf ~/.metro
}}
}}
<translate>
== Introduction == <!--T:1-->


<!--T:26-->
<!--T:135-->
You will now have a directory called {{c|/root/metro}} that contains all the Metro source code.
Metro is the tool used by Funtoo Linux to build new releases of Funtoo Linux. It is also available to the public and can be used to build custom versions of Funtoo Linux, or used by developers to perform build testing. This page documents how to install, configure and use Metro. Also note that there is various additional supplemental documentation available on sub-pages, with links above.
=== Setting up ego===
Now, we will set the {{c|ego}}, administration tool of Funtoo Linux. The way it is used with metro is independent from {{c|app-admin/ego}} installed on your box. Setup is easy as follows:
{{console|body=
# ##i##cd /root
# ##i##git clone https://github.com/funtoo/ego.git
}}
This way you will have {{c|/root/ego}} directory with {{c|ego}} binary that is then used by metro.
 
<!--T:28-->
Metro is now installed.  It's time to customize it for your local system.
 
You may wish to use the new [[Metro/AutoSetup|autosetup]] script which uses a curses based menu and allows for quickly setting up and running builds base on your choices without requiring any manual steps. Please see the [[Metro AutoSetup]] page for more details.
 
 
= Build your own tailored stage3 = <!--T:70-->
 
<!--T:71-->
Metro can be easily configured for building custom stage3 by including additional packages. You can find following directory {{c|/etc/builds/packages}} in your copy of metro repository and a corresponding {{c|arch}} configuration files inside:
{{file|name=/etc/builds/packages/x86-64bit.conf|body=
[section emerge]
 
packages: [
sys-kernel/debian-sources
]
}}
Notice a {{c|debian-sources}} ebuild is added for all 64-bit stages. Modify the file to include (or exclude in case Funtoo add additional) packages of your choice. They will be included in your custom stage3 portage's world file.
 
= Building Gentoo stages = <!--T:98-->
 
<!--T:99-->
Metro can also build Gentoo stages. After switching to Funtoo profile, see http://www.funtoo.org/Funtoo_Profiles metro require additional steps for this. We have an open bug for this -- it is simply due to the fact that we focus on ensuring Funtoo Linux builds and building Gentoo is a lower priority. Historical note: Funtoo Linux originally started as a fork of Gentoo Linux so that metro could reliably build Gentoo stages.
http://www.funtoo.org/Funtoo_Profiles
 
= Advanced Features = <!--T:100-->
 
<!--T:101-->
Metro also includes a number of advanced features that can be used to automate builds and set up distributed build servers. These features require you to {{c|emerge sqlalchemy}}, as SQLite is used as a dependency and also {{c|emerge dev-python/lxml}} as this is needed for index file generation.
 
== Repository Management == <!--T:102-->
 
<!--T:103-->
Metro includes a script in the {{c|scripts}} directory called {{c|buildrepo}}. Buildrepo serves as the heart of Metro's advanced repository management features.
 
=== Initial Setup === <!--T:104-->


<!--T:105-->
<!--T:136-->
To use {{c|buildrepo}}, you will first need to create a {{f|.buildbot}} configuration file. Here is the file I use on my AMD Jaguar build server:
Please see [[{{FULLPAGENAME}}/Initial Setup|Initial Setup]] for instructions on how to get Metro up and running on your system.


<!--T:106-->
To learn how to use Funtoo from Scratch stage1 to "seed" Metro, please see our new [[{{FULLPAGENAME}}/Evolved Bootstrap|Evolved Bootstrap Integration]] document.
{{file|name=/root/.buildbot|lang=python|body=
builds = (
"funtoo-current",
"funtoo-current-hardened",
)


<!--T:107-->
<!--T:137-->
arches = (
"x86-64bit",
"pure64"
)
 
<!--T:108-->
subarches = (
"amd64-jaguar",
"amd64-jaguar-pure64",
)
 
<!--T:109-->
def map_build(build, subarch, full, full_date):
# arguments refer to last build...
if full == True:
buildtype =  ( "freshen", )
else:
buildtype =  ("full", )
        # return value can be a string like "full+openvz" or a sequence type like [ "freshen", "openvz" ]
return buildtype
}}
 
<!--T:110-->
This file is actually a python source file that defines the tuples {{c|builds}}, {{c|arches}} and {{c|subarches}}. These variables tell {{c|buildrepo}} which builds, arches and subarches it should manage. A {{c|map_build()}} function is also defined which {{c|buildbot}} uses to determine what kind of build to perform. The arguments passed to the function are based on the last successful build. The function can read these arguments and return a string to define the type of the next build. In the above example, the {{c|map_build()}} function will cause the next build after a freshen build to be a full build, and the next build after a full build to be a freshen build, so that the build will alternate between full and freshen.
 
== Automated Builds == <!--T:111-->
 
<!--T:112-->
Once the {{c|.buildbot}} file has been created, the {{c|buildrepo}} and {{c|buildbot.sh}} tools are ready to use. Here's how they work. These tools are designed to keep your repository ({{c|path/mirror}} in {{f|/root/.metro}} up-to-date by inspecting your repository and looking for stages that are out-of-date.
 
<!--T:113-->
To list the next build that will be performed, do this -- this is from my ARM build server:
 
<!--T:114-->
{{console|body=
# ##i##./buildrepo nextbuild
build=funtoo-current
arch_desc=arm-32bit
subarch=armv7a_hardfp
fulldate=2015-02-08
nextdate=2015-02-20
failcount=0
target=full
extras=''
}}
 
<!--T:115-->
If no output is displayed, then all your builds are up-to-date.
 
<!--T:116-->
To actually run the next build, run {{c|buildbot.sh}}:
 
<!--T:117-->
{{console|body=
# ##i##./buildbot.sh
}}
 
<!--T:118-->
If you're thinking that {{c|buildbot.sh}} would be a good candidate for a cron job, you've got the right idea!
 
=== List Builds === <!--T:119-->
 
<!--T:120-->
To get a quick look at our repository, let's run the {{c|buildrepo fails}} command:
 
<!--T:121-->
{{console|body=
# ##i##./buildrepo fails
  0  2015-02-18 /home/mirror/funtoo/funtoo-current/x86-64bit/amd64-jaguar
  0  2015-02-18 /home/mirror/funtoo/funtoo-current/pure64/amd64-jaguar-pure64
  0  2015-02-18 /home/mirror/funtoo/funtoo-current-hardened/x86-64bit/amd64-jaguar
  0  2015-02-18 /home/mirror/funtoo/funtoo-current-hardened/pure64/amd64-jaguar-pure64
}}
 
<!--T:122-->
On my AMD Jaguar build server, on Feb 20, 2015, this lists all the builds that {{c|buildrepo}} has been configured to manage. The first number on each line is a '''failcount''', which is the number of consecutive times that the build has failed. A zero value indicates that everything's okay. The failcount is an important feature of the advanced repository management features. Here are a number of behaviors that are implemented based on failcount:
 
<!--T:123-->
* If {{c|buildbot.sh}} tries to build a stage and the build fails, the failcount is incremented.
* If the build succeeds for a particular build, the failcount is reset to zero.
* Builds with the lowest failcount are prioritized by {{buildrepo}} to build next, to steer towards builds that are more likely to complete successfully.
* Once the failcount reaches 3 for a particular build, it is removed from the build rotation.
 
=== Resetting Failcount === <!--T:124-->
 
<!--T:125-->
If a build has issues, the failcount for a build will reach 3, at which point it will be pulled out of build rotation. To clear failcount, so that these builds are attempted again -- possibly fixed by new updates to the Portage tree -- use {{c|buildrepo zap}}:
 
<!--T:126-->
{{console|body=
# /root/metro/scripts/buildrepo zap
Removing /mnt/data/funtoo/funtoo-current/arm-32bit/armv7a_hardfp/.control/.failcount...
Removing /mnt/data/funtoo/funtoo-current/arm-32bit/armv6j_hardfp/.control/.failcount...
Removing /mnt/data/funtoo/funtoo-current/arm-32bit/armv5te/.control/.failcount...
}}
 
== Repository Maintenance == <!--T:127-->
 
<!--T:128-->
A couple of repository maintenance tools are provided:
 
<!--T:129-->
* {{c|buildrepo digestgen}} will generate hash files for the archives in your repository, and clean up stale hashes.
* {{c|buildrepo index.xml}} will create an index.xml file at the root of your repository, listing all builds available.
* {{c|buildrepo clean}} will output a shell script that will remove old stages. No more than the three most recent stage builds for each build/arch/subarch are kept.
 
== Distributed Repositories == <!--T:130-->
 
<!--T:131-->
In many situation, you will have a number of build servers, and each will build a subset of your master repository, and then upload builds to the master repository. This is an area of Metro that is being actively developed. For now, automated upload functionality is not enabled, but is expected to be implemented in the relatively near future. However, it is possible to have your master repository differentiate between subarches that are built locally, and thus should be part of that system's {{c|buildbot}} build rotation, and those that are stored locally and built remotely. These builds should be cleaned when {{c|buildrepo clean}} is run, but should not enter the local build rotation. To set this up, modify {{f|/root/.buildbot}} and use the {{c|subarches}} and {{c|all_subarches}} variables:
 
<!--T:132-->
{{file|name=/root/.buildbot|desc=Excerpt of .buildbot config for master repository|body=
# subarches we are building locally:
 
<!--T:133-->
subarches = (
        "pentium4",
        "athlon-xp",
        "corei7",
        "corei7-pure64",
        "generic_32",
        "i686",
        "amd64-k8",
        "amd64-k8-pure64",
        "core2_64",
        "core2_64-pure64",
        "generic_64",
        "generic_64-pure64",
)
 
# Things we need to clean, even if we may not be building:
 
all_subarches = subarches + (
        "atom_32",
        "atom_64",
        "atom_64-pure64",
        "amd64-k10",
        "amd64-k10-pure64",
        "amd64-bulldozer",
        "amd64-bulldozer-pure64",
        "amd64-steamroller",
        "amd64-steamroller-pure64",
        "amd64-piledriver",
        "amd64-piledriver-pure64",
        "amd64-jaguar",
        "amd64-jaguar-pure64",
        "intel64-haswell",
        "intel64-haswell-pure64",
        "intel64-ivybridge-pure64",
        "intel64-ivybridge",
        "armv7a_hardfp",
        "armv6j_hardfp",
        "armv5te"
)
}}
== Using binary cache ==
Metro has built-in feature which allows to use binary packages cache rather then building same list of packages from sources. For example, core packages, such as @system are updated at slower pace and it makes sense to enable binary cache to make stage building blazing fast. However, the real disadvantage with using binary cache could be a core package update that due to internal ABI changes require rebuilding of numerous packages from sources. Good example is {{c|sys-libs/ncurses-5}} to {{c|sys-libs/ncurses-6}} major update. This is the case when you would need to disable binary cache and use regular ebuild installation from sources.  To enable binary cache, in your metro git repository copy, edit the {{c|common.conf}}
{{file|name=/etc/builds/common.conf|desc=Excerpt of default common.conf|body=
[section metro]
 
options:
options/stage:
target: gentoo
}}
and set {{c|cache/package}}
{{file|name=/etc/builds/common.conf|desc=Excerpt of common.conf with binary cache enabled|body=
[section metro]
 
options:
options/stage: cache/package
target: gentoo
}}
 
During stage build metro will save package cache in {{c|/var/tmp/metro/cache/package-cache}}. With any next builds this binary package  cache will be used.
<!--T:134-->
[[Category:HOWTO]]
[[Category:HOWTO]]
[[Category:Metro]]
[[Category:Metro]]
__TOC__
__TOC__
</translate>
</translate>
[[Category:Official Documentation]]
[[Category:Official Documentation]]
{{ProjectFooter}}

Latest revision as of 06:08, October 11, 2022

Other languages:
English • ‎Türkçe • ‎português do Brasil • ‎日本語
   Summary
This project is focused on metro, the framework used to create new Funtoo Linux builds.
   People
Leads
   Latest Status

Metro now has a new Initial Setup guide, which explains how to use the totally rewritten (and reliable) setup tool.

10 October 2022

Introduction

Metro is the tool used by Funtoo Linux to build new releases of Funtoo Linux. It is also available to the public and can be used to build custom versions of Funtoo Linux, or used by developers to perform build testing. This page documents how to install, configure and use Metro. Also note that there is various additional supplemental documentation available on sub-pages, with links above.

Please see Initial Setup for instructions on how to get Metro up and running on your system.

To learn how to use Funtoo from Scratch stage1 to "seed" Metro, please see our new Evolved Bootstrap Integration document.