copr icon indicating copy to clipboard operation
copr copied to clipboard

Build package by Dist-Git doesnt't store the dist-git source

Open loise-nolden opened this issue 11 months ago • 6 comments

When building a package by initially setting the build options (not stored as a package yet), the dist-git source can be selected (fedora, centos, centos-stream etc.) and the build proceeds.

Looking after the settings in the "Packages" section afterwards:

Default Build Source

Source Type: Build from DistGit Distgit: centos-stream Committish: c10s Clone_Url: https://gitlab.com/redhat/centos-stream/rpms/rubygem-asciidoctor.git

The Distgit: section is not stored when initiated through a build and is therefore re-set to "fedora". I have to manually go into the packages option and set the distgit for the default build again.

Steps to reproduce:

  1. create a copr repo with centos-stream-10 as the build environment
  2. build the above package with the according settings
  3. check the package in the "Packages" section, the Distgit is missing now.

loise-nolden avatar Jan 29 '25 12:01 loise-nolden

Mind that the problem actually resets the dist-git source to fedora so the fedora git and branch is used instead of the centos-stream git and branch, thus resulting in a rebuild that doesn't work at all, so I currently need to manually set this in the packages through editing the settings (or start by creating the package first)

loise-nolden avatar Jan 29 '25 13:01 loise-nolden

~~Yeah, the thing is ... we need to run this "generate srpm" tasks on F41+, otherwise we fail to build newer RPMs. But we now fail to build older RPMs. This is very unfortunate. My hope was that we could avoid building SRPMs at all, and stop parsing the specfile at this stage -> though then we doen't support %autochangelog and %autorelease, more info in https://github.com/release-engineering/dist-git/pull/72 and https://github.com/fedora-infra/rpmautospec/issues/211~~ This was meant to be for #3610

praiskup avatar Jan 29 '25 17:01 praiskup

So the problem is that dist-git settings is not inherited from the initial build right? But when you configure the distgit option (package edit), then you are not able to re-set the dist-git configuration via additional build. Is that correct?

praiskup avatar Jan 29 '25 17:01 praiskup

So the problem is that dist-git settings is not inherited from the initial build right? But when you configure the distgit option (package edit), then you are not able to re-set the dist-git configuration via additional build. Is that correct?

yes and no :) I'll describe what I did:

1.st way: start a build from scratch, select dist-git, there enter package name, and enter centos-stream as source, c10s as the branch (commitish). Start the build, build picks up the right git repo as advertised and everything works ok.

  1. when the build is finished, click on Packages and select the package and do a rebuild (or rebuild all)

  2. The package build gets started, but picks up the wrong git repo, instead of the correct one from centos-stream it picks it up src.fedoraproject.org, where there is no c10s branch -> build fails, wrong repo

The source of the problem is, the 1st step stored: dist-git option, branch and the repo it found out, but it didn't store the dist-git source, so it always defaults to fedora as the dist-git source.

That can be manually corrected by editing the package options and change the source from fedora to centos-stream.

Save the package options, do a rebuild from packages page, now everything works as expected.

So the error is not, that it wouldn't work in general but that the easy way to start a build, enter all options, build works, but doesn't store the dist-git source correctly prevents the right rebuilding of the package due to the wrong dist-git source.

I manually changed all my packages and to save the steps of correction in the meantime start packaging by creating a new package in the repo first and store all options and press save, then do a rebuild from there.

Do you now understand the problem ? :)

BR Loise

Thanks for taking care of my issues :)

loise-nolden avatar Jan 29 '25 17:01 loise-nolden

Do you now understand the problem ? :)

Yes, I easily reproduced this here. The package info is correctly stored in Database, but the web-UI html form isn't appropriately pre-selecting the right DistGit instance for "rebuild" button. Thank you for the detailed info!

This a frontend bug, if you want a work-around, you can do this in command-line: copr build-package <project-name> --name <package-name>

praiskup avatar Feb 07 '25 17:02 praiskup

coprdb=# select * from package where copr_id = 23722 and name = 'ksh';
┌─────────┬──────┬─────────────┬─────────────────────────────────────────────────────────────────────────────────────────────┬─────────┬────────────┬─────────────────┬─────────────────────┬────────────┬─────────┐
│   id    │ name │ source_type │                                         source_json                                         │ copr_id │ enable_net │ webhook_rebuild │ chroot_denylist_raw │ max_builds │ timeout │
├─────────┼──────┼─────────────┼─────────────────────────────────────────────────────────────────────────────────────────────┼─────────┼────────────┼─────────────────┼─────────────────────┼────────────┼─────────┤
│ 2731510 │ ksh  │          10 │ {"clone_url": "https://gitlab.com/redhat/centos-stream/rpms/ksh.git", "committish": "c10s"} │   23722 │ f          │ f               │                     │            │         │
└─────────┴──────┴─────────────┴─────────────────────────────────────────────────────────────────────────────────────────────┴─────────┴────────────┴─────────────────┴─────────────────────┴────────────┴─────────┘
(1 row)

coprdb=# select * from dist_git_instance; 
┌────┬───────────────┬────────────────────────────────────────────────┬─────────────────────────────────────────┬──────────┬───────────────────┐
│ id │     name      │                   clone_url                    │            clone_package_uri            │ priority │ default_namespace │
├────┼───────────────┼────────────────────────────────────────────────┼─────────────────────────────────────────┼──────────┼───────────────────┤
│  3 │ copr          │ https://copr-dist-git.fedorainfracloud.org     │ git/{namespace}/{pkgname}.git           │       70 │                   │
│  4 │ copr-dev      │ https://copr-dist-git-dev.fedorainfracloud.org │ git/{namespace}/{pkgname}.git           │       10 │                   │
│  1 │ fedora        │ https://src.fedoraproject.org                  │ {namespace}/rpms/{pkgname}.git          │      100 │                   │
│  2 │ centos        │ https://git.centos.org                         │ {namespace}/rpms/{pkgname}.git          │       80 │                   │
│  5 │ centos-stream │ https://gitlab.com                             │ redhat/centos-stream/rpms/{pkgname}.git │       75 │                   │
└────┴───────────────┴────────────────────────────────────────────────┴─────────────────────────────────────────┴──────────┴───────────────────┘
(5 rows)

The problem is that we only store the clone URL address, not the whole dist-git instance info. And it is not trivial to deduct the DistGit option from git clone URL, well - at least not easy without the dist-git-client code (which is not designed for web-UI).

praiskup avatar Feb 07 '25 17:02 praiskup