Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot parse %shrink #410

Closed
2 tasks
xsuchy opened this issue Sep 8, 2024 · 2 comments · Fixed by #412
Closed
2 tasks

Cannot parse %shrink #410

xsuchy opened this issue Sep 8, 2024 · 2 comments · Fixed by #412
Assignees
Labels
area/fedora Related to Fedora ecosystem complexity/single-task Regular task, should be done within days. gain/high This brings a lot of value to (not strictly a lot of) users. impact/low This issue impacts only a few users. kind/bug Something isn't working.

Comments

@xsuchy
Copy link
Contributor

xsuchy commented Sep 8, 2024

What happened? What is the problem?

Package python-graph-tool has this lines in a spec file:

License:        %{shrink:
                LGPL-3.0-or-later AND
                BSL-1.0 AND
                BSD-3-Clause AND
                GPL-3.0-or-later AND
                MIT AND
                (MIT OR Apache-2.0)
                }

Then I try to print the license tag using https://pagure.io/copr/license-validate/blob/main/f/print-spec-license.py

I get:

$ ./print-spec-license.py rpm-specs/python-graph-tool.spec
%{shrink:
LGPL-3.0-or-later AND BSL-1.0

What did you expect to happen?

No response

Example URL(s)

No response

Steps to reproduce

1.
2.
3.

Workaround

  • There is an existing workaround that can be used until this issue is fixed.

Participation

  • I am willing to submit a pull request for this issue. (Packit team is happy to help!)
@xsuchy xsuchy added the kind/bug Something isn't working. label Sep 8, 2024
@gotmax23
Copy link
Contributor

gotmax23 commented Sep 8, 2024

The code to parse tags apparently uses a regex that assumes tags are one line and doesn't account for multi-line macros. Your script should probably use the expanded_value property instead of value. License tags can have macros and other expansions that should be evaluated. In this case, it would loudly fail because of the parser issue, but otherwise, it would do the right thing.

@majamassarini majamassarini added area/fedora Related to Fedora ecosystem complexity/single-task Regular task, should be done within days. gain/high This brings a lot of value to (not strictly a lot of) users. impact/low This issue impacts only a few users. labels Sep 9, 2024
@gotmax23
Copy link
Contributor

gotmax23 commented Sep 24, 2024

For what it's worth:

$ wget "https://src.fedoraproject.org/lookaside/rpm-specs-latest.tar.xz"
$ tar xf rpm-specs-latest.tar.xz
$ rg 'License:.*%\{shrink' -l rpm-specs | wc -l
19

@nforro nforro self-assigned this Sep 26, 2024
softwarefactory-project-zuul bot added a commit that referenced this issue Sep 26, 2024
Handle multi-line tag values

Fixes #410.
RELEASE NOTES BEGIN
specfile can now handle multi-line tag values (enclosed in a macro body, e.g. %shrink).
RELEASE NOTES END

Reviewed-by: Maja Massarini
Reviewed-by: Nikola Forró
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/fedora Related to Fedora ecosystem complexity/single-task Regular task, should be done within days. gain/high This brings a lot of value to (not strictly a lot of) users. impact/low This issue impacts only a few users. kind/bug Something isn't working.
Projects
Status: done
Development

Successfully merging a pull request may close this issue.

4 participants