openSUSE / obs-service-tar_scm

An OBS source service: fetches code from any SCM and archives it
GNU General Public License v2.0
31 stars 105 forks source link

Support different scm repository name in case of forks #448

Closed perlpunk closed 1 year ago

perlpunk commented 2 years ago

For example, our openQA repo was forked under a different name, and a pull request was made. I reproduced the scenario, here with my fork github fork perlpunk/openQA-testfork2. https://build.opensuse.org/package/show/home:tinita:branches:devel:openQA-fork/openQA

As a result the obscpio and tarfile are called openQA-testfork2-version, but rpm later needs openQA-version:

Compressed openQA-testfork2-4.6.1657126281.2283b77.tar to openQA-testfork2-4.6.1657126281.2283b77.tar.xz

[   60s] + exec rpmbuild -ba --define '_srcdefattr (-,root,root)' --nosignature --define '_build_create_debug 1' --define 'disturl obs://build.opensuse.org/home:tinita:branches:devel:openQA-fork/openSUSE_Factory/0ceace1caeb2c6467ed6327406599a5f-openQA' /home/abuild/rpmbuild/SOURCES/openQA.spec
[   60s] error: Bad source: /home/abuild/rpmbuild/SOURCES/openQA-4.6.1657126281.2283b77.tar.xz: No such file or directory

The documentation says: https://openbuildservice.org/help/manuals/obs-user-guide/cha.obs.scm_ci_workflow_integration.html

Under the %prep directive, you might have to update the %setup directive if your source package name doesn't match the name of your SCM repository. Here's how, with my_package being the SCM repository name:

%prep
  %setup -q -n my_package-%version

But we actually need the opposite. The name of the forked repository should not influence the tarball name.

Is there a way to do this? I couldn't find anything in the service documentation about that.

M0ses commented 1 year ago

The 'filename' option should do exactly what you try to achieve:

https://github.com/openSUSE/obs-service-tar_scm/blob/master/tar_scm.service.in#L151

@perlpunk Please feel free to PM me if you have further questions