To work with Open Build Service, install the osc
command line tool from your
preferred openSUSE distributions or from the OBS project
openSUSE:Tools
. The tool runs on any modern Linux system and is
available for different distributions, like CentOS, Debian, Fedora, SLE,
openSUSE, to name a few.
For SUSE related systems, install it with the
zypper
command (replace
DISTRI with your distribution):
root #
zypper
addrepo https://download.opensuse.org/repositories/openSUSE:/Tools/DISTRI/openSUSE:Tools.reporoot #
zypper
install osc
For other systems, use your preferred package manager.
As an alternative, use the AppImage file. An AppImage file is a
packaged application and its dependencies which can run on many
distributions. Download the file, save it in your
~/bin
directory, and make the file executable.
Usually, the default configuration is appropriate in most cases. There are some special configuration option which might be helpful if you have special needs.
Some useful options in the ~/.oscrc
file are
described in the following list (all under the general
section):
apiurl
(string)
Used to access the Open Build Service (OBS) API server. This is needed if you work with
different OBS server (for example, a public and a private one).
If you have to distinguish different servers, you can also use the
-A
option. Usually, it is good practice to create
an alias like this:
alias
iosc="osc -A https://api.YOURSERVER"
You use iosc
the same as with osc
.
extra-pkgs
(list)Contains a space-separated list of package. These extra packages are installed when you build packages locally. Useful when you need an additional editor inside the build environment, for example vim.
build_repository
(string)
Sets the default platform when omitted in osc build
.
exclude_glob
(list)
Contains a list of space separated file names to ignore. For
example, *.bak
to ignore all backup files.
checkout_no_colon
(bool)
Separates projects and subprojects in directories and subdirectories
instead of creating a single directory. For example, setting the option
and checking out the home project will lead to a directory structure
home/obsgeeko
instead of the single directory
home:obsgeeko
.
use_keyring
(bool)Use the default keyring instead of saving the password in the OBS configuration file. For KDE the KWallet is used, for GNOME it is Seahorse.
To get a general help about this command, use osc --help
.
For help of specific subcommands, use osc help SUBCOMMAND
.
Most commands can be called by a long name (like status
)
or by one or more aliases (as st
).
osc
for the First Time #
When you use the osc
command for the first time, the command will
ask you for your credentials of your OBS instance.
The credentials are stored in the configuration file ~/.oscrc
.
By default, the password is stored as plain text. In terms of security, that is not ideal. To avoid the issue:
Use a Password Manager.
Set the option use_keyring
to
1
after you have created a configuration file
for the first time. Remove your credentials sections from your
configuration file. The next time osc
asks for your username
and password, it will store it in the password manager instead of
the configuration file.
Obfuscating the Password.
Set plaintext_passwd
to 0
.
This is not a security feature, but it obfuscates the password
in the configuration file.
If you prefer your current password manager, set the option
use_keyring
to 1
after you have
authenticated it.
The osc
command is similar to git
:
The main command osc
has several subcommands.
It serves as client and it is used to build packages locally, submit
files to a remote OBS instance, edit metadata, or query build results.
osc
ls #list projectsosc
ls Apache #list packages in a projectosc
ls Apache flood #list files of package of a project
osc ls
shows you a list of projects on OBS.
Which OBS instance it shows depends on the option apiurl
in the configuration file. By default, the openSUSE Build Server
is used. If you need another server, use the -A
option as shown in Section 3.2, “Configuring osc”.
osc
co Apache # entire projectosc
co Apache flood # a packageosc
co Apache flood flood.spec # single file
osc
uposc
up [directory]osc
up * # from within a project dir, update all packagesosc
up # from within a project dir, update all packages AND check out all newly added packages
osc
ci # current dir osc ci [file1] [file2] # only specific filesosc
ci [dir1] [dir2] ... # multiple packagesosc
ci -m "updated foobar" # specify a commit message
osc
log
osc
stosc
st [directory]
If an update cannot be merged automatically, a file is in 'C'
(conflict) state, and conflicts are marked with special lines. After
manually resolving the problem, use osc resolved FILE
.
osc
add fooosc
rm foo
osc
addremove
osc
diff [file]
osc
resultsosc
results [platform]
(you need to be inside a package directory)
osc
buildlog [platform] [arch]
.repo
Files which are Packages Sources for Package Managersosc
repourls [dir]
osc rebuildpac [dir]
osc build [platform] [arch] [specfile] [--clean|--noinit|...]
osc
platforms [project]
osc
repos
osc
meta prj [project]osc
meta pkg [project] [package]osc
meta user [username]osc
meta prjconf [project]
Create new package/project if it does not exist. It will open an editor with the raw XML metadata. To avoid need to edit XML, you can use the web UI instead.
osc
meta prj -e [project]osc
meta pkg -e [project] [package]osc
meta prjconf -e [project]
(The project configuration may well be empty. It is needed in special cases only.)
osc
updatepacmetafromspec [dir]