Git.alt reference: Difference between revisions

From ALT Linux Wiki
m (Fixed the structure)
 
(3 intermediate revisions by 3 users not shown)
Line 40: Line 40:
  $ git config --global user.name "Mikhail Gusarov"
  $ git config --global user.name "Mikhail Gusarov"


The list of available commands is displayed, when you login to SSH without commands or with <tt>help</tt> command:
The list of available commands is displayed, when you login to SSH with <tt>help</tt> command:


  $ ssh git.alt help
  $ ssh git.alt help
Line 121: Line 121:
This command clones a repository, i.e. makes a copy of a repository in the specified directory (or in <tt>packages/</tt> directory, if none specified) so that you can start hacking on it.
This command clones a repository, i.e. makes a copy of a repository in the specified directory (or in <tt>packages/</tt> directory, if none specified) so that you can start hacking on it.


  $ ssh git.alt clone /people/ldv/glibc.git
  $ ssh git.alt clone /people/ldv/packages/glibc.git
  Initialized empty Git repository in /people/dottedmag/packages/glibc.git/
  Initialized empty Git repository in /people/dottedmag/packages/glibc.git/
  $
  $
Line 127: Line 127:
You can also specify a repository name instead of just a destination directory as the second parameter:
You can also specify a repository name instead of just a destination directory as the second parameter:


  $ ssh git.alt clone /people/ldv/glibc.git public
  $ ssh git.alt clone /people/ldv/packages/glibc.git public
  Initialized empty Git repository in /people/dottedmag/public/glibc.git/
  Initialized empty Git repository in /people/dottedmag/public/glibc.git/
  $ ssh git.alt clone /people/ldv/glibc.git public/test
  $ ssh git.alt clone /people/ldv/packages/glibc.git public/test
  Initialized empty Git repository in /people/dottedmag/public/test.git/
  Initialized empty Git repository in /people/dottedmag/public/test.git/
  $
  $
Line 182: Line 182:
<!--''Смотри [[ACL]] для общей информации об ACL пакетов в Sisyphus.''-->
<!--''Смотри [[ACL]] для общей информации об ACL пакетов в Sisyphus.''-->


The first parameter of <tt>acl</tt> command should be a package repository (do not confuse with a git repository), ACLs of which are managed. At the moment there is the only possible value of this parameter, and it is <tt>sisyphus</tt>.
The first parameter of <tt>acl</tt> command should be a binary package repository (do not confuse with a git repository), ACLs of which are managed. At the moment there is the only possible value of this parameter, and it is <tt>sisyphus</tt>.


If there is no subcommand after <tt>acl <repository></tt> in the command-line, then subcommands are expected on standard input, one subcommand per line, with EOF (Control-D) terminating the list. The list of subcommands obtained this way is executed as a transaction, i.e. an error in one subcommand cancels the whole bundle.
If there is no subcommand after <tt>acl <repository></tt> in the command-line, then subcommands are expected on standard input, one subcommand per line, with EOF (Control-D) terminating the list. The list of subcommands obtained this way is executed as a transaction, i.e. an error in one subcommand cancels the whole bundle.
Line 206: Line 206:
Displays members of the specified maintainers group.
Displays members of the specified maintainers group.


  $ ssh git.alt acl sisyhpus @python show
  $ ssh git.alt acl sisyphus @python show
  @python        ns ldv george akhavr bga lav swi at hiddenman sin mithraen kas
  @python        ns ldv george akhavr bga lav swi at hiddenman sin mithraen kas


Line 266: Line 266:
* '''end date''' — unixtime, until which NMU is allowed. Omitted parameter means "forever".
* '''end date''' — unixtime, until which NMU is allowed. Omitted parameter means "forever".


NMU denial needs a login; <tt>del *</tt> won't deny all NMUs that were allowed for the package. From the other hand, <tt>del user</tt> denies all NMUs, that were allowed for the specified user.
NMU denial needs a login as a parameter; <tt>del *</tt> won't deny all NMUs that were allowed for the package. From the other hand, <tt>del user</tt> denies all NMUs, that were allowed for the specified user.


  '''$ ssh git.alt acl <binary repository> <package> nmu show'''
  '''$ ssh git.alt acl <binary repository> <package> nmu show'''
Line 273: Line 273:


0 in ''end date'' means "forever".
0 in ''end date'' means "forever".
=== Building packages with [[gear]] ===
Building packages is performed in ''tasks''. A user creates a task and specifies packages that should be built in one transaction. After that the user queues the task for execution. Tasks are executed asynchronously. After successful or unsuccessful completion, a report is sent to the user by e-mail.
==== task ====
In all commands, omitted <task_id> means the latest user's task; omitted <binary repository name> means <tt>sisyphus</tt>.
'''$ ssh git.alt task ls [--all]'''
Displays the current list of all user's tasks, with their status and short summary.<br />
With <tt>--all</tt> parameter, shows the list of all users' tasks.
'''$ ssh git.alt task show [<task_id>]'''
Displays contents of the specified task.
'''$ ssh git.alt task new [<binary_repository_name>]'''
Creates a new empty task for building or copying packages.<br />
The list of allowed binary repository identifiers can be obtained with <tt>task new --help</tt>.<br />
'''$ ssh git.alt task add [<task_id>] repo <gear_repo> <gear_tag>'''
Adds a package for building to the task with <task_id>.<br />
The package is identified by two mandatory parameters: path to gear repository of the package and git tag that specifies a certain snapshot in this repository.
'''$ ssh git.alt task add [<task_id>] copy <package> [<binary_repository_name>]'''
Adds to the task with <task_id> a package for copying from the binary repository specified in the command to the repository of the task (the one that was specified in <tt>task new</tt> command).
'''$ ssh git.alt task add [<task_id>] del <package>'''
Adds to the task a package for deletion from the binary repository of the task.
'''$ ssh git.alt task delsub <task_id> <subtask_id>'''
Removes a subtask (created with <tt>task add</tt>) from the task. Note that all parameters are mandatory.
'''$ ssh git.alt task run [<task_id>]'''
Queues the task for execution. Unlike all other commands, this one is asynchronous.
'''$ ssh git.alt task share [<task_id>] <status|enabled|disabled>'''
Displays/Alters the access mode for the task.<br />
A task with ''share enabled'' access can be filled with subtasks by other users (by means of <tt>task add</tt> command). The default access mode for all tasks is ''share disabled''.<br />
'''$ ssh git.alt task approve <task_id> <subtask_id>'''
Approves a subtask with the specified number. Note that all parameters are mandatory.<br />
This command is used to allow building packages by users who normally don't have the rights for that (non-maintainer uploads, [[NMU]]).
'''$ ssh git.alt task rm [<task_id>]'''
Deletes the task along with its subtasks.
An example of a building session follows:
$ ssh git.alt task ls
girar-task ls: no tasks for ldv
$ ssh git.alt task new
1234
new task #1234: owner=ldv repo=sisyphus
$ ssh git.alt task ls
#1234 NEW sisyphus
$ ssh git.alt task show
id=1234 locked=no shared=no repo=sisyphus owner=ldv seq= rc=
$ ssh git.alt task add repo vitmp 1.0-alt4
task #1234: added #1 build tag 1.0-alt4 from /people/ldv/packages/vitmp.git
$ ssh git.alt task show
id=1234 locked=no shared=no repo=sisyphus owner=ldv seq= rc=
  1:dir=/people/ldv/packages/vitmp.git
  1:tag_name=1.0-alt4
  1:tag_id=11c24aa6683506efd89b174de8dbea2af1cebf84
  1:tag_author=Dmitry V. Levin (for packages) <ldv@altlinux.org>
  1:userid=ldv
$ ssh git.alt task run
task #1234: try=1 queued, result will be emailed to ldv@altlinux.org
$ ssh git.alt task ls
#1234 AWAITING sisyphus vitmp.git=1.0-alt4
...after some time, which may vary from task to task...
$ ssh git.alt task ls
#1234 BUILDING [locked] sisyphus vitmp.git=1.0-alt4
...after completion...
$ ssh git.alt task ls
#1234 DONE sisyphus vitmp.git=1.0-alt4
==== build ====
'''$ ssh git.alt build [-b <binary_repository_name>] <gear_repo_path 1> <gear_tag_name 1> ...'''
This command is a macro for ordinary package building tasks. It creates a task with <tt>task new</tt>, fills it with subtasks with a proper number of <tt>task add</tt> and then invokes a task for execution with <tt>task run</tt>.<br />
<binary repository name> is the repository name for <tt>task new</tt> command.<br />
<gear repo path> and <gear tag name> specify a package (see <tt>task add</tt>).


=== Auxiliary commands ===
=== Auxiliary commands ===

Latest revision as of 14:52, 22 December 2009

Stub.png
Under construction.
This page is not finished yet and may lack substantial information.

This page describes git.alt commands; it is not a manual or a tutorial.

How to use

git.alt provides the following kinds of access to the repositories:

  • SSH. Special commands are provided: repos search, cloning, creation, deletion, build invocation and control, and some auxiliary ones.
  • ssh:, git:, http: and rsync: provide immediate access to repositories. With git:, rsync: and http: you can only do read-only operations, ssh: gives read-write access.
  • Web interface. It is located at git.altlinux.org and provides repos navigation and gitweb for each individual repo.

SSH access to git.alt is only granted to persons who joined ALT Linux Team.

SSH access

You can use git.alt via SSH at git.altlinux.org:222. The login name is your ALT Linux Team username with _ (underscores) instead of - (hyphens), if there are any.

Here is an example of an entry in your ~/.ssh/config file:

Host git.alt
  HostName git.altlinux.org
  Port 222
  User git_USERNAME

If your are behind a proxy, most ports are blocked etc., you can also access SSH with the address git.altlinux.org:443.

To work with git.alt you should setup your git, namely user.name, user.email, and user.signingkey global parameters:

$ git config --global user.signingkey "<Your GPG key ID to sign tags>"
$ git config --global user.email "<your maintainer e-mail>"
$ git config --global user.name "FirstName LastName"

Example:

$ git config --global user.signingkey 0xA26F54C8
$ git config --global user.email dottedmag@altlinux.org
$ git config --global user.name "Mikhail Gusarov"

The list of available commands is displayed, when you login to SSH with help command:

$ ssh git.alt help
Available commands:
help
git-receive-pack <directory>
git-upload-pack <directory>
charset <path to git repository> [<charset>]
clone <path to git repository> [<path to directory>]
find-package <pattern>
init-db <path to directory>
ls [<path to directory>]
mv-db <path to source directory> <path to destination directory>
quota
rm-db <path to git repository>
task {list|new|show|drop|add|run} ...
build <path to gear repository> <tag name> [<binary package repository name>] [<project name>]
acl {--help|<binary package repository name> ...}
$

In all commands, the .git suffix for repositories is optional and may be omitted; but in the output of commands this suffix is always appended.

Managing repositories

ls

$ ssh git.alt ls [<directory>]

Similar to UNIX ls, this command lets you see contents of directories at git.alt:

$ ssh git.alt ls /people/dottedmag/public
total 24
drwxr-sr-x 5 4096 Jun 13 10:22 bugzilla-repo-sync.git
...
drwxr-sr-x 5 4096 Jul  7 18:03 wackoconvert.git
$

The command issued without parameters displays the contents of /people/$USERNAME:

$ ssh git.alt ls
total 16
drwxr-s---  5 4096 May 30 21:27 etc
drwxr-sr-x 14 4096 Aug 13 23:53 packages
drwxr-s--x  2 4096 Feb 13  2007 private
drwxr-sr-x  8 4096 Aug 13 23:57 public
$

The same directory is used as a base for relative paths:

$ ssh git.alt ls public
total 24
drwxr-sr-x 5 4096 Jun 13 10:22 bugzilla-repo-sync.git
...
drwxr-sr-x 5 4096 Jul  7 18:03 wackoconvert.git
$

find-package

$ ssh git.alt find-package <pattern>

This command searches repositories with names matching <pattern>. The only wildcard character allowed in <pattern> is * (asterisk). It is assumed that all public gear-repos are located in packages/ directories of each user, so repos are only searched in these directories.

$ ssh git.alt find-package glibc*
/people/avm/packages/glibc.git	1216320095
...
/people/peet/packages/glibc-kernheaders.git	1177084354
/people/mike/packages/glibc-kvercheck.git	1160664813
$ ssh git.alt find-package glibc
/people/avm/packages/glibc.git	1216320095
...
/people/peet/packages/glibc.git	1177084600
$

The second column in find-package output is a unixtime of the last repo update.

clone

$ ssh git.alt clone <path to git repository> [<destination directory>]

This command clones a repository, i.e. makes a copy of a repository in the specified directory (or in packages/ directory, if none specified) so that you can start hacking on it.

$ ssh git.alt clone /people/ldv/packages/glibc.git
Initialized empty Git repository in /people/dottedmag/packages/glibc.git/
$

You can also specify a repository name instead of just a destination directory as the second parameter:

$ ssh git.alt clone /people/ldv/packages/glibc.git public
Initialized empty Git repository in /people/dottedmag/public/glibc.git/
$ ssh git.alt clone /people/ldv/packages/glibc.git public/test
Initialized empty Git repository in /people/dottedmag/public/test.git/
$

You can also clone a repository from outside git.alt:

$ ssh git.alt clone http://github.com/dottedmag/madshelf.git public
Initialized empty Git repository in /people/dottedmag/packages/public.git/
Getting alternates list for http://github.com/dottedmag/madshelf.git
...
walk 03d18e21d85fa30fc3ac8d921eb391e2a7bb242a
$

init-db

$ ssh git.alt init-db <path to directory>

Creates a new Git repo. By default, the repo is created in packages/ directory.

$ ssh git.alt init-db test
Initialized empty Git repository in ./
girar-init-db:	/people/dottedmag/packages/test.git

You can also pass a path and a name of the repo as the only parameter:

$ ssh git.alt init-db public/test
Initialized empty Git repository in ./
girar-init-db:	/people/dottedmag/public/test.git

mv-db

$ ssh git.alt mv-db <path to source directory> <path to destination directory>

Allows to move and rename repositories. If only a repository name is given (without path), packages/ directory is used.

Moving packages/test.git to public/newname.git:

$ ssh git.alt mv-db test public/newname
$

Moving public/newname.git to packages/test.git:

$ ssh git.alt mv-db public/newname test
$

Renaming packages/test.git to packages/megatest.git:

$ ssh git.alt mv-db test megatest
$

rm-db

$ ssh git.alt rm-db <path to git repository>

Removes a repository. If only a repository name is given (without path), packages/ directory is used:

$ ssh git.alt rm-db megatest # removes packages/megatest.git
$ ssh git.alt rm-db public/test

Managing ACLs

The first parameter of acl command should be a binary package repository (do not confuse with a git repository), ACLs of which are managed. At the moment there is the only possible value of this parameter, and it is sisyphus.

If there is no subcommand after acl <repository> in the command-line, then subcommands are expected on standard input, one subcommand per line, with EOF (Control-D) terminating the list. The list of subcommands obtained this way is executed as a transaction, i.e. an error in one subcommand cancels the whole bundle.

$ ssh git.alt acl sisyphus keyjnote
girar-acl: Go ahead and type your commands
keyjnote add peet
keyjnote add raorn
^D
girar-acl: 2 command(s) queued
$

Any command that alters the maintainers group or a package ACL, can only be issued by the leader, the maintainer that is the first in the corresponding list of group members or ACL. All such operations are performed asynchronously, the result is sent to the leader's e-mail.

acl show

$ ssh git.alt acl <binary repository> <package> show

Displays the ACL of the specified package.

$ ssh git.alt acl sisyphus bugzilla show
bugzilla       @nobody
$ ssh git.alt acl <binary repository> @<group> show

Displays members of the specified maintainers group.

$ ssh git.alt acl sisyphus @python show
@python        ns ldv george akhavr bga lav swi at hiddenman sin mithraen kas

acl check

$ ssh git.alt acl <binary repository> <package> check

Displays allowed/denied status of the command issuer for the specified package.

$ ssh git.alt acl sisyphus bugzilla check
girar-check-perms: access to bugzilla ALLOWED for ldv: project is orphaned

acl add/del

$ ssh git.alt acl <binary repository> <package> add|del <login>|@<group> ...

Adds/Deletes the specified login or group to/from the specified package ACL.

$ ssh git.alt acl sisyphus keyjnote add damir
girar-acl: 1 command(s) queued
$ ssh git.alt acl sisyphus keyjnote del damir
girar-acl: 1 command(s) queued
$ ssh git.alt acl <binary repository> @<group> add|del <login>|@<group> ...

Add/Delete members to/from the specified maintainers group.

$ ssh git.alt acl sisyphus ns add @python
girar-acl: 1 command(s) queued
$ ssh git.alt acl sisyphus ns del @python
girar-acl: 1 command(s) queued

acl replace

$ ssh git.alt acl <binary repository> <package>|@<group> replace <login>|@<group> <login>|@<group>

Replaces the former record in the package ACL with the latter one. Example:

$ ssh git.alt acl sisyphus keyjnote replace dottedmag @python

Replaces in the ACL of keyjnote the record dottedmag with @python.

acl leader

$ ssh git.alt acl <binary repository> <package> leader <login>|@<group>

Sets the package leader. When the group is specified as the latest parameter, the leader of this group becomes the leader of the package. The person that is set as a leader may or may not be in the ACL prior to execution of this command.

Example:

$ ssh git.alt acl sisyphus keyjnote leader @python
$ ssh git.alt acl <binary repository> @<group> leader <login>|@<group>

The same as above, but for a maintainers group instead of a package. Again, it is not a pre-requisite for the user that is set as a leader to be in the ACL prior to the operation.

$ ssh git.alt acl sisyphus @python leader ns

acl nmu

$ ssh git.alt acl <binary repository> <package> nmu add|del [<login> [<start date> [<end date>]]]

Allows/Denies a non-maintainer upload (NMU) for the specified package.

Parameters:

  • login — the login allowed to perform a NMU. * or ommission of the parameter means "anybody".
  • start date — unixtime, since which NMU is allowed. Omitted parameter means "from now on".
  • end date — unixtime, until which NMU is allowed. Omitted parameter means "forever".

NMU denial needs a login as a parameter; del * won't deny all NMUs that were allowed for the package. From the other hand, del user denies all NMUs, that were allowed for the specified user.

$ ssh git.alt acl <binary repository> <package> nmu show

Displays the list of allowed NMUs, in the following form:

<package> <login> <start date> <end date>

0 in end date means "forever".

Building packages with gear

Building packages is performed in tasks. A user creates a task and specifies packages that should be built in one transaction. After that the user queues the task for execution. Tasks are executed asynchronously. After successful or unsuccessful completion, a report is sent to the user by e-mail.

task

In all commands, omitted <task_id> means the latest user's task; omitted <binary repository name> means sisyphus.

$ ssh git.alt task ls [--all]

Displays the current list of all user's tasks, with their status and short summary.
With --all parameter, shows the list of all users' tasks.

$ ssh git.alt task show [<task_id>]

Displays contents of the specified task.

$ ssh git.alt task new [<binary_repository_name>]

Creates a new empty task for building or copying packages.
The list of allowed binary repository identifiers can be obtained with task new --help.

$ ssh git.alt task add [<task_id>] repo <gear_repo> <gear_tag>

Adds a package for building to the task with <task_id>.
The package is identified by two mandatory parameters: path to gear repository of the package and git tag that specifies a certain snapshot in this repository.

$ ssh git.alt task add [<task_id>] copy <package> [<binary_repository_name>]

Adds to the task with <task_id> a package for copying from the binary repository specified in the command to the repository of the task (the one that was specified in task new command).

$ ssh git.alt task add [<task_id>] del <package>

Adds to the task a package for deletion from the binary repository of the task.

$ ssh git.alt task delsub <task_id> <subtask_id>

Removes a subtask (created with task add) from the task. Note that all parameters are mandatory.

$ ssh git.alt task run [<task_id>]

Queues the task for execution. Unlike all other commands, this one is asynchronous.

$ ssh git.alt task share [<task_id>] <status|enabled|disabled>

Displays/Alters the access mode for the task.
A task with share enabled access can be filled with subtasks by other users (by means of task add command). The default access mode for all tasks is share disabled.

$ ssh git.alt task approve <task_id> <subtask_id>

Approves a subtask with the specified number. Note that all parameters are mandatory.
This command is used to allow building packages by users who normally don't have the rights for that (non-maintainer uploads, NMU).

$ ssh git.alt task rm [<task_id>]

Deletes the task along with its subtasks.

An example of a building session follows:

$ ssh git.alt task ls
girar-task ls: no tasks for ldv
$ ssh git.alt task new
1234
new task #1234: owner=ldv repo=sisyphus
$ ssh git.alt task ls
#1234 NEW sisyphus
$ ssh git.alt task show
id=1234 locked=no shared=no repo=sisyphus owner=ldv seq= rc=
$ ssh git.alt task add repo vitmp 1.0-alt4
task #1234: added #1 build tag 1.0-alt4 from /people/ldv/packages/vitmp.git
$ ssh git.alt task show
id=1234 locked=no shared=no repo=sisyphus owner=ldv seq= rc=
 1:dir=/people/ldv/packages/vitmp.git
 1:tag_name=1.0-alt4
 1:tag_id=11c24aa6683506efd89b174de8dbea2af1cebf84
 1:tag_author=Dmitry V. Levin (for packages) <ldv@altlinux.org>
 1:userid=ldv
$ ssh git.alt task run
task #1234: try=1 queued, result will be emailed to ldv@altlinux.org
$ ssh git.alt task ls
#1234 AWAITING sisyphus vitmp.git=1.0-alt4

...after some time, which may vary from task to task...

$ ssh git.alt task ls
#1234 BUILDING [locked] sisyphus vitmp.git=1.0-alt4

...after completion...

$ ssh git.alt task ls
#1234 DONE sisyphus vitmp.git=1.0-alt4

build

$ ssh git.alt build [-b <binary_repository_name>] <gear_repo_path 1> <gear_tag_name 1> ...

This command is a macro for ordinary package building tasks. It creates a task with task new, fills it with subtasks with a proper number of task add and then invokes a task for execution with task run.
<binary repository name> is the repository name for task new command.
<gear repo path> and <gear tag name> specify a package (see task add).

Auxiliary commands

charset

$ ssh git.alt charset <path to git repository> [<charset>]

Obtain or set the charset used in files of the specified git-repository. This charset is chosen to display diffs in the notification e-mails sent by git.alt.

$ ssh git.alt charset packages/glibc
utf-8
$ ssh git.alt charset packages/glibc cp1252
$ ssh git.alt charset packages/glibc
cp1252
$

quota

$ ssh git.alt quota

Displays the user's quota and the used space.

$ ssh git.alt quota
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
     /dev/simfs   16932    977M   1465M             555    100k    150k        
$

git-receive-pack, git-upload-pack

These commands are used internally by git-push, git-pull and other utilities. You should not run them explicitly.

Cloning and usage of repositories

Basically, git.alt repos are git-repositories, so any command applicable to a git repo can be used with a git.alt repo.

git.alt repositories can be accessed via the following URLs:

git (r/o)
git://git.altlinux.org/people/$USER/(packages%7Cpublic%7Cprivate)/$PACKAGE.git
rsync (r/o)
git.altlinux.org::people/$USER/(packages|public|private)/$PACKAGE.git
http (r/o)
http://git.altlinux.org/people/$USER/(packages|public|private)/$PACKAGE.git
ssh (r/w)
ssh://git.altlinux.org/people/$USER/(packages%7Cpublic%7Cprivate)/$PACKAGE.git

You can find HTTP- and git-URLs of repos in the git.alt web interface.

Git.alt web interface

The address is http://git.altlinux.org/

The web interface allows to navigate public repos of all users (i.e. /people/$USERNAME/{packages,public} directories) and includes gitweb interface for those repos.

Aside from that, the web interface displays /archive repositories (with no gitweb, you can only clone them) and a file people-packages-list — this file contains all repos from /people/$USERNAME/packages/ directories along with unixtimes of their last change.