How Metro Works

From Funtoo Linux
Revision as of 16:22, 9 January 2011 by 404 Error (Talk)

Jump to: navigation, search

Metro is a somewhat complex set of shell scripts and various files that automagically creates stages 1/2/3 tarballs used to emerge your Funtoo system. Of course, Metro needs a seed to start its work and will recompile things like the so well known gcc and glibc. A 'seed' is either pre-built a stage 3 archive available on any Funtoo mirror or a snpashot of your current Funtoo installation . Hint : those who use BTRFS/ZFS or any snapshotable filesystem will enjoy their choice here :-)

Arborescence description

Don't search through your bin directories, everything lies in /usr/lib/metro. An unfolded view as of Metro revision 1.5.1 is this one :

├── BUGS
├── ChangeLog
├── TODO
├── etc
│   ├── builds
│   │   ├── funtoo
│   │   │   ├── build.conf
│   │   │   └── multi-targets
│   │   │       ├── freshen
│   │   │       ├── full
│   │   │       ├── quick
│   │   │       ├── stage1
│   │   │       └── strategy
│   │   │           └── seed
│   │   │               ├── stage1
│   │   │               └── stage3
│   │   ├── gentoo
│   │   │   ├── build.conf
│   │   │   └── multi-targets
│   │   │       ├── freshen
│   │   │       ├── full
│   │   │       ├── quick
│   │   │       ├── stage1
│   │   │       └── strategy
│   │   │           └── seed
│   │   │               ├── stage1
│   │   │               └── stage3
│   │   ├── hollow
│   │   │   ├── build.conf
│   │   │   └── multi-targets
│   │   │       ├── freshen
│   │   │       ├── full
│   │   │       ├── quick
│   │   │       ├── stage1
│   │   │       └── strategy
│   │   │           └── seed
│   │   │               ├── stage1
│   │   │               └── stage3
│   │   └── ~funtoo
│   │       ├── build.conf
│   │       └── multi-targets
│   │           ├── freshen
│   │           ├── full
│   │           ├── quick
│   │           ├── stage1
│   │           └── strategy
│   │               └── seed
│   │                   ├── stage1
│   │                   └── stage3
│   ├── fslayouts
│   │   └── funtoo
│   │       ├── layout.conf
│   │       └── type
│   │           ├── image
│   │           └── snapshot
│   └── metro.conf
├── features
│   └── probe.conf
├── metro
├── misc
│   └── locale.gen
├── modules
│   ├── catalyst_support.py
│   ├── catalyst_support.pyo
│   ├── flexdata.py
│   ├── flexdata.pyo
│   ├── flexdata2.py
│   ├── flexdata3.py
│   ├── flexdata4.py
│   ├── targets.py
│   └── targets.pyo
├── scripts
│   ├── build.sh
│   ├── cleaner.sh
│   ├── dlstats.sh
│   └── ezbuild.sh
├── subarch
│   ├── amd64
│   │   ├── 2008.spec
│   │   └── 2009.spec
│   ├── amd64.spec
│   ├── athlon-xp.spec
│   ├── core2.spec
│   ├── core2_32.spec
│   ├── generic32.spec
│   ├── generic64.spec
│   ├── i686
│   │   ├── 2008.spec
│   │   └── 2009.spec
│   ├── i686.spec
│   ├── native32.spec
│   ├── native64.spec
│   ├── opteron-sse3.spec
│   ├── opteron.spec
│   ├── opteron_32.spec
│   ├── pentium4.spec
│   ├── phenom.spec
│   ├── x86.spec
│   ├── xen-nocona.spec
│   └── xen-prescott.spec
└── targets
    └── gentoo
        ├── openvz.spec
        ├── snapshot
        │   ├── common.spec
        │   ├── global.spec
        │   ├── source
        │   │   ├── git
        │   │   └── rsync
        │   └── type
        │       ├── dead
        │       └── live
        ├── snapshot.spec
        ├── stage
        │   ├── capture
        │   │   ├── ami.spec
        │   │   └── tar.spec
        │   ├── common.spec
        │   ├── files.spec
        │   ├── stage3-derivative.spec
        │   ├── stage3-generator.spec
        │   └── steps.spec
        ├── stage1
        │   └── strategy
        │       ├── local
        │       └── remote
        ├── stage1.spec
        ├── stage2
        │   └── strategy
        │       ├── local
        │       │   ├── stage1
        │       │   └── stage3
        │       └── remote
        │           ├── stage1
        │           └── stage3
        ├── stage2.spec
        ├── stage3-freshen.spec
        ├── stage3-quick.spec
        ├── stage3.spec
        └── stage4.spec
[/pre]

For the beginner, just retain that :

1. Python is the master of the house, everything (or at least near everything) in Funtoo tools is written Python, and as being a Funtool tool, Metro in itself plus all of the stuff it uses are written in Python.
2. The first place to start with Metro tweaking are the .spec files located under '''targets/gentoo'''. Those files control what Metro does at each stage and are basically a melt of Metro directives and some Python embedded scripts and BASH embedded scripts. If something goes wrong 
3. Another good place to look at is '''targets/gentoo''' : you will find here a couple of .spec files that governs what will be generated as a bintils, glibc and gcc, how they will be used (notice the CHOST variable) and at the end what will be put in the make.conf file in your stages archives. 


TODO: Explain briefly what file does what.

= How things works ? =

TODO


The [[Metro Data Model]] page explains the logic used in spec files.

= Adding a new sub architecture =

As of Januray 2011, Metro can handle the IA-32 architecture (x86/32 and x/86 bits) as well as being able to handle several x86 flavous lying beneath the generic 'x86 and 'amd64' taxonomies. The example here is a try to add the necessary specification file to make it generate stage 1/2/3 tarballs for tiers architectures.



[[Category:Metro]]
Personal tools
Namespaces

Variants
Actions
Categories
Toolbox
Stuff