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

Make "rpmspec -q --srpm foo.spec" say .src, not .%{arch} #1116

Conversation

vathpela
Copy link
Contributor

I noticed that "rpmspec -q --srpm foo.spec" winds up getting evaluated
as the arch that you're running it on, which I expected, but also that
the arch winds up in the output, which I did not. I asked a pile of
other people and they were all surprised by this as well.

This patch changes "rpmspec -q --srpm foo.spec" to show "src", like the
package generated by "rpmbuild -bs" would be named, instead of the local
machine's arch.

Signed-off-by: Peter Jones pjones@redhat.com

@mlschroe
Copy link
Contributor

What about nosrc packages?

@vathpela vathpela force-pushed the make-rpmspec-q-srpm-behave-as-expected branch from 01bdae8 to 72d0d65 Compare March 12, 2020 14:44
@vathpela
Copy link
Contributor Author

What about nosrc packages?

It's a bit harder to do well, as "rpmspec -q" goes through rpmcliQuery(), which doesn't parse the spec file, and rpmspec.c doesn't know about rpmSpec internals, so can't access spec->noSource without including rpmbuild_internals.h, but I've pushed an updated patch to do that.

@pmatilai
Copy link
Member

Having rpmspec default query match with what rpmbuild produces seems like a nice idea, the implementation is what I have some issues with, primarily that the new default is a magic internal behavior that you can't use it in other queries. I think this belongs to a tag extension, RPMTAG_PKGNEVRA or something like that.

Including or otherwise using stuff from build/ in lib/ is not okay, but you don't need access to spec struct for that, look for RPMTAG_NOSOURCE in the header, it should be populated at that point. And if it's not, maybe we can change that.

@pmatilai pmatilai added the RFE label Mar 13, 2020
I noticed that "rpmspec -q --srpm foo.spec" winds up getting evaluated
as the arch that you're running it on, which I expected, but also that
the arch winds up in the output, which I did not.  I asked a pile of
other people and they were all surprised by this as well.

This patch changes "rpmspec -q --srpm foo.spec" to show "src", like the
package generated by "rpmbuild -bs" would be named, instead of the local
machine's arch.

This is implemented by defining two new tags, RPMTAG_NVRS and
RPMTAG_NEVRS and their corresponding query tags "{nvrs} and %{nevrs},
which produce a string with "src" or "nosrc" rather than the build
target architecture.  By default "rpmspec -q --srpm" uses %{nvrs}, just
as "rpmspec -q" uses %{nvra}.

v2 - handle nosrc as well
v3 - make this be done with tags

Signed-off-by: Peter Jones <pjones@redhat.com>
@vathpela vathpela force-pushed the make-rpmspec-q-srpm-behave-as-expected branch from 72d0d65 to 5fa11af Compare March 17, 2020 20:51
@ffesti
Copy link
Contributor

ffesti commented Mar 19, 2020

The new tags need to be added in tests/rpmgeneral.at. The change trips up a few more test cases:
https://semaphoreci.com/rpm-ecosystem/rpm/branches/pull-request-1116/builds/3 > view more > open "Fedora Latest" at very bottom > open "docker run -t rpm" > scroll to the very end - or run the test suite locally with make check (Sorry for the inconvenience!)

@pmatilai
Copy link
Member

Yup. This is certainly in the right direction, but what I meant is using the same extension for both binary and source packages (the code seems to support it here already), and for that the NVRS name seems strange.

@ffesti
Copy link
Contributor

ffesti commented Feb 21, 2022

merged as #1923

@ffesti ffesti closed this Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants