#10852 %dist is not set correctly on `epel9-next-build`
Closed: Fixed a month ago by churchyard. Opened 2 years ago by gotmax23.

  • Describe the issue
    On el9, %dist is set to %{!?distprefix0:%{?distprefix}}%{expand:%{lua:for i=0,9999 do print("%{?distprefix" .. i .."}") end}}.el9%{?with_bootstrap:~bootstrap} in /usr/lib/rpm/macros.d/macros.dist, just like it is in Fedora. However, the epel9-next-build tag completely overrides this to .el9.next instead of of simply appending .next. This breaks the forge macros, the go macros (and other macros that depend on the forge macros or otherwise rely on %distprefix), and the %bcond_without bootstrap behavior.
  • When do you need this? (YYYY/MM/DD)
    Not really time constrained
  • When is this no longer needed or useful? (YYYY/MM/DD)
    When c9s and thus epel9-next are EOL'd
  • If we cannot complete your request, what is the impact?
    NEVR collisions and update issues will occur. Packagers will be confused.

Metadata Update from @zlopez:
- Issue tagged with: medium-gain, medium-trouble, ops

2 years ago

Any ideas where this is coming from @carlwgeorge ?

Metadata Update from @humaton:
- Issue untagged with: medium-gain, medium-trouble, ops

2 years ago

Metadata Update from @humaton:
- Issue tagged with: medium-gain, medium-trouble

2 years ago

We discussed this at today's release engineering meeting. The only solution that we find is to create epel9-next-release.rpm that would carry correct macros. There may be a different solution that we are missing.

Currently this is set in the koji tag, where I am pretty sure we can't use macros. ;(

What if we add %{?distsuffix} to the %dist definition and define that in koji instead of %dist?

The only solution that we find is to create epel9-next-release.rpm that would carry correct macros.

We already have epel-next-release and epel-rpm-macros. We could override %dist in one of those as long as the file name sorts after macros.dist in %{_rpmmacrodir}.

What if we add %{?distsuffix} to the %dist definition and define that in koji instead of %dist?

That should work. I assume we would override %dist to include %{?distsuffix} in one of the aforementioned packages? Currently, it is defined in redhat-release / centos-release / ${rebuild}-release.

Currently this is set in the koji tag, where I am pretty sure we can't use macros. ;(

FWIW, mock-core-configs has

$ rg '%dist.*%'                                                           
templates/opensuse-tumbleweed.tpl
6:config_opts['macros']['%dist'] = '.suse.tw%(sh -c ". /etc/os-release; echo \$VERSION_ID")'

which has a macro within the %dist macro. I'm not sure how/if this translates to koji

What if we add %{?distsuffix} to the %dist definition and define that in koji instead of %dist?

That should work. I assume we would override %dist to include %{?distsuffix} in one of the aforementioned packages? Currently, it is defined in redhat-release / centos-release / ${rebuild}-release.

My idea was to add this to the source in c9s and RHEL.

My idea was to add this to the source in c9s and RHEL.

I've submitted https://gitlab.com/redhat/centos-stream/rpms/centos-release/-/merge_requests/30. I tried to make a case for why this is generally applicable instead of just saying, "this breaks EPEL; please fix it." I suppose we can override it in EPEL if they don't accept it.

So, I guess that MR is just still waiting?

Yes, it is. I'll ping them again.

Currently this is set in the koji tag, where I am pretty sure we can't use macros. ;(

What are you talking about? Of course you can. That's been possible since Koji 1.18. We use this for ELN right now.

Don't bother adjusting centos-release. Just set the %dist macro override in the epel9-next build tag. We do this in ELN, which @sgallagh and @mohanboddu did and can help replicate this for EPEL Next.

$ koji taginfo eln-build
Tag: eln-build [22493]
Arches: i686 x86_64 aarch64 ppc64le s390x
Groups: appliance-build, build, livecd-build, livemedia-build, srpm-build
Tag options:
  mock.new_chroot : 0          [f37]
  mock.package_manager : 'dnf' [f37]
  rpm.macro.dist : ('%{!?distprefix0:%{?distprefix}}%{expand:%{lua:for i=0,9999 do '
 'print("%{?distprefix" .. i .."}") '
 'end}}.eln%{eln}%{?with_bootstrap:~bootstrap}')
  rpm.macro.eln : 121
  rpm.macro.rhel : 10
This tag is a buildroot for one or more targets
Current repo: repo#4729897: 2022-07-27 15:01:35.132131+00:00
Targets that build from this tag:
  eln-rebuild
  eln
  eln-candidate
Inheritance:
  0    .... eln [22492]
  5    .... f37-build [50468]

To be clear the reason I didn't want to set this is the koji docs say:

"We do not recommend setting complicated macros in this way. E.g. macros that contain complex expansions, or those that are central to the rpmbuild process."

but sure, we can I guess. It seems the upstream MR was merged tho, so perhaps this is moot now?

It looks like the best way to solve this now with that MR in place is to set distsuffix instead of overriding dist in the tag. It works as expected with the rpm command.

root@c9-container:~# rpm -D 'distsuffix .next' -E '%dist'
.el9.next

I tried to test this in staging koji, but it looks like I no longer have permissions there. If someone gives me that permission again, I can test out removing rpm.macro.dist and adding rpm.macro.distsuffix onto the epel9-next-build tag.

At the releng meeting today @humaton granted me admin in staging koji again, so I was able to test this out. I ran the following commands.

stg-koji edit-tag -r rpm.macro.dist epel9-next-build
stg-koji edit-tag -x rpm.macro.distsuffix=.next epel9-next-build
stg-koji build --scratch epel9-next xpanes-4.1.3-4.el9.src.rpm

The scratch build worked as expected and the resulting RPM had a release field containing .el9.next. Once an admin in production koji runs the equivalent commands this can be closed as completed.

This is still an problem. Could someone on the releng team run these commands to correct the tag in production koji?

koji edit-tag -r rpm.macro.dist epel9-next-build
koji edit-tag -x rpm.macro.distsuffix=.next epel9-next-build

Not on the team, but tried it out anyway:

$ koji edit-tag -r rpm.macro.dist epel9-next-build
$ koji edit-tag -x rpm.macro.distsuffix=.next epel9-next-build
$ koji taginfo epel9-next-build
Tag: epel9-next-build [45736]
Arches: aarch64 ppc64le s390x x86_64
Groups: build, srpm-build
Tag options:
  rpm.macro.distsuffix : '.next'
This tag is a buildroot for one or more targets
Current repo: repo#5761870: 2024-01-24 13:31:55.020992+00:00
Targets that build from this tag:
  epel9-next
  epel9-next-candidate
Inheritance:
  10   .... epel9-next-override [45735]
  20   .... epel9-next-base [45734]

Metadata Update from @churchyard:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

a month ago

Login to comment on this ticket.

Metadata