Difference between revisions of "ABF Console Client"

From Rosalab Wiki
Jump to: navigation, search
Line 121: Line 121:
  
 
Options:
 
Options:
 +
''abf build [--project <project>] [--branch <branch>] [--tag <tag>] [--commit <commit>] [--save-to-repository <repository>] [--repository <repository>] [--arch <arch>] [--auto-publish] [--update-type <type>] [--skip-spec-check]''
  
 
* '''-p/--project <project>''':  project name ([group/]project). If the option is not specified and you are in a git repository directory - a project name will be resolved automatically.
 
* '''-p/--project <project>''':  project name ([group/]project). If the option is not specified and you are in a git repository directory - a project name will be resolved automatically.
Line 161: Line 162:
  
 
==mock-urpm==
 
==mock-urpm==
Build a project locally using mock-urpm.
+
Build a project locally using mock-urpm. No checkouts will be made, the current git repository state will be used.
 +
 
 +
'''Options:'''
 +
 
 +
''abf mock-urpm [-c <config>]''
 +
* '''-c/--config <config>''': A config template to use. Specify one of the config names from /etc/abf/mock-urpm/configs/. Directory path and extension (".cfg") should be omitted. If no config specified, "default.cfg" will be used. Autocompletion worsk for config names.
 +
 
 +
'''Notes:'''
 +
* Be careful, "abf fetch" will be called before building a package. It means that if you have modified tarball, but .abf.yml contains a hash of an old one - your tarball will be replaced by downloaded from server.
 +
* Building root can be found in /var/lib/abf/mock-urpm.
 +
 
 
==rpmbuild==
 
==rpmbuild==
Build a project locally using rpmbuild.
+
Build a project locally using rpmbuild. No checkouts will be made, the current git repository state will be used.
 +
 
 +
'''Options:'''
 +
 
 +
''abf mock-urpm [-c <config>]''
 +
* '''-c/--config <config>''': A config template to use. Specify one of the config names from /etc/abf/mock-urpm/configs/. Directory path and extension (".cfg") should be omitted. If no config specified, "default.cfg" will be used. Autocompletion worsk for config names.
 +
 
 +
'''Notes:'''
 +
* Be careful, "abf fetch" will be called before building a package. It means that if you have modified tarball, but .abf.yml contains a hash of an old one - your tarball will be replaced by downloaded from server.
 +
* Building root can be found in /var/lib/abf/mock-urpm.
 +
 
 
==publish==
 
==publish==
 
Publish the task that have already been built.
 
Publish the task that have already been built.
 +
 +
'''Options:'''
 +
 +
''abf publish <task_id> [<task_id>] [...]
 +
* '''<task_id>''': ID of a build list to publish.
 +
 +
 
==copy==
 
==copy==
 
==status==
 
==status==

Revision as of 13:07, 12 April 2013

Intro

Command List

help

If you want to get a help for some command - you've got two options: abf help <command> and abf <command> -h/--help

Options:

abf hel <command_name>

  • <command_name>: A command to get help for.

alias

Manage aliases for console client. With aliases you can make your frequently used commands shorter.

For example, you are going to work only with packages for rosa2012.1, you have to checkout to this branch after every "abf get" (or use -b rosa2012.1). But you can just add an alias like "g: get -b rosa2012.1" and after that "abf g" will do it automatically.

Moreover, the alias name can be not only the first abf argument. For example, you can create another useful alias like "pack: rosa2012.1 build_branch -p" and run "abf copy pack" to copy contents of rosa2012.1 branch to build_branch and compress it.

Options:

abf alias <action> param1 [param2] [...]

  • <action>: One of actions: list, add, remove.

list

List all the currently available aliases. By default this list looks like

        b: build
       sp: search projects
       su: search users
       st: status
        s: store
      spl: search platforms
       sg: search groups

add

Add a new alias. the first argument is an alias name, all the arguments after that are alias target. For example, abf alias add sg search groups will срфтпу every call of "abf sg rosa" to "abf search groups rosa".

remove

Remove an alias. The only option is an alias name.

get

Clone a remote git repository by its group and name. For example, abf get import/gcc will clone a project gcc from group import.

Options:

abf get <project> [--branch <branch_name>]

  • <project>: a project to clone.
  • -b/--branch <branch_name>: specify a branch to check out inside a cloned git pepository.

Notes:

You can omit a group name, your default group (given from configs) will be used.

put

Upload binary files to File-Store and update (or create) .abf.yml file. Can also commit and push changes.

Options:

abf put [--message <message>] [--minimal-file-size <size>] [--do-not-remove-files]

  • -m/--message <message>: With this option specified, "git add --all", "git commit -m <message>" and "git push" will be executed.
  • -s/--minimal-file-size <size>: The minimal file size to upload to File-Store. Smaller files will not be processed. Default is 0B.
  • -n/--do-not-remove-files: By default files are being removed on uploading. Override this behavior.

store

Upload a given file to File-Store. Prints a sha1 hash or error message (with non-zero return code).

If the file with same hash already presents on File-Store, it will not be reuploaded. In any case, file hash will be printed.

Options: abf store <path>

  • <path>: A path to file to upload.


fetch

Download all the files listed in .abf.yml from File-Store to local directory.

Options:

abf fetch [--only <file_name>]

  • -o/--only <file_name>: Limit the list of downloaded files to this file name(s). This option can be specified more than once.

show

Show some general information about the project. Bash autocomplete uses it. If you are in a git repository directory, command will show information about this project (unless -p/--project specified).

Options:

abf show <target> [--project <project_name>]

  • <target>: What has to be displayed. Available choices: build-repos, build-platforms, save-to-repos, save-to-platforms
  • -p/--project <project_name>: Project to show information about. If you are in a git repository, the information for <project_name> will be displayed instead.

Notes:

Repository name includes its platform name. Example of repository name: "rosa2012.1/main" - repository "main" of "rosa2012.1" platform.

Build repository - repository that you can connect to a building chroot.

Target (or save-to) repository - when a build task completed successfully, packages can be published to this repository.

locate

Command to maintain a database of local projects.

Console client tends to maintain a database of local projects: while any interaction with your local git repository via abf-console-client, it stores the path to this repository. After that you can call abfcd [<project_group>/]<project_name> (omit group_name to use your default) to change your current working directory to the project's path (if it had been stored before). If you just want to get a project path without changing directory, use abf locate -p <project>.

You can also add projects to this database by manually. To add only one project call abf locate update -d /path/to/project. To scan directory recursively and add all the found projects, call abf locale update-recursive -d /path/to/directory.


Options:

abf locate [<action>] [--project <project>] [--directory <directory>]

  • <action>: one of {update, update-recursive}. update will update
  • -p/--project <project>: Project to show information for (if needed). Format: "[group/]name". If no group specified, your default group will be used.
  • -d/--directory <directory>: Directory to update locations for. It should be a git repository for "update" and any directory for "update-recursive". If not specified - the current directory will be used.


build

Initiate a build task on ABF. There are lots of options, but in most cases it works great with no options at all. abf-console-client tries to automatically resolve all the options needed. How does it work: read notes and examples.


Options: abf build [--project <project>] [--branch <branch>] [--tag <tag>] [--commit <commit>] [--save-to-repository <repository>] [--repository <repository>] [--arch <arch>] [--auto-publish] [--update-type <type>] [--skip-spec-check]

  • -p/--project <project>: project name ([group/]project). If the option is not specified and you are in a git repository directory - a project name will be resolved automatically.
  • -b/--branch <branch>: git branch name to build. Read notes.
  • -t/--tag <tag>: git tag to build. Read notes.
  • -c/--commit <commit>: git commit sha hash to build. Read notes.
  • -s/--save-to-repository <repository>: repository to save results to. If no platform part specified, it is assumed to be "<default_group>_personal". If this option is not specified at all and you are in a git repository, it will be resolved automatically (read notes).
  • -r/--repository <repository>: repositories to build with. Can be set more than once. If no platform part specified, it is assumed to be your "<default_build_platform>". If no repositories were specified at all, it will be resolved automatically (read notes).
  • -a/--arch <arch>: architectures to build for. Can be set more than once. If not set - use all the available architectures for the project given.
  • --auto-publish: Enable automatic publishing.
  • --update-type <type>: Update type, one of {security, bugfix, enhancement, recommended, newpackage}. Default is "security".
  • --skip-spec-check: Do not check spec file.

Notes:

Console client tries to automatically resolve all the options without taking into account anything except --branch. If it fails - use only user-given options. If succeeds, but user specified other parameters - discard everything we've resolved and use only user-given options.

Git hash resolving:

  • Only one of --branch, --tag or --commit options can be used at once.
  • If you've specified commit hash - it will be used "as is".
  • If you've specified branch or tag name - commit hash will be resolved automatically using ABF API. (the hash of top commit in the branch will be used for branch)
  • If you've specified a project name - you have to specify a branch, tag or commit manually.
  • If you've specified no branch, tag or commit hash and you've not specified a project name (you have to be in a git repository) - the top remote commit of your current branch will be used.

Other options resolving:

  • if no --arch specified, use all the available project architectures.
  • build repository can usually be resolved from a git branch name. If there is a build platform with the name of your current git branch exists - it will be used.
  • save-to repository: if some repository from a build platform can be used as save-to repository - it will be used.

You can execute abf build (with no options) when you've specified a branch name (or it's resolved automatically) and there is a platform on ABF having the same name. In this case a save-to repository will be selected from a list of available save-to repositories for this platform. Build repositories are repositories of this platform too("main" and one another repository if needed for selected save-to repository).

Examples:

  • Build a current branch of a local cloned project. Build and save-to repositories can be resolved from branch name: abf build
  • Build a project without a local git repository. Build and save-to repositories can be resolved from branch name: abf build --project import/gcc --branch rosa2012.1
  • Build a project to another platform: abf build --project import/gcc --branch rosa2012.1 --save-to-repository rosa2012lts/contrib. Build repositories will be rosa2012lts/main and rosa2012lts/contrib.


mock-urpm

Build a project locally using mock-urpm. No checkouts will be made, the current git repository state will be used.

Options:

abf mock-urpm [-c <config>]

  • -c/--config <config>: A config template to use. Specify one of the config names from /etc/abf/mock-urpm/configs/. Directory path and extension (".cfg") should be omitted. If no config specified, "default.cfg" will be used. Autocompletion worsk for config names.

Notes:

  • Be careful, "abf fetch" will be called before building a package. It means that if you have modified tarball, but .abf.yml contains a hash of an old one - your tarball will be replaced by downloaded from server.
  • Building root can be found in /var/lib/abf/mock-urpm.

rpmbuild

Build a project locally using rpmbuild. No checkouts will be made, the current git repository state will be used.

Options:

abf mock-urpm [-c <config>]

  • -c/--config <config>: A config template to use. Specify one of the config names from /etc/abf/mock-urpm/configs/. Directory path and extension (".cfg") should be omitted. If no config specified, "default.cfg" will be used. Autocompletion worsk for config names.

Notes:

  • Be careful, "abf fetch" will be called before building a package. It means that if you have modified tarball, but .abf.yml contains a hash of an old one - your tarball will be replaced by downloaded from server.
  • Building root can be found in /var/lib/abf/mock-urpm.

publish

Publish the task that have already been built.

Options:

abf publish <task_id> [<task_id>] [...]

  • <task_id>: ID of a build list to publish.


copy

status

clean

Analyze spec file and show missing and unnecessary files from the current git repository directory.

search

test