Project:Infrastructure/Mirrors/Distfile Mirroring System

This guide describes how our distfile process flow works, including how a new tarball gets added to the distfile mirrors

Placing files on the Gentoo Mirror system
The mirror system will automatically fetch any distfile that is in the ebuild tree. Developers don't have to do anything unless an error occurs. The mirror system is designed to propogate to all nodes within 4 hours of the files hitting the Master Private Dist Mirror using cron jobs to pull from the Master. Due to various issues the nodes may take as long as 24 hours for your file to propogate. If you suspect that your file is not being fetched simply check the failure report.

If you're ebuild contains the file will not be mirrored. The only exception to that is. This is automatically done by the mirror system, no manual intervention is required.

Files placed in will be retained for six months unless manually deleted earlier. Place any file that you want to be retained on the mirror system, even if no ebuild refers to it, here. Keep in mind that the mirror system will retain files for two weeks after it is last referred to in an ebuild so only use distfiles-whitelist if absolutely necessary.

All entries in  MUST come with a comment in the same format as. If you wish to whitelist a lot of files, you should create a seperate file in the same directory instead.

Automatic fetch failure
When the automatic fetch fails it is the responsibility of the package maintainer to manually retrieve the file from the original location and place it in on dev.gentoo.org. This file is published as an rsync directory, to which the private master distfile mirror connects to and retrieves any files in the directory. These files are synchronized to on the private master distfile mirror. From there, the runs every 30 minutes to synchronize  and  on the private master distfile mirror. Files placed in distfiles-local are automatically removed after two weeks and the Mirror System takes control of the file.

The mirror system only downloads the first instance of a file name. If subsequent ebuilds reference this file name the checksums of the two URI's are compared, if they do not match the second file will not be fetched. The mirror system will produce an error and human intervention is required. Please check file names carefully.

Common fetch errors:


 * URI port must be 80, 443, or 23
 * URI is malformed (mirrors:// is a common mistake, mirror:// is proper)
 * Mirror target isn't valid (doesn't specify a valid tier)
 * Checksum conflict with another ebuild in the tree - check your file name
 * Upstream host timeout while attempting to connect - Mirror System will reattempt at next pass
 * Upstream host isn't valid - check your URL name.

master private distfile mirror
Source tarballs are automatically fetched and placed on/removed from the mirror system and an exception report generated by three related scripts:,  and. These scripts run on osprey.gentoo.org. (all currently maintained by zmedico and ferringb).

The master script is and runs once every four hours via cron job. The script maintains a database of the death and purgatory lists. The script generates an xml file  based on.

The master private distfile mirror needs a user account. This account should be configured to run every four hours. Files are placed in which is configured in  to be available as an rsync module. From there, gentoo.oregonstate.edu runs an hourly cron job that syncs this directory. gentoo.oregonstate.edu has a password-protected rsync module available, the information which is only distributed to official Gentoo distfile mirrors. Each mirror should be synchronizing with this directory once every four hours.

Items Required:


 * A user account on the private master distfile mirror
 * The,  and  scripts
 * configured as an rsync module
 * The necessary cron job set up to run the master script, update_distfiles.sh, every four hours

Step by Step


 * update_distfiles calls mirror-dist.sh
 * mirror-dist.sh calls ebuild which scans the tree and collects file/digest pairs.
 * If the URI is a mirror, verify the mirror URI. If invalid, fail and write an error in the fail log.
 * If an existing file is found on the mirror system it's checksum is verifed. If it matches the file is used. If it fails the file is deleted.
 * Files that don't exist on the mirror system yet are downloaded from the source URI's until the file is complete or all source URI's are exhausted.
 * Once all files are complete the death-watch database is updated by recursing the tree and looking for any files that exist on the mirror system but do not appear in any ebuild.
 * Any file that doesn't exist in an ebuild is added to death watch.
 * Any file with a death watch date of > two weeks is moved to purgatory.
 * Files in purgatory are removed after two weeks.
 * Exceptions to the death watch list can be added in /space/distfiles-whitelist
 * Files removed from the whitelist are deleted from the mirror system as normal.
 * Dump stats
 * calls
 * creates a report from the stats.
 * The report is copied to http://dev.gentoo.org/~zmedico/infra/distfiles/failure.xml via cronjob.

dev.gentoo.org

 * configured as an rsync module on dev.gentoo.org
 * An rsync command to synchronize with  on the private master distfile mirror.
 * The script
 * The necessary cron jobs set up to run the above scripts and commands at the right times.

Acknowledgements
We would like to thank the following authors and editors for their contributions to this guide:


 * Kurt Lieber
 * Curtis Napier
 * Zach Medico
 * Brian Harring
 * Robin H. Johnson