Bug 1959363 - Apply a upstream patch to fix load builtin macro parsing error?
Summary: Apply a upstream patch to fix load builtin macro parsing error?
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: rpmlint
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Tom "spot" Callaway
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-05-11 11:30 UTC by Jun Aruga
Modified: 2021-05-18 17:18 UTC (History)
5 users (show)

Fixed In Version: rpmlint-1.11-17.fc35 rpmlint-1.11-17.eln110 rpmlint-1.11-17.fc34
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-05-11 16:31:10 UTC
Type: Bug


Attachments (Terms of Use)

Description Jun Aruga 2021-05-11 11:30:23 UTC
Description of problem:

Is it possible to apply the following patch to the rpmlint RPM package used in Zuul CI [1]? I am not sure which Fedora version is used in the Zuul CI.

Use proper folder _sourcedir for spec files. 
https://github.com/rpm-software-management/rpmlint/commit/aa97267150efa48de0dc77aca6de12ef2fef8fe2

Currently the rpmlint fails to parse a RPM spec file including load builtin macro `%{load:..}`. That blocks Zuul CI's rpmlint check for rpms/ruby [2].

```
$ rpmlint ruby.spec
...
ruby.spec: E: specfile-error error: ruby.spec: line 116: failed to load macro file /tmp/rpmlint.ruby.spec.ydrd1bsm/macros.ruby
ruby.spec: E: specfile-error error: query of specfile ruby.spec failed, can't parse
0 packages and 1 specfiles checked; 3 errors, 4 warnings
```

Thanks!

[1] Zuul CI: https://fedoraproject.org/wiki/Zuul-based-ci
[2] https://src.fedoraproject.org/rpms/ruby/pull-request/86

Comment 1 Jun Aruga 2021-05-11 11:35:23 UTC
> I am not sure which Fedora version is used in the Zuul CI.

I think Fabien (fbo) is a right person to ask about Zuul CI.
https://src.fedoraproject.org/user/fbo

Could you tell me which Fedora's rpmlint RPM package or upstream rpmlint is used for the rpmlint check in Zuul CI?

Comment 2 Todd Zullinger 2021-05-11 14:30:09 UTC
I built a copr with the upstream change backported to 1.11.

Source: https://src.fedoraproject.org/fork/tmz/rpms/rpmlint
COPR: https://copr.fedorainfracloud.org/coprs/tmz/rpmlint/

$ rpmlint ruby.spec
ruby.spec:20: E: use-of-RPM_SOURCE_DIR
ruby.spec:215: W: unversioned-explicit-provides bundled(ccan-build_assert)
ruby.spec:216: W: unversioned-explicit-provides bundled(ccan-check_type)
ruby.spec:217: W: unversioned-explicit-provides bundled(ccan-container_of)
ruby.spec:218: W: unversioned-explicit-provides bundled(ccan-list)
0 packages and 1 specfiles checked; 1 errors, 4 warnings.

It might be good to get some additional testing to ensure I didn't introduce any issues.  I'll file a PR for review.

Comment 4 Fabien Boucher 2021-05-11 15:00:46 UTC
(In reply to Jun Aruga from comment #1)
> > I am not sure which Fedora version is used in the Zuul CI.
> 
> I think Fabien (fbo) is a right person to ask about Zuul CI.
> https://src.fedoraproject.org/user/fbo
> 
> Could you tell me which Fedora's rpmlint RPM package or upstream rpmlint is
> used for the rpmlint check in Zuul CI?

On FZCI we are using Fedora33 container for this job. So using this version rpmlint-1.11-16.fc33.src.rpm.

We can try a new version in the Zuul w/o the change published in the Fedora compose. To do that
open a PR on https://pagure.io/zuul-distro-jobs/blob/master/f/roles/rpm-lint/tasks/main.yaml to
use the copr repo to install rpmlint.

Then on the ruby PR add in the initial message of the PR this line:

Depends-on: https://pagure.io/zuul-distro-jobs/pull-request/16 (I guess you'll get the 16 :)

And hopefully the rpm-linter job should run with the rpmlint from copr.

Comment 5 Jun Aruga 2021-05-11 15:49:35 UTC
(In reply to Todd Zullinger from comment #2)
> I built a copr with the upstream change backported to 1.11.
> ...
> It might be good to get some additional testing to ensure I didn't introduce
> any issues.  I'll file a PR for review.

Thanks! To be precisely, the error does not happen with `%{?load:%{foo}}` on the current rpms/ruby rawhide, because it hides the error. But this syntax does not work on the latest RPM on rawhide any more. The error happens with `%{load:%{foo}}` when applying the following PR to fix the current build FTBFS.
https://src.fedoraproject.org/rpms/ruby/pull-request/86

Here is a minimal reproducer to check the error.
https://github.com/junaruga/report-rpmlint-load

Comment 6 Fedora Update System 2021-05-11 16:31:10 UTC
FEDORA-2021-2cead523fe has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 7 Fedora Update System 2021-05-11 16:37:10 UTC
FEDORA-2021-6b19cf6067 has been pushed to the Fedora ELN stable repository.
If problem still persists, please make note of it in this bug report.

Comment 8 Fedora Update System 2021-05-11 16:39:55 UTC
FEDORA-2021-e9d4b61274 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-e9d4b61274

Comment 9 Todd Zullinger 2021-05-11 17:30:14 UTC
(In reply to Jun Aruga from comment #5)
> Thanks! To be precisely, the error does not happen with `%{?load:%{foo}}` on
> the current rpms/ruby rawhide, because it hides the error. But this syntax
> does not work on the latest RPM on rawhide any more. The error happens with
> `%{load:%{foo}}` when applying the following PR to fix the current build
> FTBFS.
> https://src.fedoraproject.org/rpms/ruby/pull-request/86
> 
> Here is a minimal reproducer to check the error.
> https://github.com/junaruga/report-rpmlint-load

Thanks.  With rpmlint-1.11-17, that passes:

$ rpmlint test.spec
0 packages and 1 specfiles checked; 0 errors, 0 warnings.

(In reply to Fabien Boucher from comment #4)
> On FZCI we are using Fedora33 container for this job. So using this version
> rpmlint-1.11-16.fc33.src.rpm.

I'll push an f33 update as well as the f34 update which very Tom kindly merged, built, and pushed.

Comment 10 Fedora Update System 2021-05-12 07:05:37 UTC
FEDORA-2021-e9d4b61274 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-e9d4b61274`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-e9d4b61274

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 Jun Aruga 2021-05-12 10:29:20 UTC
> I'll push an f33 update as well as the f34 update which very Tom kindly merged, built, and pushed.

Thanks! I appreciate your work!

Comment 12 Jun Aruga 2021-05-12 15:05:18 UTC
@fbo Fabien,
After merging the PR https://src.fedoraproject.org/rpms/ruby/pull-request/86 to rawhide, I executed the Zuul CI for another PR. Then I see the parsing error by rpmlint is gone. Did you already fix it on Zuul CI, right?
https://src.fedoraproject.org/rpms/ruby/pull-request/85#comment-74696

Comment 13 Jun Aruga 2021-05-12 21:50:10 UTC
Fabien, I have a suggestion. Could you print the rpmlint RPM version and/or `rpmlint --version` on the Zuul CI?

Note the rpmlint 2.0 will come soon on the upstream with breaking changes. It seems the rpmlint 2.0 prints the version in the result. But printing version by `rpmlint --version` is still useful.

I tested on the latest master `c25c5eacf8122bdc92ba2f481e42d46803b11906` in the upstream rpmlint: https://github.com/rpm-software-management/rpmlint.git . And I detected new errors/warnings.

```
(venv) $ rpmlint --version
2.0.0

(venv) $ rpmlint --file ruby.rpmlintrc ruby.spec
usage: rpmlint [-h] [-V] [-c CONFIG] [-e EXPLAIN [EXPLAIN ...]] [-r RPMLINTRC] [-v] [-p]
               [-i INSTALLED [INSTALLED ...]] [-t] [-T] [-s | -P]
               [rpmfile ...]

(venv) $ rpmlint -r ruby.rpmlintrc ruby.spec
======================================== rpmlint session starts ========================================
rpmlint: 2.0.0
configuration:
    /home/jaruga/git/rpmlint/venv/lib64/python3.9/site-packages/rpmlint/configdefaults.toml
rpmlintrc: ruby.rpmlintrc
checks: 26, packages: 1

ruby.spec: W: no-cleaning-of-buildroot %clean
ruby.spec: W: no-buildroot-tag
ruby.spec: E: lib-package-without-%mklibname
========= 0 packages and 1 specfiles checked; 1 errors, 2 warnings, 1 badness; has taken 0.1 s =========
```

Comment 14 Todd Zullinger 2021-05-12 22:44:18 UTC
It's probably best if we don't get too off-topic here with rpmlint-2.0 discussion. :)

But I believe the new error/warnings you saw would be ignored if you passed `-c $PATH_TO_RPMLINT_2.0/configs/Fedora` to rpmlint.

Comment 15 Fedora Update System 2021-05-13 01:04:48 UTC
FEDORA-2021-e9d4b61274 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 16 Jun Aruga 2021-05-13 05:36:20 UTC
> It's probably best if we don't get too off-topic here with rpmlint-2.0 discussion. :)

Todd, you are right. This ticket is for the topic "load builtin macro parsing error". Sorry about that. Thanks for the info about ignoring the error/warnings. Let's talk somewhere else if we need to talk off-topic.

Comment 17 Jun Aruga 2021-05-18 17:18:54 UTC
Fabien (fbo), we see the following rpmlint errors happening again on Zuul CI. I thought Zuul CI is using the patched version of rpmlint.

https://src.fedoraproject.org/rpms/ruby/pull-request/85#comment-75478

```
./ruby.spec: E: specfile-error error: ./ruby.spec: line 116: failed to load macro file /tmp/rpmlint.ruby.spec.hie40014/macros.ruby
./ruby.spec: E: specfile-error error: query of specfile ./ruby.spec failed, can't parse
```


Note You need to log in before you can comment on or make changes to this bug.