Iurt

Материал из Mandriva Russian Community Wiki

Перейти к: навигация, поиск
Содержимое этой статьи или раздела устарело
Следующая информация устарела и должна быть пересмотрена. Вы также можете просмотреть список статей, содержащих устаревшую информацию.
iurt — это сценарий, написанный на языке Perl, который используется для пересборки пакетов SRPM в чистом chroot-окружении. Кроме того, iurt может отслеживать пакеты и пересобирать их в случае необходимости.

Содержание

Установка iurt

Ранее iurt не был собран в виде пакета и его можно было получить только из svn, но теперь iurt оформлен в виде пакета и его установка ничем не отличается от установки любого другого приложения.

Использование

iurt следит за бинарными пакетами, пакетами с исходными кодами из различных репозиториев и источников и пересобирает их по мере необходимости.

Основные команды

Распространённые команды:

iurt --distro cooker --config_help

показать используемые параметры из конфигурационного файла

iurt --distro cooker --chroot --arch i586

создать или обновить tar-архив для chroot

iurt --distro cooker --rebuild i586 cooker /путь/к/foo.src.rpm

собрать пакет foo в chroot

iurt --distro cooker --arch i586 --media bar

пересобрать все ещё не обновлённые пакеты SRPM для источника bar

iurt --shell

создать пустой chroot и перенести в него командную оболочку

iurt --distro cooker --arch i586 --dkms

перекомпилировать все пакеты dkms для каждого доступного ядра

Использование iurt на сборочном кластере

iurt также доступен на сборочном кластере Mandriva.

Примеры команд:

sudo iurt название_пакета.src.rpm

пересобрать пакет в chroot cooker

sudo iurt2011 package.src.rpm

пересобрать пакет в chroot для 2011

sudo iurt --shell

создать пустой chroot и перевести туда командную оболочку

sudo iurt --clean

удалить предыдущий созданный chroot

sudo iurt --stop <шаг> пакет.src.rpm

создать chroot, установить зависимости и выполнить rpm -b<шаг> пакет.src.rpm, затем предоставить командную оболочку в chroot

Настройка iurt

Для нормальной работы iurt потребуется создать конфигурационный файл. Для каждой версии дистрибутива рекомендуется создать свой отдельный файл. Например, для работы с cooker необходимо создать конфигурационный файл с именем .iurt.cooker.conf. Этот файл представляет собой небольшой фрагмент кода на Perl, который будет загружаться в качестве специальной переменной, содержащей настройки для iurt.

При выполнении команды --distro foo iurt автоматически определяет файл с настройками, который будет подгружен при запуске. Чтобы убедиться, что сформированный вами файл настроек корректен, выполните следующую команду и посмотрите на её вывод: --help_config

Пример файла конфигурации

{
 home => "/home/mandrake/",
 cache_home => "/home/mandrake/.bugs/",
 supported_arch => [ 'i586', 'x86_64' ],
 upload => "kenobi:/home/mandrake/uploads/",
 local_home => "/export/home/mandrake/",
 unwanted_packages => '^monotone-',
 repository => '/mnt/BIG/dis/',
 rsync_to => "mandrake\@qa:/var/www/html/build/iurt/",
 admin => 'warly@mandriva.com',
 sendmail => 1,
 packager => 'Iurt the rebuild bot <warly@mandriva.com>',
 install_chroot_binary => '~warly/files/cvs//mdk/soft/rpm-rebuilder/install-chroot-tar.sh',
 distribution => 'Mandriva Linux',
 vendor => 'Mandriva',
 basesystem_media => ''
}
  • home your home dir, defaults to $HOME;
  • cache_home where to store the iurt cache (for cooker this cache is about 3 MB), defaults to $HOME/.bugs/;
  • upload where to copy resulting packages, defaults to $HOME/uploads/;
  • local_home where to build packages (this can be different from you $HOME if you are on NFS and you want to compile locally), defaults to $HOME;
  • unwanted_packages if you do not want to compile a certain package, you can enter here a regexp, defaults to nothing;
  • repository is the location of your local packages, note that your packages must be in a Mandriva like structure;
  • rsync_to can be set if you want to send the reports on another machine, the default is to do nothing;
  • admin who to spam with all the warning messages. Default is nothing;
  • sendmail if a warning mail will be sent for encountered error. Default is not to send mail;
  • packager field used as packager tag and mail origin. Default is 'Iurt';
  • install_chroot_binary program to create and manage chroot, it is not yet packaged and needs to be fetched for the CVS. Default is install-chroot-tar.sh;
  • vendor default is Mandriva;
  • distribution default is Mandriva Linux;
  • basesystem_media to select which media will be used to create the initial chroot.

To have a full listing of available options, use iurt --config_help, and, even better, iurt --config_help cooker x6_64 main so that you can debug your default values

Примечание
При первом запуске iurt будет работать достаточно медленно, т. к. ему потребуется просканировать все пакеты, чтобы сформировать свой кэш.
Внимание!
Настоятельно рекомендуется использовать в своём репозитории такую же структуру дерева каталогов, как в Mandriva: /some/path/cooker/$arch/media/main
.

Параметры

Unionfs (--unionfs)

По умолчанию используется базовая система (basesystem), сжатая с помощью rpm-build в архив tar.gz. При сборке каждого нового пакета старый chroot удаляется и из архива tar.gz ставится новый, затем происходит установка зависимостей и сборка пакета. Если у вас есть возможность задействовать unionfs, а также достаточно оперативной памяти, вы можете сократить общее время, затрачиваемое на сборку, исключив шаги, затрагивающие работу с архивом. При завершении сборки файловая система unionfs просто отключается. Всё происходит в ОЗУ, следовательно, происходит быстрее. Вы также можете обойти первоначальную проверку chroot с помощью параметра --nocheckchroot.

Отладка (--debug)

iurt можно запустить с отладочным флагом --debug, чтобы отладить существующие настройки. iurt можно запускать в отладочном режиме, даже если запущен другой экземпляр программы: отладочный вариант программы создаст альтернативный chroot, попытается собрать один единственный пакет, он не будет обновлять кэш, отправлять писем или переносить пакеты.

Shell (--shell)

If you need to work out or compile several packages in a clean chroot, you can use the --shell option to have a shell with your local user in an empty chroot with basesytem, sudo and urpmi. A sudo will be setup on rpm, urpmi, urpme and urpmi.addmedia.

DKMS (--dkms)

DKMS packages are kernel external module sources which are recompiled when the package is installed or when a new kernel is installed on the machine. However we can pre compile them for the kernel available in the distribution, so that they can be directly used (to create live CDs for example, or just for user convenience).

Extra Options

  • --clean: this option removes the old chroot remaining in the user's temporary chroot directory
  • --clean_all: remove all the chroots for all the users in the temporary chroot directory.
  • --chrooted-urpmi: this option adds the urpmi media inside the chroot and does not use the urpmi --root command, which usually leads to an urpmi database locking problem.

Log files

You can see the current Mandriva Iurt log files at http://qa.mandriva.com/build/iurt/.

Iurt is logging several things during the package's build:

  • install_deps_<srpm>.<build_nb>.log: result of the urpmi -s of the srpm in the chroot;
  • rpm_qa_<srpm>.<build_nb>.log: list of packages installed before the build in the chroot;
  • build_<srpm>.<build_nb>.log: result of the rpm --rebuild of the srpm in the chroot;
  • binary_test_<srpm>.<build_nb>.log: result of urpmi of the generated binary packages in the chroot.

Internals

Cache

Iurt is caching 6 things:

  • rpm_srpm: the correspondence between binaries and source packages;
  • failure: all the packages which build has failed, not to recompile them, if you want to force a recompilation, you must remove the package entry in this hash;
  • queue: all the binary packages which have been built;
  • warning: iurt keeps a list of warning messages sent, to limit the number of mails sent;
  • run: the number of iurt runs, this is used in the log file extension, to regroup all the log files of a same run;
  • needeed: keep a list of build requires and only try to rebuild a given package when all it's buildrequires are fulfilled;
  • no_unionfs: some packages could not be built with unionfs (they need too much space, or they need to access to /proc/self/exe which is not correct with unionfs)

Алгоритм работы

Сначала Iurt проверяет, не запущен ли ещё один экземпляр iurt, затем сканирует пакеты в репозитории. После этого сценарий вычисляет список пакетов, которые должны быть пересобраны, создаёт и проверяет chroot, который будет использоваться для пересборки пакетов. Затем сценарий переходит к пересборке пакетов, он каждый раз пересоздаёт chroot, устанавливает зависимости, собирает пакеты, устанавливает полученные бинарные пакеты, копирует собранные пакеты в целевой каталог.

Fault tolerance

Iurt has to be very robust against environment troubles. It must be able to detect and not stop at each problem, namely filesystem available space, concurrent runs, hdlist problems, chroot corruption, temporarily missing resources and such.

Known bugs

Some packages cause troubles with iurt. The two most common are gconftool-2 and gst-register-0.8. Sometimes they don't exit and an urpmi process is left running in memory. When several gnome packages are recompiled, for each one gconftool-2 and one or two urpmi will stay in memory, eating slowly all your RAM. The current workaround here is to kill these two processes as soon as they appear. watch 'killall -9 gconftool-2 gst-register-0.8 2>/dev/null' in a screen will do the job.

Needed Packages

For running it, you'll need at least: perl-Filesys-Statvfs_Statfs_Df perl-RPM4 perl-File-NCopy perl-Data-Dump perl-MIME-tools mkcd ( urpmi them).

Non packaged script: install-chroot-tar.sh (http://cvs.mandriva.com/cgi-bin/viewvc.cgi/soft/rpm-rebuilder/ )

TODO

First feel free to send comments or feedback to warly@mandriva.com.

Here is a list of important things to look at:

  • have it more generic, to be used in several environments ( iurt is quite linked to Mandriva though, with calls to urpmi and other Mandriva tools. However, thanks to RafaelGarciaSuarez, urpmi is now on CPAN);
  • need to test also packages updating (installing old version and updating the newly generated packages).
  • need to add a compilation set option, to compile all the packages of a group altogether
Источник — «http://wiki.mandriva.com/ru/Iurt»
На других языках