#1874 Prepare rpmbuild for rpkg 3.0 (present in f35)
Merged 2 years ago by praiskup. Opened 2 years ago by clime.
copr/ clime/copr main  into  main

@@ -641,7 +641,7 @@ 

      <div class="panel-body">

        <div class="list-group" style="margin-bottom: 0px">

          {% set srpm_build_methods = [

-         ('rpkg', 'rpkg', 'Uses <a href="https://pagure.io/rpkg-client">rpkg</a> utility to build an srpm. Supports unpacked (plain sources + .spec) as well as packed (tarballs + patches + .spec) content.'),

+         ('rpkg', 'rpkg', 'Uses <a href="https://pagure.io/rpkg-util">rpkg</a> utility to build an srpm. Supports unpacked (plain sources + .spec) as well as packed (tarballs + patches + .spec) content.'),

          ('tito', 'tito', 'This method can be used for projects that are managed with <a href="https://github.com/dgoodwin/tito">Tito</a> packaging tool.'),

          ('tito test', 'tito_test', 'Same as previous Tito method, but passes <code>--test</code> parameter to use current branch HEAD instead of the last package tag. Also extends Release of the built package with Git versioning information.'),

          ('make srpm', 'make_srpm', 'This method allows unlimited customization. You need to provide .copr/Makefile with srpm target in your project and this target will be invoked inside a mock chroot to build the srpm. You can read more <a href="https://docs.pagure.org/copr.copr/user_documentation.html#make-srpm">here</a>.'),

file modified
+14 -10
@@ -11,8 +11,12 @@ 

  enabled_source_protocols = https ftps

  

  # DistGit fallback, when no distgitX section below is usable.

- distgit_lookaside_url = {scheme}://{netloc}/repo/pkgs/%(ns1)s/%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

- distgit_clone_url = {scheme}://{netloc}/%(module)s

+ distgit_lookaside_url = {scheme}://{netloc}/repo/pkgs/%(repo_path)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

+ distgit_clone_url = {scheme}://{netloc}/%(repo_path)s

+ 

+ # The above is a rpkg 3.0+ configuration pattern. If you run against an older version, please use the following:

+ #distgit_lookaside_url = {scheme}://{netloc}/repo/pkgs/%(ns1)s/%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

+ #distgit_clone_url = {scheme}://{netloc}/%(module)s

  

  # The final %vendor would be e.g. "Fedora Copr - group @copr"

  #rpm_vendor_copr_name = Fedora Copr
@@ -41,20 +45,20 @@ 

  

  [distgit0]

  distgit_hostname_pattern = src.fedoraproject.org

- distgit_lookaside_url = https://src.fedoraproject.org/repo/pkgs/%(ns1)s/%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

- distgit_clone_url = https://src.fedoraproject.org/%(module)s

+ distgit_lookaside_url = https://src.fedoraproject.org/repo/pkgs/%(repo_path)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

+ distgit_clone_url = https://src.fedoraproject.org/%(repo_path)s

  

  [distgit1]

  distgit_hostname_pattern = copr-dist-git.fedorainfracloud.org

- distgit_lookaside_url = http://copr-dist-git.fedorainfracloud.org/repo/pkgs/%(ns2)s/%(ns1)s/%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

- distgit_clone_url = http://copr-dist-git.fedorainfracloud.org/git/%(module)s

+ distgit_lookaside_url = http://copr-dist-git.fedorainfracloud.org/repo/pkgs/%(repo_path)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

+ distgit_clone_url = http://copr-dist-git.fedorainfracloud.org/git/%(repo_path)s

  

  [distgit2]

  distgit_hostname_pattern = pkgs.fedoraproject.org

- distgit_lookaside_url = https://src.fedoraproject.org/repo/pkgs/%(ns1)s/%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

- distgit_clone_url = git://pkgs.fedoraproject.org/%(module)s

+ distgit_lookaside_url = https://src.fedoraproject.org/repo/pkgs/%(repo_path)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

+ distgit_clone_url = git://pkgs.fedoraproject.org/%(repo_path)s

  

  [distgit3]

  distgit_hostname_pattern = src.stg.fedoraproject.org

- distgit_lookaside_url = https://src.stg.fedoraproject.org/repo/pkgs/%(ns1)s/%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

- distgit_clone_url = https://src.stg.fedoraproject.org/%(module)s

+ distgit_lookaside_url = https://src.stg.fedoraproject.org/repo/pkgs/%(repo_path)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

+ distgit_clone_url = https://src.stg.fedoraproject.org/%(repo_path)s

file modified
+4 -4
@@ -1,8 +1,8 @@ 

  [rpkg]

  preprocess_spec = True

- # auto-packing is deprecated:

- auto_pack = True

  

  [git]

- lookaside = {{ lookaside_url }}

- anongiturl = {{ clone_url }}

+ anon_clone_url = {{ clone_url }}

+ 

+ [lookaside]

+ download_url = {{ lookaside_url }}

Hello,

here I updated generated rpkg config to be compatbile with rpkg-3.0.

Also includes link update to https://pagure.io/rpkg-util in scm build form (just a small detail).

Build succeeded.

Thank you @clime! Does this mean that copr-rpmbuild should Require rpkg >= 3?

Thank you @clime! Does this mean that copr-rpmbuild should Require rpkg >= 3?

Yes, that's right, I have added it to spec file. There seems to be also some Recommends clause, which is probably not needed?

1 new commit added

  • rpmbuild: add explicit requires for rpkg-3.0
2 years ago

Build succeeded.

Build succeeded.

Wait ... currently, all our builders (RH internal and public) run on Fedora 34, so we
basically can't merge this and risk an early release, am I right?

We should either merge this once we are sure we don't run on F34 or older,
or we should come up with a fix for both rhpkg versions. Would that be possible?

Wait ... currently, all our builders (RH internal and public) run on Fedora 34, so we
basically can't merge this and risk an early release, am I right?

We should either merge this once we are sure we don't run on F34 or older,
or we should come up with a fix for both rhpkg versions. Would that be possible?

Yes, you are correct. The changes are specific for f35 only. Would it be possible to prep new release with this only when switching to f35 builders? If not or it would be way too complicated for you, I will try to look at some options to support f34 and f35 builders at the same time :)

Would you mind changing this to the following?

%if 0%{?fedora} >= 35
Requires: rpkg >= 3.0
%else
Requires: rpkg
%endif

We replace the configuration by ansible anyways, and merging the stuff as-is would cause installation problems... (as 3.0 is not in f34).

It would be nice to have a comment like

# This is a rpkg 3.0+ configuration pattern.  If you run against an older
# version, please use the following:
#distgit_lookaside_url = {scheme}://{netloc}/repo/pkgs/%(ns1)s/%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s
#distgit_clone_url = {scheme}://{netloc}/%(module)s

Otherwise, I like this, thank you.

Would you mind changing this to the following?

%if 0%{?fedora} >= 35
Requires: rpkg >= 3.0
%else
Requires: rpkg
%endif

We replace the configuration by ansible anyways, and merging the stuff as-is would cause installation problems... (as 3.0 is not in f34).

I can but I don't think this itself will resolve the problem unless copr-rpmbuild is able to cope with both rpkg versions (i.e. generate different config for version 2 and different for version 3 - note that the substitutions are different, it's not only about the input template).

Another available option is just to install rpkg 3.0 to the fedora 34 builders at some point and update copr-rpmbuild too at the same time with this patch.

Btw. by replacing the rpkg.conf.j2 template by the ansible one (https://pagure.io/fedora-infra/ansible/blob/main/f/roles/copr/backend/templates/provision/rpkg.conf.j2), some functionality is lost, namely ability to download sources from other dist-gits than src.fp.o.

I can but I don't think this itself will resolve the problem unless
copr-rpmbuild is able to cope with both rpkg versions (i.e. generate different
config for version 2 and different for version 3

But fortunately, we have complete control over this (we know what Fedora
version we run on, and we generate the config file). So the switch from rpkg 2
to 3 should be doable if and only if we decided. We should have enough time to
test the new deployment, etc.

note that the substitutions are different, it's not only about the input
template).

Can you give us a bit more info on this?

Btw. by replacing the rpkg.conf.j2 template by the ansible one
(https://pagure.io/fedora-infra/ansible/blob/main/f/roles/copr/backend/templates/provision/rpkg.conf.j2),
some functionality is lost, namely ability to download sources from other
dist-gits than src.fp.o.

I guess you mean, "functionality would be lost with RPKG v3". But we are still
on F34. Can you give an example with non-src.fp.o distgit? Perhaps you mean
some usecase we use the copr-distgit-client script for already?

I'm asking once more to be 100% sure about this; is RPKG v3 a material for
Fedora 35 only, or do you plan to ship it in F34, too at some point?

I can but I don't think this itself will resolve the problem unless
copr-rpmbuild is able to cope with both rpkg versions (i.e. generate different
config for version 2 and different for version 3

But fortunately, we have complete control over this (we know what Fedora
version we run on, and we generate the config file). So the switch from rpkg 2
to 3 should be doable if and only if we decided. We should have enough time to
test the new deployment, etc.

note that the substitutions are different, it's not only about the input
template).

Can you give us a bit more info on this?

Sorry, I meant that you not only need up-to-date rpkg.conf.j2 but also rpmbuild/main.ini for correct compatibility (both files are updated in this commit). These files need to be different for v2 and different for v3.

Btw. by replacing the rpkg.conf.j2 template by the ansible one
(https://pagure.io/fedora-infra/ansible/blob/main/f/roles/copr/backend/templates/provision/rpkg.conf.j2),
some functionality is lost, namely ability to download sources from other
dist-gits than src.fp.o.

I guess you mean, "functionality would be lost with RPKG v3".

It's already being lost now with rpkg v2. It used to be possible to use SCM method for copr-dist-git: https://pagure.io/copr/copr/blob/main/f/rpmbuild/main.ini#_47 but now it's not the case when rpmbuild/rpkg.conf.j2 file is not being used.

But we are still
on F34. Can you give an example with non-src.fp.o distgit?

copr-dist-git. Also there used to be src.stg.fp.o.

Perhaps you mean
some usecase we use the copr-distgit-client script for already?

I'm asking once more to be 100% sure about this; is RPKG v3 a material for
Fedora 35 only, or do you plan to ship it in F34, too at some point?

No I don't plan it that but it is available for f34 e.g. here: https://copr.fedorainfracloud.org/coprs/clime/rpkg-util/build/2333148/. Or I think it would be possible to use a koji build for f35.

2 new commits added

  • rpmbuild: add comment into main.ini about (old) rpkg v2 dist-git configuration
  • rpmbuild: add forgotten substitutions in main.ini for rpkg v3
2 years ago

It's already being lost now with rpkg v2. It used to be possible to use SCM method for copr-dist-git: https://pagure.io/copr/copr/blob/main/f/rpmbuild/main.ini#_47

Btw. I forgot about this part of main.ini config before. Now I fixed that part as well. I have also added the comment you have suggested :).

Build succeeded.

Ok, I like the changes, but I don't think we can merge the non-conditional Requires: rpkg >= 3.0. Can you just keep the non-versioned requirement, or add there the %if 0%{?fedora} >= 35 condition? Can you also squash the commits?

rebased onto 8b128471a962bf1de190cd4d42098804a6bdbae5

2 years ago

Ok, I like the changes, but I don't think we can merge the non-conditional Requires: rpkg >= 3.0. Can you just keep the non-versioned requirement, or add there the %if 0%{?fedora} >= 35 condition? Can you also squash the commits?

Ok, done.

Build succeeded.

rebased onto ad8834a

2 years ago

Build succeeded.

Pull-Request has been merged by praiskup

2 years ago