[devel] ANN: mosquito-rebuild

Ivan Zakharyaschev imz на altlinux.org
Ср Май 18 19:34:04 MSK 2016


Хочу поделиться всякими скриптами, которые возникли при массовой обработке 
пакетов. Не то, чтобы в них есть большие хитрости или они уникальные, но 
может быть, кому-нибудь будет удобно такое поведение, которое было удобно 
мне.

Дополнения, пожелания, замечания приветствуются.

Начну с очень простого одного скрипта -- mosquito-rebuild; упаковывается в 
запланированный пакет mosquito-hive.

http://git.altlinux.org/people/imz/public/mosquito-hive.git?p=mosquito-hive.git;a=blob;f=README.md;hb=HEAD 
:

`mosquito-hive` -- Simple scripts to rebuild a collection of packages
in hasher.

The results are reported in a way similar to the beehive of ALT Sisyphus.

## Features

* rebuild selected SRPMS
** parallel builds, too
* get the list of SRPMS corresponding to a list of selected binary
   RPMS
** make the correspondence relations between src and bin pkg names,
   and between them and files (if src.list and bin.list are missing)
* diff between our results and the results of ALT Sisyphus beehive
   (based on the logs)

The features beyond the first bullet are WORK-IN-PROGRESS (not
packaged yet).

## rebuild selected SRPMS -- `mosquito-rebuild`

The packages are given by their names as arguments on the command line.

`SRPMDIR` environment variable specifies the place to search for the
.src.rpm files (`/ALT/Sisyphus/files/SRPMS` by default, if `SRPMDIR` is
unset).

`hsh` is run in `~/hasher/` with your default configuration. If you
want to pass some options to `hsh`, you can put an executable
named `hsh` into your current directory to override the default `hsh`.

The build logs are saved into subdirs of the current directory (either
`success/` or `error/`) under the "exact" pkg name (with
version-release), similarly to beehive.

As for the list of selected pkgs, it is common to make a file with the
list once and then run further iterations of `mosquito-rebuild` like
this:

     mosquito-rebuild $(<srclist-some_description)

A minimal set of tools to help make such lists is provided; see below.

Some packages can be skipped by `mosquito-rebuild` based on either the
exact pkg name (with version-release) or just the plain name (without
version-release). They are read line-by-line from `srpms-to-skip` file
in the current directory (if it is readable).

* The exact match can be useful if a certain release was known to fail
   to build, but in case it gets updated in SRPMS, a rebuild should be
   tried (because the problem might have been fixed in the new
   release).
* The match by plain name can be useful for more brute (perhaps,
   manual) intervention.

The exact names of src pkgs which have been tried to be rebuilt (with
either result) are accumulated in `srpms-tried-to-build` file in
current directory. If you want to just skip them on any
iterations of `mosquito-rebuild`, you can simply:

     ln -sT srpms-tried-to-build srpms-to-skip

В реализации mosquito-rebuild основной (но не сложный) код см. в 
http://git.altlinux.org/people/imz/public/mosquito-hive.git?p=mosquito-hive.git;a=blob;f=rebuild-helper-one.sh;hb=HEAD
.

Пример использования:

[imz на altair test-mosquito]$ ln -sT srpms-tried-to-build srpms-to-skip
[imz на altair test-mosquito]$ SRPMDIR=/ALT/p7/files/SRPMS mosquito-rebuild apt-repo gear
apt-repo rebuild start
apt-repo-1.3.3-alt1 rebuild SUCCESS
gear rebuild start
gear-2.0.3-alt1 rebuild SUCCESS
[imz на altair test-mosquito]$ SRPMDIR=/ALT/p7/files/SRPMS mosquito-rebuild apt-repo less gear
apt-repo rebuild start
apt-repo-1.3.3-alt1 rebuild SKIP
less rebuild start
less-451-alt1 rebuild SUCCESS
gear rebuild start
gear-2.0.3-alt1 rebuild SKIP
[imz на altair test-mosquito]$ mosquito-rebuild apt-repo less gear
apt-repo rebuild start
apt-repo-1.3.5-alt1 rebuild SUCCESS
less rebuild start
less-481-alt1 rebuild SUCCESS
gear rebuild start
gear-2.0.7-alt1 rebuild SUCCESS
[imz на altair test-mosquito]$ mosquito-rebuild trilinos10
trilinos10 rebuild start
trilinos10-11.12.1-alt2 rebuild ERROR
[imz на altair test-mosquito]$ ls error/
trilinos10-11.12.1-alt2
[imz на altair test-mosquito]$ ls success/
apt-repo-1.3.3-alt1  apt-repo-1.3.5-alt1  gear-2.0.3-alt1  gear-2.0.7-alt1 
less-451-alt1  less-481-alt1
[imz на altair test-mosquito]$


Пока сборка пакета с ним натыкается на то, что shell.req не понимает 
shopt -s extglob, но до того, как можно будет отправить его на сборку в 
Sisyphus, можно будет что-то с этим решить:

/usr/src/tmp/mosquito-hive-buildroot/usr/share/mosquito-hive/rebuild-helper-one.sh: 
line 22: syntax error near unexpected token `('
/usr/src/tmp/mosquito-hive-buildroot/usr/share/mosquito-hive/rebuild-helper-one.sh: 
line 22: `	-*([0-9])) num="${1#-}"; shift;;'
shell.req: ERROR: 
/usr/src/tmp/mosquito-hive-buildroot/usr/share/mosquito-hive/rebuild-helper-one.sh: 
/bin/bash --rpm-requires failed
find-requires: ERROR: /usr/lib/rpm/shell.req failed
error: /bin/sh failed
error: Failed to find Requires

Но можно "установить" как-то так:

git clone http://git.altlinux.org/people/imz/public/mosquito-hive.git
ln -svT mosquito-hive/rebuild-helper-one.sh mosquito-rebuild-helper-one
ln -svT mosquito-hive/rebuild.sh mosquito-rebuild

-- 
Best regards,
Ivan


Подробная информация о списке рассылки Devel