Skip to content
Henne Vogelsang edited this page Apr 27, 2021 · 37 revisions

This is developer documentation about the different types of "links" that exist in the OBS

Interconnect Link

The OBS instance to OBS instance link. If a Project has the attribute remoteurl it acts as an read only interface to the OBS API behind this URL.

Example:

[1] pry(main)> Project.find_by(name: 'openSUSE.org').remoteurl
=> "https://api.opensuse.org/public"

The backend supports reading from such interconnects by using the sub-project syntax (project:sub-project). So in the example above openSUSE.org:home:hennevogel will fetch the data from project home:hennevogel on the remote OBS instance. The support in the frontend for this is spotty.

Pitfalls

If you try to instantiate a Project from an interconnect you will get a string and not an Project object... 🤯

[1] pry(main)> Project.get_by_name('home:Admin').class.name
=> "Project"
[2] pry(main)> Project.get_by_name('openSUSE.org:home:hennevogel').class.name
Found local project openSUSE.org for home:hennevogel with remoteurl https://api.opensuse.org/public
=> "String"

You can create sub-projects of interconnect links which will supersede the remote projects. This will turn those into "real" projects so you can have a mixture of local and remote projects below an interconnect-link.

[1] pry(main)> Project.get_by_name('openSUSE.org:home').class.name
=> "String"
[2] pry(main)> Project.get_by_name('openSUSE.org:home:hennevogel').class.name
=> "Project"
[3] pry(main)> Project.get_by_name('openSUSE.org:home:dmarcoux').class.name
=> "String"

Remote projects are also not checked for existence.

[1] pry(main)> Project.get_by_name('openSUSE.org:I:dont:exist')
Found local project openSUSE.org for I:dont:exist with remoteurl https://api.opensuse.org/public
=> "openSUSE.org:I:dont:exist"

Project Links

The OBS project to OBS project links. A project-link is a Project that has a LinkedProject associated. This association points to the project this Project gets its packages from.

Pitfalls

Instantiating a Package will follow project-links by default. That means that the Package object you get might have a different Project associated with it, than the project name you used for instantiation... 🤯

[1] pry(main)> Package.get_by_project_and_name('openSUSE:Factory:Staging:O', 'aaa_base').project.name
=> "openSUSE:Factory:Rings:0-Bootstrap"

You can have more than one project link. In this case the order in which packages are searched is defined by the attribute LinkedProject.position.

The association can point to an local Project object or to a String (see interconnect link)

If you create a Package inside a Project it will supersede the Package from the project-link.

Package Links

The OBS package to OBS package link. A package link is a Package that has a PackageKind with the attribute kind: 'link' associated. This association is created as soon as the package has a file called _link in it's sources. Package links get their sources from the package they link to.

Pitfalls

There is no association between the two package objects. The package it links to might not even be an object on our instance (see interconnect link). There is Package.linkinfo however, this method will tell you the project and name this Package gets its sources from.

If Package has local files, they supersede files from the package-link. This is often called a "branch".

General Pitfalls

In general, combine any of the above OR introduce a cycle (link pointing to link that points back to the link) and it goes

boom

Also as stated above not every feature, class or method you will find will support all of the different link types.

Read the source Luke, good luck!

Clone this wiki locally