Development/Packaging/BuildSystem/QuickRef

From Mandriva Community Wiki

Jump to: navigation, search
Buildsystem Quick Reference Guide

Quick commands for day-to-day tasks with the new buildsystem

This page has short explanations that quickly describe how to perform day-to-day activities with the new buildsystem. For a walkthrough of the new system, please see Repository System Quickstart.

Contents


General notes:

  • $COOKER: svn+ssh://svn.mandriva.com/svn/packages/cooker
  • $MDV2007: svn+ssh://svn.mandriva.com/svn/packages/updates/2007.0
  • The mdvsys examples need the perl-MDV-Repsys package to be installed and /etc/repsys.conf to be configured with the appropriate URLs. The defaults should be fine for cooker.
  • For all mdvsys or repsys invocations, usage of a properly configured ssh-agent is mandatory.
  • In all cases, if a URL is not specified, the one from the default_parent parameter in /etc/repsys.conf is used. Even for mdvsys.
Action Command
checkout svn co [-r revision] <url/packagename/current> [localdir]
add svn add <file>
delete svn del <file>
sync mdvsys sync [path]
build bm -l
build in a chroot sudo iurt [--shell] package.src.rpm
status svn status [-v] [path]
diff svn diff [path]
update svn up [path]
commit svn commit [path] [-m commit-message]
log mdvsys log [path]
upload mdvsys [-r revision] submit <packagename>
import mdvsys import <src.rpm> [src.rpm ...]

[edit] Checkout

Syntax:

* cmd|svn co [-r revision] <url/packagename/current> [localdir]
* mdvsys [-r revision] co <package>

This command is used to download the SOURCES and SPECS directory of a given package into a local directory where you can then build it, change it and commit back your changes.

Examples:

  • svn co $COOKER/krb5/current krb5: will extract current krb5 package into the local krb5 directory;
  • svn co $COOKER/krb5/current -r 63201 krb5-r63201: will extract krb5 at revision 63201 into the local krb5-r63201 directory
  • mdvsys co krb5: will extract krb5 to the local krb5 directory
  • svn co $MDV2007/openssh/current openssh: will extract openssh from 2007 updates into the local openssh directory

NOTE: currently (Nov/2007), the security team is not using SVN for storing updates. This means that whenever an update is triggered by them, SVN will not be touched. So whatever changes they made to the packages have to be merged back into svn by someone else (the maintainer, probably).

[edit] Add file(s)

Syntax: svn add <file>

This command is used to add a new file to a package. Note that the file is only scheduled for inclusion: the actual upload will happen in the next commit.

Examples:

  • svn add foo-1.2.tar.bz2

[edit] Delete file(s)

Syntax: svn del <file>

This command is used to mark a file for deletion. As with the add command, the file is only excluded from the repository in the next commit.

Examples:

  • svn del foo-1.2.tar.bz2

Notes:

  • the file is removed from the local filesystem right after the svn del command. If you want it back, you can use svn revert <file>

[edit] 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

[edit] 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

[edit] 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.

[edit] 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

[edit] 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

[edit] 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).

[edit] 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.

[edit] 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 [email protected].

[edit] 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
Personal tools