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

Add deprecated %apply_patch, provide an alternative #1668

Conversation

hroncok
Copy link
Contributor

@hroncok hroncok commented Apr 30, 2021

This is how I'd deal with the removal of %apply_patch.

I opened it as draft, because I have not tested the implementation yet, it also needs tests and documentation. But before I dive into that, I'd like to know if this is acceptable.

@hroncok hroncok force-pushed the apply_patch_deprecation branch 6 times, most recently from 31a317c to d3bde71 Compare April 30, 2021 12:12
@pmatilai
Copy link
Member

pmatilai commented May 5, 2021

Adding -n is fine (funny how such obvious things don't get noticed), but I don't want %apply_patch back, and testing for the error seems over the top, just document -n to override -m and -M.

@hroncok
Copy link
Contributor Author

hroncok commented May 5, 2021

What about this: I'll finally shut up about %apply_patch if you'll take a backport of %autopatch -n for RPM 4.16.x and we document it as a replacement for the removal. That way, we can update our Python spec files on Fedora 33 and further and hopefully also in CentOS Stream 9. (I'd also gladly prepare downstream-only backports.)

@pmatilai
Copy link
Member

pmatilai commented May 5, 2021

Sorry but I'm finding the level of noise and bargaining quite excessive for the case. For an immediately backwards compatible version (for rpm >= 4.15), use %autopatch -m <num> -M <num> and wrap it up in a one-line local helper macro for convenience. -n is certainly subject for inclusion in a future 4.16 enhancement release.

@hroncok
Copy link
Contributor Author

hroncok commented May 5, 2021

I am just trying to make my life easier here, nothing more. Removals have negative impact on others :(

I'll open a PR with just %autopatch -n

@hroncok
Copy link
Contributor Author

hroncok commented May 5, 2021

#1673

@keszybz
Copy link
Contributor

keszybz commented May 5, 2021

FWIW, I think that deprecation+eventual removal is the way to go in this case. If the macro was exposed, but not actually used, it'd be OK to quickly yank it out. But clearly it is in use, and we know that the removal breaks packages that are out there. I appreciate the desire to make a clean break, but rpm is a foundational package that needs to preserve backwards compatibility.

@pmatilai
Copy link
Member

pmatilai commented May 5, 2021

As usual, a bit of AFK gave some helpful perspective: -n is actually a rather strange corner-case to be considering. What makes more sense is have %autopatch accept arguments, that way it's not limited to one-at-a-time special fubar and can be made to handle both paths and numbers. I'll try to supply a PR implementing that tomorrow.

@pmatilai
Copy link
Member

pmatilai commented May 6, 2021

So... it all ends up being rather cumbersome because -m and -M are a cumbersome way of specifying ranges, but now we're kinda stuck with them. Me thinks it'd make a whole lot more sense to have ranges expressable in -5, 50-70 100- style (multiple) arguments, in addition to individual patch numbers. Then the -m/-M thing can be handled as a special case of that and deprecated.

All of which is to say, I don't have that PR yet, but working on it.

@hroncok
Copy link
Contributor Author

hroncok commented May 6, 2021

I wonder if -5 would not be recognized as an option

@pmatilai
Copy link
Member

pmatilai commented May 6, 2021

That's a good point, it'd require "escaping" with -- and that gets ugly. Python-style :5 as a range syntax wouldn't have that problem, but I wonder if that clashes with something else in turn...

@hroncok
Copy link
Contributor Author

hroncok commented May 6, 2021

Note that Python ranges don't include the ending number. If you use them please keep the semantics to avoid confusion for Pythonistas.

@pmatilai
Copy link
Member

pmatilai commented May 6, 2021

Um? Maybe "range" in Python has some special meaning I'm not aware of, I guess in Python lingo what I meant is slice syntax, which can have all three variants: :5 1:5 and 5: the last I looked.

@pmatilai
Copy link
Member

pmatilai commented May 6, 2021

Hmm, but then we can nowadays have macros opt out of option processing. Already forgotten that... (f951643)

@hroncok
Copy link
Contributor Author

hroncok commented May 6, 2021

Sorry, I've meant that ranges/slices include start but not the end. I.e. 1:3 is 1, 2. Unlike %autopatch -m 1 -M 3 which is 1, 2, 3.

Hmm, but then we can nowadays have macros opt out of option processing.

Yes, but that way, no backports would be possible.

@pmatilai
Copy link
Member

pmatilai commented May 6, 2021

Sorry, I've meant that ranges/slices include start but not the end. I.e. 1:3 is 1, 2. Unlike %autopatch -m 1 -M 3 which is 1, 2, 3.

Oh, that. Yeah I ran into it in Python just recently, caused some head-scratching before realizing that's how it's supposed to work. So we'd confuse somebody no matter which behavior was used...

@pmatilai
Copy link
Member

The %apply_patch ship sailed already and resurrecting it at this point would only add to the mess, closing.

Thanks for the feedback + ideas though!

@pmatilai pmatilai closed this Jan 25, 2022
@hroncok hroncok deleted the apply_patch_deprecation branch September 6, 2022 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants