openSUSE:OBS to Git

Jump to: navigation, search

OBS to Git migration effort

We are trying to move new development from OBS based projects, to Git based projects. This is work-in-progress. The goal is to migrate openSUSE:Factory to use Git for source management. The first steps will involve migrating 265 devel projects from having sources in OBS to Git. Devel projects will be migrated one at a time.

When devel projects are migrated, the source contributions to the devel project will change. You will have to submit changes via either Gitea PR or git push, if you have repo access.

openSUSE:Factory contribution method will not change. It will continue to rely on osc sr devel_project/package openSUSE:Factory for now.

What will get migrated

We are moving source management to Git. We are not moving the build out of OBS — projects will continue to be built in OBS.

  1. Maintainership information will be retained in the Git-based devel projects. Initially, we will give maintainers package and project rights.
  2. Each devel project listed below will be assigned an organization name that matches relatively closely what we have in OBS.
  3. Package data and history will be imported using git-importer.

OBS devel projects will continue to be used to build these sources.

Where does the project go and how can I update packages?

The project will be the _ObsPrj repository in the devel organization. It will be created and automatically updated when you push/merge changes to the main branch of the package. Every repository will be automatically added to _ObsPrj. _ObsPrj will be kept up-to-date with the current state of packages in the organization.

OBS will then point to _ObsPrj via the <scmsync> mechanism and build the latest state in the OBS devel project. Binaries will remain in OBS. Sources will be in Git.

Workflow

You should have osc 1.15.0 or newer installed. Leap users can add the openSUSE:Tools repo to get it: zypper ar -f obs://openSUSE:Tools tools.

A quick overview of tools that are used in this guide:

How to create new package?

  • Create a new repository in your home.
  • Add a spec file and build sources as normal. Make sure to track large sources in Git LFS.
  • Transfer the ownership of the repository to the devel project organization of your choice. _ObsPrj will automatically be updated.
The recommended tool to initialize a new package is obs-git-init. It is part of Factory and openSUSE:Tools project for all distributions. It can also be used for updating existing git repositories with current recommended configuration.

When doing package initialization by hand, the two most important things are:

Command Explanation
git init --object-format=sha256 SHA256 repos, not SHA1
curl -O https://src.opensuse.org/whatsapp/whatsapp-for-linux/raw/commit/006ed31cef0fa9a57e08d5157b18639d8476e6f672f92fbfaecb4d7ea0c6b5f5/.gitattributes git-lfs default tracking file

How does my workflow change?

Package sources are maintained in Git. Make sure to clone with SSH and have SSH key in gitea in your profile to be able to push changes.

Command comparison
Old command New command Explanation
osc add file git add file Add a file
osc vc osc vc Changelog
osc ci git commit; git push Push changes to remote
osc build osc build Build package
osc branch osc fork Create fork on gitea and OBS build setup
osc mkpac obs-git-init Create or update git repo
osc meta prjconf vi _config Edit the “_config” file in your project git
osc fork had a couple of bugs. Like https://github.com/openSUSE/osc/pull/1767 and https://github.com/openSUSE/osc/pull/1760. Make sure you run at least version 1.15.0.

Example Update workflow

git clone gitea@src.opensuse.org:xmpp/libstrophe.git
### You can also use osc co network:messaging:xmpp/libstrophe it will pull the sources from git. 
cd libstrophe
### Should use main branch for Git devel projects.
git checkout -b main
vi *.spec
git rm *tar.xz
osc service localrun download_files
git add *tar.xz
osc vc
### Note: by default, this builds against openSUSE:Factory and not project
osc build --alternative-project=network:messaging:xmpp
git checkout main
git add *.spec *.changes *.tar.xz
git commit -m "Update to version ABC"
git push
osc results network:messaging:xmpp/libstrophe
osc sr network:messaging:xmpp/libstrophe openSUSE:Factory

Commit message and changes

When you update a package it probably makes sense to reuse the text you wrote in the .changes file in the git commit message. If you follow the standard format described here which looks like his:

-------------------------------------------------------------------
Sat Jan 11 16:37:07 UTC 2025 - Your Name <your@emailcom>

- Update to new upstream release x.y.z:
  * bling and changes from upstream for that version
  * just the relevant parts, no info about other OS
  * and keep it as short as possible

-------------------------------------------------------------------
Sat Jan 10 16:37:07 UTC 2025 - Your Name <your@emailcom>

- Initial package of packagename 1.0 for openSUSE:

You have various ways to reuse your changelog.

Changelog alias

It might be helpful to use the following line:

git diff -U0 --cached *.changes | grep '^[+]' | grep -Ev '^(--- a/|\+\+\+ b/)' | tail -n +4 | cut -c4- | git commit -F -

Which you can add as an alias to your shell:

vi *.zshrc

alias gitum="git diff -U0 --cached *.changes | grep '^[+]' | grep -Ev '^(--- a/|\+\+\+ b/)' | tail -n +4 | cut -c4- | git commit -F -"

So after you added a file to be contained in the next commit with git add *.spec *.changes *.tar.gz you can now run gitum to take the commit commit message from the staged changes file, remove the boilerplate and commit.

Git hooks

You can install a git hook from git-obs-hooks. A proposal regarding changes files can be seen here.

How to deal with contributions?

Instead of submit requests to devel projects on OBS. Contributors will now send pull requests on Gitea. You can handle those either via the Gitea web user interface on src.opensuse.org or can use git-obs (which is installed automatically via osc).

Using git-obs

To interact with Gitea on the commandline you can use git-obs if you prefer this over the WebUI. See the Quickstart guide.

Setting up git-obs:

# Configure login
git-obs login add --url=https://src.opensuse.org --user=... obs --set-as-default
# Upload an existing ssh key to Gitea
git-obs ssh-key add --key-path=~/.ssh/id_rsa.pub
# List ssh keys associated with Gitea account
git-obs ssh-key list

Submit a pull request:

# Fork a package:
git-obs repo fork pool/<package>
# Clone the forked package:
git-obs repo clone <owner>/<package> [--no-ssh-strict-host-key-checking]
# Make change
cd <package>
git remote -v # shows origin and parent pointing to pool/<package>
git switch <branch>
git branch <new-branch>
# Alternatively: git branch for/<target-branch>/<feature-name>
# Make changes
git commit
git push
# Create a pull request
git-obs pr create [--title=...] [--description=...] [--target-branch=...]

Review a pull request:

git-obs pr review [<owner>/<repo>#<number> ...]

Seeing build result and submitting to Factory

The build result will still be visible on obs:

osc results network:messaging:xmpp/libstrophe

Submitting to Factory is not done via git/Gitea yet (until Factory is also moved to git). So after changing something in your git project or accepting pull requests you create a regular submit request to Factory via osc. For example for https://src.opensuse.org/xmpp/libstrophe you do:

osc sr network:messaging:xmpp/libstrophe openSUSE:Factory

How to find the devel project of a package in Factory?

Currently a package in openSUSE:Factory doesn't show where the devel project for that package is. This will be improved in the future. For now look for the package name in pkgs/_meta/devel_packages to find the devel project.

When will my project be migrated?

To be determined. The less complicated a project, the faster it is expected to be migrated.

The ideal goal here is to finish the devel project migration in March 2025, but the possibility of going into April is very likely.

How will this happen for my devel project?

A day or two before migration, you will receive an email that your project will be migrated. After receiving this email, please do not open any new submit requests to the devel project and merge any requests that are pending as soon as possible. The same applies to new osc commit actions. There is a possibility that you will merge something that has already been imported and then switching to Git will "revert" your merge.

After migration, the changes can no longer be accepted in OBS and the accept action must be performed in/with Git.

What to do when this happens for my devel project?

1. sign into src.opensuse.org with your OBS account. Only if you signed in we can automatically add you as owner to the new devel project team.

2. add SSH key to your Profile in Gitea. This is key to make sure you can continue to contribute to the devel project

3. please merge any pending SR that could be opened to your package and project. After the sources are migrated to Git, the pending requests can no longer be merged directly in OBS.

4. briefly check that your packages are in same state as in OBS and there's nothing grossly wrong with the imported package(s)

FAQ

How can I invoke osc branch from a devel project to my own project and build many packages there?

You can do this manually via git fork and referencing the packages in OBS via scmsync. The automatic procedure for this is being worked on. See this ticket.

What should I do now to prepare?

  • Go to src.opensuse.org
  • Login with your OBS/Bugzilla credentials
  • Go to Settings -> SSH/GPG keys
  • Add your SSH key

so you'll be able to have push access to your repositories.

Gitea SSH keys were posted to the factory ML and will be added to the front page of src.opensuse.org too. They are:

ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFKNThLRPznU5Io1KrAYHmYpaoLQEMGM9nwpKyYQCkPx
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBDJ8V51MVIFUkQqQOdHwC3SP9NPqp1ZWYoEbcjvZ7HhSFi2XF8ALo/h1Mk+q8kT2O75/goeTsKFbcU8zrYFeOh0=
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCkVeXePin0haffC085V2L0jvILfwbB2Mt1fpVe21QAOcWNM+/jOC5RwtWweV/LigHImB39/KvkuPa9yLoDf+eLhdZQckSSauRfDjxtlKeFLPrfJKSA0XeVJT3kJcOvDT/3ANFhYeBbAUBTAeQt5bi2hHC1twMPbaaEdJ2jiMaIBztFf6aE9K58uoS+7Y2tTv87Mv/7lqoBW6BFMoDmjQFWgjik6ZMCvIM/7bj7AgqHk/rjmr5zKS4ag5wtHtYLm1L3LBmHdj7d0VFsOpPQexIOEnnjzKqlwmAxT6eYJ/t3qgBlT8KRfshBFgEuUZ5GJOC7TOne4PfB0bboPMZzIRo3WE9dPGRR8kAIme8XqhFbmjdJ+WsTjg0Lj+415tIbyRQoNkLtawrJxozvevs6wFEFcA/YG6o03Z577tiLT3WxOguCcD5vrALH48SyZb8jDUtcVgTWMW0to/n63S8JGUNyF7Bkw9HQWUx+GO1cv2GNzKpk22KS5dlNUVGE9E/7Ydc=

Will osc maintainership and related commands cease working?

Correct.

How to submit from devel project to Factory?

The same as before. osc sr devel_project/package openSUSE:Factory. This process does not change until Factory is also migrated to Git.

What process will keep the _PrjGit and the repositories in sync?

This will initially be done via a bot, workflow-direct. The sources can be found in the autogits repo.

Can I run these bots myself?

Yes.

Is there more documentation?

There is a summary already written by Jan on how to work with the openSUSE git backend.

Can I still have _service with server side services?

Yes, but these service runs will not be reflected in the Git sources. Packages that use this today, will not have the in their histories as they cannot be built as-is anyway since checking in such a source will get the files overwritten.

I don't want to type git clone gitea@src.opensuse.org:foo/bar all the time

Add the following to your ~/.gitconfig and then you can type git clone soo:foo/bar

   [url "gitea@src.opensuse.org:"]
       insteadOf = soo:

Devel Project Status table

Projects that are going to be migrated to Gitea next will be listed at the top. Migrated projects will be moved to the bottom.

Devel projects to Git Migration Status
Devel Project # Pkgs # in Factory Gitea Orgs Done Date
devel:languages:nodejs 192 14 https://src.opensuse.org/nodejs Next
network:NIS 6 5 https://src.opensuse.org/nis
graphics:darktable 3 1 https://src.opensuse.org/darktable
Apache
Apache:Modules
Apache:Shibboleth
Application:Astrophotography
Application:Dochazka
Application:ERP:GNUHealth:Factory
Application:Geo
Archiving
Archiving:Backup
Base:System
Cloud:OpenStack:Factory
Cloud:Seafile
Cloud:Tools
CrossToolchain:avr
Documentation
Documentation:Tools
Education
Emulators
Emulators:Wine
GNOME:Apps
GNOME:Factory
Java:Factory
Java:packages
KDE:Applications
KDE:Extra
KDE:Frameworks
KDE:Frameworks5
KDE:KDE3
KDE:Qt5
KDE:Qt6
KDE:Qt:5.15
KDE:Qt:PyQt
Kernel:slowroll
Kernel:stable
Kernel:tools
LibreOffice:Factory
Linux-PAM
M17N
M17N:Maliit
M17N:fonts
M17N:l10n.opensuse.org
Mono
Mono:Factory
Office
Printing
Publishing
Publishing:TeXLive
SUSE:SUSEStudio
Virtualization
Virtualization:Appliances:Builder
Virtualization:Appliances:Images:openSUSE-Tumbleweed
Virtualization:VMware
Virtualization:WSL
Virtualization:containers
Virtualization:containers:images
Virtualization:containers:images:openSUSE-Tumbleweed
X11:Bumblebee
X11:COSMIC:Apps
X11:COSMIC:Factory
X11:Cinnamon:Factory
X11:Compiz
X11:Deepin
X11:Drivers:Video:Redesign
X11:Enlightenment:Factory
X11:FOX
X11:GNUstep
X11:LXQt
X11:LXQt:Other
X11:MATE:Factory
X11:Pantheon
X11:Pantheon:Apps
X11:RemoteDesktop
X11:Solus
X11:Unity
X11:Utilities
X11:Wayland
X11:XOrg
X11:common:Factory
X11:terminals
X11:windowmanagers
X11:wxWidgets
X11:xfce
YaST:Head
benchmark
devel:BCI:Tumbleweed
devel:CaaSP
devel:CaaSP:Head:ControllerNode
devel:LLDC
devel:automotive
devel:gcc
devel:kanku
devel:kubic
devel:kubic:containers
devel:kubic:ignition
devel:languages:D
devel:languages:R:released
devel:languages:go
devel:languages:haskell
devel:languages:haxe
devel:languages:misc
devel:languages:ocaml
devel:languages:pascal
devel:languages:perl
devel:languages:php
devel:languages:python
devel:languages:python:Factory
devel:languages:python:aliyun
devel:languages:python:avocado
devel:languages:python:aws
devel:languages:python:azure
devel:languages:python:certbot
devel:languages:python:django
devel:languages:python:flask
devel:languages:python:google
devel:languages:python:jupyter
devel:languages:python:mailman
devel:languages:python:numeric
devel:languages:python:pytest
devel:languages:raku
devel:languages:ruby
devel:languages:ruby:extensions
devel:languages:rust
devel:languages:tcl
devel:libraries:c_c++ 539 https://src.opensuse.org/clibs
devel:libraries:libyui
devel:microos
devel:microos:aeon
devel:microos:aeon:images
devel:microos:containers
devel:microos:images
devel:microos:kalpa
devel:openQA:tested
devel:openSUSE:Factory
devel:openSUSE:Factory:Apps
devel:openSUSE:Factory:rpmlint
devel:sap:ansible
devel:sap:cluster-agents
devel:sap:monitoring:stable
devel:tools
devel:tools:building
devel:tools:compiler
devel:tools:lttng
devel:tools:scm
devel:tools:scm:svn
devel:tools:statica
editors
editors:tree-sitter
electronics
filesharing
filesystems
filesystems:ceph
filesystems:snapper
games
games:tools
graphics
hamradio
hardware
hardware:FPGA
hardware:boot
hardware:nvdimm
hardware:sdr
isv:SUSE:SupportTools:Factory
mobile:synchronization:FACTORY
mozilla:Factory
mozilla:addons
multimedia:apps
multimedia:color_management
multimedia:libs
multimedia:libs:cisco-openh264
multimedia:proaudio
multimedia:voice-assistant
multimedia:xine
network
network:cluster
network:cluster:ohpc
network:cryptocurrencies
network:fcoe
network:ha-clustering:Factory
network:ha-clustering:sap-deployments:devel
network:idm
network:ldap
network:messaging:amqp
network:messaging:kafka
network:messaging:matrix
network:messaging:mqtt
network:pidgin
network:samba:CONTAINERS
network:samba:STABLE
network:synchronization:files
network:telephony
network:time
network:utilities
network:vpn
network:vpn:wireguard
network:wicked:factory
openSUSE:Tools
openSUSE:infrastructure:MirrorCache
science
science:HPC
science:machinelearning
security
security:SELinux
security:Stunnel
security:apparmor
security:chipcard
security:csirt-tooling
security:dehydrated
security:forensics
security:idm
security:keepassxc
security:netfilter
security:privacy
security:sensor
security:tls
server:database
server:database:postgresql
server:dns
server:http
server:irc
server:mail
server:messaging
server:monitoring
server:monitoring:zabbix
server:php:applications
server:php:extensions
server:proxy
server:search
shells
system:install:head
system:packagemanager
system:packagemanager:dnf
systemsmanagement
systemsmanagement:Agama:Devel
systemsmanagement:SCC
systemsmanagement:SCC:RMT
systemsmanagement:ansible
systemsmanagement:opentofu
systemsmanagement:saltstack
systemsmanagement:terraform
systemsmanagement:yomi
utilities
vdr
windows:mingw 82 probably 0 https://src.opensuse.org/mingw
windows:mingw:win32 582 13 https://src.opensuse.org/mingw
windows:mingw:win64 583 13 https://src.opensuse.org/mingw
zypp:Head
zypp:plugins

Devel Projects in Git

Projects who's sources are now in Git are below.

Devel projects to Git Migration Status
Devel Project # Pkgs # in Factory Gitea Orgs Done Date
Kernel:firmware 35 35 https://src.opensuse.org/kernel-firmware 2025-03-18
Kernel:kdump 9 9 https://src.opensuse.org/kernel-kdump 2025-04-10
network:chromium 4 7 https://src.opensuse.org/chromium 2025-04-13
devel:languages:clojure 3 3 https://src.opensuse.org/clojure 2025-03-11
devel:languages:erlang 129 13 https://src.opensuse.org/erlang 2025-03-14
devel:languages:erlang:Factory 1 1 https://src.opensuse.org/erlang 2025-03-14
devel:languages:hare 8 6 https://src.opensuse.org/hare 2025-03-30
devel:languages:javascript 20 8 https://src.opensuse.org/javascript 2025-03-18
devel:languages:lua 85 81 https://src.opensuse.org/lua 2025-03-17
network:dhcp 3 3 https://src.opensuse.org/dhcp 2025-03-18
network:im:whatsapp 4 4 https://src.opensuse.org/whatsapp 2025-03-11
network:messaging:xmpp 13 10 https://src.opensuse.org/xmpp 2025-03-03
systemsmanagement:cockpit https://src.opensuse.org/cockpit 2025-01-01
systemsmanagement:wbem 92 21 https://src.opensuse.org/wbem <Decommissioned>
X11:lxde 45 30 https://src.opensuse.org/lxde 2025-03-18