Skip to content

Instantly share code, notes, and snippets.

@grisu48
Last active July 16, 2020 12:46
Show Gist options
  • Save grisu48/914fd5cdea8d0deb8b989982bbb24255 to your computer and use it in GitHub Desktop.
Save grisu48/914fd5cdea8d0deb8b989982bbb24255 to your computer and use it in GitHub Desktop.
OBS Cheat sheet

OSC Cheat sheet

This small cheat sheet has been created by me after duing the OBS training with mpluskal. Hope it is of help to anybody that is starting with obs :-)

Configure OBS

First, let's set some aliases for the shell

$ vim ~/.bashrc

alias osc="osc --apiurl=https://api.opensuse.org"
alias oscb="osc build --ccache --cpio-bulk-download --download-api-only "
alias oscsd="osc service localrun download_files"

And configure aliases for osc as well

$ vim ~/.oscrc

build-jobs = 4 # value for buildjobs
extra-pkgs = vim gdb strace mc less unzip # some tools
no_verify = 1 # local verification only

[https://api.opensuse.org]
user = grisu48
aliases = obs

Simple command reference sheet

The most important of all commands

osc help COMMAND

Search/Query

# Search for project and/or package
osc search 'search term'
  --description       search for matches in the 'description' element
  --title             search for matches in the 'title' element
  --project           search for a project
  --package           search for a package
  -s, --substring     Show also results where the search term is a substring (slower search)
  --binary            search binary packages
  --csv               generate output in CSV (separated by |)
  -i, --involved      show projects/packages where given person (or myself) is involved as bugowner or maintainer
  -V, --version       show package version, revision, and srcmd5. CAUTION: Slow and unreliable
  -v, --verbose       show more information
  --repos-baseurl     show base URLs of download repositories

# Search for maintained status (i.e. if a package is in a flavour)
osc maintained PACKAGE
osc sm PACKAGE

Checkout and Branching of Repositories/Packages

# Branch ("fork") existing project
osc branch SOURCEPROJECT SOURCEPACKAGE [TARGETPROJECT] [TARGETPACKAG]

# Checkout
osc co PROJECT [PACKAGE] [FILE]

Versioning

# Mark files to be added on next checkin
# URL will be downloaded
osc add URL|FILE

# Mark files as deleted on next checkin
osc rm FILE
# Delete project/packages on server
osc rdelete PROJECT [PACKAGES]

# Checkin ("commit")
osc ci

# Remove untracked files from current local repo
osc clean

Changes file

# Edit the changes file
osc vc [-m MESSAGE]

Build

# Local build
oscb
# Set alias oscb='osc build --ccache --cpio-bulk-download --download-api-only'

# Re-trigger remote builds (happens after each checkin)
osc rebuild

# Show the build results
osc r
osc results PROJECT [PACKAGE]
  -w, --watch         watch the results until all finished building

# Show build log
osc bl
osc blt              - show only tail of buildlog

Submit request

# Create request to submit source into another Project
osc sr [OPTIONS]
osc submitreq [OPTIONS] DESTPRJ [DESTPKG]
osc submitreq [OPTIONS] SOURCEPRJ SOURCEPKG DESTPRJ [DESTPKG]
  --cleanup           remove package if submission gets accepted (default for home:<id>:branch projects)
  -d, --diff          show diff only instead of creating the actual request

Recipes

Update a repository

Let's update tar

osc co Base:System/tar      # Checkout
cd Base:System/tar
vim tar.spec                # << Apply our edits and stuff
osc vc                      # << ChangeLog
oscb                        # Build locally (test if it builds before pushing)
osc ci                      # Checkin ("commit & push")
osc r -w

If you want to push your changes to the original repo, create a submit request

osc sr

Black-Voodoo stuff

# Update package meta information from a specfile
osc updatepacmetafromspec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment