Development/Tasks/Packaging/BuildSystem/QuickRef

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

Перейти к: навигация, поиск
На этой странице вы найдёте список часто используемых команд при работе со сборочной системой. Подробнее о сборочной системе см. Repository System Quickstart.

Содержание

Основные примечания:

  • $COOKER: svn+ssh://svn.mandriva.com/svn/packages/cooker
  • $MDV2007: svn+ssh://svn.mandriva.com/svn/packages/updates/2007.0
  • Примеры mdvsys требуют установки пакета perl-MDV-Repsys, а файл /etc/repsys.conf должен быть настроен с соответствующими URL.
  • Для всех вызовов mdvsys и repsys необходимо правильно настроить ssh-agent.
  • Во всех случаях, в которых не указан URL, используется один из параметров default_parent из файла /etc/repsys.conf. Даже для mdvsys.
Действие Команда
checkout svn co [-r ревизия] <url/название_пакета/current> [локальный_каталог]
add svn add <файл>
delete svn del <файл>
sync mdvsys sync [путь]
build bm -l
build in a chroot sudo iurt [--shell] package.src.rpm
status svn status [-v] [путь]
diff svn diff [путь]
update svn up [путь]
commit svn commit [путь] [-m сообщение]
log mdvsys log [путь]
upload mdvsys [-r ревизия] submit <название_пакета>
import mdvsys import <src.rpm> [src.rpm ...]

Checkout

Синтаксис:

* cmd|svn co [-r ревизия] <url/название_пакета/current> [локальный_каталог]
* mdvsys [-r ревизия] co <пакет>

Эта команда использовать для загрузки каталогов пакета SOURCES и SPECS в локальный каталог.

Примеры:

  • svn co $COOKER/krb5/current krb5: извлечь пакет krb5 в локальный каталог krb5;
  • svn co $COOKER/krb5/current -r 63201 krb5-r63201: извлечь пакет krb5 ревизии 63201 в локальный каталог krb5-r63201;
  • mdvsys co krb5: извлечь пакет krb5 в локальный каталог krb5;
  • svn co $MDV2007/openssh/current openssh: извлечь пакет openssh с обновлений 2007 в локальный каталог openssh.

Add file(s)

Синтаксис:

* {{cmd|svn add <файл>}}

Эта команда используется для добавления нового файла в пакет. Причём, после выполнения этой команды файл будет только запланирован для включения, непосредственная загрузка файла произойдёт при следующей фиксации изменений.

Примеры:

  • svn add foo-1.2.tar.bz2

Delete file(s)

Синтаксис:

* {{cmd|svn del <файл>}}

Эта команда используется для удаления файла. Также, как и в случае с командой add, файл будет исключён из репозитория при следующей фиксации изменений.

Примеры:

  • svn del foo-1.2.tar.bz2

Примечания:

  • Файл удаляется из локальной файловой системы с помощью команды svn del. Если вы хотите отменить изменение, воспользуйтесь командой svn revert <файл>

Sync

Syntax: mdvsys sync [path]

This command is used to automatically add ( svn add ) or remove ( svn del ) source files which have been added to or removed from the spec file. The changes are not commited.

Example: mdvsys sync /home/andreas/svn/krb5

Build

Syntax: whatever you prefer

It is not necessary to build a package before uploading it, but it is good practice to make sure it builds. The checkout area of svn has a regular rpm building area, with SOURCES and SPECS directories. So, just enter them and build the package as usual. Here are a few examples, assuming /home/andreas/svn/krb5 is the checkout area and current path:

  • bm -l: uses bm to build the package, generating a log file inside SPECS;
  • rpm -ba --define "_topdir $(pwd)" SPECS/krb5.spec: uses standard rpm to build the package;
  • mdvsys build: uses the perl-MDV-Repsys tool;

bm accepts most rpm parameters. Some other examples:

  • build a .src.rpm without checking for dependencies: bm -l -s --nodeps
  • build binaries for pentium4: bm -l --target pentium4

Build in a chroot

If you want to build in a chroot, you must use Iurt to do so:

  • sudo iurt package.src.rpm to build the package in a cooker chroot.
  • sudo iurt2006 package.src.rpm to build the package in a 2006 chroot.
  • sudo iurt2007 package.src.rpm to build the package in a 2007 chroot.
  • sudo iurt2007 --shell to get a shell in a 2007 clean chroot.
  • sudo iurt2007 --stop p packages.src.rpm to have a shell in a chroot after the rpm -bp stage.

WARNING: chroots are not cleaned automatically, you must perform:

  • sudo iurt2006 --clean to clean your associated chroots.

The chroots are local to the machine where you are performing the command.

Status/diff

Syntax:

* svn status [-v] [path]
* svn diff [path]

This command is used to display the current status of path, which can be a local directory or a URL specifying a remote repository. It is mostly used with local directories, though, to show which changes are not committed yet.

Examples:

* svn status /home/andreas/svn/krb5

Update

Syntax: svn up [localdir]

This command is used to freshen your local copy of a checkout area from a given package. It's important to make sure you always have the latest changes: don't forget someone else may have committed changes to the package besides you.

Examples:

  • svn up: updates the current directory with whatever is in svn
  • svn up /home/andreas/svn/krb5: equivalent to cd /home/andreas/svn/krb5; svn up

Log

Syntax:

  • mdvsys log [path]

This command prints the package changelog that will be generated at final build (from SVN commit logs and old package changelog).

Commit

Syntax:

* svn commit [path] [-m commit-message]
* mdvsys -m commit-message commit [path]

This command is used to commit your work to the repository, i.e., write all your changes. If the commit message is not specified, an $EDITOR will be opened where you can write your commit text. Once the editor is exited, the commit will begin.

Examples:

  • svn commit /home/andreas/svn/krb5
  • svn commit /home/andreas/svn/krb5 -m "- fixed build"
  • mdvsys -m "- fixed build" commit /home/andreas/svn/krb5: similar to the above, but will also make sure the spec file is in sync with the listed sources;

NOTE: mdvsys currently mandates the use of the -m option to specify a commit message.

Upload

Syntax:

* repsys submit [-t target] [url/]<packagename> <revision>
* mdvsys [-r revision] submit <packagename>

This command is used to make a new package available to the distro users. When it is executed, a build bot will take care of building the binaries from the source and, if the build was successful, upload it to the mirrors. If there was an error, an email is sent to the uploader.

Examples:

  • repsys submit krb5 63201: will upload krb5 revision 63201 from cooker into cooker
  • repsys submit $COOKER/krb5 63201: will upload revision 63201 from the $COOKER url into cooker
  • repsys submit -t 2007.0 --define section=main/testing $MDV2007/opensc 63500: uploads opensc revision 63500 from $MDV2007 url into 2007.0 distro main/testing repository
  • mdvsys submit krb5: will upload the latest revision of krb5 from cooker into cooker
  • mdvsys -r 63000 submit krb5: will upload revision 63000 of krb5 from cooker into cooker

Careful: make sure you are submitting the right package to the right target. For example, the following is probably NOT what you want because it will upload a cooker package to 2007.0:

repsys submit -t 2007.0 --define section=main/testing krb5 63201

Notes:

  • these commands can be run from anywhere where there is access to the SVN server via ssh. For example, your own workstation that doesn't even need to be running cooker;
  • there is no need to build or fetch a .src.rpm file before uploading: this command does not upload any local file. Think of it as a phone call: "Hey, buildsystem, please upload for me the krb5 package at revision 63201, thanks.";
  • the revision number at the end of the command corresponds to the revision of the package you want to upload. If you don't remember this number, just change into the rpm directory where the package is extracted and issue svn up; svn log | head and look for it.

Important: if you get submission errors, please contact distrib-admin@mandrivalinux.org.

Import package(s)

Syntax: mdvsys import <src.rpm> [src.rpm ...]

This command is used to import one or more new package into svn.

Examples:

  • mdvsys import /mdk/SRPMS/media/main/recode-3.6-12mdv2007.1.src.rpm: will import a single package
  • mdvsys import /build/testing/SRPMS/*.src.rpm: will import all matched packages
На других языках