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

Handle %() command expansion #60

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

willmurnane
Copy link

Spec files can include shell commands inline in macros, so that something like:

Release: %(echo foo)

translates to the same thing as:

Release: foo

This commit also includes changes to the way tags are defined, so that things that rpmbuild doesn't treat as space-delimited are also not treated as space-delimited. Without this change, e.g. the Release tag defined above is treated as Release: $(echo which obviously doesn't evaluate correctly.

@bkircher
Copy link
Owner

Hey ho. Sorry for letting this unanswered for so long.

Two things

  1. I feel a bit uneasy of adding subprocess.run to this library. I wouldn't want a parser execute stuff on my machine based on a spec file or string I pass to it. What do you think?
  2. I like the white space changes. Do you think you can split them out into a separate PR?

@willmurnane
Copy link
Author

  1. Yeah, I can at least see the value in making a flag to turn this on or off. Rpmbuild does execute subshells, though, and to accurately mimic its behavior one must follow suit.
  2. Do you mean the regexes matching until end of line? Sure, I can split those out.
  3. This version doesn’t work in some edge cases. I should be able to push up the fixed version pretty soon, which works on the whole corpus of spec files that I have to deal with.

@bkircher
Copy link
Owner

  • Yeah, I can at least see the value in making a flag to turn this on or off. Rpmbuild does execute subshells, though, and to accurately mimic its behavior one must follow suit.

OK for me as long as the default is off.

  • Do you mean the regexes matching until end of line? Sure, I can split those out.

Yes. That would be nice.

  • This version doesn’t work in some edge cases. I should be able to push up the fixed version pretty soon, which works on the whole corpus of spec files that I have to deal with.

👍 Many thanks!

@bkircher bkircher added the stale label Feb 17, 2024
@bkircher bkircher self-assigned this Feb 17, 2024
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.

2 participants