osc-batch-submit
Tool to batch submit requests with osc. This helps when submitting large software stacks from one OBS project to another. For example, KDE Frameworks + Plasma + Applications consists of ~500 packages and Qt6 has ~30 packages.
Installation
The easiest is to install the package from OBS in https://build.opensuse.org/package/show/home:alarrosa:packages/python-osc-batch-submit .
Basic Usage
The basic usage consists in running osc-batch-submit with a command and configuration file as parameters. Something like:
osc-batch-submit submitrequest gstreamer-from-Factory-to-SLFO.conf
or
osc-batch-submit copypac qt6-from-Factory-to-home-prj.conf
That creates a shell script file with all the osc commands you need.
You should then review the commands (especially if osc-batch-submit tells you to check some message logs, more on this below) and once they're ok, just run this script.
Reviewing the shell script
The shell script will contain a list of osc commands with appropriate parameters and automatically generated message logs. This is easy when, for example, a SR just updates a package with a newer version, or adds a patch. But there are situations in which osc-batch-submit will warn you that it's better for someone to review a message log if, for example, it detects a patch being removed. In this case, osc-batch-submit will tell you to check the message log files to better explain what's being submitted (and more importantly, to check if something may be being submitted by mistake).
In some circumstances, while reviewing the shell script you might notice a package will be submitted that you don't really want to submit, in this case, there's no need to rerun osc-batch-submit. Just comment (or remove) the related osc command from the script.
Note that before every osc command, the shell script contains a command to print some internal information. This is done this way because when you run the script, all the script output is also written to a logfile and these "headers" are used to identify which osc command output refer to each package. This allows to later use the list-srs
command to check the status of the SRs generated.
General Usage
The configuration file
The configuration file sets a series of variables that define how osc-batch-submit works: the packages that will be submitted (or copied), from which project(s) and to which project among other data. This configuration file is written in python format as it's loaded as if it was a python file.
ibs
The first variable that needs to be defined is an ibs
boolean that defines if the osc commands will be run on build.opensuse.org (if False) or build.suse.de (if True).
packages
The packages
variable is a string that defines a set expression that, when evaluated, returns the set of the packages that osc-batch-submit will operate on. The set expression can use unions (∪
), interesections (∩
) and substractions (∖
) on ibs/obs projects or lists of packages (package names written between curly brackets). It's also possible to filter packages with a regular expression by using * {pattern}
. Let's see some examples:
packages = '(KDE:Applications ∪ KDE:Extra) ∩ openSUSE:Factory'
Selects all packages in KDE:Applications or KDE:Extra that are already in openSUSE:Factory
packages = '(openSUSE:Backports:SLE-15-SP4 ∩ KDE:Frameworks5 ∩ openSUSE:Factory) ∖ SUSE:SLE-15-SP5:GA'
Selects all packages that are in openSUSE:Backports:SLE-15-SP4 that also are in KDE:Frameworks5 and openSUSE:Factory, except if they are in SUSE:SLE-15-SP5:GA
packages = '{libqt5-qt3d, libqt5-qtcharts , libqt5-qtconnectivity, libqt5-qtdatavis3d, libqt5-qtdoc}'
Selects that list of packages
packages = '((openSUSE.org:multimedia:libs * {.*gst.*}) ∩ SUSE:SLFO:Main) ∪ {pipewire, wireplumber}'
Selects all packages in multimedia:libs (from obs) that have gst
in their name if they are also in SUSE:SLFO:Main and adds pipewire
and wireplumber
to the list. Note that since this expression uses projects from obs and ibs, this assumes ibs was set to True.
source_projects
The source_projects
variable is a list of strings containing the source projects for the packages evaluated from the packages
expression. For each package, the first project will be tested to be used as source, if it doesn't contain the package, the second project will be used. If it doesn't contain the package, the third project will be used, and so on. Example:
source_projects = ['openSUSE.org:openSUSE:Factory']
Uses openSUSE:Factory as source (assuming ibs is True)
source_projects = ['KDE:Frameworks', 'KDE:Applications', 'KDE:Extra']
Use KDE:Frameworks, KDE:Applications and KDE:Extra as source project.
target_project
The target_project
variable is the project used as target for the copypacs/submitrequests commands.
only_packages_developed_in_project
This variable is used to filter the packages list and keep only the packages that are developed in a given project. This variable can be None
or a project.
only_packages_developed_in_project = None
Don't use this variable.
only_packages_developed_in_project = 'KDE:Frameworks5'
Only keep packages whose devel project is KDE:Frameworks.
reference
This can be used to specify a jira ticket, bugzilla ID or any other reference that should be added to every message text in submit requests or copypac commands.
reference = 'jsc#PED-2635'
Adds a reference to that jira ID
reference = ''
Don't add any reference.
set_bugowner
When submitting a new package to a project, you sometimes need to set a bugowner, this variable can be used to set this. The variable contains the username of the bugowner that should be set.
set_bugowner = False
Do not set a bugowner (an empty string can also be used)
set_bugowner = 'geeko'
Set the geeko obs userid as bugowner
set_bugowner = 'group:gnome-maintainers'
Set the gnome-maintainers group as bugowner
force_write_message_file
This is a boolean that can be used to force to write a message file that can be edited instead of just using a generated text.
previous_logfile
This variable contains the name of a logfile generated in a previous run of osc-batch-submit (actually, by the generated shell script) to allow osc-batch-submit to supersede previous SRs.
Imagine that you submit all of GNOME to Factory and while the SRs are being reviewed you notice there's a new version in the source project that you want to submit, superseding all previous SRs.
This would be quite tedious to do manually, so you can just set previous_logfile
to the name of the logfile and the new shell script generated by osc-batch-submit will generate osc sr
commands
including the -s superseded_SR
parameter to supersede old SRs.
use_cache
osc-batch-submit always write all information it gets from obs to a cache, but doesn't use the contents in this cache unless the use_cache variable is set in the config file or the --cache parameter is passed on the command line. This is done this way because packages might have been added, removed or modified in obs and using the cache implicitly would give unexpected results so it's better to only use it when explicitly requested (like when you re-run osc-batch-submit just after changing something in the configuration file).
list-srs
After running the shell script generated by osc-batch-submit, it will generate a logfile under a logs directory containing the result of the run. You can use the list-srs
command to check the SRs generated and the status of them. Some examples:
> list-srs gstreamer-from-Factory-to-SLFO.log
376234 376235 376236 376237 376238 376239 376240 376241 376242 376243
> list-srs -v gstreamer-from-Factory-to-SLFO.log
376234 gstreamer
376235 gstreamer-devtools
376236 gstreamer-docs
376237 gstreamer-plugins-bad
376238 gstreamer-plugins-base
376239 gstreamer-plugins-good
376240 gstreamer-plugins-libav
376241 gstreamer-plugins-rs
376242 gstreamer-plugins-ugly
376243 gstreamer-rtsp-server
> list-srs -vv gstreamer-from-Factory-to-SLFO.log
https://build.suse.de/request/show/376234 gstreamer
https://build.suse.de/request/show/376235 gstreamer-devtools
https://build.suse.de/request/show/376236 gstreamer-docs
https://build.suse.de/request/show/376237 gstreamer-plugins-bad
https://build.suse.de/request/show/376238 gstreamer-plugins-base
https://build.suse.de/request/show/376239 gstreamer-plugins-good
https://build.suse.de/request/show/376240 gstreamer-plugins-libav
https://build.suse.de/request/show/376241 gstreamer-plugins-rs
https://build.suse.de/request/show/376242 gstreamer-plugins-ugly
https://build.suse.de/request/show/376243 gstreamer-rtsp-server
> list-srs -s qt6-6.8.2-from-KDE_Qt6-to-SLFO.log
363017 superseded : python3-pyside6
363018 accepted : Auto accept qt6-3d
363019 accepted : Auto accept qt6-base
363020 accepted : Auto accept qt6-charts
...