mirror of https://github.com/openSUSE/osc.git synced 2024-07-21 14:46:12 +02:00
The Command Line Interface to work with an Open Build Service
Go to file
2024-07-15 14:54:19 +02:00
.github Fix tests so they don't modify fixtures 2024-06-25 08:48:45 +02:00
behave Change 'repairwc' command to always run all repair steps 2024-07-04 22:09:24 +02:00
contrib release 1.8.3 2024-07-08 09:11:02 +02:00
doc Document loading configuration from env variables 2024-05-07 16:40:35 +02:00
osc Introduce build --checks parameter 2024-07-15 13:37:34 +02:00
tests Make most of the fields in KeyinfoPubkey and KeyinfoSslcert models optional 2024-07-04 14:24:52 +02:00
.gitattributes Configure Read the Docs 2022-10-13 09:50:46 +02:00
.gitignore Update .gitignore based on a GitHub template 2022-08-12 14:23:00 +02:00
.readthedocs.yaml RTD: Bump ubuntu to 22.04 and python to 3.11 2023-09-11 21:14:47 +02:00
AUTHORS Update AUTHORS: change my last name 2023-09-12 09:15:28 +02:00
COPYING COPYING: Use the latest version from gnu.org 2022-01-27 10:06:03 +01:00
MANIFEST.in Rename README to README.md in MANIFEST.in 2022-08-24 10:06:17 +02:00
NEWS release 1.8.3 2024-07-08 09:11:02 +02:00
osc-wrapper.py Replace osc-wrapper.py with entry_points. 2022-07-28 09:46:34 +02:00
README.md spell openSUSE correctly 2023-06-01 20:48:02 +02:00
setup.cfg Move core.File to obs_scm.File 2024-04-15 13:56:56 +02:00
setup.py Move python package metadata from setup.py to setup.cfg 2022-08-24 10:05:49 +02:00

unit tests docs codecov code climate contributors

openSUSE Commander

openSUSE Commander (osc) is a command-line interface to the Open Build Service (OBS).


RPM packages are available in the openSUSE:Tools repository.

zypper addrepo --repo http://download.opensuse.org/repositories/openSUSE:/Tools/openSUSE_Tumbleweed/openSUSE:Tools.repo
zypper install osc

Unstable RPM packages are available in the OBS:Server:Unstable repository.

zypper addrepo --repo http://download.opensuse.org/repositories/OBS:/Server:/Unstable/openSUSE_Factory/OBS:Server:Unstable.repo
zypper install osc

To install from git, do

./setup.py build
./setup.py install

Alternatively, you can directly use ./osc-wrapper.py from the source directory, which is easier if you develop on osc.


When you use osc for the first time, it will ask you for your username and password, and store it in ~/.config/osc/oscrc.


Osc can store passwords in keyrings instead of ~/.config/osc/oscrc. To use them, you need python3-keyring with a backend of your choice installed:

  • kwalletd5 (A pasword manager for KDE)
  • secrets (A password manager for GNOME)
  • python3-keyring-keyutils (A python-keyring backend for the kernel keyring)

If you want to switch to using a keyring you need to delete apiurl section from ~/.config/osc/oscrc and you will be asked for credentials again, which will be then stored in the keyring application.


For more details please check the openSUSE wiki.

To list existing content on the server

osc ls                              # list projects
osc ls Apache                       # list packages in a project
osc ls Apache subversion            # list files of package of a project

Check out content

osc co Apache                       # entire project
osc co Apache subversion            # a package
osc co Apache subversion foo        # single file

Update a working copy

 osc up
 osc up [pac_dir]                   # update a single package by its path
 osc up *                           # from within a project dir, update all packages
 osc up                             # from within a project dir, update all packages
                                    #   AND check out all newly added packages

If an update can't be merged automatically, a file is in C (conflict) state, and conflicts are marked with special <<<<<<< and >>>>>>> lines. After manually resolving the problem, use

osc resolved foo

Upload change content

osc ci                              # current dir
osc ci <dir>
osc ci file1 file2 ...

Show the status (which files have been changed locally)

osc st
osc st <directory>
osc st file1 file2 ...

Mark files to be added or removed on the next 'checkin'

osc add file1 file2 ...
osc rm file1 file2 ...

Adds all new files in local copy and removes all disappeared files

osc addremove

Generates a diff, to view the changes

osc diff                            # current dir
osc diff file1 file2 ...

Shows the build results of the package

osc results
osc results [repository]

Shows the log file of a package (you need to be inside a package directory)

osc log <repository> <arch>

Shows the URLs of .repo files which are packages sources for Yum/YaST/smart

osc repourls [dir]

Triggers a package rebuild for all repositories/architectures of a package

osc rebuildpac [dir]

Shows available repository/build targets

osc repository

Shows the configured repository/build targets of a project

osc repository <project>

Shows meta information

osc meta Apache
osc meta Apache subversion
osc id username

Edit meta information (Creates new package/project if it doesn't exist)

osc editmeta Apache
osc editmeta Apache subversion

Update package meta data with metadata taken from spec file

osc updatepacmetafromspec <dir>

There are other commands, which you may not need (they may be useful in scripts)

osc repos
osc buildconfig
osc buildinfo

Locally build a package (see 'osc help build' for more info)

osc build <repo> <arch> specfile [--clean|--noinit]

Update a package to a different sources (directory foo_package_source)

cp -a foo_package_source foo
cd foo
osc init <prj> <pac>
osc addremove
osc ci
rm -r foo


Report issues or submit pull-requests to the osc project on GitHub.


Unit tests can be run from a git checkout by executing

./setup.py test