mgarepo man page

mgarepo — Package sources repository management tool

Synopsis

mgarepo command [options] [arguments]

Description

mgarepo is the tool used to manage RPM packages in a subversion repository. It is used to create, tag releases, generate .src.rpm, generate changelog, and request new package releases for build. It mostly acts as a interface to svn(1) commands and small task scripts run on the build system side over ssh(1).

Most of the mgarepo commands operate on a given package URL, these URLs can be omitted when the configuration option repository is set.

Detailed help on commands is available running mgarepo <command> --help.

Basic Usage

Setup

mgarepo does not handle the authentication interface used by svn. So it is usually required to setup ssh-agent(1) if the repository access method is over SSH (svn+ssh:// URLs), or performing some simple operation in order to obtain a authentication token.

For more information related how to setup ssh-agent, see:
https://wiki.mageia.org/en/Packagers_ssh

Users that don't have an ssh account in the default repository URL can set the option mirror pointing to a non-authenticated, read-only repository (such as svn://svn.mageia.org/svn/packages).

Examples

mgarepo co foo

Obtains a working copy of the package foo.

mgarepo co 1/mutt

Obtains a working copy of the package mutt of from the 1 branch.

mgarepo co hplip -k 5

Obtains a working copy of the package hplib of from the 5 branch and backport directory.

mgarepo ci

Commits pending changes in the working copy.

mgarepo submit foo -r 12345

Requests the package foo in the revision 12345 to be built and, if successful, to be uploaded to the RPMs repository.

mgarepo submit foo -r 12345 -t 1 --define section=core/testing

Will submit the package foo and, upon successful build will have its RPMs placed inside the core/testing media of the 1 repository.

mgarepo submit

submit run without parameters will use package name and revision found in the working copy in the current directory.

mgarepo obsolete foo

Move the package foo from cauldron/foo to obsolete/foo on svn.

Commands

For detailed help on commands run mgarepo <command> --help.

co

checkout a package

ci

commit changes

submit

submit a package in a given revision for build and release

sync

add-remove all file changes from the .spec

maintdb

get/set package maintainers informations

putsrpm

import a source package to the repository

getspec

print the spec

rpmlog

print the RPM changelog generated from SVN

getsrpm

create the source RPM

create

create the structure of a new package

changed

show changes not submitted

authoremail

print the e-mail of a given svn author

switch

relocate to mirror or upstream repository

markrelease

create a tag for a given package revision and version

upload

add a file to binrepo

del

remove a file from binrepo

up

update the working copy and synchronize all binaries

obsolete

move a package in obsolete directory

Repository Layout

A detailed description can be found at:
http://wiki.mandriva.com/en/Development/Packaging/RepositorySystem

The svn repository used by mgarepo consists of a set of branches in the top directory, followed by package directories having the internal package structure.

The internal package layout contains a directory current/, which contains the latest version of the package (equivalent to "trunk" in software repositories). The directory releases/ contain copies of older submitted packages that have been already released, it is organized in the <version>/<release> format (equivalent to "tags" directories).

URLs used in mgarepo commands refer to the package directory, and never to current. In other words, the http://host/svn/cauldron/foo is valid, whereas http://host/svn/cauldron/foo/current is not.

One example layout:

/packages/cauldron
    |
    +- cauldron/
    |  ...
    |  +- rsync/
    |  +- coreutils/
    |  +- make/
    |  +- foo/
    |     +- current/
    |     |  +- SOURCES/
    |     |  +- SPECS/
    |     +- releases/
    |        ...
    |        +- 1.0
    |           +- 1.mga1/
    |              +- SOURCES/
    |              +- SPECS/
    |           +- 2.mga1/
    |           ...
    +- updates/
       +- 1/
       +- 2/
       +- 3/

Setting up a repository

The minimal setup is accomplished with a Subversion repository having three directories: cauldron/, misc/ and updates/. The name of this directories can be changed using the configuration options trunk-dir and branches-dir. Having this you can start importing packages with mgarepo import.

Configuration

Introduction

The main configuration file is /etc/mgarepo.conf, it is in the .ini format. It is basically defined by a set of [name] sections, with a set of variables defined by name = value.

If existing, the file ~/.mgarepo/config is also loaded.

[global] section

repository = URL

Contains the base URL used to access packages in the svn repository when only package names are used in mgarepo commands. For example, if mgarepo co trafshow is run and repository is http://host/svn/, the URL http://host/svn/cauldron/trafshow will be used ("cauldron" is the default branch).

default_parent = URL

Points to the base URL of the development branch of the svn repository. This option is deprecated as it has been replaced by "repository".

mirror = URL

The URL of an alternative and read-only repository to be used when checking out packages. mgarepo ci will automatically relocate to "repository" when comitting.

use-mirror = yes/no

Disable the use of the mirror repository when checking out packages.

url-map = MATCH-REGEXP REPLACE-EXPR

This option is used on server-side to remap remote URLs brought by the user when running mgarepo submit to local (and probably faster) URLs. MATCH-REGEXP is a Python regular expression matching the components that must be reused in the local URL. REPLACE-EXPR is a replace expression that should expand in the final URL. Example: svn+ssh://svn.mageia.org/(.*) file:///1

tempdir = PATH

The directory to be used as base for temporay directories and files created by mgarepo.

download-command = COMMAND-FMT

Command used to download generic remote URLs, it accepts the variables $url and $dest. It is currently used when running mgarepo sync -d.

svn-command = COMMAND

The base command used to execute svn(1). Runs through system(3).

svn-env = VAR=VALUE ..

The environment variables to use when running svn. More entries can be defined by using more lines. The variable defined by default is SVN_SSH, which points to the mgarepo-ssh ssh wrapper.

verbose = yes/no

Increase the verbosity of mgarepo output, printing commands being run and complete traceback when unhanlded errors happen.

trunk-dir

Points to the default branch of the distro used in commands that do not have their branch or URL specified.

branches-dir

The directory inside the repository which contains all the branches of the distro. It is used to build the URL of packages referred using the branch notation BRANCH/PACKAGE, as in mgarepo co 1/mutt.

[submit-groups] section

This section contains aliases to groups of packages to be submitted at once. For example, a line with my-python-packages = bzr bzrtools bzr-gtk would allow the user to simply run mgarepo submit my-python-packages.

Also distro branches or revision numbers can be specified for each package group. For example: mgarepo submit 1/my-python-packages.

[submit] section

host = HOST

Defines the default host in which mgarepo submit will run the submit helper.

default = TARGET

The default target to be used in mgarepo submit when the option -t is not used.

[submit TARGET] sections (server-side only)

These sections describe each one of the sections available to submit packages, ther configuration options are:

target = PATH

The path where SRPMs generated by create-srpm- will be placed during during the submit process.

allowed = URLs

A space-delimited list of package URLs that will be allowed to be used with this target. The comparison is done by checking if the package URL used in submit starts with one of the URLs of this option.

scripts = PATHS

A space-delimited list of scripts that will be run receiving the generated SRPM as first argument. These scripts are usually used to perform small changes in the SRPM structure, increasing release number for example.

rpm-macros = NAMES

It points to sections in the configuration that will contain the RPM macros used when generating the SRPM of the package being submitted. These section should be named in the [macros NAME] format.

[macros NAME] sections (server-side only)

These sections contain variables that will be defined as RPM macros when generating the SRPM of the package being submitted.It is usually used to define the distribution suffix that will be used in package releases, such as "mga1".

[users] section (server-side only)

This section maps the usernames found in svn to their real names and e-mails. It is used when generating the changelog based on commits in svn and by authoremail. Example: joe = Joe User <joeuser@host.com>.

This section can be used on client-side too, but will have no effect in generated changelogs on the server-side.

[helper] section

create-srpm = PATH

The path of the script that will be run through ssh on the submit host when running mgarepo submit.

upload-srpm = PATH

(server-side only) Path of the script that will be called after the generated SRPM is copied to its target location (see target sections above) and target scripts are run.

rpmbuild = COMMAND

The command used to call rpmbuild. Note that build options (such as -bs) are supplied by mgarepo.

[log] section

oldurl = URL

The URL of a directory structure that will contain old changelogs of packages that will be appended to the changelog being generated by rpmlog or getsrpm -l.

merge-spec = yes/no

If enabled, changelogs generated by mgarepo will have the contents of the %changelog found in the .spec file of the package appended.

sort = yes/no

If enabled, the changelog will be resorted after its generation. It is useful when changelogs found in oldurl or in the .spec's %changelog section are newer than those generated by SVN.

revision-offset = REVISION-NUMBER

The base revision used to generated changelogs. As in svn log -r REVISION-OFFSET:HEAD URL.

ignore-string = STRING

Mark used to hide log messages. When it appears at the beginning of the log message, the whole changeset log is hidden. When it is found in the middle of a string, only the line will not be shown.

unignore-string = STRING

The complement of the previous option. When this token is found, only those lines containg this mark will be shown. It is intended to be used in very long log messages.

[template] section

path = PATH

Obsolete. The path of the template used to generate the changelog from svn commits.

name = NAME

The name of the template used to generate the changelog from svn commits. Use default or revno.

[srpm] section

run-prep = yes/no

Repsys can check for the presence of a file named Makefile in the top directory of the package and run make prep-srpm so that it can generate the actual files that must be distributed in in the srpm. This option enables this feature. (Note: the command is expected to run in an restricted environment, the Makefile must use only minimal funcionalities.)

Environment Variables

REPSYS_CONF

Sets the configuration file to be read by mgarepo

Files

~/.mgarepo/config
/etc/mgarepo.conf
/usr/share/mgarepo/
/usr/share/doc/mgarepo/

Bugs

See the list of bugs at http://bugs.mageia.org/buglist.cgi?quicksearch=mgarepo

See Also

mdvsys(1), svn(1), ssh-agent(1)

https://wiki.mageia.org/en/Packagers_svn
https://wiki.mageia.org/en/Mgarepo

Author

repsys was originally written by Gustavo Niemeyer <gustavo@niemeyer.net>
for the Conectiva Linux distribution. It was then maintained by Mandriva
contributors and employees. mgarepo is a fork of repsys maintained by
Mageia contributors.

Info

2011 Jan 11 Mageia